Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add notification script that's printed after all services are started (#1098)

Leendert de Borst73600a49f888
diff --git a/dockerfiles/all-in-one/Dockerfile.server.allinone b/dockerfiles/all-in-one/Dockerfile.server.allinone
index 580c6d25a..1c0a27ec7 100644
--- a/dockerfiles/all-in-one/Dockerfile.server.allinone
+++ b/dockerfiles/all-in-one/Dockerfile.server.allinone
@@ -137,7 +137,8 @@ RUN mkdir -p /etc/s6-overlay/s6-rc.d/user/contents.d && \
touch /etc/s6-overlay/s6-rc.d/user/contents.d/admin && \
touch /etc/s6-overlay/s6-rc.d/user/contents.d/smtp && \
touch /etc/s6-overlay/s6-rc.d/user/contents.d/taskrunner && \
- touch /etc/s6-overlay/s6-rc.d/user/contents.d/nginx
+ touch /etc/s6-overlay/s6-rc.d/user/contents.d/nginx && \
+ touch /etc/s6-overlay/s6-rc.d/user/contents.d/notification
# Set environment variables for s6-overlay
# ALIASVAULT_VERBOSITY: 0=minimal (default), 1=normal, 2=verbose
diff --git a/dockerfiles/all-in-one/s6-scripts/init/script b/dockerfiles/all-in-one/s6-scripts/init/script
index 9910fe03a..cb799e434 100644
--- a/dockerfiles/all-in-one/s6-scripts/init/script
+++ b/dockerfiles/all-in-one/s6-scripts/init/script
@@ -67,8 +67,14 @@ if [ ! -f /secrets/admin_password_hash ]; then
# Generate a random admin password if not provided
if [ -z "$ADMIN_PASSWORD" ]; then
ADMIN_PASSWORD=$(openssl rand -base64 16 | tr -d "\n")
- echo "[init] ⚠️ Generated random admin password: $ADMIN_PASSWORD"
- echo "[init] ⚠️ Please save this password securely and/or optionally change it after first login!"
+ # Only show password in verbose mode during init
+ if [ "$VERBOSITY" -ge 2 ]; then
+ echo "[init] ⚠️ Generated random admin password: $ADMIN_PASSWORD"
+ echo "[init] ⚠️ Please save this password securely and/or optionally change it after first login!"
+ fi
+ # Save the password temporarily for the final notification (only if newly generated)
+ echo "$ADMIN_PASSWORD" > /secrets/admin_password_temp
+ chmod 600 /secrets/admin_password_temp
fi
# Use the InstallCLI to hash the password and append generation timestamp
if [ "$VERBOSITY" -ge 2 ]; then
@@ -192,7 +198,7 @@ else
fi
echo ""
-echo "[init] Waiting for all services to be ready... this can take up to 2 minutes..."
+echo "[init] Waiting for all services to be ready... this can take a short while..."
echo ""
# Oneshot service exits successfully, dependencies can now start
\ No newline at end of file
diff --git a/dockerfiles/all-in-one/s6-scripts/nginx/run b/dockerfiles/all-in-one/s6-scripts/nginx/run
index d8e6e365e..135acc2cb 100644
--- a/dockerfiles/all-in-one/s6-scripts/nginx/run
+++ b/dockerfiles/all-in-one/s6-scripts/nginx/run
@@ -38,25 +38,7 @@ for i in {1..60}; do
sleep 1
done
-echo "Starting main reverse proxy server..."
-echo ""
-echo "[nginx] ========================================="
-echo "[nginx] AliasVault is now ready and accessible!"
-echo "[nginx] ========================================="
-echo "[nginx]"
-echo "[nginx] 🌐 Web Access:"
-echo "[nginx] • HTTPS: https://localhost:443 (or your custom mapped port)"
-echo "[nginx] • Admin: https://localhost:443/admin (or your custom mapped port)"
-echo "[nginx]"
-echo "[nginx] 🔑 Admin Password:"
-echo "[nginx] • The admin password is stored in the /secrets/admin_password_hash file"
-echo "[nginx] • To reset the admin password, delete the file and restart the container"
-echo "[nginx] • The password is also displayed in the admin panel after first login"
-echo "[nginx]"
-echo "[nginx] 📧 Email Ports (if email server enabled):"
-echo "[nginx] • SMTP: port 25 (or your custom mapped port)"
-echo "[nginx] • SMTP TLS: port 587 (or your custom mapped port)"
-echo "[nginx]"
+echo "Starting Nginx reverse proxy..."
# Set nginx error log level based on verbosity
if [ "$VERBOSITY" -ge 2 ]; then
diff --git a/dockerfiles/all-in-one/s6-scripts/notification/dependencies.d/nginx b/dockerfiles/all-in-one/s6-scripts/notification/dependencies.d/nginx
new file mode 100644
index 000000000..e69de29bb
diff --git a/dockerfiles/all-in-one/s6-scripts/notification/run b/dockerfiles/all-in-one/s6-scripts/notification/run
new file mode 100755
index 000000000..51ceaf18f
--- /dev/null
+++ b/dockerfiles/all-in-one/s6-scripts/notification/run
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+# Get verbosity level (0=minimal, 1=normal, 2=verbose)
+VERBOSITY="${ALIASVAULT_VERBOSITY:-0}"
+
+# Only show the final message at verbosity level 0 and 1 (not verbose)
+if [ "$VERBOSITY" -le 1 ]; then
+ # Wait for all service ports to be responsive with timeout
+ READY=false
+ for i in $(seq 1 180); do # 3 minute timeout
+ if nc -z localhost 3000 && nc -z localhost 3001 && nc -z localhost 3002 && nc -z localhost 80 && nc -z localhost 443; then
+ READY=true
+ break
+ fi
+ if [ $i -eq 180 ]; then
+ echo "[notification] Warning: Timeout waiting for all services (180s), showing status anyway..."
+ break
+ fi
+ sleep 1
+ done
+
+ # If services are ready, show the message
+ if [ "$READY" = true ]; then
+ echo ""
+ echo "========================================="
+ echo "🎉 AliasVault is now ready and accessible!"
+ echo "========================================="
+ echo ""
+ echo "🌐 Web Access:"
+ echo " • HTTP: http://localhost:80"
+ echo " • HTTPS: https://localhost:443"
+ echo " • Admin: https://localhost:443/admin"
+ echo ""
+
+ # Show admin credentials if available
+ if [ -f /secrets/admin_password_temp ]; then
+ ADMIN_PASSWORD=$(cat /secrets/admin_password_temp)
+ echo "🔑 Admin Login:"
+ echo " • Username: admin"
+ echo " • Password: ${ADMIN_PASSWORD}"
+ echo ""
+ echo "⚠️ IMPORTANT: Save these credentials securely!"
+ echo " This password won't be shown again."
+ echo ""
+ # Clean up the temporary password file
+ rm -f /secrets/admin_password_temp
+ else
+ echo "🔑 Admin Login:"
+ echo " • Username: admin"
+ echo " • Password: (previously set - to reset the admin password, delete the file ./secrets/admin_password_hash and restart the container)"
+ echo ""
+ fi
+
+ echo "📧 Email Ports (if email server enabled):"
+ echo " • SMTP: port 25"
+ echo " • SMTP TLS: port 587"
+ echo ""
+ fi
+fi
+
+# Sleep forever to keep this as a longrun service
+exec sleep infinity
\ No newline at end of file
diff --git a/dockerfiles/all-in-one/s6-scripts/notification/type b/dockerfiles/all-in-one/s6-scripts/notification/type
new file mode 100644
index 000000000..1780f9f44
--- /dev/null
+++ b/dockerfiles/all-in-one/s6-scripts/notification/type
@@ -0,0 +1 @@
+longrun
\ No newline at end of file