* Add set -e to docker-setup script * Add error handling for db setup stage * Sometimes Elasticsearch takes time to boot up * Also delete docker_data * search:setup must come first * Revert "Sometimes Elasticsearch takes time to boot up" This reverts commit e975f6e5c3edad084d4f2c4d8718675bf5c8d07c. Reason for revert: Instead of using wait-on, we can use Docker’s health check instead See review comment: https://github.com/thepracticaldev/dev.to/pull/7378#discussion_r411839255 * Use wait-on without installing into package.json * Add /usr/src/app/node_modules to volumes Otherwise, webpacker will not run in docker-compose. See: https://stackoverflow.com/questions/30043872/docker-compose-node-modules-not-present-in-a-volume-after-npm-install-succeeds
67 lines
1.8 KiB
YAML
67 lines
1.8 KiB
YAML
version: "3"
|
|
services:
|
|
web:
|
|
build: .
|
|
ports:
|
|
- "3000:3000"
|
|
depends_on:
|
|
- db
|
|
- redis
|
|
- elasticsearch
|
|
environment:
|
|
RAILS_ENV: development
|
|
DATABASE_URL: postgresql://devto:devto@db:5432/PracticalDeveloper_development
|
|
ELASTICSEARCH_URL: http://elasticsearch:9200
|
|
REDIS_URL: redis://redis:6379
|
|
REDIS_SESSIONS_URL: redis://redis:6379
|
|
volumes:
|
|
- .:/usr/src/app
|
|
- /usr/src/app/node_modules
|
|
command: bundle exec rails server -b 0.0.0.0 -p 3000
|
|
webpacker:
|
|
build: .
|
|
command: ./bin/webpack-dev-server
|
|
sidekiq:
|
|
build: .
|
|
command: bundle exec sidekiq -c 2
|
|
depends_on:
|
|
- redis
|
|
- db
|
|
- elasticsearch
|
|
environment:
|
|
RAILS_ENV: development
|
|
REDIS_SIDEKIQ_URL: redis://redis:6379
|
|
DATABASE_URL: postgresql://devto:devto@db:5432/PracticalDeveloper_development
|
|
ELASTICSEARCH_URL: http://elasticsearch:9200
|
|
db:
|
|
image: postgres:${POSTGRES_VERSION:-9.6.15-alpine}
|
|
environment:
|
|
POSTGRES_USER: devto
|
|
POSTGRES_PASSWORD: devto
|
|
POSTGRES_DB: PracticalDeveloper_development
|
|
ports:
|
|
- "5432:5432"
|
|
redis:
|
|
image: "redis"
|
|
ports:
|
|
- "6379:6379"
|
|
elasticsearch:
|
|
image: docker.elastic.co/elasticsearch/elasticsearch:7.5.2
|
|
container_name: elasticsearch
|
|
environment:
|
|
- cluster.name=docker-cluster
|
|
- 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
|
|
ulimits:
|
|
memlock:
|
|
soft: -1
|
|
hard: -1
|
|
volumes:
|
|
- ./docker_data/elasticsearch/data:/usr/share/elasticsearch/data
|
|
ports:
|
|
- "9200:9200"
|