wait for postgres container to start. provide env variables through .env file

This commit is contained in:
nouryxd 2024-07-19 22:18:35 +02:00
parent 59a2cbe80f
commit ce701c2230
2 changed files with 13 additions and 11 deletions

View file

@ -10,11 +10,9 @@ TWITCH_CLIENT_SECRET=asd
EVENTSUB_SECRET=asd EVENTSUB_SECRET=asd
DSN=postgres://nourybot:coolpassword@postgres:5432/nourybot?sslmode=disable DSN=postgres://nourybot:coolpassword@postgres:5432/nourybot?sslmode=disable
DB_HOST=postgres POSTGRES_DB=nourybot
DB_PORT=5432 POSTGRES_USER=nourybot
DB_USER=nourybot POSTGRES_PASSWORD=coolpassword
DB_PASSWORD=coolpassword
DB_NAME=nourybot
OWM_KEY=asd OWM_KEY=asd
WOLFRAMALPHA_APP_ID=asd WOLFRAMALPHA_APP_ID=asd

View file

@ -6,19 +6,23 @@ services:
restart: unless-stopped restart: unless-stopped
env_file: .env env_file: .env
depends_on: depends_on:
- postgres postgres:
condition: service_healthy
volumes: volumes:
- "/tmp/CHANGE_ME/uploads:/public/uploads" - "/tmp/CHANGEME/uploads:/public/uploads"
ports: ports:
- "127.0.0.1:8080:8080" - "127.0.0.1:8080:8080"
postgres: postgres:
image: postgres image: postgres
restart: unless-stopped restart: unless-stopped
environment: env_file: .env
POSTGRES_DB: nourybot
POSTGRES_USER: nourybot
POSTGRES_PASSWORD: coolpassword
volumes: volumes:
- nourybotdb:/var/lib/postgresql/data - nourybotdb:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 5s
retries: 5
start_period: 20s
volumes: volumes:
nourybotdb: nourybotdb: