-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
123 lines (116 loc) · 3.41 KB
/
docker-compose.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
version: '3.7'
services:
# Rails database
# If you wish to clear the database contents simply run
# docker-compose down -v
db:
image: postgres:alpine
container_name: db
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: postgres
# Redis server
# This server is used as a cache for all temporary data
# You can of course, make redis have permanent storage, but I
# recommend using postgres for that.
redis:
image: 'redis:alpine'
# Sidekiq server
# This is the thing that will perform all delayed jobs, sending
# emails, do periodic checks etc. I recommend using this to your
# advantage to automate schedulable tasks.
sidekiq:
build: .
platform: linux/amd64
command: bundle exec sidekiq -C config/sidekiq.yml
environment:
DATABASE_URL: postgres://postgres:postgres@db
REDIS_URL: redis://redis:6379/0
depends_on:
- db
- redis
# Rails server
# This is the main server.
# You can use rails c too by simply going
# docker-compose exec rails rails c
# Using this mechanism you can also perform database migrations and rollbacks
# docker-compose exec rails rails db:migrate
rails:
build: .
platform: linux/amd64
container_name: rails
command: sh -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
ports:
- "3000:3000"
environment:
DATABASE_URL: postgres://postgres:postgres@db
REDIS_URL: redis://redis:6379/0
CHROME_HOSTNAME: chrome # Point to the chrome container for testing
volumes:
- .:/srv
- active_storage:/srv/storage
depends_on:
- db
- redis
stdin_open: true
tty: true
healthcheck:
test: ["CMD", "curl", "-vf", "http://localhost:3000/api/v1/health"]
interval: 10s
timeout: 5s
retries: 3
# Startup script
# This container only starts to prepare the database. It will then exit after it is done.
# Use db/seed.rb to seed your database for development.
rails_startup:
build: .
platform: linux/amd64
environment:
DATABASE_URL: postgres://postgres:postgres@db
depends_on:
- db
- redis
command: sh -c "rails db:create && rails db:migrate && rails db:seed"
# ****************
# Tools
# ****************
# All the containers described below here are not for production use
# but to assist development
# PGAdmin
# Use this to inspect your database and test queries
pgadmin:
image: dpage/pgadmin4:4
ports:
- 5050:80
environment:
PGADMIN_DEFAULT_EMAIL: admin@example.com
PGADMIN_DEFAULT_PASSWORD: admin
entrypoint: /entrypoint.sh
volumes:
- type: bind
source: ./pgadmin_servers.json
target: /pgadmin4/servers.json
read_only: true
depends_on:
- db
# Selenium Chrome instance
# This is used to perform browser testing and also to ensure that
# secure parts of the webapp are not inadvertantly open to the public
# See the browser specs in /spec/browser.
# If you have a VNC client, simply login to port 5900 with the
# password: secret
chrome:
platform: linux/amd64
image: selenium/standalone-chrome-debug
container_name: chrome
ports:
- "5900:5900"
healthcheck:
test: ["CMD", "curl", "-vf", "http://localhost:4444/wd/hub/status"]
interval: 10s
timeout: 5s
retries: 3
volumes:
db_data:
active_storage: