-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
102 lines (87 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
version: '2.1'
volumes:
# We'll define a volume that will store the data from the postgres databases:
postgres-data:
driver: local
# The rabbitmq data store volume
redis-data:
driver: local
services:
# Our PostgreSQL service:
postgres:
image: postgres:9.6.1
ports:
# We'll bind our host's port 5432 to postgres's port 5432, so we can use
# our database IDEs with it:
- 5432:5432
volumes:
# Mount the DB dumps folder into the container, to be able to create & access database dumps:
- ./db/dumps:/db/dumps
# Mount out tmp folder, we might want to have access to something there during development:
- ./tmp:/tmp
# Mount our 'restoredb' script:
- ./bin/restoredb:/bin/restoredb:ro
# Mount our 'dumpdb' script:
- ./bin/dumpdb:/bin/dumpdb:ro
# We'll mount the 'postgres-data' volume into the location Postgres stores it's data:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: 3x4mpl3
# Our Redis service:
redis:
image: redis:3.2.4-alpine
ports:
# We'll bind our host's port 6379 to redis's port 6379, so we can use
# Redis Desktop Manager (or other tools) with it:
- 6379:6379
volumes:
# We'll mount the 'redis-data' volume into the location redis stores it's data:
- redis-data:/var/lib/redis
command: redis-server --appendonly yes
# Application: -----------------------------------------------------------------
# We'll also use this configuration (&app_base) for the web and test containers:
jobs: &app_base
build:
context: .
dockerfile: dev.Dockerfile
entrypoint: /usr/src/app/development-entrypoint
# The command this container will run - in this case, this container will run our sidekiq
# process:
command: bundle exec sidekiq -c 25 -q default
volumes:
# Mount our app code directory (".") into our app containers at the
# "/usr/src/app" folder:
- .:/usr/src/app
# Keep the stdin open, so we can attach to our app container's process and do things such as
# byebug, etc:
stdin_open: true
# Enable sending signals (CTRL+C, CTRL+P + CTRL+Q) into the container:
tty: true
# Link to our postgres and redis containers, so they can be visible from our
# app containers:
links:
# We'll include a link to the 'db' (postgres) container, making it visible from the container
# using the 'postgres.local' hostname (which is not necessary, but I'm doing it here to
# illustrate that you can play with this):
- postgres:db.local
# We'll include a link to the 'keyval' (redis) container, making it
# visible from the container using the 'keyval.local' hostname:
- redis:keyval.local
environment: &app_environment
# The postgres database URL:
DATABASE_URL: postgres://postgres:[email protected]:5432/example_development
# The redis URL:
REDIS_URL: redis://keyval.local:6379
# Sidekiq configuration:
SIDEKIQ_CONCURRENCY: 5
SIDEKIQ_TIMEOUT: 10
# Run the app in the 'development' environment:
RACK_ENV: development
RAILS_ENV: development
# This container will run the rails web server:
web:
# We'll copy from &app_base, and override:
<<: *app_base
command: bundle exec rails server -p 3000 -b 0.0.0.0
ports:
- "3000:3000" # Bind our host's port 3000 to the app port 3000: