feat(deploy): enhance database management and configuration
- Updated .env.example to clarify database password usage for OpenWebUI. - Modified compose-up.sh to ensure databases are created if they do not exist after bringing services up. - Added ensure-databases.sh script to check and create necessary Postgres databases. - Adjusted health check for Nextcloud service in docker-compose to point to the correct status endpoint. - Updated OpenWebUI's DATABASE_URL to use environment variables for Postgres credentials.
This commit is contained in:
parent
857b9afc43
commit
00944f0eb5
@ -176,7 +176,7 @@ AI_ASSISTANT_ENABLED=false
|
|||||||
OPENWEBUI_URL=http://openwebui:8080
|
OPENWEBUI_URL=http://openwebui:8080
|
||||||
AI_ASSISTANT_PUBLIC_PATH=/ai
|
AI_ASSISTANT_PUBLIC_PATH=/ai
|
||||||
ULTIMAIL_MCP_URL=http://ultimail-mcp:3100
|
ULTIMAIL_MCP_URL=http://ultimail-mcp:3100
|
||||||
OPENWEBUI_DB_PASSWORD=changeme-openwebui
|
# OpenWebUI utilise POSTGRES_USER/POSTGRES_PASSWORD (base openwebui créée dans init-db.sh)
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Jitsi Meet (Visioconference)
|
# Jitsi Meet (Visioconference)
|
||||||
@ -221,8 +221,9 @@ IMMICH_ML_URL=http://immich-ml:3003
|
|||||||
# Endpoints vérifiés par /healthz (surchargables pour déploiements externes)
|
# Endpoints vérifiés par /healthz (surchargables pour déploiements externes)
|
||||||
HEALTH_NEXTCLOUD_URL={{NEXTCLOUD_URL}}/status.php
|
HEALTH_NEXTCLOUD_URL={{NEXTCLOUD_URL}}/status.php
|
||||||
HEALTH_IMMICH_URL={{IMMICH_API_URL}}/server-info/ping
|
HEALTH_IMMICH_URL={{IMMICH_API_URL}}/server-info/ping
|
||||||
# Par défaut on retire /meet de JITSI_PUBLIC_URL pour viser /about/health
|
# Stack Docker locale : probe interne jitsi-web
|
||||||
HEALTH_JITSI_URL=https://{{DOMAIN}}/about/health
|
# Déploiement externe : https://{{DOMAIN}}/about/health (ou JITSI_PUBLIC_URL sans /meet + /about/health)
|
||||||
|
HEALTH_JITSI_URL=http://jitsi-web:80/about/health
|
||||||
HEALTH_HTTP_TIMEOUT=3s
|
HEALTH_HTTP_TIMEOUT=3s
|
||||||
# Grafana local (monitoring)
|
# Grafana local (monitoring)
|
||||||
GRAFANA_ADMIN_USER=admin
|
GRAFANA_ADMIN_USER=admin
|
||||||
|
|||||||
@ -58,4 +58,9 @@ if [[ "$(to_bool "${AI_ASSISTANT_ENABLED:-false}")" == "true" ]]; then
|
|||||||
compose_files+=("-f" "deploy/openwebui/docker-compose.openwebui.yml")
|
compose_files+=("-f" "deploy/openwebui/docker-compose.openwebui.yml")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec docker compose --env-file .env.resolved "${compose_files[@]}" "$@"
|
docker compose --env-file .env.resolved "${compose_files[@]}" "$@"
|
||||||
|
status=$?
|
||||||
|
if [[ $status -eq 0 && "${1:-}" == "up" ]]; then
|
||||||
|
"$ROOT/deploy/ensure-databases.sh" || true
|
||||||
|
fi
|
||||||
|
exit $status
|
||||||
|
|||||||
32
deploy/ensure-databases.sh
Executable file
32
deploy/ensure-databases.sh
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Ensure auxiliary Postgres databases exist (idempotent).
|
||||||
|
# Safe to run after postgres is healthy — init-db.sh only runs on first volume init.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
|
cd "$ROOT"
|
||||||
|
|
||||||
|
if [[ ! -f .env.resolved ]]; then
|
||||||
|
echo "Missing .env.resolved — run ./deploy/compose-up.sh first" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
set -a
|
||||||
|
source .env.resolved
|
||||||
|
set +a
|
||||||
|
|
||||||
|
postgres_container="$(docker compose --env-file .env.resolved -f deploy/docker-compose.yml ps -q postgres 2>/dev/null || true)"
|
||||||
|
if [[ -z "$postgres_container" ]]; then
|
||||||
|
echo "postgres container not running — skip ensure-databases" >&2
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
for db in authentik nextcloud immich openwebui; do
|
||||||
|
exists="$(docker exec "$postgres_container" psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -Atc \
|
||||||
|
"SELECT 1 FROM pg_database WHERE datname = '${db}'" 2>/dev/null || true)"
|
||||||
|
if [[ "$exists" != "1" ]]; then
|
||||||
|
echo "Creating database ${db}..."
|
||||||
|
docker exec "$postgres_container" psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE DATABASE ${db};"
|
||||||
|
fi
|
||||||
|
done
|
||||||
@ -64,7 +64,7 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- ulti-net
|
- ulti-net
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1/ >/dev/null 2>&1 || exit 1"]
|
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1/status.php >/dev/null 2>&1 || exit 1"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|||||||
@ -13,7 +13,7 @@ services:
|
|||||||
OPENAI_API_BASE_URL: http://ultid:8080/api/v1/ai
|
OPENAI_API_BASE_URL: http://ultid:8080/api/v1/ai
|
||||||
OPENAI_API_KEY: ulti-gateway
|
OPENAI_API_KEY: ulti-gateway
|
||||||
WEBUI_URL: http://${DOMAIN:-localhost}/ai
|
WEBUI_URL: http://${DOMAIN:-localhost}/ai
|
||||||
DATABASE_URL: postgresql://openwebui:${OPENWEBUI_DB_PASSWORD:-changeme}@postgres:5432/openwebui
|
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/openwebui
|
||||||
USER_PERMISSIONS_CHAT_TEMPORARY_ENFORCED: "false"
|
USER_PERMISSIONS_CHAT_TEMPORARY_ENFORCED: "false"
|
||||||
volumes:
|
volumes:
|
||||||
- openwebui_data:/app/backend/data
|
- openwebui_data:/app/backend/data
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user