I am testing some stuff where I have to init my Postgres DB DDL into airflow Postgres DB when I compose-up it should automatically init for one time as it will be cached afterward as airflow DB works usually. Thanks
As requested in the last comment: Adding your own database to the Airflow Docker-compose file:
Put this piece of code as a service somewhere amongst the other services:
mypostgres:
image: postgres:13
environment:
POSTGRES_USER: mydbuser
POSTGRES_PASSWORD: securepassword
POSTGRES_DB: mydb
volumes:
- ./database:/var/lib/postgresql/data
- ./init-database.sh:/docker-entrypoint-initdb.d/init-database.sh
restart: always
Make sure you have a database-directory and a init-database.sh file in the current directory (otherwise the volume mappings fail)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With