kutt
kutt copied to clipboard
[QUESTION] Why to use wait-for-it.sh cli when we have depends-on in docker-compose.
Because I don't know, that time when I researched for this problem I had wait-for-it seemed to work. Feel free to let me know if we can do this better, or even a PR is welcome.
To use the built in ready checks the docker compose yaml just needs to be update to this
version: "3.7"
volumes:
redis_data:
postgres_data:
services:
kutt:
image: kutt/kutt
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
command: ["npm", "start"]
environment:
DB_HOST: postgres
DB_NAME: kutt
DB_USER: user
DB_PASSWORD: pass
REDIS_HOST: redis
SITE_NAME: somesite
DEFAULT_DOMAIN: somesite.com
JWT_SECRET: change-me
MAIL_HOST: change.me
MAIL_PORT: 465
ADMIN_EMAILS: [email protected]
MAIL_USER: some-user
MAIL_FROM: [email protected]
MAIL_PASSWORD: some-password
MAIL_SECURE: true
redis:
image: redis:6.0-alpine
healthcheck:
test: [ "CMD", "redis-cli","ping" ]
interval: 30s
timeout: 60s
retries: 5
start_period: 10s
volumes:
- redis_data:/data
postgres:
image: postgres:12-alpine
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: pass
POSTGRES_DB: kutt
healthcheck:
test: [ "CMD-SHELL", "pg_isready", "-d", "db_prod" ]
interval: 30s
timeout: 60s
retries: 5
start_period: 60s
volumes:
- postgres_data:/var/lib/postgresql/data