feat: verify production runtime integrity
This commit is contained in:
@@ -154,6 +154,46 @@ for service in "${required_services[@]}"; do
|
||||
fi
|
||||
done
|
||||
|
||||
application_environments=()
|
||||
application_environment_missing=false
|
||||
for application_service in api callbacks worker; do
|
||||
application_container=$("${compose[@]}" ps -q "$application_service")
|
||||
if [[ -z "$application_container" ]]; then
|
||||
application_environment_missing=true
|
||||
continue
|
||||
fi
|
||||
application_environment=$(docker inspect -f '{{range .Config.Env}}{{println .}}{{end}}' "$application_container" | sed -n 's/^APP_ENV=//p' | head -n1)
|
||||
if [[ -z "$application_environment" ]]; then
|
||||
application_environment_missing=true
|
||||
else
|
||||
application_environments+=("$application_environment")
|
||||
fi
|
||||
done
|
||||
if [[ "$application_environment_missing" == true || ${#application_environments[@]} -ne 3 ]]; then
|
||||
record_check application_environment critical missing
|
||||
elif [[ "${application_environments[0]}" != "${application_environments[1]}" || "${application_environments[0]}" != "${application_environments[2]}" ]]; then
|
||||
record_check application_environment critical mixed
|
||||
elif [[ "$deployment_profile" == production && "${application_environments[0]}" != prod ]]; then
|
||||
record_check application_environment critical "${application_environments[0]}"
|
||||
elif [[ "$deployment_profile" == demo && "${application_environments[0]}" != local ]]; then
|
||||
record_check application_environment critical "${application_environments[0]}"
|
||||
else
|
||||
record_check application_environment healthy "${application_environments[0]}"
|
||||
fi
|
||||
|
||||
keycloak_container=$("${compose[@]}" ps -q keycloak)
|
||||
if [[ -z "$keycloak_container" ]]; then
|
||||
record_check identity_service_mode critical missing
|
||||
elif docker inspect -f '{{json .Config.Cmd}}' "$keycloak_container" | grep -q 'start-dev'; then
|
||||
if [[ "$deployment_profile" == production ]]; then
|
||||
record_check identity_service_mode critical development
|
||||
else
|
||||
record_check identity_service_mode healthy development
|
||||
fi
|
||||
else
|
||||
record_check identity_service_mode healthy hardened
|
||||
fi
|
||||
|
||||
mock_services_running=()
|
||||
for mock_service in mock-provider mock-alert-receiver; do
|
||||
mock_container=$("${compose[@]}" ps -q "$mock_service")
|
||||
|
||||
Reference in New Issue
Block a user