I'm running n8n on ECS with a PostgreSQL database, and everything works normally until about a week into the deployment, when n8n suddenly loses access and reports the error:
password authentication failed for user "dbadmin"
The deployment relies on a shell script that exports the necessary environment variables. Here is the configuration script used:
export DB_TYPE=postgresdb
export DB_POSTGRESDB_DATABASE=n8n
export DB_POSTGRESDB_HOST=$RDS_ENDPOINT
export DB_POSTGRESDB_PORT=$RDS_PORT
export DB_POSTGRESDB_USER=$RDS_USERNAME
export DB_POSTGRESDB_PASSWORD=$RDS_PASSWORD
export DB_POSTGRESDB_SCHEMA=n8n
The error suggests that the value for DB_POSTGRESDB_USER is defaulting to "dbadmin" instead of the expected value, which could be due to credential mismatches, environment variable misconfiguration during container restarts, or improper variable injection in ECS.
I've verified that the deployment is correct initially, so I'm looking for insights into why the container might be reverting to outdated or default credentials over time and how to ensure the environment variables remain consistent across restarts. Any help or suggestions on managing environment variables properly in ECS would be greatly appreciated.