NUWCDIVNPT / stig-manager

An API and client for managing STIG assessments
Other
112 stars 29 forks source link

feat: early listening; 503 status; healthcheck uses `/api/op/definition` #1274

Closed csmig closed 4 months ago

csmig commented 5 months ago

This PR refactors the API bootstrap code so we start listening on STIGMAN_API_PORT before any database migrations are started. The goal is to discourage container orchestration platforms from declaring our container unhealthy during a long-running migration, which has lead to container shutdowns and incomplete migrations.

The refactored code:

csmig commented 5 months ago

Appears the GitHub runner using ubuntu-latest has an older version of docker which does not support --start-interval in the HEALTHCHECK. Will need to remove that.

Related question: should we even include an explicit HEALTHCHECK in our Dockerfile? I did so because I thought DISA guidance required it. But that document refers to liveness and readiness probes, which are k8s concepts not Docker. And I notice few major projects incorporate HEALTHCHECK into their published containers, neither MySQL nor Keycloak for example.

sonarcloud[bot] commented 4 months ago

Quality Gate Passed Quality Gate passed for 'nuwcdivnpt_stig-manager-api'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
65.6% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud