docker-compose.yml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. # Compiles new joystream/node and joystream/apps images if local images not found
  2. # and runs a complete joystream development network
  3. # To prevent build of docker images run docker-compose with "--no-build" arg
  4. version: '3.4'
  5. services:
  6. joystream-node:
  7. image: joystream/node:$JOYSTREAM_NODE_TAG
  8. build:
  9. # context is relative to the compose file
  10. context: .
  11. # dockerfile is relative to the context
  12. dockerfile: joystream-node.Dockerfile
  13. container_name: joystream-node
  14. volumes:
  15. - /data
  16. command: --dev --alice --validator --unsafe-ws-external --unsafe-rpc-external --rpc-methods Unsafe --rpc-cors=all --log runtime --base-path /data
  17. ports:
  18. - '127.0.0.1:9944:9944'
  19. - '127.0.0.1:9933:9933'
  20. colossus-1:
  21. image: node:14
  22. container_name: colossus-1
  23. restart: on-failure
  24. volumes:
  25. - /data
  26. - /keystore
  27. - type: bind
  28. source: .
  29. target: /joystream
  30. working_dir: /joystream/storage-node-v2
  31. ports:
  32. - '127.0.0.1:3333:3333'
  33. env_file:
  34. # relative to working directory where docker-compose was run from
  35. - .env
  36. environment:
  37. # ACCOUNT_URI overrides command line arg --accountUri
  38. - ACCOUNT_URI=${COLOSSUS_1_ACCOUNT_URI}
  39. command: [
  40. 'yarn', 'storage-node', 'server', '--worker=${COLOSSUS_1_WORKER_ID}', '--port=3333', '--uploads=/data',
  41. '--sync', '--syncInterval=1',
  42. '--queryNodeHost=${COLOSSUS_QUERY_NODE_HOST}',
  43. '--apiUrl=${JOYSTREAM_NODE_WS}'
  44. ]
  45. distributor-1:
  46. image: node:14
  47. container_name: distributor-1
  48. restart: on-failure
  49. volumes:
  50. - /data
  51. - /cache
  52. - /logs
  53. - type: bind
  54. source: .
  55. target: /joystream
  56. # let the working_dir be the distributor node to pickup the config.yml file
  57. working_dir: /joystream/distributor-node
  58. ports:
  59. - 127.0.0.1:3334:3334
  60. env_file:
  61. # relative to working directory where docker-compose was run from
  62. - .env
  63. # Node configuration can be overriden via env, for exampe:
  64. environment:
  65. JOYSTREAM_DISTRIBUTOR__ID: distributor-1
  66. JOYSTREAM_DISTRIBUTOR__ENDPOINTS__QUERY_NODE: ${DISTRIBUTOR_QUERY_NODE_URL}
  67. JOYSTREAM_DISTRIBUTOR__KEYS: "[{\"suri\":\"${DISTRIBUTOR_1_ACCOUNT_URI}\"}]"
  68. JOYSTREAM_DISTRIBUTOR__WORKER_ID: ${DISTRIBUTOR_1_WORKER_ID}
  69. JOYSTREAM_DISTRIBUTOR__PORT: 3334
  70. JOYSTREAM_DISTRIBUTOR__ENDPOINTS__JOYSTREAM_NODE_WS: ${JOYSTREAM_NODE_WS}
  71. JOYSTREAM_DISTRIBUTOR__DIRECTORIES__ASSETS: /data
  72. JOYSTREAM_DISTRIBUTOR__DIRECTORIES__CACHE_STATE: /cache
  73. JOYSTREAM_DISTRIBUTOR__DIRECTORIES__LOGS: /logs
  74. # JOYSTREAM_DISTRIBUTOR__ENDPOINTS__ELASTIC_SEARCH: es-endpoint
  75. # JOYSTREAM_DISTRIBUTOR__LOG__CONSOLE: "off"
  76. # JOYSTREAM_DISTRIBUTOR__LOG__FILE: "off"
  77. # JOYSTREAM_DISTRIBUTOR__LOG__ELASTIC: "off"
  78. # JOYSTREAM_DISTRIBUTOR__LIMITS__STORAGE: 50G
  79. # JOYSTREAM_DISTRIBUTOR__BUCKETS: "[1,2]"
  80. command: ['yarn', 'joystream-distributor', 'start']
  81. colossus-2:
  82. image: node:14
  83. container_name: colossus-2
  84. restart: on-failure
  85. volumes:
  86. - /data
  87. - /keystore
  88. - type: bind
  89. source: .
  90. target: /joystream
  91. working_dir: /joystream/storage-node-v2
  92. ports:
  93. - '127.0.0.1:3335:3333'
  94. env_file:
  95. # relative to working directory where docker-compose was run from
  96. - .env
  97. environment:
  98. # ACCOUNT_URI overrides command line arg --accountUri
  99. - ACCOUNT_URI=${COLOSSUS_2_ACCOUNT_URI}
  100. command: [
  101. 'yarn', 'storage-node', 'server', '--worker=${COLOSSUS_2_WORKER_ID}', '--port=3333', '--uploads=/data',
  102. '--sync', '--syncInterval=1',
  103. '--queryNodeHost=${COLOSSUS_QUERY_NODE_HOST}',
  104. '--apiUrl=${JOYSTREAM_NODE_WS}'
  105. ]
  106. distributor-2:
  107. image: node:14
  108. container_name: distributor-2
  109. restart: on-failure
  110. volumes:
  111. - /data
  112. - /cache
  113. - /logs
  114. - type: bind
  115. source: .
  116. target: /joystream
  117. # let the working_dir be the distributor node to pickup the config.yml file
  118. working_dir: /joystream/distributor-node
  119. ports:
  120. - 127.0.0.1:3336:3334
  121. env_file:
  122. # relative to working directory where docker-compose was run from
  123. - .env
  124. # Node configuration can be overriden via env, for exampe:
  125. environment:
  126. JOYSTREAM_DISTRIBUTOR__ID: distributor-2
  127. JOYSTREAM_DISTRIBUTOR__ENDPOINTS__QUERY_NODE: ${DISTRIBUTOR_QUERY_NODE_URL}
  128. JOYSTREAM_DISTRIBUTOR__KEYS: "[{\"suri\":\"${DISTRIBUTOR_2_ACCOUNT_URI}\"}]"
  129. JOYSTREAM_DISTRIBUTOR__WORKER_ID: ${DISTRIBUTOR_2_WORKER_ID}
  130. JOYSTREAM_DISTRIBUTOR__PORT: 3334
  131. JOYSTREAM_DISTRIBUTOR__ENDPOINTS__JOYSTREAM_NODE_WS: ${JOYSTREAM_NODE_WS}
  132. JOYSTREAM_DISTRIBUTOR__DIRECTORIES__ASSETS: /data
  133. JOYSTREAM_DISTRIBUTOR__DIRECTORIES__CACHE_STATE: /cache
  134. JOYSTREAM_DISTRIBUTOR__DIRECTORIES__LOGS: /logs
  135. # JOYSTREAM_DISTRIBUTOR__ENDPOINTS__ELASTIC_SEARCH: es-endpoint
  136. # JOYSTREAM_DISTRIBUTOR__LOG__CONSOLE: "off"
  137. # JOYSTREAM_DISTRIBUTOR__LOG__FILE: "off"
  138. # JOYSTREAM_DISTRIBUTOR__LOG__ELASTIC: "off"
  139. # JOYSTREAM_DISTRIBUTOR__LIMITS__STORAGE: 50G
  140. # JOYSTREAM_DISTRIBUTOR__BUCKETS: "[1,2]"
  141. command: ['yarn', 'joystream-distributor', 'start']
  142. db:
  143. image: postgres:12
  144. container_name: db
  145. restart: always
  146. ports:
  147. - '127.0.0.1:${DB_PORT}:${DB_PORT}'
  148. volumes:
  149. - /var/lib/postgresql/data
  150. env_file:
  151. # relative to working directory where docker-compose was run from
  152. - .env
  153. environment:
  154. POSTGRES_USER: ${DB_USER}
  155. POSTGRES_PASSWORD: ${DB_PASS}
  156. POSTGRES_DB: ${INDEXER_DB_NAME}
  157. PGPORT: ${DB_PORT}
  158. graphql-server:
  159. image: node:14
  160. container_name: graphql-server
  161. restart: unless-stopped
  162. env_file:
  163. # relative to working directory where docker-compose was run from
  164. - .env
  165. environment:
  166. - DB_HOST=db
  167. - WARTHOG_APP_PORT=${GRAPHQL_SERVER_PORT}
  168. ports:
  169. - '127.0.0.1:${GRAPHQL_SERVER_PORT}:${GRAPHQL_SERVER_PORT}'
  170. depends_on:
  171. - db
  172. volumes:
  173. - type: bind
  174. source: .
  175. target: /joystream
  176. working_dir: /joystream
  177. command: ['yarn', 'workspace', 'query-node-root', 'query-node:start:prod']
  178. processor:
  179. image: node:14
  180. container_name: processor
  181. restart: unless-stopped
  182. env_file:
  183. # relative to working directory where docker-compose was run from
  184. - .env
  185. environment:
  186. - INDEXER_ENDPOINT_URL=${PROCESSOR_INDEXER_GATEWAY}
  187. - TYPEORM_HOST=db
  188. - TYPEORM_DATABASE=${DB_NAME}
  189. depends_on:
  190. - db
  191. volumes:
  192. - type: bind
  193. source: .
  194. target: /joystream
  195. working_dir: /joystream
  196. command: ['yarn', 'workspace', 'query-node-root', 'processor:start']
  197. indexer:
  198. image: joystream/hydra-indexer:3.0.0
  199. container_name: indexer
  200. restart: unless-stopped
  201. env_file:
  202. # relative to working directory where docker-compose was run from
  203. - .env
  204. environment:
  205. - DB_NAME=${INDEXER_DB_NAME}
  206. - INDEXER_WORKERS=5
  207. - REDIS_URI=redis://redis:6379/0
  208. - TYPES_JSON=types.json
  209. - WS_PROVIDER_ENDPOINT_URI=${JOYSTREAM_NODE_WS}
  210. - DB_HOST=db
  211. depends_on:
  212. - db
  213. - redis
  214. volumes:
  215. - ./types/augment/all/defs.json:/home/hydra/packages/hydra-indexer/types.json
  216. command: >
  217. sh -c "yarn db:bootstrap && yarn start:prod"
  218. hydra-indexer-gateway:
  219. image: joystream/hydra-indexer-gateway:3.0.0
  220. container_name: hydra-indexer-gateway
  221. restart: unless-stopped
  222. env_file:
  223. # relative to working directory where docker-compose was run from
  224. - .env
  225. environment:
  226. - WARTHOG_STARTER_DB_DATABASE=${INDEXER_DB_NAME}
  227. - WARTHOG_STARTER_DB_HOST=db
  228. - WARTHOG_STARTER_DB_PASSWORD=${DB_PASS}
  229. - WARTHOG_STARTER_DB_PORT=${DB_PORT}
  230. - WARTHOG_STARTER_DB_USERNAME=${DB_USER}
  231. - WARTHOG_STARTER_REDIS_URI=redis://redis:6379/0
  232. - WARTHOG_APP_PORT=${HYDRA_INDEXER_GATEWAY_PORT}
  233. - PORT=${HYDRA_INDEXER_GATEWAY_PORT}
  234. - DEBUG=*
  235. ports:
  236. - '127.0.0.1:${HYDRA_INDEXER_GATEWAY_PORT}:${HYDRA_INDEXER_GATEWAY_PORT}'
  237. depends_on:
  238. - db
  239. - redis
  240. redis:
  241. image: redis:6.0-alpine
  242. container_name: redis
  243. restart: always
  244. ports:
  245. - '127.0.0.1:6379:6379'
  246. pioneer:
  247. image: nginx
  248. container_name: pioneer
  249. volumes:
  250. - ./pioneer/packages/apps/build:/usr/share/nginx/html
  251. ports:
  252. - "127.0.0.1:3000:80"
  253. environment:
  254. - NGINX_PORT=80