-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose-prod.yml
93 lines (87 loc) · 2.14 KB
/
docker-compose-prod.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
version: '3.4'
services:
db:
environment:
- POSTGRES_PASSWORD=my-db-password
image: postgres:11-alpine
hostname: db.my-site.com
ports:
- 5432
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 30s
timeout: 30s
retries: 3
volumes:
- postgres_data:/var/lib/postgresql/data
redis:
image: redis:5.0-alpine
hostname: redis.my-site.com
restart: always
volumes:
- terraform_rails_redis_data:/data
app: &app_base
image: terraform-rails
hostname: app.my-site.com
build:
context: .
dockerfile: ./devops/docker/app/Dockerfile
args:
- EXECJS_RUNTIME=Disabled
- RAILS_ENV=production
- NODE_ENV=production
- FOLDERS_TO_REMOVE=spec node_modules app/assets vendor/assets lib/assets tmp/cache
- BUNDLE_WITHOUT=development:test
- SECRET_KEY_BASE=fake-secret-for-assets-precompilation
environment: # this will override .env
- POSTGRES_HOST=db
- POSTGRES_PASSWORD=my-db-password
- POSTGRES_USER=postgres
- RAILS_ENV=production
- NODE_ENV=production
- RAILS_MAX_THREADS=5
- REDIS_SIDEKIQ_URL=redis://redis:6379/0
links:
- db
- redis
volumes:
- ./config/master.key:/app/config/master.key
- type: tmpfs
target: /app/tmp/pids
restart: always
healthcheck:
test: ["CMD-SHELL", "nc -z 127.0.0.1 3000 || exit 1"]
interval: 5m
start_period: 1m
web:
hostname: my-site.com
build:
context: .
dockerfile: ./devops/docker/web/Dockerfile
depends_on:
- app
ports:
- 8080:80
restart: always
healthcheck:
test: ["CMD-SHELL", "nc -z 127.0.0.1 8080 || exit 1"]
interval: 5m
start_period: 1m
worker:
<<: *app_base
command: bundle exec sidekiq
ports: []
depends_on:
- app
- redis
restart: always
healthcheck:
test: "ps ax | grep -v grep | grep sidekiq"
interval: 1m
start_period: 1m
volumes:
postgres_data:
external: true
terraform_rails_redis_data:
external: true