forked from vovimayhem/docker-compose-rails-dev-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
79 lines (70 loc) · 2.84 KB
/
Copy pathdocker-compose.yml
File metadata and controls
79 lines (70 loc) · 2.84 KB
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
---
# Our PostgreSQL service:
postgres:
image: postgres:9.4.4
ports:
- "5432:5432" # Bind host port 5432 to PostgreSQL port 5432
volumes:
- ./db/dumps:/app-db-dumps # We're mounting this folder so we can backup/restore database dumps from our app folder.
- ./db/postgres-setup.sql/docker-entrypoint-initdb.d/setup.sql
environment:
LC_ALL: C.UTF-8
POSTGRES_PASSWORD: 3x1mpl3
# Our Redis service:
redis:
image: redis:3.0.4
ports:
- "6379:6379" # Bind host port 6379 to Redis port 6379
# Application: -----------------------------------------------------------------
# We'll also use this configuration (&app_base) for the worker and test
# containers:
web: &app_base
image: vovimayhem/app-dev:mri-2.2.3 # A ruby image with DTrace enabled for dev
# Rails 4.2 now binds to 127.0.0.1 by default and not 0.0.0.0.
# Start the server using bin/rails server -b 0.0.0.0 and that should sort it.
# http://stackoverflow.com/questions/27799260/rails-4-2-server-port-forwarding-on-vagrant-does-not-work
# It's fine for development, do not do it in production:
command: rails server -p 3000 -b 0.0.0.0
ports:
- "3000:3000" # Bind host port 3000 to app HTTP port 3000
volumes:
- .:/app
##############################################################################
# With linked containers, Docker writes entries to the container's /etc/hosts.
# We'll try here naming the entries docker will insert into the
# container's /etc/hosts, so we can use more familiar URL's for our app - See
# this container's environment section below:
links: &app_links
- postgres:postgres.local
- redis:redis.local
environment: &app_environment
# PostgreSQL Development Database:
DATABASE_URL: postgres://postgres:3x1mpl3@postgres.local:5432/xmple_development?pool=25&encoding=unicode&schema_search_path=public
# Redis Database:
REDIS_URL: redis://redis.local:6379
# Sidekiq configuration:
SIDEKIQ_CONCURRENCY: 5
SIDEKIQ_TIMEOUT: 10
# Enable the byebug debugging server - this can be overriden
# from the command line:
ENABLE_DEBUG_SERVER: true
# Run the app in the 'development' environment:
RACK_ENV: development
RAILS_ENV: development
env_file: .env # Include the environment variables in the unversioned .env file
worker:
<<: *app_base
ports: []
command: sidekiq -c 25 -q default
# App Guard: Keeps running tests on a separate process:
test:
<<: *app_base # We copy from &app_base, and override:
ports: []
command: guard start --no-bundler-warning --no-interactions
environment:
<<: *app_environment
# PostgreSQL Test Database:
DATABASE_URL: postgres://postgres:3x1mpl3@postgres.local:5432/xmple_test?pool=25&encoding=unicode&schema_search_path=public
# Run the app in the 'test' environment, instead of the default 'developent'
RACK_ENV: test
RAILS_ENV: test