-
-
Notifications
You must be signed in to change notification settings - Fork 111
Description
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-openwispusing theauto-install.shscript. - Stop the containers using
docker compose down(without the--volumesflag). - Delete the
.envfile or the configuration directory. - Run the
auto-install.shscript 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 --volumesAlternatively, 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.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status