This repository has been archived by the owner on Jan 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdocker-compose.yml
207 lines (197 loc) · 5.97 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
version: "3"
networks:
default:
volumes:
origin_js_node_modules:
flask_session: # Flask session persistence
services:
postgres:
container_name: postgres
restart: always
image: postgres:10.0
environment:
- POSTGRES_USER=origin
- POSTGRES_PASSWORD=origin
- POSTGRES_DB=origin
networks:
- default
elasticsearch:
container_name: elasticsearch
image: elasticsearch
build:
context: .
dockerfile: development/dockerfiles/elasticsearch
ports:
- "9200:9200"
environment:
network.bind_host: 0
ES_JAVA_OPTS: "-Xmx256m -Xms256m"
networks:
- default
origin-js:
container_name: origin-js
image: origin-js
build:
context: .
dockerfile: development/dockerfiles/origin-js
volumes:
- ./origin-js:/app
- origin_js_node_modules:/app/node_modules
environment:
- NODE_ENV=development
ports:
- "5001:5000" # Faucet
- "5002:5002"
- "8080:8080"
- "8081:8081" # Tests
- "8545:8545" # Blockchain
# Run npm install on every container start to avoid volumes issue
# https://github.com/docker/compose/issues/4337
command: >
/bin/bash -c "npm install --quiet --no-progress &&
node scripts/build.js serve"
networks:
- default
origin-discovery:
container_name: origin-discovery
image: origin-discovery
build:
context: .
dockerfile: development/dockerfiles/origin-discovery
volumes:
- ./origin-js/daemon/indexing:/app
# Mount compiled origin-js inside node modules, this is not actually a
# dependency of the graphql server, but it is required here because the
# event-listener and origin-discovery share the same package.json
- ./origin-js:/usr/local/lib/node_modules/origin
- origin_js_node_modules:/usr/local/lib/node_modules/origin/node_modules
environment:
- DATABASE_HOST=postgres
- DATABASE_PORT=5432
- DATABASE_USERNAME=origin
- DATABASE_PASSWORD=origin
- DATABASE_NAME=origin
- ELASTICSEARCH_HOST=elasticsearch:9200
depends_on:
- origin-js
- postgres
- elasticsearch
ports:
- "4000:4000" # Apollo
command: >
/bin/bash -c "wait-for.sh -t 0 -q origin-js:8081 --
npm link origin &&
npm install --quiet --no-progress &&
node apollo/index.js"
networks:
- default
event-listener:
container_name: event-listener
image: event-listener
build:
context: .
dockerfile: development/dockerfiles/event-listener
volumes:
- ./origin-js/daemon/indexing:/app
# Mount compiled origin-js inside node modules
- ./origin-js:/usr/local/lib/node_modules/origin
- origin_js_node_modules:/usr/local/lib/node_modules/origin/node_modules
depends_on:
- origin-js
- postgres
- elasticsearch
environment:
- DATABASE_HOST=postgres
- DATABASE_PORT=5432
- DATABASE_USERNAME=origin
- DATABASE_PASSWORD=origin
- DATABASE_NAME=origin
- ELASTICSEARCH_HOST=elasticsearch:9200
- DATABASE_URL=postgres://origin:origin@postgres/origin
command: >
/bin/bash -c "wait-for.sh -t 0 -q origin-js:8081 --
npm link origin &&
npm install --quiet --no-progress &&
node node_modules/db-migrate/bin/db-migrate up &&
node listener/listener.js --elasticsearch --db --web3-url='http://origin-js:8545'"
networks:
- default
origin-messaging:
container_name: origin-messaging
image: origin-messaging
build:
context: .
dockerfile: development/dockerfiles/origin-messaging
ports:
- "9012:9012"
volumes:
- ./origin-messaging/src:/app/src
- ./development/.ipfs:/ipfs
environment:
- MESSAGING_NAMESPACE=dev
networks:
- default
# TODO Add nodemon
# Waits for origin-messaging-ipfs to be available before starting
command: node_modules/.bin/babel-node src/index.js --presets es2015
origin-bridge:
container_name: origin-bridge
image: origin-bridge
build:
context: .
dockerfile: development/dockerfiles/origin-bridge
volumes:
- ./origin-bridge:/app
# Set the envfile from the local envfile
- ./development/envfiles/origin-bridge.env:/app/.env
- flask_session:/app/flask_session
depends_on:
- postgres
ports:
- "5000:5000"
environment:
- FLASK_APP=/app/main.py
- FLASK_DEBUG=1
- DATABASE_URL=postgresql://origin:origin@postgres/origin
command: /bin/bash -c "flask db upgrade && flask run --host=0.0.0.0"
networks:
- default
origin-dapp:
container_name: origin-dapp
image: origin-dapp
build:
context: .
dockerfile: development/dockerfiles/origin-dapp
volumes:
# Mount origin-dapp inside the container
- ./origin-dapp:/app
# Set the envfile from the local envfile
- ./development/envfiles/origin-dapp.env:/app/.env
# Mount compiled origin-js inside node modules
- ./origin-js:/usr/local/lib/node_modules/origin
- origin_js_node_modules:/usr/local/lib/node_modules/origin/node_modules
- ./development/.ipfs:/ipfs
depends_on:
- origin-js
- origin-messaging
- origin-bridge
environment:
- NODE_ENV=development
ports:
- "3000:3000"
command:
# Waits for origin-messaging to start then uses a script to read the
# origin-messaging IPFS peer id and write the configuration key/pair to
# the .env file.
#
# The copying is necessary because the .env file is mounted as a volume
# and the inode is not allowed to change.
>
/bin/bash -c "wait-for.sh -t 0 -q origin-messaging:9012 --
npm install --quiet --no-progress &&
npm link origin &&
source set-ipfs-swarm.sh /ipfs/config &&
wait-for.sh -t 0 -q origin-js:8081 --
node node_modules/webpack-dev-server/bin/webpack-dev-server.js --host 0.0.0.0 --watch-poll 500"
networks:
- default