Skip to content

Commit 0fec6ba

Browse files
feat: db migrate
1 parent c76837b commit 0fec6ba

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

compose.yaml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ x-airflow-common: &airflow-common
99
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: "true"
1010
AIRFLOW__CORE__LOAD_EXAMPLES: "false"
1111
AIRFLOW__CORE__MAX_ACTIVE_TASKS_PER_DAG: 32
12+
AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@postgres/airflow
13+
AIRFLOW__CELERY__BROKER_URL: redis://:@redis:6379/0
1214
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
1315
AIRFLOW__SCHEDULER__ENABLE_HEALTH_CHECK: "true"
1416
AIRFLOW__CORE__EXECUTION_API_SERVER_URL: "http://airflow-apiserver:8080/execution/"
@@ -62,8 +64,7 @@ services:
6264
- |
6365
mkdir -p /sources/logs
6466
chown -R "${AIRFLOW_UID:-1010}:0" /sources/logs
65-
exec uv run airflow version &&
66-
exec airflow db migrate
67+
exec uv run airflow version
6768
environment:
6869
<<: *airflow-common-env
6970
_AIRFLOW_DB_MIGRATE: "true"
@@ -74,6 +75,23 @@ services:
7475
volumes:
7576
- ${AIRFLOW_PROJ_DIR:-.}:/sources
7677

78+
airflow-cli:
79+
<<: *airflow-common
80+
entrypoint: /bin/bash
81+
command:
82+
- -c
83+
- |
84+
mkdir -p /sources/logs
85+
chown -R "${AIRFLOW_UID:-1010}:0" /sources/logs
86+
exec uv run airflow db migrate
87+
user: "0:0"
88+
volumes:
89+
- ${AIRFLOW_PROJ_DIR:-.}:/sources
90+
depends_on:
91+
<<: *airflow-common-depends-on
92+
airflow-init:
93+
condition: service_completed_successfully
94+
7795

7896
airflow-dag-processor:
7997
<<: *airflow-common
@@ -117,7 +135,8 @@ services:
117135
<<: *airflow-common
118136
command:
119137
- airflow
120-
- celery worker
138+
- celery
139+
- worker
121140
healthcheck:
122141
# yamllint disable rule:line-length
123142
test:

0 commit comments

Comments
 (0)