The default retry interval for dockerize when using the `wait` parameter is 1s. Because it takes several seconds, at least, to boot up elasticsearch and bundler, the `rails` and `webpacker` services generate a number of retry messages. The `seed` and `sidekiq` services both wait for `rails` service to be up and running. That takes time as well, and these two generate a sometimes overwhelming level of output. This change sets the retry interval for dockerize to 10s for `rails` and `webpacker` and 20s for `seed` and `sidekiq`. These choices are fairly arbitrary, but aim to strike a balance between keeping the output readable as services start and not excessively delaying start times. With bad luck, this could delay start up on the order of 30s. However, the increased awareness of where the various services are in their startup process is hopefully a worthwhile tradeoff.
165 lines
5.3 KiB
YAML
165 lines
5.3 KiB
YAML
version: "3"
|
|
services:
|
|
rails:
|
|
image: quay.io/forem/forem:development
|
|
container_name: forem_rails
|
|
user: root
|
|
ports:
|
|
- "3000:3000"
|
|
depends_on:
|
|
- bundle
|
|
- db
|
|
- elasticsearch
|
|
- redis
|
|
- yarn
|
|
environment:
|
|
RAILS_ENV: development
|
|
DATABASE_URL: postgresql://forem:forem@db:5432/PracticalDeveloper_development
|
|
ELASTICSEARCH_URL: http://elasticsearch:9200
|
|
REDIS_SESSIONS_URL: redis://redis:6379
|
|
REDIS_SIDEKIQ_URL: redis://redis:6379
|
|
REDIS_URL: redis://redis:6379
|
|
RACK_TIMEOUT_WAIT_TIMEOUT: 10000
|
|
RACK_TIMEOUT_SERVICE_TIMEOUT: 10000
|
|
STATEMENT_TIMEOUT: 10000
|
|
APP_DOMAIN: rails
|
|
volumes:
|
|
- .:/opt/apps/forem:delegated
|
|
entrypoint: ["dockerize", "-wait", "tcp://db:5432", "-wait", "http://elasticsearch:9200", "-wait", "tcp://redis:6379", "-wait", "file:///opt/apps/forem/vendor/bundle/.bundle_finished", "-timeout", "2700s", "-wait-retry-interval", "10s"]
|
|
command: [ "bash", "-c", "./scripts/entrypoint.sh bootstrap && bundle exec rails server -b 0.0.0.0 -p 3000"]
|
|
|
|
bundle:
|
|
image: quay.io/forem/forem:development
|
|
container_name: forem_bundle
|
|
user: root
|
|
environment:
|
|
RAILS_ENV: development
|
|
REDIS_SESSIONS_URL: redis://redis:6379
|
|
REDIS_SIDEKIQ_URL: redis://redis:6379
|
|
REDIS_URL: redis://redis:6379
|
|
DATABASE_URL: postgresql://forem:forem@db:5432/PracticalDeveloper_development
|
|
ELASTICSEARCH_URL: http://elasticsearch:9200
|
|
volumes:
|
|
- .:/opt/apps/forem:delegated
|
|
command: ["./scripts/bundle.sh"]
|
|
|
|
yarn:
|
|
image: quay.io/forem/forem:development
|
|
container_name: forem_yarn
|
|
user: root
|
|
environment:
|
|
RAILS_ENV: development
|
|
REDIS_SESSIONS_URL: redis://redis:6379
|
|
REDIS_SIDEKIQ_URL: redis://redis:6379
|
|
REDIS_URL: redis://redis:6379
|
|
DATABASE_URL: postgresql://forem:forem@db:5432/PracticalDeveloper_development
|
|
ELASTICSEARCH_URL: http://elasticsearch:9200
|
|
volumes:
|
|
- .:/opt/apps/forem:delegated
|
|
command: yarn install --dev
|
|
|
|
webpacker:
|
|
image: quay.io/forem/forem:development
|
|
container_name: forem_webpacker
|
|
user: root
|
|
depends_on:
|
|
- bundle
|
|
- rails
|
|
- yarn
|
|
environment:
|
|
RAILS_ENV: development
|
|
REDIS_SESSIONS_URL: redis://redis:6379
|
|
REDIS_SIDEKIQ_URL: redis://redis:6379
|
|
REDIS_URL: redis://redis:6379
|
|
DATABASE_URL: postgresql://forem:forem@db:5432/PracticalDeveloper_development
|
|
ELASTICSEARCH_URL: http://elasticsearch:9200
|
|
volumes:
|
|
- .:/opt/apps/forem:delegated
|
|
entrypoint: ["dockerize", "-wait", "file:///opt/apps/forem/node_modules/.bin/webpack-dev-server", "-wait", "file:///opt/apps/forem/vendor/bundle/.bundle_finished", "-timeout", "2700s", "-wait-retry-interval", "10s"]
|
|
command: ["./bin/webpack-dev-server"]
|
|
|
|
seed:
|
|
image: quay.io/forem/forem:development
|
|
container_name: forem_seed
|
|
user: root
|
|
depends_on:
|
|
- rails
|
|
- redis
|
|
- db
|
|
- elasticsearch
|
|
environment:
|
|
RAILS_ENV: development
|
|
REDIS_SESSIONS_URL: redis://redis:6379
|
|
REDIS_SIDEKIQ_URL: redis://redis:6379
|
|
REDIS_URL: redis://redis:6379
|
|
DATABASE_URL: postgresql://forem:forem@db:5432/PracticalDeveloper_development
|
|
ELASTICSEARCH_URL: http://elasticsearch:9200
|
|
volumes:
|
|
- .:/opt/apps/forem:delegated
|
|
entrypoint: ["dockerize", "-wait", "tcp://db:5432", "-wait", "http://elasticsearch:9200", "-wait", "tcp://redis:6379", "-wait", "http://rails:3000", "-timeout", "2700s", "-wait-retry-interval", "20s"]
|
|
command: ["bundle", "exec", "rake","db:seed"]
|
|
|
|
sidekiq:
|
|
image: quay.io/forem/forem:development
|
|
container_name: forem_sidekiq
|
|
user: root
|
|
depends_on:
|
|
- rails
|
|
- redis
|
|
- db
|
|
- elasticsearch
|
|
environment:
|
|
RAILS_ENV: development
|
|
REDIS_SESSIONS_URL: redis://redis:6379
|
|
REDIS_SIDEKIQ_URL: redis://redis:6379
|
|
REDIS_URL: redis://redis:6379
|
|
DATABASE_URL: postgresql://forem:forem@db:5432/PracticalDeveloper_development
|
|
ELASTICSEARCH_URL: http://elasticsearch:9200
|
|
volumes:
|
|
- .:/opt/apps/forem:delegated
|
|
entrypoint: ["dockerize", "-wait", "tcp://db:5432", "-wait", "http://elasticsearch:9200", "-wait", "tcp://redis:6379", "-wait", "http://rails:3000", "-timeout", "2700s", "-wait-retry-interval", "20s"]
|
|
command: ["bundle", "exec", "sidekiq","-c","2"]
|
|
|
|
db:
|
|
image: postgres:11-alpine
|
|
container_name: forem_postgresql
|
|
environment:
|
|
POSTGRES_USER: forem
|
|
POSTGRES_PASSWORD: forem
|
|
POSTGRES_DB: PracticalDeveloper_development
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- db_data:/var/lib/postgresql/data:delegated
|
|
|
|
redis:
|
|
image: redis:6.0.9-alpine
|
|
container_name: forem_redis
|
|
ports:
|
|
- "6379:6379"
|
|
|
|
elasticsearch:
|
|
image: docker.elastic.co/elasticsearch/elasticsearch:7.5.2
|
|
container_name: forem_elasticsearch
|
|
environment:
|
|
- cluster.name=forem
|
|
- bootstrap.memory_lock=true
|
|
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
|
- "discovery.type=single-node"
|
|
- xpack.security.enabled=false
|
|
- xpack.monitoring.enabled=false
|
|
- xpack.graph.enabled=false
|
|
- xpack.watcher.enabled=false
|
|
volumes:
|
|
- es_data:/usr/share/elasticsearch/data:delegated
|
|
ports:
|
|
- "9200:9200"
|
|
ulimits:
|
|
memlock:
|
|
soft: -1
|
|
hard: -1
|
|
|
|
volumes:
|
|
db_data:
|
|
es_data:
|
|
|