Skip to content

Commit e05acc2

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 e05acc2

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

deploy/auto-install.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,20 @@ 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" ]]; then
107+
if docker volume inspect "docker-openwisp_postgres_data" &>/dev/null; then
108+
{
109+
echo -e "${RED}CRITICAL: Existing database data detected!${NON}"
110+
echo -e "New credentials will break your connection to existing volumes."
111+
echo -e "\nTo fix, either restore your .env or run:"
112+
echo -e "${YLW}cd ${INSTALL_PATH} && docker compose down --volumes${NON}"
113+
echo -e "or directly: ${YLW}docker volume rm docker-openwisp_postgres_data${NON}"
114+
echo -e "\nAborting to prevent authentication failure."
115+
echo -e "${RED}Check logs at $LOG_FILE${NON}"
116+
} | tee -a "$LOG_FILE"
117+
exit 1
118+
fi
119+
fi
106120
# Dashboard Domain
107121
echo -ne ${GRN}"(1/5) Enter dashboard domain: "${NON}
108122
read dashboard_domain

0 commit comments

Comments
 (0)