Как настроить файл offcial airflow docker-compose?

#python #docker #airflow

Вопрос:

Я использую официальный файл yaml docker в ссылке, который работает нормально. Тем не менее, я хочу настроить его. Я попытался ввести пользовательское имя базы данных,
пользователя postgres
, пароль postgres,
пользователя воздушного
потока и пароль воздушного
потока.
но контейнеры переходят в фазу перезапуска и выходят из строя.

Вот файл compose, который я пробовал.

 version: '3'
x-airflow-common:
  amp;airflow-common
  image: ${AIRFLOW_IMAGE_NAME:-abhigyan97/airflow}
  environment:
    amp;airflow-common-env
    AIRFLOW__CORE__EXECUTOR: CeleryExecutor
    AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql psycopg2://**Custom_Postgres_User**:**Custom_Postgres_Pass**@postgres/airflow
    AIRFLOW__CELERY__RESULT_BACKEND: db postgresql://**Custom_Postgres_User**:**Custom_Postgres_Pass**@postgres/airflow
    AIRFLOW__CELERY__BROKER_URL: redis://:@redis:6379/0
    AIRFLOW__CORE__FERNET_KEY: ''
    AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: 'true'
    AIRFLOW__CORE__LOAD_EXAMPLES: 'False'
    AIRFLOW__CORE__DEFAULT_TIMEZONE: 'IST'
    AIRFLOW__API__AUTH_BACKEND: 'airflow.api.auth.backend.basic_auth'
  volumes:
    - /home/ubuntu/apache-airflow/dags:/opt/airflow/dags
    - /home/ubuntu/apache-airflow/logs:/opt/airflow/logs
    - /home/ubuntu/apache-airflow/plugins:/opt/airflow/plugins
    
  user: "${AIRFLOW_UID:-50000}:${AIRFLOW_GID:-50000}"
  depends_on:
    redis:
      condition: service_healthy
    postgres:
      condition: service_healthy

services:
  postgres:
    image: postgres:13
    environment:
      POSTGRES_USER: **Custom_Postgres_User**
      POSTGRES_PASSWORD: **Custom_Postgres_password**
      POSTGRES_DB: airflow
    volumes:
      - postgres-db-volume:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "**Custom_Postgres_User**"]
      interval: 5s
      retries: 5
    restart: always

  redis:
    image: redis:latest
    ports:
      - 6379:6379
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 30s
      retries: 50
    restart: always

  airflow-webserver:
    <<: *airflow-common
    command: webserver
    ports:
      - 8050:8080
    healthcheck:
      test: ["CMD", "curl", "--fail", "http://localhost:8080/health"]
      interval: 10s
      timeout: 10s
      retries: 5
    restart: always

  airflow-scheduler:
    <<: *airflow-common
    command: scheduler
    healthcheck:
      test: ["CMD-SHELL", 'airflow jobs check --job-type SchedulerJob --hostname "${HOSTNAME}"']
      interval: 10s
      timeout: 10s
      retries: 5
    restart: always

  airflow-worker:
    <<: *airflow-common
    command: celery worker
    healthcheck:
      test:
        - "CMD-SHELL"
        - 'celery --app airflow.executors.celery_executor.app inspect ping -d "celery@${HOSTNAME}"'
      interval: 10s
      timeout: 10s
      retries: 5
    restart: always

  airflow-init:
    <<: *airflow-common
    command: version
    environment:
      <<: *airflow-common-env
      _AIRFLOW_DB_UPGRADE: 'true'
      _AIRFLOW_WWW_USER_CREATE: 'true'
      _AIRFLOW_WWW_USER_USERNAME: ${_AIRFLOW_WWW_USER_USERNAME:-**Custom_User_Name**}
      _AIRFLOW_WWW_USER_PASSWORD: ${_AIRFLOW_WWW_USER_PASSWORD:-**Custom_Password**}

  flower:
    <<: *airflow-common
    command: celery flower
    ports:
      - 5555:5555
    healthcheck:
      test: ["CMD", "curl", "--fail", "http://localhost:5555/"]
      interval: 10s
      timeout: 10s
      retries: 5
    restart: always

volumes:
  postgres-db-volume:
 

Журнал контейнера веб-сервера:

 {
      "Start": "2021-07-16T08:26:04.360421291Z",
      "End": "2021-07-16T08:26:04.73954199Z",
      "ExitCode": 7,
      "Output": "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Currentn                                 Dload  Upload   Total   Spent    Left  Speednr  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to localhost port 8080: Connection refusedn"
    }
 

Журнал для планировщика:

  {
      "Start": "2021-07-16T08:25:54.784372726Z",
      "End": "2021-07-16T08:26:04.784518701Z",
      "ExitCode": -1,
      "Output": "Health check exceeded timeout (10s)"
    },
 

Журнал для рабочего:

 {
      "Start": "2021-07-16T08:25:54.579081967Z",
      "End": "2021-07-16T08:26:04.579230977Z",
      "ExitCode": -1,
      "Output": "Health check exceeded timeout (10s)"
    }
 

Заранее благодарю вас!

Комментарии:

1. Пожалуйста, опубликуйте соответствующую часть журнала контейнеров.

2. @КлаусД. Я отредактировал вопрос с помощью журналов