Improve nginx status page (#1098)
This commit is contained in:
committed by
Leendert de Borst
parent
b861a30596
commit
990d94397b
@@ -6,15 +6,15 @@ http {
|
||||
client_max_body_size 25M;
|
||||
|
||||
upstream client {
|
||||
server client:3000;
|
||||
server client:3000 max_fails=1 fail_timeout=5s;
|
||||
}
|
||||
|
||||
upstream api {
|
||||
server api:3001;
|
||||
server api:3001 max_fails=1 fail_timeout=5s;
|
||||
}
|
||||
|
||||
upstream admin {
|
||||
server admin:3002;
|
||||
server admin:3002 max_fails=1 fail_timeout=5s;
|
||||
}
|
||||
|
||||
# Preserve any existing X-Forwarded-* headers, this is relevant if AliasVault
|
||||
@@ -80,6 +80,9 @@ http {
|
||||
location = /status.html {
|
||||
internal;
|
||||
try_files /status.html =404;
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
add_header Pragma "no-cache";
|
||||
add_header Expires "0";
|
||||
}
|
||||
|
||||
# Admin interface
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
</div>
|
||||
|
||||
<p class="status-message">
|
||||
AliasVault is temporarily unavailable. The service may be undergoing maintenance or starting up. Please try again later.
|
||||
AliasVault is temporarily unavailable. The service may be undergoing maintenance or starting up. Please try again by refreshing the page.
|
||||
</p>
|
||||
|
||||
<div class="info-box">
|
||||
@@ -107,12 +107,5 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Auto-refresh every 3 seconds to check if services are back
|
||||
setInterval(function() {
|
||||
window.location.reload();
|
||||
}, 3000);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -27,7 +27,6 @@ for i in {1..30}; do
|
||||
sleep 2
|
||||
done
|
||||
|
||||
export ConnectionStrings__AliasServerDbContext="Host=localhost;Database=aliasvault;Username=aliasvault;Password=$POSTGRES_PASSWORD"
|
||||
export PRIVATE_EMAIL_DOMAINS="${PRIVATE_EMAIL_DOMAINS:-}"
|
||||
export SMTP_TLS_ENABLED="${SMTP_TLS_ENABLED:-false}"
|
||||
|
||||
|
||||
+80
-2
@@ -1467,6 +1467,70 @@ print_install_success_message() {
|
||||
printf " ${CYAN}Client Website:${NC} https://localhost/\n"
|
||||
}
|
||||
|
||||
# Function to check if AliasVault is responding on configured ports
|
||||
check_aliasvault_health() {
|
||||
printf "${CYAN}ℹ Verifying AliasVault is responding...${NC} "
|
||||
|
||||
local ports_config
|
||||
ports_config=$(get_port_config)
|
||||
read -r http_port https_port smtp_port <<< "$ports_config"
|
||||
|
||||
local max_attempts=30
|
||||
local attempt=1
|
||||
local spinstr='|/-\\'
|
||||
local i=0
|
||||
local all_healthy=false
|
||||
|
||||
while [ $attempt -le $max_attempts ]; do
|
||||
printf "\b%c" "${spinstr:$i:1}"
|
||||
((i = (i + 1) % 4))
|
||||
|
||||
local http_ok=false
|
||||
local https_ok=false
|
||||
|
||||
# Check HTTP port (should redirect to HTTPS)
|
||||
if curl -s -o /dev/null -w "%{http_code}" "http://localhost:$http_port" 2>/dev/null | grep -q "301"; then
|
||||
http_ok=true
|
||||
fi
|
||||
|
||||
# Check HTTPS port (should return status page or main app)
|
||||
local https_status
|
||||
https_status=$(curl -s -k -o /dev/null -w "%{http_code}" "https://localhost:$https_port" 2>/dev/null)
|
||||
if [ "$https_status" = "200" ] || [ "$https_status" = "503" ]; then
|
||||
https_ok=true
|
||||
fi
|
||||
|
||||
if [ "$http_ok" = true ] && [ "$https_ok" = true ]; then
|
||||
all_healthy=true
|
||||
break
|
||||
fi
|
||||
|
||||
sleep 2
|
||||
((attempt++))
|
||||
done
|
||||
|
||||
if [ "$all_healthy" = true ]; then
|
||||
printf "\b ${GREEN}✓${NC}\n"
|
||||
printf " ${GREEN}✓ AliasVault is responding on HTTP:$http_port and HTTPS:$https_port${NC}\n"
|
||||
return 0
|
||||
else
|
||||
printf "\b ${RED}✗${NC}\n"
|
||||
printf "\n${RED}❌ Health Check Failed${NC}\n"
|
||||
printf "AliasVault containers started but the service is not responding properly.\n"
|
||||
printf "\n"
|
||||
printf "${YELLOW}Troubleshooting steps:${NC}\n"
|
||||
printf "1. Check container status: ${DIM}docker compose ps${NC}\n"
|
||||
printf "2. Check container logs: ${DIM}docker compose logs${NC}\n"
|
||||
printf "3. Verify ports are not blocked by firewall\n"
|
||||
printf "4. Wait a few more minutes for services to fully initialize\n"
|
||||
printf "\n"
|
||||
printf "You can manually check if AliasVault is working by visiting:\n"
|
||||
printf " ${CYAN}https://localhost:$https_port${NC}\n"
|
||||
printf "\n"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to recreate (restart) Docker containers
|
||||
recreate_docker_containers() {
|
||||
printf "${CYAN}ℹ (Re)creating Docker containers...${NC}\n"
|
||||
@@ -1712,7 +1776,14 @@ handle_build() {
|
||||
|
||||
printf "${GREEN}✓ Docker Compose stack started successfully${NC}\n"
|
||||
|
||||
# Only show success message if we made it here without errors
|
||||
# Check if AliasVault is actually responding before showing success
|
||||
if ! check_aliasvault_health; then
|
||||
printf "${YELLOW}Installation completed but AliasVault health check failed.${NC}\n"
|
||||
printf "${YELLOW}Please check the troubleshooting steps above.${NC}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Only show success message if we made it here without errors and health check passed
|
||||
print_install_success_message
|
||||
}
|
||||
|
||||
@@ -2464,7 +2535,14 @@ handle_install_version() {
|
||||
fi
|
||||
printf "${GREEN}✓ Docker containers started successfully${NC}\n"
|
||||
|
||||
# Only show success message if we made it here without errors
|
||||
# Check if AliasVault is actually responding before showing success
|
||||
if ! check_aliasvault_health; then
|
||||
printf "${YELLOW}Installation completed but AliasVault health check failed.${NC}\n"
|
||||
printf "${YELLOW}Please check the troubleshooting steps above.${NC}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Only show success message if we made it here without errors and health check passed
|
||||
print_install_success_message
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user