@@ -874,40 +874,81 @@ validate_deployment() {
874874 vm_exec " ${vm_ip} " "
875875 echo '=== Testing Application Endpoints ==='
876876
877- # Test global health check endpoint (through nginx proxy)
877+ # Test HTTP health check endpoint (through nginx proxy)
878+ echo 'Testing HTTP health check endpoint...'
878879 if curl -f -s http://localhost/health_check >/dev/null 2>&1; then
879- echo '✅ Global health check endpoint: OK'
880+ echo '✅ HTTP health check endpoint: OK'
880881 else
881- echo '❌ Global health check endpoint: FAILED'
882+ echo '❌ HTTP health check endpoint: FAILED'
882883 exit 1
883884 fi
884885
885- # Test API stats endpoint (through nginx proxy, requires auth)
886+ # Test HTTPS health check endpoint (through nginx proxy, with self-signed certificates)
887+ echo 'Testing HTTPS health check endpoint...'
888+ if curl -f -s -k https://localhost/health_check >/dev/null 2>&1; then
889+ echo '✅ HTTPS health check endpoint: OK (self-signed certificate)'
890+ else
891+ echo '❌ HTTPS health check endpoint: FAILED'
892+ # Don't exit on HTTPS failure in case certificates aren't ready yet
893+ echo '⚠️ HTTPS may not be fully configured yet, continuing with HTTP tests'
894+ fi
895+
896+ # Test HTTP API stats endpoint (through nginx proxy, requires auth)
897+ echo 'Testing HTTP API stats endpoint...'
886898 # Save response to temp file and get HTTP status code
887899 api_http_code=\$ (curl -s -o /tmp/api_response.json -w '%{http_code}' \" http://localhost/api/v1/stats?token=MyAccessToken\" 2>&1 || echo \" 000\" )
888900 api_response_body=\$ (cat /tmp/api_response.json 2>/dev/null || echo \" No response\" )
889901
890902 # Check if HTTP status is 200 (success)
891903 if [ \"\$ api_http_code\" -eq 200 ] 2>/dev/null; then
892- echo '✅ API stats endpoint: OK'
904+ echo '✅ HTTP API stats endpoint: OK'
893905 else
894- echo '❌ API stats endpoint: FAILED'
906+ echo '❌ HTTP API stats endpoint: FAILED'
895907 echo \" HTTP Code: \$ api_http_code\"
896908 echo \" Response: \$ api_response_body\"
897909 rm -f /tmp/api_response.json
898910 exit 1
899911 fi
900912 rm -f /tmp/api_response.json
901913
914+ # Test HTTPS API stats endpoint (through nginx proxy, with self-signed certificates)
915+ echo 'Testing HTTPS API stats endpoint...'
916+ # Save response to temp file and get HTTP status code
917+ api_https_code=\$ (curl -s -k -o /tmp/api_response_https.json -w '%{http_code}' \" https://localhost/api/v1/stats?token=MyAccessToken\" 2>&1 || echo \" 000\" )
918+ api_https_response=\$ (cat /tmp/api_response_https.json 2>/dev/null || echo \" No response\" )
919+
920+ # Check if HTTPS status is 200 (success)
921+ if [ \"\$ api_https_code\" -eq 200 ] 2>/dev/null; then
922+ echo '✅ HTTPS API stats endpoint: OK (self-signed certificate)'
923+ else
924+ echo '⚠️ HTTPS API stats endpoint: FAILED'
925+ echo \" HTTPS Code: \$ api_https_code\"
926+ echo \" Response: \$ api_https_response\"
927+ # Don't exit on HTTPS failure in case certificates aren't ready yet
928+ echo '⚠️ HTTPS may not be fully configured yet, continuing with HTTP validation'
929+ fi
930+ rm -f /tmp/api_response_https.json
931+
902932 # Test HTTP tracker endpoint (through nginx proxy - expects 404 for root)
933+ echo 'Testing HTTP tracker endpoint...'
903934 if curl -s -w '%{http_code}' http://localhost/ -o /dev/null | grep -q '404'; then
904935 echo '✅ HTTP tracker endpoint: OK (nginx proxy responding, tracker ready for BitTorrent clients)'
905936 else
906937 echo '❌ HTTP tracker endpoint: FAILED'
907938 exit 1
908939 fi
909940
910- echo '✅ All endpoints are responding'
941+ # Test HTTPS tracker endpoint (through nginx proxy - expects 404 for root)
942+ echo 'Testing HTTPS tracker endpoint...'
943+ if curl -s -k -w '%{http_code}' https://localhost/ -o /dev/null | grep -q '404'; then
944+ echo '✅ HTTPS tracker endpoint: OK (nginx proxy with SSL responding, tracker ready for secure BitTorrent clients)'
945+ else
946+ echo '⚠️ HTTPS tracker endpoint: FAILED'
947+ # Don't exit on HTTPS failure in case certificates aren't ready yet
948+ echo '⚠️ HTTPS may not be fully configured yet, HTTP tracker is working'
949+ fi
950+
951+ echo '✅ All critical endpoints are responding (HTTP validated, HTTPS optional)'
911952 " " Testing application endpoints"
912953
913954 log_success " Deployment validation passed"
@@ -924,15 +965,21 @@ show_connection_info() {
924965 echo " SSH Access: ssh torrust@${vm_ip} "
925966 echo
926967 echo " === APPLICATION ENDPOINTS ==="
927- echo " Health Check: http://${vm_ip} /health_check" # DevSkim: ignore DS137138
928- echo " API Stats: http://${vm_ip} /api/v1/stats?token=MyAccessToken" # DevSkim: ignore DS137138
929- echo " HTTP Tracker: http://${vm_ip} / (for BitTorrent clients)" # DevSkim: ignore DS137138
930- echo " UDP Tracker: udp://${vm_ip} :6868, udp://${vm_ip} :6969"
931- echo " Grafana: http://${vm_ip} :3100 (admin/admin)" # DevSkim: ignore DS137138
968+ echo " HTTP Health Check: http://${vm_ip} /health_check" # DevSkim: ignore DS137138
969+ echo " HTTP API Stats: http://${vm_ip} /api/v1/stats?token=MyAccessToken" # DevSkim: ignore DS137138
970+ echo " HTTP Tracker: http://${vm_ip} / (for BitTorrent clients)" # DevSkim: ignore DS137138
971+ echo " UDP Tracker: udp://${vm_ip} :6868, udp://${vm_ip} :6969"
972+ echo " Grafana HTTP : http://${vm_ip} :3100 (admin/admin)" # DevSkim: ignore DS137138
932973 echo
933974 echo " === HTTPS ENDPOINTS (with self-signed certificates) ==="
934- echo " Tracker API: https://tracker.test.local (add to /etc/hosts)"
935- echo " Grafana: https://grafana.test.local (add to /etc/hosts)"
975+ echo " HTTPS Health Check: https://${vm_ip} /health_check (expect certificate warning)" # DevSkim: ignore DS137138
976+ echo " HTTPS API Stats: https://${vm_ip} /api/v1/stats?token=MyAccessToken (expect certificate warning)" # DevSkim: ignore DS137138
977+ echo " HTTPS Tracker: https://${vm_ip} / (expect certificate warning)" # DevSkim: ignore DS137138
978+ echo " Grafana HTTPS: https://${vm_ip} :3100 (expect certificate warning)" # DevSkim: ignore DS137138
979+ echo
980+ echo " === DOMAIN-BASED HTTPS (add to /etc/hosts for testing) ==="
981+ echo " Tracker API: https://tracker.test.local (requires hosts entry)"
982+ echo " Grafana: https://grafana.test.local (requires hosts entry)"
936983 echo
937984 echo " === SETUP FOR HTTPS TESTING ==="
938985 echo " Add these lines to your /etc/hosts file:"
0 commit comments