Hi, I keep getting `Airflow metadata database cou...
# troubleshooting
i
Hi, I keep getting
Airflow metadata database could not be initialized: 'airflow initdb' failed
after running
docker-compose -f docker-compose.prod.yml up -d
I have
airflow 2.1.2
and
psycopg2
with the following in the
docker-compose.prod.yml
file:
Copy code
x-meltano-env: &meltano-env
  MELTANO_DATABASE_URI: <postgresql://postgres:postgres@meltano-system-db/meltano>
  # Add any additional Meltano configuration environment variables here

# # Uncomment if you are using the Airflow orchestrator, delete otherwise
x-airflow-env: &airflow-env
  AIRFLOW__CORE__SQL_ALCHEMY_CONN: <postgresql://postgres:postgres@airflow-metadata-db/airflow>
  AIRFLOW__CORE__EXECUTOR: LocalExecutor
What am I missing here?
I found out why my Airflow webserver and scheduler kept restarting, it was because the database already existed. I did
docker-compose -f docker-compose.prod.yml down --volumes --remove-orphans
which cleaned everything up by removing the -db volumes. The
docker-compose -f docker-compose.prod.yml up -d
command was then successful, at least partially succesful.