This commit is contained in:
Alexandre
2025-07-16 15:50:00 +02:00
committed by GitHub
parent 38b7cedfa7
commit b65bcc9cbe
9 changed files with 1 additions and 161 deletions

View File

@@ -78,7 +78,7 @@
"startup": "services",
"udev": true,
"url": "https://github.com/alexbelgium/hassio-addons",
"version": "1.0.0test11",
"version": "1.0.0test12",
"video": true,
"webui": "http://[HOST]:[PORT:3000]"
}

View File

@@ -1,15 +0,0 @@
db:
host: "${DB_HOSTNAME}"
port: ${DB_PORT}
name: "${DB_DATABASE_NAME}"
user: "${DB_USERNAME}"
password: "${DB_PASSWORD}"
s3:
are_local_buckets: true
b2-eu-cen:
key: "${MINIO_ROOT_USER}"
secret: "${MINIO_ROOT_PASSWORD}"
endpoint: "http://localhost:3200"
region: "eu-central-2"
bucket: "${S3_BUCKET}"

View File

@@ -1,3 +0,0 @@
#!/usr/bin/with-contenv bashio
set -euo pipefail
exit 0

View File

@@ -1,39 +0,0 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -euo pipefail
if bashio::config.true 'USE_EXTERNAL_DB'; then
bashio::log.info "External DB requested; skipping internal Postgres service."
exit 0
fi
# Create folder structure
mkdir -p /run/postgresql
chown postgres:postgres /run/postgresql
chmod 775 /run/postgresql
# Persistent location
PGDATA="${PGDATA:-/config/postgres-data}"
export PGDATA
# Create and secure PGDATA
mkdir -p "$PGDATA"
chown -R postgres:postgres "$PGDATA"
chmod 0700 "$PGDATA"
INITDB="$(command -v initdb || echo /usr/bin/initdb)"
POSTGRES="$(command -v postgres || echo /usr/bin/postgres)"
if [[ ! -x "$INITDB" || ! -x "$POSTGRES" ]]; then
bashio::log.error "PostgreSQL binaries not found."
exit 1
fi
if [[ ! -s "${PGDATA}/PG_VERSION" ]]; then
bashio::log.info "Initializing Postgres data directory..."
# Alpines initdb runs as the postgres user
su - postgres -c "$INITDB -D $PGDATA"
fi
exec su - postgres -c "$POSTGRES -D $PGDATA -c listen_addresses='127.0.0.1'" & \
bashio::log.info "Starting Postgres (127.0.0.1:5432)..."

View File

@@ -1,35 +0,0 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -euo pipefail
if bashio::config.true 'USE_EXTERNAL_DB'; then
# External DB; nothing to create here.
exit 0
fi
DB_USER="$(bashio::config 'DB_USERNAME')"
DB_PASS="$(bashio::config 'DB_PASSWORD')"
DB_NAME="$(bashio::config 'DB_DATABASE_NAME')"
bashio::log.info "Postgres-init: waiting for local Postgres..."
until pg_isready -q -h 127.0.0.1 -p 5432 -U postgres; do
sleep 1
done
bashio::log.info "Postgres-init: creating role/database if missing..."
# psql search_path safe quoting using dollar-quoted strings for password
psql -v ON_ERROR_STOP=1 -h 127.0.0.1 -p 5432 -U postgres <<SQL
DO \$\$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = '${DB_USER}') THEN
EXECUTE 'CREATE ROLE ${DB_USER} LOGIN PASSWORD ''' || replace('${DB_PASS}','''','''''') || '''';
END IF;
IF NOT EXISTS (SELECT 1 FROM pg_database WHERE datname = '${DB_NAME}') THEN
EXECUTE 'CREATE DATABASE ${DB_NAME} OWNER ${DB_USER}';
END IF;
END
\$\$;
SQL
bashio::log.info "Postgres-init: done."
exit 0

View File

@@ -1,10 +0,0 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -euo pipefail
# Persistent path
MINIO_DATA="/config/minio-data"
mkdir -p "${MINIO_DATA}"
exec /usr/local/bin/minio server "${MINIO_DATA}" --address ":3200" & \
bashio::log.info "Starting MinIO (3200)..."

View File

@@ -1,18 +0,0 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -euo pipefail
MINIO_USER="$(bashio::config 'MINIO_ROOT_USER')"
MINIO_PASS="$(bashio::config 'MINIO_ROOT_PASSWORD')"
S3_BUCKET="$(bashio::config 'S3_BUCKET')"
bashio::log.info "MinIO-init: waiting for API..."
until /usr/local/bin/mc alias set h0 http://127.0.0.1:3200 "${MINIO_USER}" "${MINIO_PASS}" 2>/dev/null; do
sleep 1
done
bashio::log.info "MinIO-init: ensuring bucket ${S3_BUCKET}..."
/usr/local/bin/mc mb -p "h0/${S3_BUCKET}" || true
bashio::log.info "MinIO-init: done."
exit 0

View File

@@ -1,29 +0,0 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -euo pipefail
CFG=/config/museum.yaml
if ! bashio::fs.file_exists "$CFG"; then
bashio::log.error "$CFG not found; aborting museum start."
exit 1
fi
if bashio::config.true 'USE_EXTERNAL_DB'; then
DB_HOST="$(bashio::config 'DB_HOSTNAME')"
DB_PORT="$(bashio::config 'DB_PORT')"
DB_USER="$(bashio::config 'DB_USERNAME')"
bashio::log.info "Museum: waiting for external Postgres at ${DB_HOST}:${DB_PORT}..."
until pg_isready -q -h "${DB_HOST}" -p "${DB_PORT}" -U "${DB_USER}"; do
sleep 2
done
else
# We'll connect as DB_USER (the one we created), not postgres superuser
DB_USER="$(bashio::config 'DB_USERNAME')"
bashio::log.info "Museum: waiting for internal Postgres..."
until pg_isready -q -h 127.0.0.1 -p 5432 -U "${DB_USER}"; do
sleep 2
done
fi
exec /usr/bin/museum --config "$CFG" & \
bashio::log.info "Starting museum."

View File

@@ -1,11 +0,0 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -euo pipefail
if bashio::config.true 'DISABLE_WEB_UI'; then
bashio::log.info "Web UI disabled."
exit 0
fi
exec /usr/bin/ente-web & \
bashio::log.info "Starting Ente web."