Allow constrained pricing health checks to complete

This commit is contained in:
2026-11-15 21:54:21 -05:00
parent a19fab34e3
commit 34f26e6948
15 changed files with 460 additions and 67 deletions
+7 -5
View File
@@ -2,12 +2,14 @@
## Reviewed Jenkins execution, 15 November 2026
PR 24 is merged. The actual [test/secret gate demonstrations](evidence/gates-20261115.md)
PRs 24 and 25 are merged. The actual [test/secret gate demonstrations](evidence/gates-20261115.md)
blocked as intended. [Release attempt 3](evidence/release-attempt-3-20261115.md)
passed scans and published v1, then stopped before any app change at the
Ansible PTY request. The noninteractive SSH correction was verified in
agent-preflight build 3 but awaits source review/merge. No successful promotion,
production approval or recovery has occurred.
published v1 and stopped at the Ansible PTY request. After that correction
merged, [release attempt 4](evidence/release-attempt-4-20261115.md) passed initial
staging checks but its unchanged rerun stopped at Docker's health timeout.
Eight isolated diagnostic probes passed with ten seconds instead of three.
That correction and the separate v2 source/test change await review. No passed
idempotence gate, production approval, promotion or recovery is claimed.
## Preparation evidence — historical baseline
+20 -12
View File
@@ -1,15 +1,23 @@
# Fix noninteractive Ansible deployment over the restricted SSH key
# Fix constrained health checks and add pricing v2
The first reviewed v1 release passed its tests and security gates and published
an image, but stopped during Ansible Gathering Facts: Ansible forced a PTY
that the dedicated deploy key forbids. Set `ansible_ssh_use_tty=false` in the
delivery inventory and extend the administrator preflight to exercise Ansible's
actual SSH/sudo path. Keep the key restriction and pinned host verification.
Pricing build 4 passed tests/scans and deployed v1 staging with correct HTTPS,
source identity and total 30. Its unchanged rerun stopped because Docker's
three-second health deadline was too short for Python startup under the
0.25 CPU cap. Keep the two-second HTTP timeout and all security/resource limits;
extend only Docker's overall health timeout to ten seconds.
Record the actual Jenkins test/secret blocks, passing image scans and publication,
zero-change staging connection failure, and successful connection preflight.
No app deployment or production approval is claimed. Retry v1 after merge;
v2 promotion, both recoveries and monitoring evidence still remain.
An isolated trial of the same reviewed image passed eight consecutive checks
in 2.817–5.660 seconds under identical limits. The temporary container had no
network, published port or proxy alias and was removed afterward. Preserve the
actual failed gate and diagnostic evidence; no production approval is claimed.
Validation: credential-bound Jenkins agent-preflight build 3 passed and returned
root UID 0 through Ansible without a PTY; twelve release-control tests passed.
Also prepare the required v2 source/tests: version v2, unit price 12, total 36.
Keep two commits: first the health fix with v1 source, then the v2 app/test
change. Review both and merge with a merge commit, preserving both SHAs.
Jenkins will release the first commit as v1, then the second as v2, each with
staging/idempotence checks and separate human production approval. Recovery
records will be saved from actual successful builds and reviewed afterward.
Validation: eight constrained diagnostic probes passed; three local functional
tests and twelve control tests passed. Local functional tests used Flask 3.1.3
and Werkzeug 3.1.8; assessed Jenkins runs retain the exact 3.1.9 dependency lock.
+18 -13
View File
@@ -1,7 +1,7 @@
# Secure Delivery and Rollback — Assignment 8
The active application starts with the instructor's Startup Pricing Service
v1 from `Examples.zip`, `Examples/dosSecureDelivery/v1/`. The deployment
The application is adapted from the instructor's Startup Pricing Service
v1 in `Examples.zip`, `Examples/dosSecureDelivery/v1/`. The deployment
starters come from that bundle's `ansible/` directory. The task follows
Chapter 6 of instructor manual version 1.43.
@@ -13,16 +13,19 @@ generated by Jenkins from reviewed source.
Current execution status, 15 November: PR 24 is merged and the delivery job
is enabled. Real Jenkins test/secret demonstrations blocked as intended. The
first v1 image was scanned and published, but staging stopped before any app
change because Ansible requested a PTY forbidden by the deploy key. The
noninteractive inventory correction and expanded, passing Ansible preflight
await review/merge. See [gate evidence](evidence/gates-20261115.md) and
[release attempt 3](evidence/release-attempt-3-20261115.md).
first v1 image was scanned and published, but staging stopped at a PTY request.
PR 25's noninteractive correction is now merged. Build 4 passed initial staging
health/identity/price checks, then the unchanged rerun blocked on the three-second
Docker health deadline. Eight diagnostic probes passed at ten seconds under the
same limits. This health correction and a separate v2 source/test change await
review. See [build 4 and the trial](evidence/release-attempt-4-20261115.md).
Run the tests from `app/` after installing its requirements into the selected
Linux test environment. The expected v1 result for three units is USD 30.
The later v2 source/test change will be a separate reviewed commit and will
return USD 36. The source commit must be baked into each built image.
The prepared v2 source/test change returns USD 36 and must be committed
separately after the v1 health correction. Review both in one PR and use a
merge commit, preserving both SHAs: select the first for v1, then the second
for v2. The source commit must be baked into each built image.
Deployment work uses a dedicated trusted Jenkins agent, immutable images
in the existing Gitea registry, and separate Ansible-managed staging and
@@ -107,13 +110,15 @@ controller's declarative parser checks passed. These are preparation checks;
## Remaining checkpoints
Vincent merged PR #24, including runner migration and HTTPS, after Billy's
latest review. Review/merge the noninteractive Ansible correction before
retrying v1. Create the assignment issue if still absent. Keep main protection.
latest review; PR 25's SSH correction is also merged. Review/merge the health
correction and separate v2 commit before retrying v1. Preserve their history
with a merge commit. Create the assignment issue if still absent. Keep main protection.
Billy added the A
records; Google and Cloudflare now resolve both names to `147.182.178.136`.
On 15 November Caddy's prepared routes were validated and gracefully reloaded;
both names have trusted HTTPS and HTTP redirects. They currently return 502
because the app containers are not deployed. See `evidence/https-20261115.md`.
both names have trusted HTTPS and HTTP redirects. Staging v1 now exists and
passed its first HTTPS checks; production still returns 502. The original TLS
readiness snapshot is `evidence/https-20261115.md`.
The release job is enabled; follow `RUNBOOKS.md` after the corrected source reaches main.
Keep Jenkins and the remote delivery node available. Production approval requires an authorized
human; an agent must not approve unattended.
+15 -4
View File
@@ -4,13 +4,17 @@ These are execution instructions, not completed release evidence.
Current status, 15 November 2026: Billy's DNS records resolve correctly and the
two Caddy routes are active with trusted certificates and HTTP-to-HTTPS redirects.
502 is expected while the app backends are absent. The one-time HTTPS helper
502 is expected for production while its backend is absent. The one-time HTTPS helper
has already run; use the normal validate/reload procedure for later changes.
The reviewed preparation is merged, the release job is enabled, and real
Jenkins test/secret blocks are recorded. Release build 3 published v1 but
stopped at Ansible's PTY request before any app change. Review/merge the
noninteractive inventory correction and retry from the corrected main SHA.
The expanded Ansible/sudo preflight passed; full deployment remains unverified.
stopped at Ansible's PTY request before any app change. PR 25's SSH correction
is merged; build 4 passed initial staging checks, but its unchanged rerun was
blocked by Docker's three-second health timeout. The ten-second diagnostic
passed eight checks under identical limits. Review the health correction and
separate v2 source/test change as two commits in one PR; use a merge commit
to retain both SHAs. Select the first for v1 and the second for v2. Neither
version is approved for production yet.
Monitoring additions and successful releases remain pending.
## Authority and preparation
@@ -61,6 +65,13 @@ procedure. The temporary candidate checks already passed without a reload.
VERSION=v2, UNIT_PRICE=12, expected total=36. Repeat the complete release and
real approval. Preserve v1 images/configuration/records; save v2 records.
The v1 health correction and v2 source/test change may be reviewed together
in one PR while remaining separate commits. Do not squash them: the delivery
job requires both selected source commits to remain ancestors of protected
main. Start with the full v1 health-fix SHA, then use the full v2 SHA only after
v1 production verification. Actual successful records still need review before
rollback. Never substitute a failed attempt's generated record for that evidence.
## Healthy production rollback
Record the detection/decision UTC and reason. Before approval, start the HTTPS
+2 -1
View File
@@ -9,5 +9,6 @@ RUN pip install --no-cache-dir -r requirements.txt \
COPY app.py .
USER 10001:10001
EXPOSE 8000
HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=3 CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=2)"
# Allow Python startup under the 0.25 CPU cap; the HTTP timeout remains 2s.
HEALTHCHECK --interval=10s --timeout=10s --start-period=10s --retries=3 CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=2)"
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "1", "--worker-tmp-dir", "/tmp", "app:app"]
@@ -0,0 +1,133 @@
{
"started": "2026-11-16T02:06:37.133690+00:00",
"image": "git.yebilly.me/ssw590-group1/pricing@sha256:63e2e3d49a5119b1064868b0b15b39a1719a60a632ff0ecdc3f676fcdc55de3b",
"existing_staging_health": {
"Status": "healthy",
"FailingStreak": 0,
"Log": [
{
"Start": "2026-11-16T02:05:39.379167981Z",
"End": "2026-11-16T02:05:42.481797619Z",
"ExitCode": -1,
"Output": "Health check exceeded timeout (3s)"
},
{
"Start": "2026-11-16T02:05:52.483085766Z",
"End": "2026-11-16T02:05:55.560331159Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2026-11-16T02:06:05.56119162Z",
"End": "2026-11-16T02:06:08.689713122Z",
"ExitCode": -1,
"Output": "Health check exceeded timeout (3s)"
},
{
"Start": "2026-11-16T02:06:18.690913613Z",
"End": "2026-11-16T02:06:21.782465826Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2026-11-16T02:06:31.784224739Z",
"End": "2026-11-16T02:06:34.780482181Z",
"ExitCode": 0,
"Output": ""
}
]
},
"existing_staging_memory_events": "low 0\nhigh 0\nmax 29\noom 0\noom_kill 0\noom_group_kill 0",
"candidate_timeout_seconds": 10,
"samples": [
{
"Start": "2026-11-16T02:06:42.778495877Z",
"End": "2026-11-16T02:06:48.438554619Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2026-11-16T02:06:58.439880386Z",
"End": "2026-11-16T02:07:01.623272338Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2026-11-16T02:07:11.624979767Z",
"End": "2026-11-16T02:07:14.734453351Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2026-11-16T02:07:24.735921433Z",
"End": "2026-11-16T02:07:27.640717567Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2026-11-16T02:07:37.641388311Z",
"End": "2026-11-16T02:07:40.639898244Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2026-11-16T02:07:50.64115933Z",
"End": "2026-11-16T02:07:53.824315905Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2026-11-16T02:08:03.825342377Z",
"End": "2026-11-16T02:08:07.523556252Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2026-11-16T02:08:17.525594582Z",
"End": "2026-11-16T02:08:20.342264608Z",
"ExitCode": 0,
"Output": ""
}
],
"final_health": {
"Status": "healthy",
"FailingStreak": 0,
"Log": [
{
"Start": "2026-11-16T02:07:24.735921433Z",
"End": "2026-11-16T02:07:27.640717567Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2026-11-16T02:07:37.641388311Z",
"End": "2026-11-16T02:07:40.639898244Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2026-11-16T02:07:50.64115933Z",
"End": "2026-11-16T02:07:53.824315905Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2026-11-16T02:08:03.825342377Z",
"End": "2026-11-16T02:08:07.523556252Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2026-11-16T02:08:17.525594582Z",
"End": "2026-11-16T02:08:20.342264608Z",
"ExitCode": 0,
"Output": ""
}
]
},
"memory_events": "low 0\nhigh 0\nmax 0\noom 0\noom_kill 0\noom_group_kill 0",
"cpu_stat": "usage_usec 8426586\nuser_usec 6475439\nsystem_usec 1951147\ncore_sched.force_idle_usec 0\nnr_periods 372\nnr_throttled 327\nthrottled_usec 23409965\nnr_bursts 0\nburst_usec 0",
"passed": true,
"completed": "2026-11-16T02:08:24.345181+00:00",
"temporary_container_removed": true
}
@@ -0,0 +1,51 @@
"""Administrator-only diagnostic; never deploys a pricing environment."""
import json
import subprocess
import time
from datetime import datetime, timezone
IMAGE = 'git.yebilly.me/ssw590-group1/pricing@sha256:63e2e3d49a5119b1064868b0b15b39a1719a60a632ff0ecdc3f676fcdc55de3b'
NAME = 'ssw590-pricing-health-trial'
def command(*args):
return subprocess.check_output(args, text=True).strip()
def health(container):
return json.loads(command('docker', 'inspect', '--format', '{{json .State.Health}}', container))
def now():
return datetime.now(timezone.utc).isoformat()
existing = subprocess.run(['docker','container','inspect',NAME],capture_output=True)
assert existing.returncode != 0, 'Existing diagnostic container must be reviewed'
report = {'started':now(), 'image':IMAGE, 'existing_staging_health':health('pricing-staging-app-1'),
'existing_staging_memory_events':command('docker','exec','pricing-staging-app-1','cat','/sys/fs/cgroup/memory.events'),
'candidate_timeout_seconds':10, 'samples':[]}
container = command('docker','run','-d','--pull','never','--name',NAME,
'--network','none','--read-only','--tmpfs','/tmp:size=16m,mode=1777',
'--cap-drop','ALL','--security-opt','no-new-privileges:true','--user','10001:10001',
'--memory','64m','--memory-swap','96m','--cpus','0.25','--pids-limit','64',
'--health-timeout','10s',IMAGE)
assert len(container) == 64 and all(c in '0123456789abcdef' for c in container)
seen = set()
try:
deadline = time.monotonic() + 170
while time.monotonic() < deadline:
state = health(container)
for sample in state.get('Log',[]):
if sample['Start'] not in seen:
seen.add(sample['Start'])
report['samples'].append(sample)
if len(report['samples']) >= 8:
break
time.sleep(5)
report['final_health'] = health(container)
report['memory_events'] = command('docker','exec',container,'cat','/sys/fs/cgroup/memory.events')
report['cpu_stat'] = command('docker','exec',container,'cat','/sys/fs/cgroup/cpu.stat')
report['passed'] = len(report['samples']) >= 8 and all(s['ExitCode'] == 0 for s in report['samples']) and report['final_health']['Status'] == 'healthy'
finally:
subprocess.run(['docker','rm','-f',container],check=True,capture_output=True)
report['completed'] = now()
report['temporary_container_removed'] = True
print(json.dumps(report,indent=2))
assert report['passed'], 'Health trial did not pass'
@@ -0,0 +1,74 @@
# Staging deployment, blocked rerun and health-timeout trial
Client date: 15 November 2026 (Eastern). Execution timestamps below are
16 November UTC. Billy approved PR 25 at 01:46:19 UTC; Vincent merged it at
01:51:04 as `a19fab34e39420811e73f91fcfbb82ee598bd74a`.
[Pricing build 4](https://ci.yebilly.me/job/secure-delivery/job/pricing/4/)
selected that full source/configuration commit. It began 02:00:09.554 UTC,
took 198.101 seconds and finished FAILURE. Twelve control tests, three app
tests, source/dependency gates and both image gates passed. The published image was:
```text
git.yebilly.me/ssw590-group1/pricing@sha256:63e2e3d49a5119b1064868b0b15b39a1719a60a632ff0ecdc3f676fcdc55de3b
```
The noninteractive SSH correction worked. Initial staging deployment ran
02:01:48.628–02:02:58.341 UTC (69.713 seconds) and passed all HTTPS health,
version, source-SHA and quantity=3 total=30 assertions. Its recap was
`ok=10 changed=4 unreachable=0 failed=0`.
The unchanged rerun ran 02:03:01.314–02:03:25.201 UTC (23.887 seconds).
Directory/template checks were unchanged, but Compose stopped because the
existing container was unhealthy: `ok=4 changed=0 unreachable=0 failed=1`.
This is **not** a passed idempotence gate. Jenkins skipped production approval
and deployment. All reports are archived in build 4 and copied to ignored
`build/evidence/assignment8-execution/jenkins-4/`. These records are not
known-good rollback selections in `delivery/releases/`.
## Diagnosis
Docker reported `Health check exceeded timeout (3s)`. Its recorded probe
durations were near three seconds, including successful probes. The staging
container later recovered without a restart; an HTTPS health request returned
`{"status":"ok","version":"v1"}`. Gunicorn remained running. The observed
container had no OOM kill, about 48.56 MiB usage against 64 MiB, and memory-limit
events without OOM events. CPU quota is 0.25. This supports a probe deadline
problem under these constraints; it does not establish that every later health
failure has that cause.
## Bounded diagnostic of the correction
At 02:06:37–02:08:24 UTC a temporary container ran the **same reviewed image**
with the same UID, read-only filesystem, capability restrictions, 64/96 MiB
RAM/RAM+swap, 0.25 CPU and 64 PID cap. It had no Docker network, published port,
proxy alias, deployment directory or app data volume. Only Docker's overall
health timeout was overridden to ten seconds. The HTTP request timeout remained
two seconds. Existing staging and shared services were unchanged.
Eight consecutive probes passed, taking 5.660, 3.183, 3.109, 2.905, 2.999,
3.183, 3.698 and 2.817 seconds. The final state was healthy; memory events
showed no limit hit or OOM. CPU throttling was observed. The temporary container
was removed by its exact newly created ID in a finally block. The
[exact diagnostic script](health-timeout-trial-20261115.py) and
[raw JSON](health-timeout-trial-20261115.json) preserve the experiment.
The Dockerfile correction changes only the overall health-check timeout from
three to ten seconds. It keeps the endpoint, request timeout, retry count,
cadence, startup period and all resource/security limits. It still needs review
and a successful assessed release; this diagnostic did not deploy production.
## v1 and v2 review sequence
The branch also prepares the required v2 source/test change: VERSION=v2,
UNIT_PRICE=12, quantity 3 total=36. Three local functional tests and twelve
control tests passed. The Windows functional environment used Flask 3.1.3 and
Werkzeug 3.1.8; deployment remains locked to Werkzeug 3.1.9 and must pass the
real Jenkins gates. Docker Desktop was not running; the remote runners remain
independent of it.
Keep two commits: first the health fix with v1 source, then the v2 app/test
change. Review both in one PR and merge with a merge commit, preserving their
SHAs. Run v1 with the first reviewed commit and v2 with the second; each still
requires staging/idempotence and real human production approval. Save and
review the actual successful release records before either recovery exercise.