Advertisement
Guest User

Untitled

a guest
Mar 13th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.11 KB | None | 0 0
  1. version: '3'
  2.  
  3. # Run as
  4. # docker-compose build; docker-compose up -d
  5. # Check with
  6. # docker ps
  7. # Then check the logs with
  8. # docker logs --tail 50 $container_id
  9. # docker-compose images
  10. # docker-compose logs --tail 20 repo_name
  11.  
  12. services:
  13. # RabbitMQ, used by the flask app to queue up jobs whee
  14. rabbit:
  15. hostname: rabbit
  16. image: rabbitmq:latest
  17. environment:
  18. - RABBITMQ_DEFAULT_USER=admin
  19. - RABBITMQ_DEFAULT_PASS=mypass
  20. - SERVICE_PORTS=5672
  21. - TCP_PORTS=5672
  22. # ports:
  23. # - "5672:5672"
  24. networks:
  25. - app-tier
  26. volumes:
  27. - /var/run/docker.sock:/var/run/docker.sock
  28.  
  29. celery_results_postgres_db:
  30. hostname: celery_results_postgres_db
  31. image: postgres:11.1
  32. environment: # Set up postgres database name and password
  33. POSTGRES_PASSWORD: password
  34. POSTGRES_DATABASE: celery
  35. POSTGRES_USER: celery
  36. ports: # Set up ports exposed for other containers to connect to
  37. - 5433:5432
  38. volumes:
  39. - /var/run/docker.sock:/var/run/docker.sock
  40. networks:
  41. - app-tier
  42.  
  43. airflow_postgres_db:
  44. hostname: airflow_postgres_db
  45. image: postgres:11.1
  46. environment: # Set up postgres database name and password
  47. POSTGRES_DATABASE: airflow
  48. POSTGRES_USER: airflow
  49. POSTGRES_PASSWORD: password
  50. POSTGRES_HOST: localhost
  51. ports: # Set up ports exposed for other containers to connect to
  52. - 5434:5432
  53. volumes:
  54. - /var/run/docker.sock:/var/run/docker.sock
  55. networks:
  56. - app-tier
  57.  
  58. adminer:
  59. image: adminer
  60. restart: always
  61. ports:
  62. - 8088:8080
  63. networks:
  64. - app-tier
  65.  
  66. # In order to build the image run
  67. # It needs to be retagged to upload to quay
  68. # docker-compose build --force-rm
  69. # docker tag sequence_automation_airflow quay.io/nyuad_cgsb/sequence_automation_airflow:latest
  70. airflow_init_db:
  71. build:
  72. context: .
  73. dockerfile: Dockerfile
  74. depends_on:
  75. - celery_results_postgres_db
  76. - airflow_postgres_db
  77. - rabbit
  78. links:
  79. - celery_results_postgres_db
  80. - airflow_postgres_db
  81. - rabbit
  82. environment:
  83. RABBIT_RESULTS_HOST: celery_results_postgres_db
  84. AIRFLOW_HOST: airflow_postgres_db
  85. RABBIT_MQ_HOST: rabbit
  86. C_FORCE_ROOT: 'true'
  87. command: >
  88. bash -c "/home/airflow/scripts/wait-for-it.sh -p 5432 -h airflow_postgres_db -- airflow initdb; tail -f /dev/null"
  89. volumes:
  90. - ./pkgs:/home/airflow/pkgs
  91. - ./plugins:/home/airflow/plugins
  92. - ./dags:/home/airflow/dags
  93. - ./.ssh:/home/airflow/.ssh:Z
  94. - ./scripts:/home/airflow/scripts
  95. - /var/run/docker.sock:/var/run/docker.sock
  96. networks:
  97. - app-tier
  98.  
  99. airflow_scheduler:
  100. build:
  101. context: .
  102. dockerfile: Dockerfile
  103. depends_on:
  104. - celery_results_postgres_db
  105. - airflow_postgres_db
  106. - rabbit
  107. - airflow_init_db
  108. links:
  109. - celery_results_postgres_db
  110. - airflow_postgres_db
  111. - rabbit
  112. environment:
  113. RABBIT_RESULTS_HOST: celery_results_postgres_db
  114. AIRFLOW_HOST: airflow_postgres_db
  115. RABBIT_MQ_HOST: rabbit
  116. C_FORCE_ROOT: 'true'
  117. command: >
  118. bash -c "/home/airflow/scripts/wait-for-it.sh -p 5432 -h airflow_postgres_db -- sleep 120; airflow scheduler"
  119. volumes:
  120. - ./pkgs:/home/airflow/pkgs
  121. - ./plugins:/home/airflow/plugins
  122. - ./dags:/home/airflow/dags
  123. - ./.ssh:/home/airflow/.ssh:Z
  124. - ./scripts:/home/airflow/scripts
  125. - /var/run/docker.sock:/var/run/docker.sock
  126. networks:
  127. - app-tier
  128.  
  129. airflow_webserver:
  130. build:
  131. context: .
  132. dockerfile: Dockerfile
  133. depends_on:
  134. - celery_results_postgres_db
  135. - airflow_postgres_db
  136. - rabbit
  137. - airflow_init_db
  138. - airflow_scheduler
  139. links:
  140. - celery_results_postgres_db
  141. - airflow_postgres_db
  142. - rabbit
  143. environment:
  144. RABBIT_RESULTS_HOST: celery_results_postgres_db
  145. AIRFLOW_HOST: airflow_postgres_db
  146. RABBIT_MQ_HOST: rabbit
  147. C_FORCE_ROOT: 'true'
  148. command: >
  149. bash -c "/home/airflow/scripts/wait-for-it.sh -p 5432 -h airflow_postgres_db -- sleep 120; airflow webserver"
  150. volumes:
  151. - ./pkgs:/home/airflow/pkgs
  152. - ./plugins:/home/airflow/plugins
  153. - ./dags:/home/airflow/dags
  154. - ./.ssh:/home/airflow/.ssh:Z
  155. - ./scripts:/home/airflow/scripts
  156. - /var/run/docker.sock:/var/run/docker.sock
  157. ports:
  158. - "8089:8080"
  159. - "5001:5000"
  160. networks:
  161. - app-tier
  162.  
  163. airflow_worker:
  164. build:
  165. context: .
  166. dockerfile: Dockerfile
  167. depends_on:
  168. - celery_results_postgres_db
  169. - airflow_postgres_db
  170. - rabbit
  171. - airflow_init_db
  172. - airflow_scheduler
  173. links:
  174. - celery_results_postgres_db
  175. - airflow_postgres_db
  176. - rabbit
  177. environment:
  178. RABBIT_RESULTS_HOST: celery_results_postgres_db
  179. AIRFLOW_HOST: airflow_postgres_db
  180. RABBIT_MQ_HOST: rabbit
  181. C_FORCE_ROOT: 'true'
  182. command: >
  183. bash -c "/home/airflow/scripts/wait-for-it.sh -p 5432 -h airflow_postgres_db -- sleep 120; airflow worker"
  184. volumes:
  185. - ./pkgs:/home/airflow/pkgs
  186. - ./plugins:/home/airflow/plugins
  187. - ./dags:/home/airflow/dags
  188. - ./.ssh:/home/airflow/.ssh:Z
  189. - ./scripts:/home/airflow/scripts
  190. - /var/run/docker.sock:/var/run/docker.sock
  191. networks:
  192. - app-tier
  193.  
  194. networks:
  195. app-tier:
  196. driver: bridge
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement