Update docker-compose.yml
This commit is contained in:
parent
5510c07108
commit
28affcc3c3
@ -1,77 +1,62 @@
|
|||||||
version: "3.8"
|
version: "3.9"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
# ── Postgres Database ───────────────────────────────────────────────────────
|
|
||||||
db:
|
db:
|
||||||
image: postgres:15-alpine
|
image: postgres:15
|
||||||
container_name: lnbits_db
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: "${DB_USER}"
|
POSTGRES_USER: "${DB_USER:-postgres}"
|
||||||
POSTGRES_PASSWORD: "${DB_PASS}"
|
POSTGRES_PASSWORD: "${DB_PASS:-}"
|
||||||
POSTGRES_DB: "${DB_NAME}"
|
POSTGRES_DB: "${DB_NAME:-lnbitsdb}"
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data
|
- db_data:/var/lib/postgresql/data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "pg_isready", "-U", "${DB_USER}"]
|
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER}"]
|
||||||
interval: 10s
|
interval: 5s
|
||||||
timeout: 5s
|
timeout: 2s
|
||||||
retries: 5
|
retries: 5
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
# ── Web UI ──────────────────────────────────────────────────────────────────
|
|
||||||
web:
|
web:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
container_name: discord-lnbits-web
|
restart: on-failure
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
environment:
|
# wait for the DB, then launch the Flask app under Gunicorn
|
||||||
DATABASE_URL: "${DATABASE_URL}"
|
|
||||||
FLASK_SECRET: "${FLASK_SECRET}"
|
|
||||||
depends_on:
|
|
||||||
- db
|
|
||||||
# wait for Postgres then launch Gunicorn
|
|
||||||
command: >
|
command: >
|
||||||
sh -c '
|
sh -c "
|
||||||
until pg_isready -h db -U "${DB_USER}" ; do
|
until pg_isready -h db -U \$DB_USER; do
|
||||||
echo "[web] waiting for db…" ;
|
echo '[web] waiting for db…';
|
||||||
sleep 2 ;
|
sleep 1;
|
||||||
done ;
|
done &&
|
||||||
exec gunicorn -b 0.0.0.0:3000 app:app
|
exec gunicorn -b 0.0.0.0:3000 app:app
|
||||||
'
|
"
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
# ── Discord Lightning Bot ──────────────────────────────────────────────────
|
|
||||||
bot:
|
bot:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
container_name: discord-lnbits-bot
|
restart: on-failure
|
||||||
environment:
|
|
||||||
DISCORD_TOKEN: "${DISCORD_TOKEN}"
|
|
||||||
GUILD_ID: "${GUILD_ID}"
|
|
||||||
ROLE_ID: "${ROLE_ID}"
|
|
||||||
CHANNEL_ID: "${CHANNEL_ID}"
|
|
||||||
LNBITS_URL: "${LNBITS_URL}"
|
|
||||||
LNBITS_API_KEY: "${LNBITS_API_KEY}"
|
|
||||||
PRICE: "${PRICE}"
|
|
||||||
COMMAND_NAME: "${COMMAND_NAME}"
|
|
||||||
INVOICE_MESSAGE: "${INVOICE_MESSAGE}"
|
|
||||||
DATABASE_URL: "${DATABASE_URL}"
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
db:
|
||||||
# wait for Postgres as well, then launch the bot
|
condition: service_healthy
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
# wait for the DB, then run your bot loop
|
||||||
command: >
|
command: >
|
||||||
sh -c '
|
sh -c "
|
||||||
until pg_isready -h db -U "${DB_USER}" ; do
|
until pg_isready -h db -U \$DB_USER; do
|
||||||
echo "[bot] waiting for db…" ;
|
echo '[bot] waiting for db…';
|
||||||
sleep 2 ;
|
sleep 1;
|
||||||
done ;
|
done &&
|
||||||
exec python3 discord_lnbits_bot.py
|
exec python discord_lnbits_bot.py
|
||||||
'
|
"
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
db_data:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user