docker-compose.yml 4.78 KB
Newer Older
Domenico Giordano's avatar
Domenico Giordano committed
1
version: '3.3'
Domenico Giordano's avatar
Domenico Giordano committed
2

Domenico Giordano's avatar
Domenico Giordano committed
3
4
x-environment:
    &airflow-common-env
Domenico Giordano's avatar
Domenico Giordano committed
5
6
7
8
         KRB5CCNAME: ${KRB5CCNAME}
         REDIS_HOST: redis
         REDIS_PASSWORD: ${REDIS_PASSWORD}
         THIS_DEPLOYMENT_CACHE: ${THIS_DEPLOYMENT_CACHE}
9
10
11
         
         # This list changes the default_airflow.cfg using the syntax
         # AIRFLOW_[component_in_the_cfg]_<parameter_in_the_cfg>
Domenico Giordano's avatar
Domenico Giordano committed
12

13
         AIRFLOW__WEBSERVER__DAG_DEFAULT_VIEW: graph
Domenico Giordano's avatar
Domenico Giordano committed
14
         AIRFLOW__WEBSERVER__DAG_ORIENTATION: TB # dag layout top-bottom
15
         AIRFLOW__CORE__EXECUTOR: CeleryExecutor
Domenico Giordano's avatar
Domenico Giordano committed
16
17
         AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}/${POSTGRES_DB}
         AIRFLOW__CORE__FERNET_KEY: ${FERNET_KEY}
18
19
         AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: 'true'
         AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
20
21
22
         AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}/${POSTGRES_DB}
         AIRFLOW__CELERY__BROKER_URL: redis://:${REDIS_PASSWORD}@redis:${REDIS_PORT}/${REDIS_DBNUM}

Domenico Giordano's avatar
fix tab    
Domenico Giordano committed
23
         # These are global env variables passed to the AIRFLOW objects
24
         AIRFLOW_VAR_KRB5CCNAME: ${KRB5CCNAME}
Domenico Giordano's avatar
Domenico Giordano committed
25
26

x-airflow-common:
27
    &airflow-common
Domenico Giordano's avatar
Domenico Giordano committed
28
    image: gitlab-registry.cern.ch/cloud-infrastructure/data-analytics/docker-airflow:${AIRFLOW_IMAGE_TAG}
29
30
31
32
33
34
35
36
37
38
39
40
41
42
    volumes:
          - ${DAG_PATH}:/opt/airflow/dags
          - ${AD_LOGS_PATH}:/opt/airflow/logs
          - $KRB5CCNAME:$KRB5CCNAME
          - /eos:/eos
          - /var/run/docker.sock:/var/run/docker.sock
          #- ${KUBECONFIG}:/opt/airflow/.kube/config
    user: "${AIRFLOW_UID:-50000}:${AIRFLOW_GID:-50000}"
    depends_on:
      redis:
        condition: service_healthy
      postgres:
        condition: service_healthy
    restart: always
Domenico Giordano's avatar
Domenico Giordano committed
43

Domenico Giordano's avatar
Domenico Giordano committed
44
45
46
services:
########################################################
### support services
47
  srv_cvmfs:
Domenico Giordano's avatar
Domenico Giordano committed
48
      image: gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-builder/cvmfs-image:${CVMFS_IMAGE_TAG}
49
      command: -r sft.cern.ch -t /tmp/traces
Domenico Giordano's avatar
Domenico Giordano committed
50
51
52
      privileged: true
      #container_name: cnt_cvmfs_sft
      volumes:
53
54
         - /cvmfs:/cvmfs:shared
      network_mode: host
Domenico Giordano's avatar
Domenico Giordano committed
55
56
57
58
59
60
61
62
      # This does not work
      # https://docs.docker.com/compose/compose-file/
      # https://docs.docker.com/storage/bind-mounts/#configure-bind-propagation
        # - type: bind
        #   source: /tmp/cvmfs-stf
        #   target: /cvmfs
        #   propagation: shared
      #ERROR: The Compose file './docker-compose.yml' is invalid because:
63
      #services.srv_cvmfs.volumes contains unsupported option: 'propagation'
64
      restart: always
Domenico Giordano's avatar
Domenico Giordano committed
65

66
  srv_fluentd:
Matteo Paltenghi's avatar
Matteo Paltenghi committed
67
68
69
70
71
72
      image: gitlab-registry.cern.ch/cloud-infrastructure/data-analytics/fluentd:${FLUENTD_IMAGE_TAG}
      volumes:
         - ./fluentd_conf/fluent_to_monit.conf:/fluentd/etc/fluent.conf
      ports:
         - "24224:24224"
         - "24224:24224/udp"
73
      restart: always
Domenico Giordano's avatar
Domenico Giordano committed
74
75
76

########################################################

Domenico Giordano's avatar
Domenico Giordano committed
77
78
79
80
81
82
83
84
85
86
87
88
  redis:
    image: redis:6.2.1
    command: redis-server --requirepass ${REDIS_PASSWORD}
    ports:
      - 6379:6379
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 30s
      retries: 50
    restart: always

89
90
91
  postgres:
    image: postgres:13
    environment:
Domenico Giordano's avatar
Domenico Giordano committed
92
93
94
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=${POSTGRES_DB}
95
96
97
98
99
100
101
102
103
    volumes:
      - postgres-db-volume:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "airflow"]
      interval: 5s
      retries: 5
    restart: always


Domenico Giordano's avatar
Domenico Giordano committed
104
  airflow_web:
105
106
    <<: *airflow-common
    environment:
Domenico Giordano's avatar
Domenico Giordano committed
107
          <<: *airflow-common-env
108
109
110
111
112
113
114
115
116
117
    privileged: true
    ports:
      - 8080:8080
    healthcheck:
      test: ["CMD", "curl", "--fail", "http://localhost:8080/health"]
      interval: 10s
      timeout: 10s
      retries: 5
    command: webserver

Domenico Giordano's avatar
Domenico Giordano committed
118
  airflow_scheduler:
119
120
    <<: *airflow-common
    environment:
Domenico Giordano's avatar
Domenico Giordano committed
121
122
          <<: *airflow-common-env
          AD_SRV: scheduler
123
124
    command: scheduler
    privileged: true
Domenico Giordano's avatar
Domenico Giordano committed
125

Domenico Giordano's avatar
Domenico Giordano committed
126
  airflow_worker:
127
128
    <<: *airflow-common
    environment:
Domenico Giordano's avatar
Domenico Giordano committed
129
          <<: *airflow-common-env
130
131
132
133
134
135
136
137
138
139
140
141
142
    command: celery worker
    privileged: true

  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:-airflow}
      _AIRFLOW_WWW_USER_PASSWORD: ${_AIRFLOW_WWW_USER_PASSWORD:-airflow}

Domenico Giordano's avatar
Domenico Giordano committed
143
  airflow_flower:
144
145
146
147
148
149
150
151
152
153
154
155
    <<: *airflow-common
    environment:
          <<: *airflow-common-env
    command: celery flower
    privileged: true
    ports:
      - 5555:5555
    healthcheck:
      test: ["CMD", "curl", "--fail", "http://localhost:5555/"]
      interval: 10s
      timeout: 10s
      retries: 5
Domenico Giordano's avatar
Domenico Giordano committed
156
157

volumes:
158
  postgres-db-volume:
Domenico Giordano's avatar
Domenico Giordano committed
159
      driver: local