Describe the bug
Stemming from https://github.com/orgs/openwisp/discussions/1213.
The auto-install.sh script generates a new .env file with randomized database credentials (DB_USER, DB_PASSWORD) on every new installation. If a user attempts to reinstall or recover a setup by re-running the script without purging existing Docker volumes, a credential mismatch occurs.
The PostgreSQL container retains the original credentials stored in its persistent data volume, while the OpenWISP application containers attempt to authenticate using the newly generated credentials in the .env file. This results in a permanent "FATAL: password authentication failed" error.
Steps To Reproduce
- Install
docker-openwisp using the auto-install.sh script.
- Stop the containers using
docker compose down (without the --volumes flag).
- Delete the
.env file or the configuration directory.
- Run the
auto-install.sh script again to generate a fresh configuration.
- Attempt to start the stack; the application will fail to connect to the database.
Expected behavior
The installation process should be idempotent or provide a warning when existing volumes are detected. If the .env file is missing but volumes are present, the script should ideally warn the user that generating new credentials will break database connectivity unless the volumes are also cleared.
Screenshots
N/A
System Information:
- OS: Ubuntu 24.04 LTS
- Docker version: Docker version 28.1.1
Suggested Mitigation
For users encountering this, the following command must be run to ensure the database is initialized with the current .env credentials (note that this deletes all existing data):
docker compose -f /opt/openwisp/docker-openwisp/docker-compose.yml down --volumes
Alternatively, the auto-install.sh script could be updated to check for existing openwisp_db_data volumes and prompt the user for confirmation before proceeding with new credential generation.
Describe the bug
Stemming from https://github.com/orgs/openwisp/discussions/1213.
The
auto-install.shscript generates a new.envfile with randomized database credentials (DB_USER,DB_PASSWORD) on every new installation. If a user attempts to reinstall or recover a setup by re-running the script without purging existing Docker volumes, a credential mismatch occurs.The PostgreSQL container retains the original credentials stored in its persistent data volume, while the OpenWISP application containers attempt to authenticate using the newly generated credentials in the
.envfile. This results in a permanent "FATAL: password authentication failed" error.Steps To Reproduce
docker-openwispusing theauto-install.shscript.docker compose down(without the--volumesflag)..envfile or the configuration directory.auto-install.shscript again to generate a fresh configuration.Expected behavior
The installation process should be idempotent or provide a warning when existing volumes are detected. If the
.envfile is missing but volumes are present, the script should ideally warn the user that generating new credentials will break database connectivity unless the volumes are also cleared.Screenshots
N/A
System Information:
Suggested Mitigation
For users encountering this, the following command must be run to ensure the database is initialized with the current
.envcredentials (note that this deletes all existing data):Alternatively, the
auto-install.shscript could be updated to check for existingopenwisp_db_datavolumes and prompt the user for confirmation before proceeding with new credential generation.