Advertisement
ElRandir42

docker-compose

Sep 16th, 2022 (edited)
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.37 KB | None | 0 0
  1. # Licensed to the Apache Software Foundation (ASF) under one
  2. # or more contributor license agreements. See the NOTICE file
  3. # distributed with this work for additional information
  4. # regarding copyright ownership. The ASF licenses this file
  5. # to you under the Apache License, Version 2.0 (the
  6. # "License"); you may not use this file except in compliance
  7. # with the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing,
  12. # software distributed under the License is distributed on an
  13. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. # KIND, either express or implied. See the License for the
  15. # specific language governing permissions and limitations
  16. # under the License.
  17. #
  18.  
  19. # Basic Airflow cluster configuration for CeleryExecutor with Redis and PostgreSQL.
  20. #
  21. # WARNING: This configuration is for local development. Do not use it in a production deployment.
  22. #
  23. # This configuration supports basic configuration using environment variables or an .env file
  24. # The following variables are supported:
  25. #
  26. # AIRFLOW_IMAGE_NAME - Docker image name used to run Airflow.
  27. # Default: apache/airflow:master-python3.8
  28. # AIRFLOW_UID - User ID in Airflow containers
  29. # Default: 50000
  30. # AIRFLOW_GID - Group ID in Airflow containers
  31. # Default: 50000
  32. # _AIRFLOW_WWW_USER_USERNAME - Username for the administrator account.
  33. # Default: airflow
  34. # _AIRFLOW_WWW_USER_PASSWORD - Password for the administrator account.
  35. # Default: airflow
  36. #
  37. # Feel free to modify this file to suit your needs.
  38. ---
  39. version: '3'
  40. x-airflow-common:
  41. &airflow-common
  42. image: apache/airflow-custom
  43. #image: ${AIRFLOW_IMAGE_NAME:-apache/airflow:2.1.0}
  44. environment:
  45. &airflow-common-env
  46. AIRFLOW__CORE__EXECUTOR: CeleryExecutor
  47. AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@10.0.00.00/airflow_metadata
  48. AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@10.0.00.00/airflow_metadata
  49. AIRFLOW__CELERY__BROKER_URL: redis://:@redis:6379/0
  50. AIRFLOW__CORE__FERNET_KEY: 0
  51. AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: 'true'
  52. AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
  53. AIRFLOW__API__AUTH_BACKEND: 'airflow.api.auth.backend.basic_auth'
  54. AIRFLOW__WEBSERVER__BASE_URL: 'http://10.0.00.0:666'
  55. volumes:
  56. - .:/opt/airflow
  57. #- ./dags:/opt/airflow/dags
  58. #- ./logs:/opt/airflow/logs
  59. #- ./plugins:/opt/airflow/plugins
  60. user: "${AIRFLOW_UID:-50000}:${AIRFLOW_GID:-50000}"
  61. depends_on:
  62. redis:
  63. condition: service_healthy
  64.  
  65. services:
  66.  
  67. redis:
  68. image: redis:latest
  69. ports:
  70. - 6379:6379
  71. healthcheck:
  72. test: ["CMD", "redis-cli", "ping"]
  73. interval: 5s
  74. timeout: 30s
  75. retries: 50
  76. restart: always
  77.  
  78. airflow-webserver:
  79. <<: *airflow-common
  80. command: webserver
  81. ports:
  82. - 666:8080
  83. healthcheck:
  84. test: ["CMD", "curl", "--fail", "http://0.0.0.0:8080/health"]
  85. interval: 10s
  86. timeout: 10s
  87. retries: 5
  88. restart: always
  89.  
  90. airflow-scheduler:
  91. <<: *airflow-common
  92. command: scheduler
  93. healthcheck:
  94. test: ["CMD-SHELL", 'airflow jobs check --job-type SchedulerJob --hostname "$${HOSTNAME}"']
  95. interval: 10s
  96. timeout: 10s
  97. retries: 5
  98. restart: always
  99.  
  100. airflow-worker:
  101. <<: *airflow-common
  102. command: celery worker
  103. healthcheck:
  104. test:
  105. - "CMD-SHELL"
  106. - 'celery --app airflow.executors.celery_executor.app inspect ping -d "celery@$${HOSTNAME}"'
  107. interval: 10s
  108. timeout: 10s
  109. retries: 5
  110. restart: always
  111.  
  112. airflow-init:
  113. <<: *airflow-common
  114. command: version
  115. environment:
  116. <<: *airflow-common-env
  117. _AIRFLOW_DB_UPGRADE: 'true'
  118. _AIRFLOW_WWW_USER_CREATE: 'true'
  119. _AIRFLOW_WWW_USER_USERNAME: ${_AIRFLOW_WWW_USER_USERNAME:-airflow}
  120. _AIRFLOW_WWW_USER_PASSWORD: ${_AIRFLOW_WWW_USER_PASSWORD:-airflow}
  121.  
  122. flower:
  123. <<: *airflow-common
  124. command: celery flower
  125. ports:
  126. - 5555:5555
  127. healthcheck:
  128. test: ["CMD", "curl", "--fail", "http://localhost:5555/"]
  129. interval: 10s
  130. timeout: 10s
  131. retries: 5
  132. restart: always
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement