Add healthchecks to container-compose.yml (#19283)

This commit is contained in:
Raphaël Chaumier 2023-04-14 17:27:05 +02:00 committed by GitHub
parent 51b1cc212b
commit 2233f2865b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,3 @@
version: "3"
services:
rails:
image: quay.io/forem/forem:development
@ -10,6 +9,12 @@ services:
- db
- redis
- yarn
healthcheck:
test: ["CMD", "curl" , "-f", "http://localhost:3000/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
environment:
RAILS_ENV: development
DATABASE_URL: postgresql://forem:forem@db:5432/PracticalDeveloper_development
@ -72,9 +77,12 @@ services:
image: quay.io/forem/forem:development
container_name: forem_seed
depends_on:
- rails
- redis
- db
rails:
condition: service_healthy
redis:
condition: service_healthy
db:
condition: service_healthy
environment:
RAILS_ENV: development
REDIS_SESSIONS_URL: redis://redis:6379
@ -83,16 +91,18 @@ services:
DATABASE_URL: postgresql://forem:forem@db:5432/PracticalDeveloper_development
volumes:
- .:/opt/apps/forem:z
entrypoint: ["dockerize", "-wait", "tcp://db:5432", "-wait", "tcp://redis:6379", "-wait", "http://rails:3000", "-timeout", "300s"]
command: ["bundle", "exec", "rake","db:seed"]
sidekiq:
image: quay.io/forem/forem:development
container_name: forem_sidekiq
depends_on:
- rails
- redis
- db
rails:
condition: service_healthy
redis:
condition: service_healthy
db:
condition: service_healthy
environment:
RAILS_ENV: development
REDIS_SESSIONS_URL: redis://redis:6379
@ -101,12 +111,16 @@ services:
DATABASE_URL: postgresql://forem:forem@db:5432/PracticalDeveloper_development
volumes:
- .:/opt/apps/forem:z
entrypoint: ["dockerize", "-wait", "tcp://db:5432", "-wait", "tcp://redis:6379", "-wait", "http://rails:3000", "-timeout", "300s"]
command: ["bundle", "exec", "sidekiq","-c","2"]
db:
image: postgres:11-alpine
container_name: forem_postgresql
healthcheck:
test: [ "CMD", "pg_isready", "-d" ,"forem", "-U", "forem" ]
interval: 10s
timeout: 5s
retries: 5
environment:
POSTGRES_USER: forem
POSTGRES_PASSWORD: forem
@ -118,6 +132,12 @@ services:
redis:
image: redis:6.0.9-alpine
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
interval: 20s
timeout: 5s
retries: 3
start_period: 10s
container_name: forem_redis
ports:
- "6379:6379"