master
 1version: '2'
 2services:
 3  haproxy:
 4    image: haproxy:latest
 5    volumes:
 6      - ./config/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
 7      - ./config/server.pem:/usr/local/etc/haproxy/server.pem
 8    links:
 9      - www1
10      - www2
11    ports:
12      - "80:80"
13      - "443:443"
14  www1:
15    image: nginx:latest
16    volumes:
17      - ./config/nginx.conf:/etc/nginx/nginx.conf
18      - ./public:/var/www/public
19      - ./config/server.crt:/etc/nginx/server.crt
20      - ./config/server.key:/etc/nginx/server.key
21    links:
22      - web
23  www2:
24    image: nginx:latest
25    volumes:
26      - ./config/nginx.conf:/etc/nginx/nginx.conf
27      - ./public:/var/www/public
28      - ./config/server.crt:/etc/nginx/server.crt
29      - ./config/server.key:/etc/nginx/server.key
30    links:
31      - web
32  web:
33    build: .
34    command: bundle exec foreman start web
35    volumes:
36      - .:/app
37    links:
38      - redis
39      - db
40    depends_on:
41      - redis
42      - db
43    environment:
44      - REDIS_URL=redis://redis:6379/12
45      - RAILS_LOG_TO_STDOUT=true
46  worker:
47    build: .
48    command: bundle exec sidekiq
49    volumes:
50      - .:/app
51    links:
52      - redis
53      - db
54    depends_on:
55      - redis
56      - db
57    environment:
58      REDIS_URL: 'redis://redis:6379/12'
59  db:
60    image: postgres:latest
61    ports:
62      - "5432:5432"
63    volumes:
64      - ./db/data:/var/lib/postgresql/data
65  redis:
66    image: redis:latest
67    ports:
68      - "6379:6379"