Add healthchecks to container-compose.yml (#19283)
This commit is contained in:
parent
51b1cc212b
commit
2233f2865b
1 changed files with 29 additions and 9 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
version: "3"
|
|
||||||
services:
|
services:
|
||||||
rails:
|
rails:
|
||||||
image: quay.io/forem/forem:development
|
image: quay.io/forem/forem:development
|
||||||
|
|
@ -10,6 +9,12 @@ services:
|
||||||
- db
|
- db
|
||||||
- redis
|
- redis
|
||||||
- yarn
|
- yarn
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl" , "-f", "http://localhost:3000/"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 10s
|
||||||
environment:
|
environment:
|
||||||
RAILS_ENV: development
|
RAILS_ENV: development
|
||||||
DATABASE_URL: postgresql://forem:forem@db:5432/PracticalDeveloper_development
|
DATABASE_URL: postgresql://forem:forem@db:5432/PracticalDeveloper_development
|
||||||
|
|
@ -72,9 +77,12 @@ services:
|
||||||
image: quay.io/forem/forem:development
|
image: quay.io/forem/forem:development
|
||||||
container_name: forem_seed
|
container_name: forem_seed
|
||||||
depends_on:
|
depends_on:
|
||||||
- rails
|
rails:
|
||||||
- redis
|
condition: service_healthy
|
||||||
- db
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
environment:
|
environment:
|
||||||
RAILS_ENV: development
|
RAILS_ENV: development
|
||||||
REDIS_SESSIONS_URL: redis://redis:6379
|
REDIS_SESSIONS_URL: redis://redis:6379
|
||||||
|
|
@ -83,16 +91,18 @@ services:
|
||||||
DATABASE_URL: postgresql://forem:forem@db:5432/PracticalDeveloper_development
|
DATABASE_URL: postgresql://forem:forem@db:5432/PracticalDeveloper_development
|
||||||
volumes:
|
volumes:
|
||||||
- .:/opt/apps/forem:z
|
- .:/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"]
|
command: ["bundle", "exec", "rake","db:seed"]
|
||||||
|
|
||||||
sidekiq:
|
sidekiq:
|
||||||
image: quay.io/forem/forem:development
|
image: quay.io/forem/forem:development
|
||||||
container_name: forem_sidekiq
|
container_name: forem_sidekiq
|
||||||
depends_on:
|
depends_on:
|
||||||
- rails
|
rails:
|
||||||
- redis
|
condition: service_healthy
|
||||||
- db
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
environment:
|
environment:
|
||||||
RAILS_ENV: development
|
RAILS_ENV: development
|
||||||
REDIS_SESSIONS_URL: redis://redis:6379
|
REDIS_SESSIONS_URL: redis://redis:6379
|
||||||
|
|
@ -101,12 +111,16 @@ services:
|
||||||
DATABASE_URL: postgresql://forem:forem@db:5432/PracticalDeveloper_development
|
DATABASE_URL: postgresql://forem:forem@db:5432/PracticalDeveloper_development
|
||||||
volumes:
|
volumes:
|
||||||
- .:/opt/apps/forem:z
|
- .:/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"]
|
command: ["bundle", "exec", "sidekiq","-c","2"]
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres:11-alpine
|
image: postgres:11-alpine
|
||||||
container_name: forem_postgresql
|
container_name: forem_postgresql
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "pg_isready", "-d" ,"forem", "-U", "forem" ]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: forem
|
POSTGRES_USER: forem
|
||||||
POSTGRES_PASSWORD: forem
|
POSTGRES_PASSWORD: forem
|
||||||
|
|
@ -118,6 +132,12 @@ services:
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:6.0.9-alpine
|
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
|
container_name: forem_redis
|
||||||
ports:
|
ports:
|
||||||
- "6379:6379"
|
- "6379:6379"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue