From 4b30c1831031d3b62aad4534f1de1842e7d39bfc Mon Sep 17 00:00:00 2001 From: saulteafarmer Date: Wed, 14 May 2025 16:47:49 +0000 Subject: [PATCH] Update docker-compose.yml --- docker-compose.yml | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ca65986..ef98e1d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.8" services: - # ── Postgres ──────────────────────────────────────────────────────────────── + # ── Postgres Database ─────────────────────────────────────────────────────── db: image: postgres:15-alpine container_name: lnbits_db @@ -25,14 +25,22 @@ services: context: . dockerfile: Dockerfile container_name: discord-lnbits-web + ports: + - "3000:3000" environment: DATABASE_URL: "${DATABASE_URL}" FLASK_SECRET: "${FLASK_SECRET}" depends_on: - db: - condition: service_healthy - ports: - - "3000:3000" + - db + # wait for Postgres then launch Gunicorn + command: > + sh -c ' + until pg_isready -h db -U "${DB_USER}" ; do + echo "[web] waiting for db…" ; + sleep 2 ; + done ; + exec gunicorn -b 0.0.0.0:3000 app:app + ' restart: unless-stopped # ── Discord Lightning Bot ────────────────────────────────────────────────── @@ -53,8 +61,16 @@ services: INVOICE_MESSAGE: "${INVOICE_MESSAGE}" DATABASE_URL: "${DATABASE_URL}" depends_on: - db: - condition: service_healthy + - db + # wait for Postgres as well, then launch the bot + command: > + sh -c ' + until pg_isready -h db -U "${DB_USER}" ; do + echo "[bot] waiting for db…" ; + sleep 2 ; + done ; + exec python3 discord_lnbits_bot.py + ' restart: unless-stopped volumes: