Skip to content

Commit bd59264

Browse files
committed
[deploy] Fixed password authentication failure #562
Prevents credential mismatch when reinstalling without clearing volumes. The script now detects existing postgres_data volumes and aborts with a clear warning instead of silently generating new credentials that break database connectivity. Fixes #562
1 parent 8f378f3 commit bd59264

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

deploy/auto-install.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,17 @@ setup_docker_openwisp() {
103103
echo -ne ${GRN}"Do you have .env file? Enter filepath (leave blank for ad-hoc configuration): "${NON}
104104
read env_path
105105
if [[ ! -f "$env_path" ]]; then
106+
if [[ ! -f "$INSTALL_PATH/.env" ]] && [[ ! -f "$ENV_BACKUP" ]]; then
107+
if docker volume inspect "docker-openwisp_postgres_data" &>/dev/null; then
108+
echo -e "${RED}CRITICAL: Existing database data detected!${NON}" | tee -a "$LOG_FILE"
109+
echo -e "New credentials will break your connection to existing volumes."
110+
echo -e "\nTo fix, either restore your .env or run:"
111+
echo -e "${YLW}cd ${INSTALL_PATH} && docker compose down --volumes${NON}"
112+
echo -e "or directly: ${YLW}docker volume rm docker-openwisp_postgres_data${NON}"
113+
echo -e "\nAborting to prevent authentication failure." | tee -a "$LOG_FILE"
114+
exit 1
115+
fi
116+
fi
106117
# Dashboard Domain
107118
echo -ne ${GRN}"(1/5) Enter dashboard domain: "${NON}
108119
read dashboard_domain

0 commit comments

Comments
 (0)