mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-01 03:36:06 +02:00
Merge pull request #2759 from alexbelgium/copilot/fix-comments-in-review-thread
Fix Ente addon: idempotent web start, random MinIO creds, bind console, fix albums origin
This commit is contained in:
@@ -83,6 +83,7 @@ options:
|
|||||||
USE_EXTERNAL_DB: false
|
USE_EXTERNAL_DB: false
|
||||||
ports:
|
ports:
|
||||||
3000/tcp: 8300
|
3000/tcp: 8300
|
||||||
|
3002/tcp: 8302
|
||||||
3005/tcp: 8305
|
3005/tcp: 8305
|
||||||
3006/tcp: 8306
|
3006/tcp: 8306
|
||||||
3007/tcp: 8307
|
3007/tcp: 8307
|
||||||
@@ -91,6 +92,7 @@ ports:
|
|||||||
8080/tcp: 8280
|
8080/tcp: 8280
|
||||||
ports_description:
|
ports_description:
|
||||||
3000/tcp: Ente web UI
|
3000/tcp: Ente web UI
|
||||||
|
3002/tcp: Ente Albums
|
||||||
3005/tcp: Ente Share
|
3005/tcp: Ente Share
|
||||||
3006/tcp: Ente Embed
|
3006/tcp: Ente Embed
|
||||||
3007/tcp: Ente Paste
|
3007/tcp: Ente Paste
|
||||||
|
|||||||
@@ -3,8 +3,25 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Internal MinIO credentials (not user-configurable; MinIO is 127.0.0.1 only)
|
# Internal MinIO credentials (not user-configurable; MinIO is 127.0.0.1 only)
|
||||||
MINIO_USER="minioadmin"
|
MINIO_CRED_FILE="/config/minio-creds"
|
||||||
MINIO_PASS="minioadmin"
|
if [ -f "$MINIO_CRED_FILE" ]; then
|
||||||
|
# Reuse persisted credentials across restarts
|
||||||
|
MINIO_USER="$(sed -n '1p' "$MINIO_CRED_FILE")"
|
||||||
|
MINIO_PASS="$(sed -n '2p' "$MINIO_CRED_FILE")"
|
||||||
|
# Regenerate if file is corrupted
|
||||||
|
if [ -z "$MINIO_USER" ] || [ -z "$MINIO_PASS" ]; then
|
||||||
|
MINIO_USER="minio_$(tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c 8)"
|
||||||
|
MINIO_PASS="$(head -c 24 /dev/urandom | base64 | tr -d '\n')"
|
||||||
|
printf '%s\n%s\n' "$MINIO_USER" "$MINIO_PASS" > "$MINIO_CRED_FILE"
|
||||||
|
chmod 600 "$MINIO_CRED_FILE"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Generate random credentials on first run
|
||||||
|
MINIO_USER="minio_$(tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c 8)"
|
||||||
|
MINIO_PASS="$(head -c 24 /dev/urandom | base64 | tr -d '\n')"
|
||||||
|
printf '%s\n%s\n' "$MINIO_USER" "$MINIO_PASS" > "$MINIO_CRED_FILE"
|
||||||
|
chmod 600 "$MINIO_CRED_FILE"
|
||||||
|
fi
|
||||||
S3_BUCKET="b2-eu-cen"
|
S3_BUCKET="b2-eu-cen"
|
||||||
|
|
||||||
export ENTE_S3_ARE_LOCAL_BUCKETS=true
|
export ENTE_S3_ARE_LOCAL_BUCKETS=true
|
||||||
@@ -184,7 +201,9 @@ bootstrap_internal_db() {
|
|||||||
start_minio() {
|
start_minio() {
|
||||||
bashio::log.info "Starting MinIO (127.0.0.1:3200)..."
|
bashio::log.info "Starting MinIO (127.0.0.1:3200)..."
|
||||||
mkdir -p /config/minio-data
|
mkdir -p /config/minio-data
|
||||||
"$MINIO_BIN" server /config/minio-data --address "127.0.0.1:3200" &
|
export MINIO_ROOT_USER="$MINIO_USER"
|
||||||
|
export MINIO_ROOT_PASSWORD="$MINIO_PASS"
|
||||||
|
"$MINIO_BIN" server /config/minio-data --address "127.0.0.1:3200" --console-address "127.0.0.1:9001" &
|
||||||
MINIO_PID=$!
|
MINIO_PID=$!
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +222,9 @@ wait_minio_ready_and_bucket() {
|
|||||||
############################################
|
############################################
|
||||||
start_web() {
|
start_web() {
|
||||||
ENTE_API_ORIGIN="$(bashio::config 'ENTE_ENDPOINT_URL')"
|
ENTE_API_ORIGIN="$(bashio::config 'ENTE_ENDPOINT_URL')"
|
||||||
ENTE_ALBUMS_ORIGIN="http://localhost:3002"
|
# Derive albums origin from the same host as the API endpoint, mapped to port 8302
|
||||||
|
ENTE_ALBUMS_HOST="$(echo "$ENTE_API_ORIGIN" | sed -E 's#(https?://[^:/]+).*#\1#')"
|
||||||
|
ENTE_ALBUMS_ORIGIN="${ENTE_ALBUMS_HOST}:8302"
|
||||||
export ENTE_API_ORIGIN ENTE_ALBUMS_ORIGIN
|
export ENTE_API_ORIGIN ENTE_ALBUMS_ORIGIN
|
||||||
|
|
||||||
# Running ente-web-prepare
|
# Running ente-web-prepare
|
||||||
@@ -213,8 +234,10 @@ start_web() {
|
|||||||
|
|
||||||
mkdir -p /run/nginx /var/log/nginx
|
mkdir -p /run/nginx /var/log/nginx
|
||||||
|
|
||||||
# Set nginx
|
# Set nginx (idempotent: only move if .bak still exists)
|
||||||
|
if [ -f /etc/nginx/http.d/web.bak ]; then
|
||||||
mv /etc/nginx/http.d/web.bak /etc/nginx/http.d/web.conf
|
mv /etc/nginx/http.d/web.bak /etc/nginx/http.d/web.conf
|
||||||
|
fi
|
||||||
|
|
||||||
bashio::log.info "Starting Ente web (nginx, ports 3000‑3009)..."
|
bashio::log.info "Starting Ente web (nginx, ports 3000‑3009)..."
|
||||||
nginx -g 'daemon off;' &
|
nginx -g 'daemon off;' &
|
||||||
|
|||||||
Reference in New Issue
Block a user