-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-compose.yml
51 lines (45 loc) · 1.72 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
version: '3.3'
services:
postgres:
image: postgres:13.1
environment:
- POSTGRES_USER=${DEFAULT_USER}
- POSTGRES_PASSWORD=${DEFAULT_PASSWORD}
- POSTGRES_DB=airflow
ports:
- "5678:5432"
airflow:
build:
context: ./airflow
environment:
- AIRFLOW__CORE__SQL_ALCHEMY_CONN=postgresql://${DEFAULT_USER}:${DEFAULT_PASSWORD}@postgres:5432/airflow
- AIRFLOW_CONN_POSTGRES_DEFAULT=postgresql://${DEFAULT_USER}:${DEFAULT_PASSWORD}@postgres:5432/datawarehouse
- AIRFLOW__CORE__FERNET_KEY=${FERNET_KEY}
- AIRFLOW__WEBSERVER__SECRET_KEY=${SECRET_KEY}
- DEFAULT_USER=${DEFAULT_USER}
- DEFAULT_PASSWORD=${DEFAULT_PASSWORD}
command: >
/bin/bash -c "
# Wait for PG
sleep 5
# Clean up pid
rm -f airflow-webserver.pid
# Set up metadata database
airflow db upgrade
# Create default user
airflow users create --username ${DEFAULT_USER} --password ${DEFAULT_PASSWORD} --email ${DEFAULT_USER}@gusty.com --firstname Default --lastname User --role Admin
# Set up warehouse db & views schema
python3 demo-setup/datawarehouse_setup.py
# Start airflow
airflow scheduler &
airflow webserver
# Keep the server on no matter what
sleep infinity
"
restart: always
depends_on:
- postgres
volumes:
- ./airflow:/usr/local/airflow
ports:
- "8080:8080"