This commit enhances the Docker diagnostics system with comprehensive
Swarm-specific health checks to ensure the application is properly
deployed in a Docker Swarm/CapRover environment.
Changes:
- Add check_swarm_status() function to verify Docker Swarm configuration
- Checks if Docker is running in Swarm mode
- Retrieves and logs Swarm node information (hostname, role, state)
- Detects if container is running as a Swarm service task
- Provides clear diagnostic messages for troubleshooting
- Integrate Swarm checks into application startup (app.py)
- Runs after Docker connection is verified
- Logs success for production Swarm deployments
- Warns (but doesn't fail) for local development environments
- Add comprehensive test coverage (8 new tests)
- Tests for active/inactive Swarm states
- Tests for error handling and edge cases
- Tests for node retrieval and hostname detection
- Maintains 99% overall code coverage (128 tests passing)
This ensures that Docker Swarm-related issues are caught early during
deployment and provides clear diagnostic information for troubleshooting
CapRover deployments with Docker socket mounting.
https://claude.ai/code/session_01RRUv2BWJ76L24VyY6Fi2bh