-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
154 lines (144 loc) · 4.04 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
version: "3"
# NOTE: You have to setup your hosts file such that it routes corretly to the domains set up for the backend services!
# Follow the below steps to set up your development environment
#
# 1. Add the following entries to your hosts file:
#
# 127.0.0.1 front.traefik
# 127.0.0.1 game.front.traefik
#
# 2. Create an external docker network with the following commnad:
# $ docker network create -d overlay traefik-net
#
# 3. Set up the source volume of the game service to point to your development dicretory. (This lets us see our code changes immediately)
# For example, if I have my code at ~/dev/poker-js , then I set it up as follows:
# - "~/dev/poker-js:/app"
#
# 4. Deploy with:
# $ docker stack deploy -c docker-compose.yml poker --with-registry-auth
#
# To enter the site, hit http://front.traefik/ on your browser
#
# 5. When you make a code change locally and want to see the result, just redeploy the game service with the following command:
# $ docker service update poker_game --force
services:
# NOTE: You have to setup your hosts file & set up a docker network as shown above for the load balancer to work!
traefik:
image: traefik:v1.7
command:
--docker \
--docker.watch \
--docker.swarmMode \
--api
ports:
- 80:80
- 25581:8080
deploy:
placement:
constraints: [node.role == manager]
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- traefik-net
# The mental poker game
game:
image: fairpoker/mental-poker:stage
depends_on:
- redis
- db
volumes:
- "~/dev/poker-js:/app" # NOTE: Mount the source directory to your working directory
environment:
- PGHOST=db
- PGUSER=postgres
- PGPASSWORD=passhere
- PGDATABASE=poker
- ENVIRONMENT=DEV
- MAIN_URL=http://front.traefik
- LOG_LEVEL=debug
- TIMEOUT_SEC=15
networks:
- net
- traefik-net
deploy:
replicas: 3
resources:
limits:
memory: 150M
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:game.front.traefik"
- "traefik.docker.network=traefik-net"
- "traefik.backend.loadbalancer.sticky=true"
- "traefik.port=3000"
# This instance of redis is used for communicaton between the poker game containers
redis-game:
image: redis
command: redis-server --appendonly yes
volumes:
- devredis:/data
networks:
- net
# The main fair.poker website
front:
image: fairpoker/poker-front:stage
depends_on:
- redis
- db
environment:
- PORT=8888
- SERVER_ADDR=104.248.159.81
- LN_NODE_ADDR=104.248.159.81
- LN_NODE_PORT_RPC=10012
- LN_NODE_PORT_P2P=9736
- GAME_URL=http://game.front.traefik # For redirects
- PGHOST=db
- NO_NEW_ACCOUNT_ADDR=TRUE
- PGPASSWORD=passhere
- DOMAIN_NAME=front.traefik
- NETWORK=TESTNET
- ENABLE_EMAILS=FALSE
- ENABLE_LND=FALSE
- JWT_COOKIE_KEY=coookiekeyANmGHCMZXMn54HjBPrWYN4Nyw3Km33at9X # Dev JWT key
networks:
- net
- traefik-net
deploy:
replicas: 2
labels:
- "traefik.enable=true"
- "traefik.port=8888"
- "traefik.docker.network=traefik-net"
- "traefik.frontend.rule=Host:front.traefik"
- "traefik.backend.loadbalancer.sticky=true"
# The main database
db:
image: postgres:10
volumes:
- devpgdb:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=passhere
networks:
- net
# This instance of redis is responsible for session tokens and works mostly as a link between main site & game
redis:
image: redis
command: redis-server
networks:
- net
# Database explorer
adminer:
image: adminer
ports:
- 8080:8080
networks:
- net
volumes:
devpgdb:
devredis:
# NOTE: Use the following command to create the external traefik network:
# $ docker network create -d overlay traefik-net
networks:
net:
traefik-net:
external: true