Skip to content

Commit 9443a0d

Browse files
committed
add method to deploy locally
1 parent fd6fdb2 commit 9443a0d

File tree

3 files changed

+114
-0
lines changed

3 files changed

+114
-0
lines changed

Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ airflow-push-image: push-to-ecr
1919

2020
airflow-destroy:
2121
python -c 'from deploy_cloudformation import destroy_stacks; destroy_stacks()';
22+
23+
airflow-local:
24+
pip install cryptography
25+
export AIRFLOW_FERNET_KEY=$(python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())")
26+
docker-compose up --build

dags/crypto_extract_dag.py

Whitespace-only changes.

docker-compose.yml

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
version: '3'
2+
3+
services:
4+
redis:
5+
image: 'redis:5.0.3'
6+
command: redis-server
7+
8+
postgres:
9+
image: postgres:10.4
10+
environment:
11+
- POSTGRES_USER=airflow
12+
- POSTGRES_PASSWORD=airflow
13+
- POSTGRES_DB=airflow
14+
volumes:
15+
- ./postgres_data:/var/lib/postgresql/data
16+
ports:
17+
- 5432:5432
18+
19+
webserver:
20+
image: airflow:latest
21+
restart: always
22+
build: .
23+
depends_on:
24+
- postgres
25+
- redis
26+
environment:
27+
- REDIS_HOST=redis
28+
- REDIS_PORT=6379
29+
- POSTGRES_HOST=postgres
30+
- POSTGRES_PORT=5432
31+
- POSTGRES_USER=airflow
32+
- POSTGRES_PASSWORD=airflow
33+
- POSTGRES_DB=airflow
34+
- FERNET_KEY=${AIRFLOW_FERNET_KEY}
35+
- AIRFLOW_BASE_URL=http://localhost:8080
36+
- ENABLE_REMOTE_LOGGING=False
37+
- STAGE=dev
38+
volumes:
39+
- ./dags:/usr/local/airflow/dags
40+
ports:
41+
- "8080:8080"
42+
command: webserver
43+
healthcheck:
44+
test: ["CMD-SHELL", "[ -f /usr/local/airflow/airflow-webserver.pid ]"]
45+
interval: 30s
46+
timeout: 30s
47+
retries: 3
48+
49+
flower:
50+
image: airflow:latest
51+
restart: always
52+
depends_on:
53+
- redis
54+
- webserver
55+
environment:
56+
- REDIS_HOST=redis
57+
- REDIS_PORT=6379
58+
- POSTGRES_HOST=postgres
59+
- POSTGRES_PORT=5432
60+
- POSTGRES_USER=airflow
61+
- POSTGRES_PASSWORD=airflow
62+
- POSTGRES_DB=airflow
63+
- STAGE=dev
64+
ports:
65+
- "5555:5555"
66+
command: flower
67+
68+
scheduler:
69+
image: airflow:latest
70+
restart: always
71+
depends_on:
72+
- webserver
73+
volumes:
74+
- ./dags:/usr/local/airflow/dags
75+
environment:
76+
- REDIS_HOST=redis
77+
- REDIS_PORT=6379
78+
- POSTGRES_HOST=postgres
79+
- POSTGRES_PORT=5432
80+
- POSTGRES_USER=airflow
81+
- POSTGRES_PASSWORD=airflow
82+
- POSTGRES_DB=airflow
83+
- FERNET_KEY=${AIRFLOW_FERNET_KEY}
84+
- AIRFLOW_BASE_URL=http://localhost:8080
85+
- ENABLE_REMOTE_LOGGING=False
86+
- STAGE=dev
87+
command: scheduler
88+
89+
worker:
90+
image: airflow:latest
91+
restart: always
92+
depends_on:
93+
- webserver
94+
- scheduler
95+
volumes:
96+
- ./dags:/usr/local/airflow/dags
97+
environment:
98+
- REDIS_HOST=redis
99+
- REDIS_PORT=6379
100+
- POSTGRES_HOST=postgres
101+
- POSTGRES_PORT=5432
102+
- POSTGRES_USER=airflow
103+
- POSTGRES_PASSWORD=airflow
104+
- POSTGRES_DB=airflow
105+
- FERNET_KEY=${AIRFLOW_FERNET_KEY}
106+
- AIRFLOW_BASE_URL=http://localhost:8080
107+
- ENABLE_REMOTE_LOGGING=False
108+
- STAGE=dev
109+
command: worker

0 commit comments

Comments
 (0)