Author SHA1 Message Date
Sbhayana f976f56765 Merge pull request 'Allow v3 release in Ansible deploy validation (refs #25)' (#27) from fix/allow-v3-deploy into main
continuous-integration/jenkins Jenkins: all gates passed
Reviewed-on: #27
2026-12-01 20:15:43 +00:00
Sbhayana 9cc9ede5d8 Allow v3 release in Ansible deploy validation (refs #25) 2026-12-01 20:15:20 +00:00
Sbhayana d3cdee8f1f Merge pull request 'Bulk discount for 10+ units (Closes #25)' (#26) from fix/bulk-discount-25 into main
continuous-integration/jenkins Jenkins: a gate failed or approval was not given
Reviewed-on: #26
2026-12-01 20:08:30 +00:00
Sbhayana b0a3fb04da Apply 10% bulk discount for 10+ units; release v3 / 1.3 (closes #25)
continuous-integration/jenkins Jenkins: all gates passed
2026-12-01 19:34:47 +00:00
Sbhayana a160b84da6 Merge pull request 'Pipeline: semantic version major.minor.build, Pyreverse diagrams + LaTeX release notes, versioned ZIP artifact' (#24) from feature/demo-pipeline into main
Reviewed-on: #24
2026-12-01 15:44:27 +00:00
Sbhayana 177b0675a7 Pipeline: semantic version major.minor.build, Pyreverse diagrams + LaTeX release notes, versioned ZIP artifact
continuous-integration/jenkins Jenkins: all gates passed
2026-12-01 15:36:00 +00:00
Sbhayana 3f9d481750 Merge pull request 'Zammad support desk config + support.ssw590 HTTPS probe (closes #22)' (#23) from feature/zammad-support into main
Reviewed-on: #23
2026-11-30 20:57:53 +00:00
Sbhayana 39634fc404 Dockerfile: keep zlib1g comment together (refs #22)
continuous-integration/jenkins Jenkins: all gates passed
2026-11-30 20:53:27 +00:00
Sbhayana bb395aed23 Pricing image: fix libzstd1 CVE-2026-124851; dated exceptions for OpenSSL QUIC CVEs (refs #22) 2026-11-30 20:52:37 +00:00
Sbhayana fca706c9bb Add Zammad support desk config and support.ssw590 HTTPS probe (closes #22)
continuous-integration/jenkins Jenkins: a gate failed or approval was not given
2026-11-30 20:19:11 +00:00
Sbhayana e0c02eefe3 Merge pull request 'Revert "Failure drill: bind Gunicorn to 8001 in staging only, healthcheck still probes 8000 (refs #16)"' (#21) from drill/restore-staging into main
continuous-integration/jenkins Jenkins: all gates passed
Reviewed-on: #21
2026-11-12 21:11:33 +00:00
Sbhayana 5c663fe237 Revert "Failure drill: bind Gunicorn to 8001 in staging only, healthcheck still probes 8000 (refs #16)"
continuous-integration/jenkins Jenkins: all gates passed
This reverts commit c81879f4f2.
2026-11-12 16:09:32 -05:00
Sbhayana 3c56d87896 Merge pull request 'Failure drill: bind Gunicorn to 8001 in staging only, healthcheck still probes 8000 (refs #16)' (#20) from drill/staging-bad-port into main
continuous-integration/jenkins Jenkins: a gate failed or approval was not given
Reviewed-on: #20
2026-11-12 21:04:57 +00:00
Sbhayana c81879f4f2 Failure drill: bind Gunicorn to 8001 in staging only, healthcheck still probes 8000 (refs #16)
continuous-integration/jenkins Jenkins: all gates passed
2026-11-12 15:58:36 -05:00
Sbhayana 2c76722b04 Merge pull request 'Immutable releases: fix v1 record after tag overwrite, add v2 records (refs #16)' (#19) from fix/immutable-releases into main
continuous-integration/jenkins Jenkins: all gates passed
Reviewed-on: #19
2026-11-12 20:51:36 +00:00
Sbhayana c83174f2c2 Point v1 records at surviving v1 digest, add v2 records, refuse to overwrite published tags (refs #16)
continuous-integration/jenkins Jenkins: all gates passed
2026-11-12 15:46:04 -05:00
Sbhayana 0465bde401 Merge pull request 'Pricing service v2 and v1 release records (refs #16)' (#18) from feature/pricing-v2 into main
continuous-integration/jenkins Jenkins: a gate failed or approval was not given
Reviewed-on: #18
2026-11-12 19:29:37 +00:00
Sbhayana c815e53fc2 Release v2: unit price USD 12, starter v2 source and tests (refs #16)
continuous-integration/jenkins Jenkins: all gates passed
2026-11-12 14:16:51 -05:00
Sbhayana 615fcb396a Record v1 release (Jenkins #7, digest 3c0d12eb) for staging and production (refs #16) 2026-11-12 14:16:51 -05:00
Sbhayana d4c012560d Merge pull request 'Pricing service v1 with secure delivery pipeline (refs #16)' (#17) from feature/pricing-delivery into main
continuous-integration/jenkins Jenkins: a gate failed or approval was not given
Reviewed-on: #17
2026-11-12 18:35:15 +00:00
Sbhayana e15f3eaf6f Revert "Synthetic secret fixture to demonstrate the secret-scan gate (refs #16)"
continuous-integration/jenkins Jenkins: all gates passed
This reverts commit afddb17de3.
2026-11-12 13:30:52 -05:00
Sbhayana afddb17de3 Synthetic secret fixture to demonstrate the secret-scan gate (refs #16)
continuous-integration/jenkins Jenkins: a gate failed or approval was not given
2026-11-12 13:26:22 -05:00
Sbhayana f373cc0532 Revert "Controlled failing test to demonstrate the unit-test gate (refs #16)"
This reverts commit 80b77d70e1.
2026-11-12 13:25:57 -05:00
Sbhayana 80b77d70e1 Controlled failing test to demonstrate the unit-test gate (refs #16)
continuous-integration/jenkins Jenkins: a gate failed or approval was not given
2026-11-12 13:22:49 -05:00
Sbhayana e69ac37974 Harden pricing image (zlib fix, drop pip) and add time-limited Trivy exceptions after build #1 triage (refs #16) 2026-11-12 13:05:08 -05:00
Sbhayana 12621dadde Add pricing service v1, Ansible deployment and delivery pipeline (refs #16) 2026-11-12 12:50:12 -05:00
Sbhayana 517af910d9 Merge pull request 'Add Prometheus/Grafana monitoring (closes #11)' (#12) from feature/monitoring into main
Reviewed-on: #12
2026-11-01 05:59:06 +00:00
Sbhayana 22d631410f Add Prometheus/Grafana monitoring stack, dashboard, alert rules and runbook (refs #11) 2026-11-01 05:50:09 +00:00
46 changed files with 2210 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
PROMETHEUS_TAG=v3.15.1
GRAFANA_TAG=13.3.0
NODE_EXPORTER_TAG=v1.12.1
BLACKBOX_TAG=v0.29.1
+26
View File
@@ -0,0 +1,26 @@
# Monitoring (Prometheus + Grafana) for the SSW590 droplet
Deployed at `/opt/startup/monitoring` with `docker compose up -d`.
| Container | Image (pinned) | Port (private only) |
|---|---|---|
| prometheus | prom/prometheus:v3.15.1 | 9090 |
| grafana | grafana/grafana:13.3.0 | 3000 (via Caddy as https://metrics.ssw590.abrdns.com) |
| node-exporter | quay.io/prometheus/node-exporter:v1.12.1 | 9100 |
| blackbox-exporter | quay.io/prometheus/blackbox-exporter:v0.29.1 | 9115 |
- `.env` holds image tags only (no secrets).
- `prometheus/prometheus.yml`: 30 s scrapes; jobs prometheus, node, blackbox, https (Gitea and Jenkins login pages via Blackbox).
- `blackbox/blackbox.yml`: `http_2xx` module, IPv4, TLS verification on.
- `grafana/provisioning/`: data source (uid dg2y8czei4y68b) and dashboard provider.
- `grafana/dashboards/ssw590-ops.json`: team dashboard (versioned definition).
- `grafana/alert-rules-export.yaml`: sanitized export of the two Grafana-managed alert rules.
- Grafana is attached to the existing `startup_private` network so Caddy can reach `grafana:3000`; Prometheus and exporters stay on the `monitoring` network.
- Secrets (Grafana admin password, Discord webhook URL) are not in Git.
Validate before (re)starting:
```
docker compose config --quiet
docker compose run --rm --no-deps --entrypoint /bin/promtool prometheus check config /etc/prometheus/prometheus.yml
```
See RUNBOOK.md for alert response and rollback.
+31
View File
@@ -0,0 +1,31 @@
# SSW590 monitoring runbook
Owner: Shubham Bhayana (SB). Verifier/backup: Sandya Devanahally (SD).
Alerts go to the `team-alerts` Grafana contact point (team Discord channel; webhook URL kept outside Git).
Dashboard: https://metrics.ssw590.abrdns.com/d/ssw590-ops
## Alert: HTTPS service unavailable (severity: critical)
Fires per service when `probe_success{job="https"}` stays 0 for 1 minute, or when the series is missing.
1. Acknowledge in the alert channel ("ack - <name> investigating").
2. Open the dashboard; confirm which service is DOWN and whether the other one is still UP.
3. On the droplet: `cd /opt/startup && docker compose ps`. If the service is stopped, `docker compose start <service>`; if running but unhealthy, `docker compose logs --tail=100 <service>`.
4. If both probes fail, check Caddy (`docker compose logs --tail=50 caddy`), DNS and the certificate.
5. If only monitoring is affected (no data), check `cd /opt/startup/monitoring && docker compose ps` and the Prometheus targets (`up`).
6. Recovery is confirmed when `probe_success` returns 1 and the RESOLVED notification arrives. Then run one Jenkins build and check the Gitea login page.
7. Record start/ack/restore times in the incident notes.
## Alert: Root filesystem free space below 15% (severity: warning)
Fires when available/size for the host root filesystem (/dev/vda1, ext4, /) stays below 15% for 5 minutes. 15% leaves room for logs, image pulls and Jenkins workspaces on a 25 GB disk before services fail.
1. `df -h /` and `docker system df` on the droplet.
2. Remove unused images: `docker image prune` (never `docker compose down -v`; it deletes data volumes).
3. Clean old Jenkins workspaces/builds; check `/var/lib/docker/containers/*/*-json.log` sizes.
4. If still low, plan a disk/volume resize and open a Gitea issue.
## Restore / rollback
- Monitoring config lives in `monitoring/` in this repository and on the droplet at `/opt/startup/monitoring`.
- Pause: `docker compose stop` / `docker compose start`. Do not use `down -v`.
- Roll back a config change: restore the previous file from Git (or `compose.yaml.bak`), `docker compose config --quiet`, then `docker compose up -d <service>`.
- State that is not in Git: the `monitoring_prometheus_data` and `monitoring_grafana_data` volumes (Grafana users, contact point, alert rules). Back up with
`docker run --rm -v monitoring_grafana_data:/d -v $PWD:/b alpine tar czf /b/grafana-data.tgz -C /d .` while Grafana is stopped.
+9
View File
@@ -0,0 +1,9 @@
modules:
http_2xx:
prober: http
timeout: 10s
http:
method: GET
preferred_ip_protocol: ip4
tls_config:
insecure_skip_verify: false
+55
View File
@@ -0,0 +1,55 @@
services:
prometheus:
image: prom/prometheus:${PROMETHEUS_TAG:?choose a release}
restart: unless-stopped
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
- --storage.tsdb.retention.time=7d
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
networks: [monitoring]
grafana:
image: grafana/grafana:${GRAFANA_TAG:?choose a release}
restart: unless-stopped
environment:
GF_AUTH_ANONYMOUS_ENABLED: "false"
GF_USERS_ALLOW_SIGN_UP: "false"
GF_SERVER_ROOT_URL: "https://metrics.ssw590.abrdns.com/"
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:ro
- ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources:ro
- ./grafana/dashboards:/var/lib/grafana/dashboards:ro
networks: [monitoring, proxy]
node-exporter:
image: quay.io/prometheus/node-exporter:${NODE_EXPORTER_TAG:?choose a release}
restart: unless-stopped
pid: host
command:
- --path.rootfs=/host
- --path.procfs=/host/proc
- --path.sysfs=/host/sys
volumes:
- /:/host:ro,rslave
networks: [monitoring]
blackbox-exporter:
image: quay.io/prometheus/blackbox-exporter:${BLACKBOX_TAG:?choose a release}
restart: unless-stopped
command: ["--config.file=/config/blackbox.yml"]
volumes:
- ./blackbox/blackbox.yml:/config/blackbox.yml:ro
networks: [monitoring]
networks:
monitoring:
proxy:
external: true
name: startup_private
volumes:
prometheus_data:
grafana_data:
+120
View File
@@ -0,0 +1,120 @@
apiVersion: 1
groups:
- orgId: 1
name: ssw-590-30s
folder: SSW590
interval: 30s
rules:
- uid: fg2yd76uk00sga
title: HTTPS service unavailable
condition: C
data:
- refId: A
relativeTimeRange:
from: 600
to: 0
datasourceUid: dg2y8czei4y68b
model:
editorMode: code
expr: probe_success{job="https"}
instant: true
intervalMs: 1000
legendFormat: __auto
maxDataPoints: 43200
range: false
refId: A
- refId: C
queryType: expression
datasourceUid: __expr__
model:
conditions:
- evaluator:
params:
- 1
type: lt
operator:
type: and
query:
params:
- C
reducer:
params: []
type: last
type: query
datasource:
type: __expr__
uid: __expr__
expression: A
intervalMs: 1000
maxDataPoints: 43200
refId: C
type: threshold
noDataState: Alerting
execErrState: Alerting
for: 1m
annotations:
description: 'Check: docker compose ps in /opt/startup; restart the failed service; verify login page and probe_success returns 1.'
runbook_url: https://git.ssw590.abrdns.com/StartupTeam/Strartup-product/src/branch/feature/monitoring/monitoring/RUNBOOK.md
summary: '{{ $labels.instance }} HTTPS probe failing for 1 minute'
labels:
owner: shubham
severity: critical
isPaused: false
notification_settings:
receiver: team-alerts
- uid: dg2ydl5gwz474e
title: Root filesystem free space below 15%
condition: C
data:
- refId: A
relativeTimeRange:
from: 600
to: 0
datasourceUid: dg2y8czei4y68b
model:
editorMode: code
expr: ' 100 * node_filesystem_avail_bytes{device="/dev/vda1",fstype="ext4",mountpoint="/",job="node"} / node_filesystem_size_bytes{device="/dev/vda1",fstype="ext4",mountpoint="/",job="node"}'
instant: true
intervalMs: 1000
legendFormat: __auto
maxDataPoints: 43200
range: false
refId: A
- refId: C
queryType: expression
datasourceUid: __expr__
model:
conditions:
- evaluator:
params:
- 15
type: lt
operator:
type: and
query:
params:
- C
reducer:
params: []
type: last
type: query
datasource:
type: __expr__
uid: __expr__
expression: A
intervalMs: 1000
maxDataPoints: 43200
refId: C
type: threshold
noDataState: Alerting
execErrState: Alerting
for: 5m
annotations:
description: 'Check: df -h /; docker system df; remove unused images (docker image prune) and old build workspaces; resize volume if still low.'
summary: Root filesystem on SSW590-Droplet has less than 15% free
labels:
owner: shubham
severity: warning
isPaused: false
notification_settings:
receiver: team-alerts
@@ -0,0 +1,695 @@
{
"uid": "ssw590-ops",
"title": "SSW590 Startup Operations",
"tags": [
"ssw590",
"sre"
],
"timezone": "America/New_York",
"time": {
"from": "now-6h",
"to": "now"
},
"refresh": "30s",
"schemaVersion": 41,
"version": 2,
"editable": true,
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"panels": [
{
"id": 1,
"type": "timeseries",
"title": "Droplet CPU utilization (%)",
"description": "Whole-droplet CPU busy %, averaged across all CPUs: 100 x (1 - idle rate). node_cpu_seconds_total is a counter, so rate() is used, never the raw total.",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"gridPos": {
"x": 0,
"y": 0,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"expr": "100 * (1 - avg(rate(node_cpu_seconds_total{job=\"node\",mode=\"idle\"}[$__rate_interval])))",
"legendFormat": "CPU busy %"
}
],
"fieldConfig": {
"defaults": {
"unit": "percent",
"custom": {
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "never",
"thresholdsStyle": {
"mode": "line"
}
},
"min": 0,
"max": 100,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "orange",
"value": 70
},
{
"color": "red",
"value": 90
}
]
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi"
}
}
},
{
"id": 2,
"type": "timeseries",
"title": "Available host memory (bytes)",
"description": "MemAvailable: kernel estimate of memory available to applications without swapping (not just unused RAM). Unit: bytes (IEC). Host total is about 961 MiB.",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"gridPos": {
"x": 12,
"y": 0,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"expr": "node_memory_MemAvailable_bytes{job=\"node\"}",
"legendFormat": "MemAvailable"
}
],
"fieldConfig": {
"defaults": {
"unit": "bytes",
"custom": {
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "never",
"thresholdsStyle": {
"mode": "line"
}
},
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "orange",
"value": 104857600
},
{
"color": "green",
"value": 209715200
}
]
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi"
}
}
},
{
"id": 3,
"type": "timeseries",
"title": "Root filesystem free space (%)",
"description": "Available bytes / size bytes for the verified host root filesystem only (/dev/vda1, ext4, mounted at /). /boot, /boot/efi, overlay and pseudo filesystems are excluded. Alert line at 15%.",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"gridPos": {
"x": 0,
"y": 8,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"expr": "100 * node_filesystem_avail_bytes{device=\"/dev/vda1\",fstype=\"ext4\",mountpoint=\"/\",job=\"node\"} / node_filesystem_size_bytes{device=\"/dev/vda1\",fstype=\"ext4\",mountpoint=\"/\",job=\"node\"}",
"legendFormat": "/ free %"
}
],
"fieldConfig": {
"defaults": {
"unit": "percent",
"custom": {
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "never",
"thresholdsStyle": {
"mode": "line"
}
},
"min": 0,
"max": 100,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "orange",
"value": 15
},
{
"color": "green",
"value": 25
}
]
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi"
}
}
},
{
"id": 4,
"type": "timeseries",
"title": "Gitea HTTPS availability (probe_success)",
"description": "Blackbox http_2xx probe of the Gitea login page through Caddy: DNS, valid TLS, redirects followed, final 2xx. 1 = UP, 0 = DOWN.",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"gridPos": {
"x": 12,
"y": 8,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"expr": "probe_success{job=\"https\",instance=\"https://git.ssw590.abrdns.com/user/login\"}",
"legendFormat": "Gitea"
}
],
"fieldConfig": {
"defaults": {
"unit": "none",
"custom": {
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "never",
"thresholdsStyle": {
"mode": "line"
},
"lineInterpolation": "stepAfter"
},
"min": 0,
"max": 1,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": 1
}
]
},
"mappings": [
{
"type": "value",
"options": {
"0": {
"text": "DOWN",
"color": "red"
},
"1": {
"text": "UP",
"color": "green"
}
}
}
]
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi"
}
}
},
{
"id": 5,
"type": "timeseries",
"title": "Jenkins HTTPS availability (probe_success)",
"description": "Blackbox http_2xx probe of the Jenkins login page through Caddy. 1 = UP, 0 = DOWN. Login-page success does not prove a working build.",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"gridPos": {
"x": 0,
"y": 16,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"expr": "probe_success{job=\"https\",instance=\"https://ci.ssw590.abrdns.com/login\"}",
"legendFormat": "Jenkins"
}
],
"fieldConfig": {
"defaults": {
"unit": "none",
"custom": {
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "never",
"thresholdsStyle": {
"mode": "line"
},
"lineInterpolation": "stepAfter"
},
"min": 0,
"max": 1,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": 1
}
]
},
"mappings": [
{
"type": "value",
"options": {
"0": {
"text": "DOWN",
"color": "red"
},
"1": {
"text": "UP",
"color": "green"
}
}
}
]
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi"
}
}
},
{
"id": 6,
"type": "timeseries",
"title": "HTTPS probe duration (seconds)",
"description": "Total Blackbox probe time per service (DNS + connect + TLS + HTTP), one line per service.",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"gridPos": {
"x": 12,
"y": 16,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"expr": "probe_duration_seconds{job=\"https\",instance=\"https://git.ssw590.abrdns.com/user/login\"}",
"legendFormat": "Gitea"
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"expr": "probe_duration_seconds{job=\"https\",instance=\"https://ci.ssw590.abrdns.com/login\"}",
"legendFormat": "Jenkins"
}
],
"fieldConfig": {
"defaults": {
"unit": "s",
"custom": {
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "never",
"thresholdsStyle": {
"mode": "line"
}
},
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "orange",
"value": 1
},
{
"color": "red",
"value": 5
}
]
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi"
}
}
},
{
"id": 7,
"type": "timeseries",
"title": "Scrape health (up)",
"description": "Collection health: 1 = Prometheus scraped the target. For the https job, up=1 only means the probe ran; probe_success shows whether the site answered.",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"gridPos": {
"x": 0,
"y": 24,
"w": 24,
"h": 7
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"expr": "up",
"legendFormat": "{{job}} {{instance}}"
}
],
"fieldConfig": {
"defaults": {
"unit": "none",
"custom": {
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "never",
"thresholdsStyle": {
"mode": "line"
},
"lineInterpolation": "stepAfter"
},
"min": 0,
"max": 1,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": 1
}
]
},
"mappings": [
{
"type": "value",
"options": {
"0": {
"text": "DOWN",
"color": "red"
},
"1": {
"text": "UP",
"color": "green"
}
}
}
]
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi"
}
}
},
{
"id": 8,
"type": "timeseries",
"title": "Zammad HTTPS reachable (0/1)",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"gridPos": {
"x": 0,
"y": 31,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"expr": "probe_success{job=\"https\",instance=\"https://support.ssw590.abrdns.com/\"}",
"legendFormat": "support"
}
],
"fieldConfig": {
"defaults": {
"unit": "none",
"min": 0,
"max": 1,
"decimals": 0
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
}
},
{
"id": 9,
"type": "timeseries",
"title": "Zammad probe duration (seconds)",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"gridPos": {
"x": 8,
"y": 31,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"expr": "probe_duration_seconds{job=\"https\",instance=\"https://support.ssw590.abrdns.com/\"}",
"legendFormat": "support"
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
}
},
{
"id": 10,
"type": "timeseries",
"title": "TLS certificate remaining lifetime (days)",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"gridPos": {
"x": 16,
"y": 31,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "dg2y8czei4y68b"
},
"expr": "(probe_ssl_earliest_cert_expiry{job=\"https\",instance=\"https://support.ssw590.abrdns.com/\"} - time()) / 86400",
"legendFormat": "support"
}
],
"fieldConfig": {
"defaults": {
"unit": "none",
"decimals": 1
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
}
}
]
}
@@ -0,0 +1,8 @@
apiVersion: 1
providers:
- name: ssw590
folder: SSW590
type: file
allowUiUpdates: true
options:
path: /var/lib/grafana/dashboards
@@ -0,0 +1,9 @@
apiVersion: 1
datasources:
- name: prometheus
uid: dg2y8czei4y68b
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
editable: true
+25
View File
@@ -0,0 +1,25 @@
global:
scrape_interval: 30s
scrape_configs:
- job_name: prometheus
static_configs: [{targets: ["prometheus:9090"]}]
- job_name: node
static_configs: [{targets: ["node-exporter:9100"]}]
- job_name: blackbox
static_configs: [{targets: ["blackbox-exporter:9115"]}]
- job_name: https
metrics_path: /probe
params: {module: [http_2xx]}
static_configs:
- targets:
- https://git.ssw590.abrdns.com/user/login
- https://ci.ssw590.abrdns.com/login
- https://app.ssw590.abrdns.com/health
- https://support.ssw590.abrdns.com/
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
+3
View File
@@ -0,0 +1,3 @@
.venv
__pycache__
*.pyc
+300
View File
@@ -0,0 +1,300 @@
// Secure delivery pipeline for the Startup Pricing Service (SSW 590, Chapter 6).
// Runs only on the trusted 'delivery' agent. Release mode: test, scan, build once,
// publish, deploy staging, verify, human approval, promote the SAME digest.
// Redeploy mode: deploy a committed release record (rollback / recovery), no build.
def deployRecord(String record, String tag = '') {
// record is validated before this is called (vN-staging.yml / vN-production.yml)
withCredentials([sshUserPrivateKey(credentialsId: 'deploy-ssh', keyFileVariable: 'DEPLOY_KEY')]) {
dir('pricing') {
sh """#!/bin/bash -e
set -o pipefail
echo "Ansible start \$(date -u +%Y-%m-%dT%H:%M:%SZ) record=${record}"
\$ANSIBLE/ansible-playbook ansible/deploy.yml --syntax-check
\$ANSIBLE/ansible-playbook ansible/deploy.yml --private-key "\$DEPLOY_KEY" \\
-e @releases/${record} | tee ../reports/ansible-${record}${tag}.log
echo "Ansible end \$(date -u +%Y-%m-%dT%H:%M:%SZ)"
"""
}
}
sh """#!/bin/bash -e
set -o pipefail
bash pricing/ci/smoke.sh pricing/releases/${record} | tee reports/smoke-${record}${tag}.log
"""
}
def approve(String what) {
def summary = """${what}
Source commit: ${env.COMMIT}
Image: ${env.DIGEST_REF}
Gates: unit tests, pip-audit, Trivy secret scan, Trivy image scan (HIGH/CRITICAL) -> see build artifacts
Staging: ${env.STAGING_RESULT}"""
timeout(time: 30, unit: 'MINUTES') {
env.APPROVER = input(message: summary, ok: 'Approve', submitter: env.APPROVERS,
submitterParameter: 'APPROVER')
}
env.APPROVED_AT = sh(script: 'date -u +%Y-%m-%dT%H:%M:%SZ', returnStdout: true).trim()
writeFile file: 'reports/approval.txt',
text: "decision=approved\napprover=${env.APPROVER}\napproved_at=${env.APPROVED_AT}\nrequest=${what}\n"
echo "Approved by ${env.APPROVER} at ${env.APPROVED_AT}"
}
pipeline {
agent { label 'delivery' }
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '50'))
timeout(time: 75, unit: 'MINUTES')
}
parameters {
string(name: 'BRANCH', defaultValue: 'main',
description: 'Branch to build. Only main is published and deployed.')
choice(name: 'MODE', choices: ['release', 'redeploy'],
description: 'release: full gated delivery. redeploy: deploy a committed release record (rollback/recovery).')
string(name: 'RECORD', defaultValue: '',
description: 'redeploy only: file in pricing/releases, e.g. v1-production.yml')
}
environment {
REGISTRY = 'git.ssw590.abrdns.com'
IMAGE = 'git.ssw590.abrdns.com/startupteam/pricing'
ANSIBLE = '/opt/ansible-venv/bin'
PIPAUDIT = '/opt/pip-audit-venv/bin/pip-audit'
PROXY_NET = 'startup_private'
STAGING_URL = 'https://staging.ssw590.abrdns.com'
PROD_URL = 'https://app.ssw590.abrdns.com'
APPROVERS = 'sbhayana,sdevanahally'
ANSIBLE_CONFIG = "${WORKSPACE}/pricing/ansible.cfg"
}
stages {
stage('Identify source') {
steps {
script {
env.COMMIT = sh(script: 'git rev-parse HEAD', returnStdout: true).trim()
env.STAGING_RESULT = 'not run'
def mm = readFile('pricing/VERSION').trim()
if (!(mm ==~ /^[0-9]+\.[0-9]+$/)) { error "pricing/VERSION must be major.minor, got '${mm}'" }
env.SEMVER = "${mm}.${env.BUILD_NUMBER}"
currentBuild.displayName = "#${env.BUILD_NUMBER} v${env.SEMVER}"
}
sh '''
rm -rf reports && mkdir -p reports
git log -1 --format='commit %H%nauthor %an%ndate %cI%nsubject %s' | tee reports/source.txt
echo "branch ${BRANCH} mode ${MODE} build ${BUILD_URL}" | tee -a reports/source.txt
echo "version ${SEMVER}" | tee -a reports/source.txt
{ docker version --format 'docker client {{.Client.Version}} server {{.Server.Version}}'
python3 --version; trivy --version | head -1; $PIPAUDIT --version
$ANSIBLE/ansible --version | head -1
$ANSIBLE/ansible-galaxy collection list community.docker 2>/dev/null | tail -1; } | tee reports/tools.txt
'''
withCredentials([usernamePassword(credentialsId: 'gitea-status-token', usernameVariable: 'GITEA_USER', passwordVariable: 'GITEA_TOKEN')]) {
sh 'bash pricing/ci/gitea_status.sh pending "Jenkins delivery pipeline running" || echo "status post failed (non-fatal)"'
}
}
}
// ---------------- release mode: gates ----------------
stage('Unit tests') {
when { expression { params.MODE == 'release' } }
steps {
dir('pricing/app') {
sh '''#!/bin/bash -e
set -o pipefail
python3 -m venv .venv && . .venv/bin/activate
pip install --quiet --require-hashes -r requirements.txt
python -m py_compile app.py test_app.py
python -m unittest -v 2>&1 | tee ../../reports/unittest.log
'''
}
}
}
stage('Docs: architecture + LaTeX') {
when { expression { params.MODE == 'release' } }
steps {
sh '''#!/bin/bash -e
set -o pipefail
cp reports/unittest.log pricing/docs/unittest.log
docker build -f pricing/docs/Dockerfile --target out --output type=local,dest=reports/docs \
--build-arg SEMVER="$SEMVER" --build-arg COMMIT="$COMMIT" --build-arg BRANCH="$BRANCH" \
--build-arg BUILD_URL="$BUILD_URL" --build-arg BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
pricing 2>&1 | tee reports/docs-build.log
rm -f pricing/docs/unittest.log
ls -l reports/docs
'''
}
}
stage('Dependency audit') {
when { expression { params.MODE == 'release' } }
steps {
sh '''#!/bin/bash -e
set -o pipefail
$PIPAUDIT --disable-pip --require-hashes --strict -r pricing/app/requirements.txt \
--format columns 2>&1 | tee reports/pip-audit.log
'''
}
}
stage('Secret scan') {
when { expression { params.MODE == 'release' } }
steps {
sh '''#!/bin/bash -e
set -o pipefail
trivy fs --scanners secret --exit-code 1 --no-progress \
--skip-dirs .git --skip-dirs pricing/app/.venv --skip-dirs reports . 2>&1 | tee reports/trivy-secrets.log
'''
}
}
stage('Build image') {
when { expression { params.MODE == 'release' } }
steps {
sh '''#!/bin/bash -e
set -o pipefail
docker build --build-arg APP_COMMIT="$COMMIT" --build-arg APP_SEMVER="$SEMVER" \
--label org.opencontainers.image.version="$SEMVER" \
-t "$IMAGE:$COMMIT" -t "$IMAGE:$SEMVER" pricing/app 2>&1 | tee reports/docker-build.log
docker image inspect "$IMAGE:$COMMIT" --format 'local image id {{.Id}} arch {{.Architecture}}' | tee -a reports/docker-build.log
'''
}
}
stage('Image scan') {
when { expression { params.MODE == 'release' } }
steps {
sh '''#!/bin/bash -e
set -o pipefail
IGNORE=""
[ -s pricing/security/trivyignore.yaml ] && IGNORE="--ignorefile pricing/security/trivyignore.yaml"
# Policy gate: any HIGH or CRITICAL vulnerability blocks (fixed or not) unless a
# documented, time-limited exception exists in pricing/security/trivyignore.yaml.
trivy image --scanners vuln --severity HIGH,CRITICAL --exit-code 1 --no-progress --show-suppressed $IGNORE \
"$IMAGE:$COMMIT" 2>&1 | tee reports/trivy-image-gate.log
# Full report of all severities for the record (does not gate).
trivy image --scanners vuln --no-progress --skip-db-update --format json \
--output reports/trivy-image-all.json "$IMAGE:$COMMIT"
'''
}
}
stage('Package artifact') {
when { expression { params.MODE == 'release' } }
steps {
sh '''#!/bin/bash -e
set -o pipefail
PKG="pricing-$SEMVER"; rm -rf "build/$PKG" && mkdir -p "build/$PKG"
cp -r pricing/app/app.py pricing/app/requirements.txt pricing/app/Dockerfile pricing/ansible "build/$PKG/"
cp reports/docs/release-notes.pdf reports/docs/*.png "build/$PKG/"
docker image inspect "$IMAGE:$SEMVER" --format '{{.Id}}' > "build/$PKG/image-id.txt"
printf 'version=%s\ncommit=%s\nimage=%s:%s\nbuild=%s\n' "$SEMVER" "$COMMIT" "$IMAGE" "$SEMVER" "$BUILD_URL" > "build/$PKG/VERSION.txt"
(cd build && python3 -m zipfile -c "../reports/$PKG.zip" "$PKG")
python3 -m zipfile -l "reports/$PKG.zip" | tee reports/package-contents.txt
sha256sum "reports/$PKG.zip" | tee "reports/$PKG.zip.sha256"
rm -rf build
'''
}
}
// ---------------- release mode: publish (main only) ----------------
stage('Publish image') {
when { allOf { expression { params.MODE == 'release' }; expression { params.BRANCH == 'main' } } }
steps {
withCredentials([usernamePassword(credentialsId: 'gitea-registry-write',
usernameVariable: 'REG_USER', passwordVariable: 'REG_TOKEN')]) {
sh '''#!/bin/bash -e
set -o pipefail
export DOCKER_CONFIG="$WORKSPACE/.docker-publish"
printf '%s' "$REG_TOKEN" | docker login "$REGISTRY" -u "$REG_USER" --password-stdin
# Releases are immutable: never overwrite an existing tag (see Chapter 6, rollback incident).
if docker manifest inspect "$IMAGE:$COMMIT" >/dev/null 2>&1; then
echo "ERROR: $IMAGE:$COMMIT is already published; releases are immutable. Use MODE=redeploy with the committed record." >&2
docker logout "$REGISTRY"; exit 1
fi
if docker manifest inspect "$IMAGE:$SEMVER" >/dev/null 2>&1; then
echo "ERROR: $IMAGE:$SEMVER is already published." >&2; docker logout "$REGISTRY"; exit 1
fi
docker push "$IMAGE:$COMMIT" 2>&1 | tee reports/docker-push.log
docker push "$IMAGE:$SEMVER" 2>&1 | tee -a reports/docker-push.log
docker rmi "$IMAGE:$COMMIT"
docker pull "$IMAGE:$COMMIT" 2>&1 | tee reports/docker-pull.log
docker image inspect "$IMAGE:$COMMIT" --format '{{range .RepoDigests}}{{println .}}{{end}}' \
| grep "^$IMAGE@sha256:" | head -1 > reports/image-digest.txt
docker logout "$REGISTRY"; rm -rf "$DOCKER_CONFIG"
echo "Published $(cat reports/image-digest.txt)"
'''
}
sh 'python3 pricing/ci/write_release.py'
script {
env.APP_VERSION = sh(script: "sed -n 's/^APP_VERSION=//p' reports/release.env", returnStdout: true).trim()
env.EXPECTED_TOTAL = sh(script: "sed -n 's/^EXPECTED_TOTAL=//p' reports/release.env", returnStdout: true).trim()
env.DIGEST_REF = sh(script: "sed -n 's/^DIGEST_REF=//p' reports/release.env", returnStdout: true).trim()
}
}
}
stage('Deploy staging') {
when { allOf { expression { params.MODE == 'release' }; expression { params.BRANCH == 'main' } } }
steps {
script { deployRecord("${env.APP_VERSION}-staging.yml") }
}
}
stage('Staging idempotence') {
when { allOf { expression { params.MODE == 'release' }; expression { params.BRANCH == 'main' } } }
steps {
script {
deployRecord("${env.APP_VERSION}-staging.yml", '-rerun')
def recap = sh(script: "grep -E '^startup +:' reports/ansible-${env.APP_VERSION}-staging.yml-rerun.log",
returnStdout: true).trim()
if (!recap.contains('changed=0 ')) { error "Second Ansible run was not idempotent: ${recap}" }
env.STAGING_RESULT = "${env.STAGING_URL} healthy, ${env.APP_VERSION}, total ${env.EXPECTED_TOTAL}, rerun ${recap}"
writeFile file: 'reports/staging-result.txt', text: env.STAGING_RESULT + '\n'
}
}
}
stage('Approve production') {
when { allOf { expression { params.MODE == 'release' }; expression { params.BRANCH == 'main' } } }
steps {
script { approve("Promote ${env.APP_VERSION} (${env.COMMIT.substring(0, 10)}) to PRODUCTION ${env.PROD_URL}?") }
}
}
stage('Deploy production') {
when { allOf { expression { params.MODE == 'release' }; expression { params.BRANCH == 'main' } } }
steps {
script { deployRecord("${env.APP_VERSION}-production.yml") }
}
}
// ---------------- redeploy mode: rollback / recovery ----------------
stage('Redeploy committed record') {
when { expression { params.MODE == 'redeploy' } }
steps {
script {
if (params.BRANCH != 'main') { error 'Redeploy only from reviewed main' }
if (!(params.RECORD ==~ /^v[0-9]+-(staging|production)\.yml$/)) { error "Bad RECORD '${params.RECORD}'" }
def path = "pricing/releases/${params.RECORD}"
if (!fileExists(path)) { error "${path} is not committed on main" }
def cfg = sh(script: "awk '\$1==\"config_commit:\"{print \$2}' ${path}", returnStdout: true).trim()
if (!(cfg ==~ /^[0-9a-f]{40}$/)) { error "Record has no valid config_commit" }
// Restore the deployment configuration that was reviewed with this release.
sh "git checkout ${cfg} -- pricing/ansible && git log -1 --format='config %H %s' ${cfg} | tee reports/config.txt"
env.DIGEST_REF = sh(script: "awk '\$1==\"release_image:\"{print \$2}' ${path}", returnStdout: true).trim()
env.STAGING_RESULT = 'redeploy of a committed record (no new build)'
if (params.RECORD.contains('production')) {
approve("REDEPLOY ${params.RECORD} to PRODUCTION (rollback/recovery)?")
}
deployRecord(params.RECORD)
}
}
}
}
post {
success {
withCredentials([usernamePassword(credentialsId: 'gitea-status-token', usernameVariable: 'GITEA_USER', passwordVariable: 'GITEA_TOKEN')]) {
sh 'bash pricing/ci/gitea_status.sh success "Jenkins: all gates passed" || true'
}
}
unsuccessful {
withCredentials([usernamePassword(credentialsId: 'gitea-status-token', usernameVariable: 'GITEA_USER', passwordVariable: 'GITEA_TOKEN')]) {
sh 'bash pricing/ci/gitea_status.sh failure "Jenkins: a gate failed or approval was not given" || true'
}
}
always {
sh 'date -u +"finished %Y-%m-%dT%H:%M:%SZ" >> reports/source.txt; ls pricing/releases/ > reports/records.txt'
archiveArtifacts artifacts: 'reports/**, pricing/releases/v*.yml', allowEmptyArchive: true, fingerprint: true
}
}
}
+52
View File
@@ -0,0 +1,52 @@
# Startup Pricing Service: secure delivery (SSW 590, Chapter 6)
Course starter `Examples/dosSecureDelivery` (Flask + Gunicorn, stateless), delivered by
Jenkins on a trusted agent, published to the Gitea container registry, and deployed by
Ansible to two Compose projects on the team Droplet.
| Path | Purpose |
|---|---|
| `app/` | Application (`app.py`), unit tests, `requirements.in` (starter ranges), `requirements.txt` (exact, hash-locked), `Dockerfile` (base image pinned by digest) |
| `ansible/` | `deploy.yml` (starter, adapted), `templates/compose.yaml.j2`, `inventory.ini`, `known_hosts` (pinned host key), `requirements.yml` |
| `ansible.cfg` | Inventory and strict host-key checking |
| `releases/` | Release records (metadata only, no secrets); `release.example.yml` is the starter template |
| `ci/` | `write_release.py`, `smoke.sh`, `gitea_status.sh` used by the pipeline |
| `agent/` | Trusted Jenkins agent image and Compose file (`/opt/startup/delivery-agent`) |
| `Jenkinsfile` | Delivery pipeline (job `pricing-delivery`) |
| `RUNBOOK.md` | Release, failed deployment, rollback, cleanup |
## Locked build inputs
* Base image: `python:3.13-slim@sha256:e48f59cdba69a3cbd9ed2cf0f348d90d45a8d350d98134cf1070bc106ee9ed90`
(multi-arch index; the Droplet is linux/amd64). Selected 2026-11-12.
* Python dependencies: `requirements.txt` generated with
`pip-compile --generate-hashes --strip-extras requirements.in` (pip-tools 7.6.2, Python 3.13):
Flask 3.1.3, gunicorn 23.0.0, Werkzeug 3.1.9, Jinja2 3.1.6, MarkupSafe 3.0.4,
itsdangerous 2.2.0, click 8.5.1, blinker 1.9.0, packaging 26.3.
The Dockerfile installs with `--require-hashes`. Rebuild and rescan after any change.
* No version is claimed to be vulnerability-free; see the scan reports of each build.
## Agent toolchain (rebuilt from `agent/Dockerfile`)
`jenkins/inbound-agent:latest-jdk21@sha256:25a3704f…78ab`, Docker CLI 29.8.2 (+ buildx),
Trivy 0.69.3 (checksum-verified; known-safe release after the March 2026 Trivy
supply-chain incident, GHSA-69fq-xp46-6x23), ansible-core 2.19.15 with
community.docker 5.2.2 (venv `/opt/ansible-venv`), pip-audit 2.10.1 (`/opt/pip-audit-venv`).
## Security gate policy
| Gate | Tool | Blocks when |
|---|---|---|
| Unit tests | `python -m unittest` | any test fails |
| Dependency audit | pip-audit 2.10.1 (`--strict`, hash-locked) | any known vulnerability, or a package cannot be audited |
| Secret scan | Trivy `fs --scanners secret` (whole repository) | any detected secret |
| Image scan | Trivy `image --severity HIGH,CRITICAL` | any HIGH/CRITICAL not covered by an unexpired entry in `security/trivyignore.yaml` |
A scanner error or an unavailable vulnerability database exits non-zero and fails the build;
a failed scan is never treated as clean. Fixable findings are fixed (pin the fixed package or
remove the component) and rebuilt. Findings without a published fix may be accepted only as
time-limited exceptions in `security/trivyignore.yaml`, each with a statement and an
`expired_at` date; the gate output lists suppressed findings (`--show-suppressed`), and the
full all-severity report is archived as `reports/trivy-image-all.json`. False positives are
handled the same way, with the reason in the statement. Exceptions are reviewed in a pull
request and are pending instructor acceptance.
+78
View File
@@ -0,0 +1,78 @@
# Startup Pricing Service: delivery and recovery runbook
Service: stateless Flask + Gunicorn pricing API (course starter `dosSecureDelivery`).
Environments on the single Droplet (shared failure domain, no high availability):
| Environment | URL | Compose project / directory | Network alias |
|---|---|---|---|
| staging | https://staging.ssw590.abrdns.com | `pricing-staging` / `/opt/startup/pricing-staging` | `pricing-staging` |
| production | https://app.ssw590.abrdns.com | `pricing-production` / `/opt/startup/pricing-production` | `pricing-production` |
Jenkins job: `pricing-delivery` (https://ci.ssw590.abrdns.com/job/pricing-delivery/), runs only on agent `delivery-agent`.
## Roles
| Action | Who | How it is enforced |
|---|---|---|
| Change code or configuration | SB, SD | Gitea pull request to `main` |
| Start a release or redeploy | SB, SD (Jenkins accounts) | Jenkins login; anonymous users have no build permission |
| Approve production (release or rollback) | `sbhayana`, `sdevanahally` only | `input` step `submitter`, 30-minute timeout |
| Roll back production | SB, SD | `MODE=redeploy` + approval |
| Host-level emergency access | SB, SD | SSH as root from allow-listed addresses only |
## Release (normal path)
1. Merge the reviewed change to `main` (Jenkins posts `continuous-integration/jenkins`).
2. Jenkins → `pricing-delivery` → Build with Parameters: `BRANCH=main`, `MODE=release`.
3. Pipeline: unit tests → pip-audit → Trivy secret scan → build → Trivy image scan →
publish + pull back by digest → write release records → Ansible deploy staging →
smoke test → second Ansible run must report `changed=0` → **approval** → Ansible deploy
production (same digest) → smoke test.
4. Download `pricing/releases/vN-staging.yml` and `vN-production.yml` from the build
artifacts and commit them to `pricing/releases/` through a pull request. Rollback uses
only committed records.
## Failed deployment
Symptom: Ansible task "Converge application without rebuilding" fails (container
unhealthy) or a smoke/assert task fails; Jenkins run is red; no automatic rollback.
1. Do not retry blindly. Read the Ansible log artifact and
`docker compose -p pricing-<env> ps` / `docker logs pricing-<env>-app-1` on the Droplet.
2. Revert the faulty configuration commit in Gitea (pull request) so `main` again holds
the last reviewed record/template.
3. Run `MODE=redeploy`, `RECORD=<last good record>`. The job checks out the record's
`config_commit` version of `pricing/ansible` before deploying.
4. Confirm the smoke test passes (health, version, commit, total 30/36, HTTP 400).
## Production rollback (healthy release, wrong business result)
1. Decide: e.g. v2 price is not approved. Note the time.
2. Start a timestamped check from an allow-listed laptop:
`while true; do printf '%s ' "$(date -u +%T.%N | cut -c1-12)"; curl -s -m 2 https://app.ssw590.abrdns.com/ || echo FAIL; echo; sleep 0.5; done | tee rollback-probe.log`
3. Jenkins: `MODE=redeploy`, `RECORD=v1-production.yml`; approve.
4. Recovery = first `SMOKE PASS` with v1 and total 30; interruption = gap of FAIL/502
lines in the probe log. A recreate deployment is **not** zero-downtime.
Never run `docker compose down -v`, `docker system prune`, or touch Gitea/Jenkins/Caddy
volumes as part of an application rollback.
## State and rollback limits
This service is stateless, so image + configuration rollback is complete. With a
database, a v2 schema migration (e.g. dropping or renaming a column) could make v1
fail against the migrated data; payments already captured at v2 prices cannot be
"rolled back". Use expand/contract migrations: add new columns/tables first (both
versions work), switch code, and drop old structures only in a later release after
rollback is no longer needed.
## Cleanup (only after grading, when instructed)
```
cd /opt/startup/pricing-staging && docker compose -p pricing-staging down
cd /opt/startup/pricing-production && docker compose -p pricing-production down
```
Then remove the two Caddy site blocks and reload Caddy, delete the `staging` and `app`
DNS records, remove the `app` probe target, revoke the Gitea package tokens and the
`deploy` SSH key, and delete the `deploy-ssh`, `gitea-registry-write`,
`gitea-status-token` Jenkins credentials. Keep Gitea, Jenkins, monitoring and their volumes.
+1
View File
@@ -0,0 +1 @@
1.3
+3
View File
@@ -0,0 +1,3 @@
# Copy to .env on the Droplet (chmod 600). Never commit .env.
JENKINS_AGENT_SECRET=
DOCKER_GID=
+39
View File
@@ -0,0 +1,39 @@
# Trusted Jenkins delivery agent: inbound (WebSocket) agent + Docker CLI, Python,
# Ansible, pip-audit and Trivy. Rebuilding this image recreates every tool.
ARG AGENT_BASE=jenkins/inbound-agent:latest-jdk21@sha256:25a3704f7de4d3d0becc441f5683a227556658df1473865ee94c5232355678ab
# Docker CLI matching the host daemon (Docker Engine 29.8.2); the official CLI image ships buildx.
ARG DOCKER_CLI=docker:29.8.2-cli
FROM ${DOCKER_CLI} AS dockercli
FROM ${AGENT_BASE}
USER root
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 python3-venv git openssh-client curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Docker client only (the daemon is the host's, via the mounted socket).
COPY --from=dockercli /usr/local/bin/docker /usr/local/bin/docker
COPY --from=dockercli /usr/local/libexec/docker/cli-plugins/docker-buildx /usr/libexec/docker/cli-plugins/docker-buildx
# Trivy 0.69.3: a known-safe release after the March 2026 supply-chain incident
# (GHSA-69fq-xp46-6x23; 0.69.4-0.69.6 were malicious). Checksum from the release's checksums file.
ARG TRIVY_VERSION=0.69.3
ARG TRIVY_SHA256=1816b632dfe529869c740c0913e36bd1629cb7688bd5634f4a858c1d57c88b75
RUN curl -fsSLo /tmp/trivy.tgz "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" \
&& echo "${TRIVY_SHA256} /tmp/trivy.tgz" | sha256sum -c - \
&& tar -xzf /tmp/trivy.tgz -C /usr/local/bin trivy && rm /tmp/trivy.tgz
# Ansible and pip-audit in separate virtual environments (pinned top-level versions).
RUN python3 -m venv /opt/ansible-venv \
&& /opt/ansible-venv/bin/pip install --no-cache-dir ansible-core==2.19.15 \
&& /opt/ansible-venv/bin/ansible-galaxy collection install -p /usr/share/ansible/collections community.docker:==5.2.2 \
&& python3 -m venv /opt/pip-audit-venv \
&& /opt/pip-audit-venv/bin/pip install --no-cache-dir pip-audit==2.10.1
# Fail the image build if any tool is missing.
RUN for t in docker trivy python3 git ssh; do command -v "$t" >/dev/null || exit 1; done \
&& docker buildx version && trivy --version && /opt/ansible-venv/bin/ansible --version \
&& /opt/pip-audit-venv/bin/pip-audit --version
USER jenkins
+29
View File
@@ -0,0 +1,29 @@
# Trusted Jenkins delivery agent. Deployed at /opt/startup/delivery-agent on the Droplet.
# Secrets come from the untracked .env file (see .env.example).
services:
agent:
build: .
image: ssw590/delivery-agent:1.0
container_name: delivery-agent
restart: unless-stopped
environment:
JENKINS_URL: http://startup-jenkins-1:8080
JENKINS_WEB_SOCKET: "true"
JENKINS_AGENT_NAME: delivery-agent
JENKINS_AGENT_WORKDIR: /home/jenkins/agent
JENKINS_SECRET: ${JENKINS_AGENT_SECRET:?set in .env}
# Docker socket = host-administrator power. Only reviewed delivery jobs run here.
group_add:
- "${DOCKER_GID:?set in .env}"
volumes:
- agent-home:/home/jenkins
- /var/run/docker.sock:/var/run/docker.sock
mem_limit: 900m
networks:
- private
volumes:
agent-home:
networks:
private:
external: true
name: startup_private
+11
View File
@@ -0,0 +1,11 @@
[defaults]
inventory = ansible/inventory.ini
interpreter_python = /usr/bin/python3
host_key_checking = True
retry_files_enabled = False
stdout_callback = default
display_skipped_hosts = False
[ssh_connection]
# Only the pinned host key is trusted; no trust-on-first-use.
ssh_args = -o UserKnownHostsFile=ansible/known_hosts -o StrictHostKeyChecking=yes -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s
+74
View File
@@ -0,0 +1,74 @@
# Course starter playbook (dosSecureDelivery), adapted: staging-only command override
# guard, explicit certificate validation, and an invalid-input check.
- name: Deploy a selected immutable pricing release
hosts: delivery
become: true
vars:
project_dir: "/opt/startup/pricing-{{ target_env }}"
tasks:
- name: Validate release selection
ansible.builtin.assert:
that:
- target_env in ['staging', 'production']
- "'@sha256:' in release_image"
- expected_version in ['v1', 'v2', 'v3']
- expected_total | int > 0
- public_url.startswith('https://')
- proxy_network | length > 0
# A command override is only allowed for the staging failure exercise.
- target_env == 'staging' or command_override is not defined
- name: Create deployment directory
ansible.builtin.file:
path: "{{ project_dir }}"
state: directory
mode: '0750'
- name: Render selected Compose configuration
ansible.builtin.template:
src: compose.yaml.j2
dest: "{{ project_dir }}/compose.yaml"
mode: '0640'
- name: Converge application without rebuilding
community.docker.docker_compose_v2:
project_src: "{{ project_dir }}"
project_name: "pricing-{{ target_env }}"
state: present
build: never
pull: missing
wait: true
wait_timeout: 90
- name: Verify health through public TLS endpoint
ansible.builtin.uri:
url: "{{ public_url }}/health"
return_content: true
validate_certs: true
register: health
until: health.status == 200 and health.json.status == 'ok'
retries: 12
delay: 5
changed_when: false
- name: Read release identity
ansible.builtin.uri:
url: "{{ public_url }}/"
return_content: true
validate_certs: true
register: identity
changed_when: false
- name: Exercise business behavior
ansible.builtin.uri:
url: "{{ public_url }}/price?quantity=3"
return_content: true
validate_certs: true
register: price
changed_when: false
- name: Reject invalid input
ansible.builtin.uri:
url: "{{ public_url }}/price?quantity=0"
status_code: 400
validate_certs: true
changed_when: false
- name: Check release identity and calculation
ansible.builtin.assert:
that:
- identity.json.version == expected_version
- identity.json.commit == expected_commit
- price.json.total | int == expected_total | int
+4
View File
@@ -0,0 +1,4 @@
[delivery]
# Droplet host, reached from the delivery-agent container over the host's private address.
# Host key pinned in ansible/known_hosts (verified on the Droplet console; see README).
startup ansible_host=10.10.0.5 ansible_user=deploy
+3
View File
@@ -0,0 +1,3 @@
# Droplet host key, collected from inside delivery-agent with ssh-keyscan on 2026-11-12 and
# verified against the console fingerprint SHA256:duhmmS3goD3K1mYmFt5YoSD4XclbqeDg9TyunmkN8p4.
10.10.0.5 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIESkXXHpEl0772FvV9Z9ug+FOq2Ke4qb74l8Qunc2ynK
+3
View File
@@ -0,0 +1,3 @@
collections:
- name: community.docker
version: "==5.2.2"
+25
View File
@@ -0,0 +1,25 @@
# Rendered by Ansible for pricing-{{ target_env }}. Do not edit on the host.
services:
app:
image: "{{ release_image }}"
restart: unless-stopped
read_only: true
tmpfs:
- /tmp
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
mem_limit: 160m
pids_limit: 64
{% if command_override is defined %}
command: {{ command_override | to_json }}
{% endif %}
networks:
edge:
aliases:
- "pricing-{{ target_env }}"
networks:
edge:
external: true
name: "{{ proxy_network }}"
+4
View File
@@ -0,0 +1,4 @@
__pycache__
.venv
.git
*.pyc
+27
View File
@@ -0,0 +1,27 @@
# Startup Pricing Service image (course starter, adapted).
# Base image pinned by digest: python:3.13-slim, linux/amd64 compatible (Droplet is x86_64).
# Record of selection: see pricing/README.md. Rebuild and rescan when this digest changes.
FROM python:3.13-slim@sha256:e48f59cdba69a3cbd9ed2cf0f348d90d45a8d350d98134cf1070bc106ee9ed90
# Security fix (Trivy, 2026-11-12): zlib1g fixed in the Debian 13 point update
# (CVE-2026-76844, CVE-2026-85091). Exact version, so the build stays reproducible.
# Security fix (Trivy, 2026-11-30, Jenkins #20): libzstd1 CVE-2026-124851 fixed in 1.5.7+dfsg-1+deb13u1
RUN apt-get update \
&& apt-get install -y --no-install-recommends --only-upgrade 'zlib1g=1:1.3.dfsg+really1.3.1-1+deb13u1' 'libzstd1=1.5.7+dfsg-1+deb13u1' \
&& rm -rf /var/lib/apt/lists/*
ARG APP_COMMIT=development
ARG APP_SEMVER=development
ENV APP_COMMIT=$APP_COMMIT APP_SEMVER=$APP_SEMVER PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
LABEL org.opencontainers.image.source="https://git.ssw590.abrdns.com/StartupTeam/Strartup-product" \
org.opencontainers.image.revision=$APP_COMMIT
WORKDIR /app
COPY requirements.txt .
# Exact, hash-locked direct and transitive dependencies (generated by pip-compile from requirements.in).
# pip is not needed at runtime; removing it also removes its vendored msgpack, urllib3
# and pkg_resources (setuptools), which Trivy reported as HIGH.
RUN pip install --no-cache-dir --require-hashes -r requirements.txt \
&& python -m pip uninstall -y pip
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)"
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "1", "--worker-tmp-dir", "/tmp", "app:app"]
+39
View File
@@ -0,0 +1,39 @@
import os
from flask import Flask, jsonify, request
app = Flask(__name__)
VERSION = "v3"
UNIT_PRICE = 12
BULK_MIN_QUANTITY = 10
BULK_DISCOUNT = 0.10
COMMIT = os.environ.get("APP_COMMIT", "development")
BUILD = os.environ.get("APP_SEMVER", "development")
def total_price(quantity):
if quantity < 1 or quantity > 1000:
raise ValueError("quantity must be between 1 and 1000")
total = UNIT_PRICE * quantity
if quantity >= BULK_MIN_QUANTITY:
total = round(total * (1 - BULK_DISCOUNT), 2)
return total
@app.get("/")
def index():
return jsonify(service="Startup Pricing", version=VERSION, build=BUILD, commit=COMMIT)
@app.get("/health")
def health():
return jsonify(status="ok", version=VERSION, build=BUILD)
@app.get("/price")
def price():
try:
quantity = int(request.args.get("quantity", "1"))
total = total_price(quantity)
except ValueError as error:
return jsonify(error=str(error)), 400
return jsonify(quantity=quantity, total=total, currency="USD")
+2
View File
@@ -0,0 +1,2 @@
Flask>=3.1,<3.2
gunicorn>=23,<24
+188
View File
@@ -0,0 +1,188 @@
blinker==1.9.0 \
--hash=sha256:b4ce2265a7abece45e7cc896e98dbebe6cead56bcf805a3d23136d145f5445bf \
--hash=sha256:ba0efaa9080b619ff2f3459d1d500c57bddea4a6b424b60a91141db6fd2f08bc
# via flask
click==8.5.1 \
--hash=sha256:8bb5376d2006950386f8c6427613334a2acadc5f559cb80e638d00b4df957e37 \
--hash=sha256:9bbfada76703fd1d784b83eea012e3e8c6a001a876543ef104fa56aaaeb072b4
# via flask
flask==3.1.3 \
--hash=sha256:0ef0e52b8a9cd932855379197dd8f94047b359ca0a78695144304cb45f87c9eb \
--hash=sha256:f4bcbefc124291925f1a26446da31a5178f9483862233b23c0c96a20701f670c
# via -r requirements.in
gunicorn==23.0.0 \
--hash=sha256:ec400d38950de4dfd418cff8328b2c8faed0edb0d517d3394e457c317908ca4d \
--hash=sha256:f014447a0101dc57e294f6c18ca6b40227a4c90e9bdb586042628030cba004ec
# via -r requirements.in
itsdangerous==2.2.0 \
--hash=sha256:c6242fc49e35958c8b15141343aa660db5fc54d4f13a1db01a3f5891b98700ef \
--hash=sha256:e0050c0b7da1eea53ffaf149c0cfbb5c6e2e2b69c4bef22c81fa6eb73e5f6173
# via flask
jinja2==3.1.6 \
--hash=sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d \
--hash=sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67
# via flask
markupsafe==3.0.4 \
--hash=sha256:007e1ffd9bf65bb6ee96df7b258fc632a4868dd5566037986c64781f35a36e98 \
--hash=sha256:02fa4acbc6a3fc5c693c34d4dd8c1130b7fe99cc915181b0ddd6f72aeb296002 \
--hash=sha256:03470d1a8268e692ecf79ecd565593e59d44219377a7ead61f1f1b94c1f7ff6b \
--hash=sha256:04e7902ba80ee4bac1d50a549606527a1dcf0476cd81403db41099d3b60ec653 \
--hash=sha256:051417f74bcaaefa316276e0ff723f541616ca51043d070da00249d9bddd3e3c \
--hash=sha256:05295589e619b9bed252a86b532b8e27350abc372d18ba89b59375325e91ec1e \
--hash=sha256:06de8ef6331f6e822c28d577dc8bf43fe398800477c49498f38fc38b67ff33fc \
--hash=sha256:0764a13d34cae40db7bbf3a09b7e9b491bf4603e20b263a7a9d6b8e324975d0a \
--hash=sha256:077293e425f28ec737dbcad442a71752e28f8ae27cde3d68acd1fb212091cd92 \
--hash=sha256:0930db9bdc62d22944e10b066448bb65dc9abe9112880c7cab8da54db4284d5f \
--hash=sha256:0cee7cb0f9a1b6892ea482237d9403b3d1b4603aee057d0ff01f0fac2d019a97 \
--hash=sha256:0d9c47709875fdb321452056622e930c52afbc07a7d780762fbb8b4d91ce6fa4 \
--hash=sha256:11935df9bf455ed0c04eb87bcd720f02b1fe5e02128a9430f23aed6f93336fc7 \
--hash=sha256:12a606a492de952afcb43b59a14aaaaad120e708d3663dd0fdf2d738d427a691 \
--hash=sha256:14bd2d845d62ab678eaf81da89d7b621b51756c72346745c1a594c09d49207a2 \
--hash=sha256:15ba9e28640feef770374b116a6f019c21f52404aeabe516aa7f800587b98cfc \
--hash=sha256:18a801868a884f216e784d7d14db2a4077143ce7610440aee2ce8f734e7cfcde \
--hash=sha256:1c0df495a977d10460a94941799c72d5b5ab03d3858d949b55b5a66c8f371c99 \
--hash=sha256:1caa2fa5a6184fb233153b35f654e6687bd555476f6170f29d8ee9be1a8b0af9 \
--hash=sha256:1e1451fab512d1bcc3dc26988ec1edb0b82c2db909132872cd9356070a6b63df \
--hash=sha256:1f1f9477e174582b0a1b583d60b66e1f2cf5d3fe12cee985e4aedf44766600e5 \
--hash=sha256:2628d3a8cb648ecebb3c5d6b0a1052d400e4d8b7ac0fb786be8d285b50040d17 \
--hash=sha256:26e9867520db70d37f7fb421a7f0d8adb40171011fb84ce869afa1a83370dfa8 \
--hash=sha256:2a6ef68ae94aed8721934072b27a3b654ea2100b97e4ab864cf1489c90926fbc \
--hash=sha256:2b2b1e18af909b448bb3cf9e3433366f7a8726271fc214e8b10e0f62a78c724b \
--hash=sha256:2cb3dd71fc6be918ad4264346a8ed69485f9b7ed7bf35495d8e22807cd6b8bea \
--hash=sha256:2d1b7d9308288661f56672b1b157d75fc536714d3638487bbea17b6318a78248 \
--hash=sha256:2dad610540cb2e6272855c178f08ae9a1c7ac258a7fb71660553a5f104b42741 \
--hash=sha256:2e5a7cd7fdd14fcb1ae5d7d8bf23d24fbd1daefd1fbca2580132e1ea75f098b5 \
--hash=sha256:2e9ad7dd851bf45fab9f75cbff4cb493fee9979e8d8c7c9c3ee119022518edd6 \
--hash=sha256:340cbb1957ba99929cbf19a75626d36ba1ae21d1730b287d1cf7f824a20c4fc7 \
--hash=sha256:34bdde374c5932765d7dc685c4a1d191a3207852d67e8e0a9eb6ea85156181f1 \
--hash=sha256:353bd63081912ab8cfa6a0c7d185934cdf8426f04c618bba6bc4b394f2069b67 \
--hash=sha256:387d8cd30e69b3f0a72877b9ae717033396404e19095b17fe89753a981fda44f \
--hash=sha256:3882fb412298575bae3b9c46868251f15cc69307359f87bb1b382e53d6e5a2c9 \
--hash=sha256:38fc55594dab834470b6733dead2ee9e3f657fb0608c769dcafa0ba5ab52f45c \
--hash=sha256:396ec4e65cc889f69786b3b89478b471cee5a3bcf468b9d9bb03e1a30fb291fc \
--hash=sha256:39dbacefc411633db5b4378b066a9aca70a3d7e2922c9e578d825f844026eeba \
--hash=sha256:3a93d9616ddecfb393727a0041a562cf0b15a244e20f2bd25efc7949be4c4f17 \
--hash=sha256:3d23795802fc8bd72534836d64489bbf0f67c088959091bdb22e10735a5107bf \
--hash=sha256:434139499bb20b502ed3baa1f169e618f924a97e7a777fea1a49446d80106cf6 \
--hash=sha256:436e3ffc6310d3c41878c601db29098102fe5d8a467c49da4a4125254e0980f2 \
--hash=sha256:489505b03f692c3f376394e49194fa7a7f9e8558d6e293a7056a0032b0c38163 \
--hash=sha256:4a540e2d3192792fc84eced57bef37851ccb2b41f73291bb17408eea77bcd278 \
--hash=sha256:4a7cdc2a420ca01058182da4253329764d4bfa055564d1eced90e6ba1e8b1d3d \
--hash=sha256:4bced6e2a6dba6a28f7dd3c6ce14df1b2dd495923f16ea484cad03decd463b2b \
--hash=sha256:4cf3468d5ec187ffffcaca8e61929a37448f215dafc1386a12c750a72fe53634 \
--hash=sha256:4e2c4809c14559aa7ef426f27fb35afbb38104c349a903bf8f3600456764bb38 \
--hash=sha256:4ed644d75aa94a2baf7ec3a96eaa160ea58c742eb9d27c6506053c5c40fc84ed \
--hash=sha256:4f6e0852a0283b1b1fd776eeb7b766a5f440b3e2bd31ab51af3b400585f3965c \
--hash=sha256:5066b244f576f91afc8ee3ba029a89f99d39c79b1853fe9d39bea9f0afbec148 \
--hash=sha256:5086f9975abb1ab531ee6afca1761e4b59a19b446f3f6522ed776963228cfe5a \
--hash=sha256:50b5bedc9ed8a94fc8857a42ef4f84a81ea88f8d4f05dc8705fb23ee6d8dcca7 \
--hash=sha256:52704c5d36eb6dda8866493decd61111fff86244c9b1ad225ca01b9e91e5970f \
--hash=sha256:55ffd6ce583d97dc71dc92e930324c8c0d25aea7e3ade6ae54ef77cedb096811 \
--hash=sha256:569d65055d367e3dcdf30c3f41119467b73d9ee9faf332bdf40402644f5ac08e \
--hash=sha256:57f9947a7e57a081c1e3e0a2dd0d2dcf290a4531450e6f611e30084c222a7295 \
--hash=sha256:5989cb26b2e1efc6a42216a9f6b5ee495ce5ace2e5b352a9af489976b32d1ee2 \
--hash=sha256:5c22873ad1f0532ba40fa1727f3c0fc1bbbaab6d373d4cbe3f0dc74b2e2521c7 \
--hash=sha256:5e8b3d0b18fd623afa12ecb2ce8d8becef69f9b5440c6330c7972200e0bb84b0 \
--hash=sha256:61631e08084be9e21a8967ec3139c7616ed7c5e9368e05c86d1b39562c8a57b6 \
--hash=sha256:64511c54db4e4987aef4c41923235927428729e8174c5dba488429be70a998ed \
--hash=sha256:6669c1bf34080161ce49c589cc512ef24d4c704ac9d2b2d3667f519c60418378 \
--hash=sha256:672d207103e6b16ca098611b0f9efad6bc00afd47c03d6ef62186495ca677dc0 \
--hash=sha256:6768d67d1bce64270e0fdc2e69309d68b9b18ae56ddf6c711d168e9d051c2cac \
--hash=sha256:6a45c3d514f2436064db00d7fc8778d888f0236ebfed649b53d13a59e69ad51b \
--hash=sha256:6bd9e1788e15bfcf6a9082de42e30387e7b85d211ab21e57a939bb8cfaaf8d96 \
--hash=sha256:6d2a9efe686f9de00d0d1ea32a4a5a86d558a2277501bd78d964214eab625e59 \
--hash=sha256:6da83a088f8ef93b2d483a8232a4dbf4d69d3d8496b568a03c56becac43e1808 \
--hash=sha256:7018d4af1cd272e847aa5917983ab5e83e4f6579f9dbfecd4a79c0ca80b144c2 \
--hash=sha256:71f88e749ea29f67f21f3b36433c1dc54c7729ed2a6d9e2da2e0d9e0d7b224eb \
--hash=sha256:737c9c3981998eba27f11786f84fddcbabc74068b72a4a1f454ea02094b57b65 \
--hash=sha256:73e77980c7207854f00fc4e71fb1626868d5740ab4012623d55c7a99ad122a72 \
--hash=sha256:799c39bdf5e2f1292fedd3009f7b3c9e760f10b2420cb9638d56920840ff6db8 \
--hash=sha256:7a83aa6e4805df46fed18e989d3d16f86ef60cb50bbc8d9ce3a6be89165fbf6e \
--hash=sha256:7d3391b2188d18737cb2fa147028b1096236eaa7e156446c650a489fa2cadc91 \
--hash=sha256:7e1636da3d8dfc220b6dd10264db5f2b165e4888c4518594898fbe381049af8a \
--hash=sha256:805c8b84534fa10891890f0e4be39f3a99e94615d93e8836bf9fa1fdca2feeb2 \
--hash=sha256:811d02d5122171c1941357efd8f9bf4ffe907b7f0a1a4e729a880e4be3f46e3e \
--hash=sha256:8138eb83940ec7299024d92d4dee45f601b9e6c5ffde9d25f4e35e326203c707 \
--hash=sha256:83b3944fea42a8400edf92fd1770fb8d0d4f7de651353bd2d8525a92dba69a21 \
--hash=sha256:849dd2bb0e5e4ab2b71c7191726a4a8d5aa8a610daa584728cbee0b710ddc4ef \
--hash=sha256:8698d70a8081ee8c090dbb394768b5789a1da8b131b5499f89d071dd3cfaf6be \
--hash=sha256:8781a792a070cf2bd1b86d3aa943894115faaba6e88122a7bf32d62072742453 \
--hash=sha256:88d59b473bfb03259722600839af9bbd7fa13a2eb514beefeedb95997882f69a \
--hash=sha256:8909c2f1c6dd65e054ac4b573a91c8384d1492281e55d82d159d653f7a13adf6 \
--hash=sha256:8965520ac587c94a4ac48b729be3d8b8de00af39699b17585dfb599babe77977 \
--hash=sha256:8b5d563170ff8ba3181caa967c99a3c804d1dedb702c7cb93a6a7c32247da978 \
--hash=sha256:8e124f974786f831d6043728e38296969d3579db8896fe004682f5758e613581 \
--hash=sha256:8f0fac8b13d14bb06c68195f849371924ae53dd7b1c00fed24650f704383b692 \
--hash=sha256:9240187afb63d2f9ddc3e032c670356fe941f6e20662ea168a5dc3f1f317e1b3 \
--hash=sha256:925f929d6b59a8b3f8b8c6ac363cd0af7eecc81efb3071770b3c6717c450a369 \
--hash=sha256:9348cbb300d224fe3b89793262cb093504d4ae927004468463f745188a193e4a \
--hash=sha256:9388003072b95f2f1e3fd908604194d653ba21330d811961a78b7da1a77e9e36 \
--hash=sha256:9438a2648b2195980cb2dd8e53ed7b8df91319e2d0b70ae61a9e1d1bc8d3bec9 \
--hash=sha256:94e4c421742086aeee4c32a506eec8859d7634aad943f7e6aacf70f813478768 \
--hash=sha256:94f5407f7bc64fa6463906b896f9904beeeb7dd8dc116ee8e9056c8714ff9916 \
--hash=sha256:971a3bbb75d97ae4e2e8f7d4834236f86f85f0c85e04ab2e191db1123b04f80b \
--hash=sha256:9e227f3dbe6bde7491cf0a9965d00b88c6b1a4a95d11480ddf88bb96d397c19f \
--hash=sha256:9e25feb9e330b63edb0278a0acdf85e50d0cb0fbf49c3084abbe4e24ae195346 \
--hash=sha256:9f098115c247e11d138ab83a28fa0323c77015007ea2df73ba5fd714dfefd67c \
--hash=sha256:a18f38cafc329bac5e3c2b96c765b4c96d3d103421ed22ab7988c1e3fce27464 \
--hash=sha256:a4bbd2d87dd233b9fc5812160c3d0ffbe42edc22a26ce0469f58479ede633fe9 \
--hash=sha256:a5fcffb37e602b0b3c1638a97746b9b96125caa9bcf6fa41d337a9261de231ee \
--hash=sha256:a8e9f292fcda89b324f2f5c91d13f1424a153e40fc2756f38ee23b15835ff300 \
--hash=sha256:a9f54054101545a9a9cccefddf54316aa6e4491611fcbef9e91b3b6bebec04f6 \
--hash=sha256:aa2c838cc024642cc04c6854232f32b43e5e22833dd11119c1766c7873b8370d \
--hash=sha256:ac0c7c9f1609b0c4c114feb1d7a3409564c7fb77e360bed9e97e5d25dfeaf868 \
--hash=sha256:add96447a86d205ab616665d53b2950ee81083757f56e6ea833c8b2917646b46 \
--hash=sha256:ae9dcb8fbe244cb82f8a6458b455b927a03685e383d9bacf1ea5ce180b96dc97 \
--hash=sha256:b4a635a0487774f841cb1fb62e907e7195cc95bc761e053184b8acc3ceb20733 \
--hash=sha256:b4d12837e0203bbace818ff4a7461afdcd78bcd782351cea148139180d7bcffe \
--hash=sha256:b61687d0828e72bf5cda24a2690188f37170bd31c9359ac97e4e66569f120a16 \
--hash=sha256:b807e598953730f82e4eae3bd30f6a122cf6b31c398c6b504c0e04c13c170429 \
--hash=sha256:b8cd1f918b26fd7b1832ece557cc18f2d8747309ff8b3f0ef9d4250c5ad67a39 \
--hash=sha256:b91cc9d336957239ff200f30097e6fea2dc6d6fb3c81e853eaa09eac904fd894 \
--hash=sha256:bd3ce56ae2cbae3ba82b683bc425cd7e48d2ed8b10f3e818186b6f5646d9271c \
--hash=sha256:be6cb0c799abb0e2ba3e618e6d28ddddf7e485f6c2ce938dfa237daf3905072c \
--hash=sha256:befb4158af32106b9a93db8d6d1d1cbbd418c0d5aca0cabb7b1780abf0c89169 \
--hash=sha256:bf053da3c97a4bc5ecfbb218cdd2983febd91c617be8367d139882aa11e490aa \
--hash=sha256:c02e8f18bdedba082cef725942ac823b9b60656db07f7e265cb31618dfd00d77 \
--hash=sha256:c1bc67752d5f21013cfe430df4062441714eab79f65a6a05e01505957e9c35fe \
--hash=sha256:c61750fadcd119d0825bcb7d7d675dd264dcc89cc05292aab5be68ebdbb374ad \
--hash=sha256:c90d5b3d4e944e065a301d741b3c1d784f6bd1f503aa68b4967e32b2ba313d85 \
--hash=sha256:c9a7f43c0b202b334cc9184af09bb8f21d3a209e038efaf106936fb69e6b026e \
--hash=sha256:cb96e6e088d6cf71c1ea977510948320234824cf226e32f6f6e044f7a9c82b34 \
--hash=sha256:cf63c214fe879a65e69a386f915e36104fc84254ab141240f8854602d8e0be2a \
--hash=sha256:d1aca03ede943eb80ab3d63bb082c84b7aab85ea83bd0fd0c200260945fb49d9 \
--hash=sha256:d2e56fd3b00222722abfb3f5f0759ddbae4b90811b5ad4343c64030ad1bde70c \
--hash=sha256:d5f93ebbeb8032d47e349328ec8662d973d9b05a70b3c35df1f91fe419b84749 \
--hash=sha256:d882a373d8093c2941e01291b7ced96e9cbe4781da9a7751ca7e6c70385e5214 \
--hash=sha256:d920abdfa61279ba1a2ef9484aab07bf03331f8c08a10120fa332353d06e6932 \
--hash=sha256:da2af0d7aebfc2074080d72efa6ab8317c62481ef1f896f65d9999c1c01f4494 \
--hash=sha256:dd8ea6ebee7aedbf7c749fa80521d9ccf1ba473e0d1e14805caafbaad281c889 \
--hash=sha256:de8b364c423ef0a4bad9069657d617f9a5d2b2062457a89b1fa16ee199c399c1 \
--hash=sha256:df1ae86ff54725a01fa1a0510b914ca53a161b7050be74f6204e24aded5971d0 \
--hash=sha256:dff05cb7016dff1e9fd68f4122c127b65dfc59de5306cfb7ad92f956f230bee2 \
--hash=sha256:e1a622f13970d81f95d0c72f9dc090dce9085fccfa4c9f2174377ee32bd15786 \
--hash=sha256:e49fb0d1ce92cfa0cb198cc5b1b11cdf9d0638658e2a2db2687e39db7c87fc78 \
--hash=sha256:e5c802729725bd07e2bc3ab7b76dc7e0bbfc53129d8f1eb1c002c24cf774717e \
--hash=sha256:e841068dc0be4cb6dfb5c890eb88cbdcff2f4a332393c7ec94e8e618bd32c1a8 \
--hash=sha256:e916035e3e9930cbdfdd10abf48861340221857f45509565898e012263f7b289 \
--hash=sha256:eba154571c16e032112afac0dc2dfe9e63c2ceb7aedd07bb7eecf2ce26d4dd4c \
--hash=sha256:f03460ff076f70ab595bb45a0205ccea1971443575b6920c52e755dec2b3fbfe \
--hash=sha256:f0ec3b750b59375eab5b0fb2b9254810c00a3375be6d789899f1055a1d556237 \
--hash=sha256:f291bcf42ae98eb5107edb162c3c998b4a89648fd8e99ed4cbd12705292788cd \
--hash=sha256:f61efe1d2fe0de16158a5fe1d1cf3c14bdb6aecd54d8938fd26512c525c1f624 \
--hash=sha256:f68edfc67aabac33708941f26f22a7b8e9f81429bc0cf249fcf7d66b23af8d19 \
--hash=sha256:fa95848c929b6a75f6848d3c9793e59db365ee436776e57db835cdbfa79ba977 \
--hash=sha256:fd9f8797427910198f95bced71ddfed61130d7e349213bfb8466c9c99e2c46a8 \
--hash=sha256:fdb4ca07ab75ffadab4a8b135ad59cdbb3156b99310f3d565370da74a15d6bd3
# via
# flask
# jinja2
# werkzeug
packaging==26.3 \
--hash=sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79 \
--hash=sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c
# via gunicorn
werkzeug==3.1.9 \
--hash=sha256:55ca7c70a75689be937aa27f8ff4b018f06ff4838fc73045560bf0f5a1291060 \
--hash=sha256:6392e50c78460ba618e5b21f08a71f59c99ce99cdc6cf6e3dd7e6ccca8754fab
# via flask
+31
View File
@@ -0,0 +1,31 @@
import unittest
from app import app, total_price
class PricingTests(unittest.TestCase):
def setUp(self):
self.client = app.test_client()
def test_price(self):
self.assertEqual(total_price(3), 36)
response = self.client.get("/price?quantity=3")
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json["total"], 36)
def test_bulk_discount(self):
self.assertEqual(total_price(9), 108)
self.assertEqual(total_price(10), 108.0)
r = self.client.get("/price?quantity=12")
self.assertEqual(r.json["total"], 129.6)
def test_invalid_quantity(self):
for value in ["0", "-1", "1001", "abc", "1.5"]:
self.assertEqual(self.client.get("/price?quantity=" + value).status_code, 400)
def test_release_identity(self):
self.assertEqual(self.client.get("/").json["version"], "v3")
self.assertEqual(self.client.get("/health").json["status"], "ok")
if __name__ == "__main__":
unittest.main()
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# Post a commit status to Gitea so branch protection sees the Jenkins result.
# Usage: gitea_status.sh <pending|success|failure|error> "<description>"
# Needs GITEA_TOKEN (Jenkins credential), COMMIT and BUILD_URL in the environment.
set -euo pipefail
state="$1"; desc="$2"
curl -fsS --max-time 15 -o /dev/null -X POST \
-H "Authorization: token ${GITEA_TOKEN}" -H "Content-Type: application/json" \
-d "{\"state\":\"${state}\",\"context\":\"continuous-integration/jenkins\",\"description\":\"${desc}\",\"target_url\":\"${BUILD_URL}\"}" \
"https://git.ssw590.abrdns.com/api/v1/repos/StartupTeam/Strartup-product/statuses/${COMMIT}"
echo "Gitea status ${state}: ${desc}"
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Smoke-test a deployed release through its public HTTPS URL, using a release record.
# Usage: pricing/ci/smoke.sh pricing/releases/v1-staging.yml
set -euo pipefail
record="$1"
val() { awk -v k="$1:" '$1 == k { print $2 }' "$record"; }
url="$(val public_url)"; version="$(val expected_version)"
commit="$(val expected_commit)"; total="$(val expected_total)"
echo "Smoke test $url at $(date -u +%Y-%m-%dT%H:%M:%SZ): expect $version $commit total $total"
health="$(curl -fsS --max-time 10 "$url/health")"
identity="$(curl -fsS --max-time 10 "$url/")"
price="$(curl -fsS --max-time 10 "$url/price?quantity=3")"
bad="$(curl -s -o /dev/null -w '%{http_code}' --max-time 10 "$url/price?quantity=0")"
echo "GET /health -> $health"
echo "GET / -> $identity"
echo "GET /price?quantity=3 -> $price"
echo "GET /price?quantity=0 -> HTTP $bad"
python3 - "$health" "$identity" "$price" "$bad" "$version" "$commit" "$total" <<'EOF'
import json, sys
health, identity, price = (json.loads(x) for x in sys.argv[1:4])
bad, version, commit, total = sys.argv[4:8]
assert health["status"] == "ok", "health"
assert identity["version"] == version, f"version {identity['version']} != {version}"
assert identity["commit"] == commit, f"commit {identity['commit']} != {commit}"
assert int(price["total"]) == int(total), f"total {price['total']} != {total}"
assert bad == "400", f"invalid input returned {bad}"
print("SMOKE PASS")
EOF
+46
View File
@@ -0,0 +1,46 @@
#!/usr/bin/env python3
"""Write the staging and production release records for one published image.
Inputs: pricing/app/app.py (version, unit price), reports/image-digest.txt,
and the Jenkins environment (COMMIT, BUILD_URL, STAGING_URL, PROD_URL, PROXY_NET).
Outputs: pricing/releases/<version>-staging.yml and <version>-production.yml.
The records hold metadata only, never credentials.
"""
import datetime
import os
import pathlib
import re
import sys
src = pathlib.Path("pricing/app/app.py").read_text()
version = re.search(r'^VERSION = "(v\d+)"', src, re.M).group(1)
unit_price = int(re.search(r"^UNIT_PRICE = (\d+)", src, re.M).group(1))
image = pathlib.Path("reports/image-digest.txt").read_text().strip()
if "@sha256:" not in image:
sys.exit(f"not a registry digest reference: {image!r}")
commit = os.environ["COMMIT"]
if not re.fullmatch(r"[0-9a-f]{40}", commit):
sys.exit(f"not a full commit hash: {commit!r}")
now = datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
for env, url in (("staging", os.environ["STAGING_URL"]), ("production", os.environ["PROD_URL"])):
record = (
f"# Release record: {version} {env}. Metadata only; no credentials.\n"
f"target_env: {env}\n"
f"release_image: {image}\n"
f"expected_version: {version}\n"
f"expected_commit: {commit}\n"
f"expected_total: {unit_price * 3}\n"
f"public_url: {url}\n"
f"proxy_network: {os.environ['PROXY_NET']}\n"
f"config_commit: {commit}\n"
f"jenkins_build: {os.environ['BUILD_URL']}\n"
f"recorded_at: {now}\n"
)
path = pathlib.Path(f"pricing/releases/{version}-{env}.yml")
path.write_text(record)
print(f"--- {path}\n{record}")
pathlib.Path("reports/release.env").write_text(
f"APP_VERSION={version}\nEXPECTED_TOTAL={unit_price * 3}\nDIGEST_REF={image}\n"
)
+27
View File
@@ -0,0 +1,27 @@
# Builds the per-release documentation without touching the host:
# 1) Pyreverse (Pylint) + Graphviz draw class and module diagrams from the source code
# 2) pdflatex compiles release-notes.tex with the version, commit, test log, and diagrams
# 3) the "out" stage holds only the results; Jenkins exports it with --output type=local
# Context: pricing/ Usage: see the "Docs: architecture + LaTeX" stage in pricing/Jenkinsfile
FROM python:3.13-slim@sha256:e48f59cdba69a3cbd9ed2cf0f348d90d45a8d350d98134cf1070bc106ee9ed90 AS uml
RUN apt-get update && apt-get install -y --no-install-recommends graphviz \
&& rm -rf /var/lib/apt/lists/* && pip install --no-cache-dir pylint==3.3.7
WORKDIR /src
COPY app/app.py app/test_app.py ./app/
RUN mkdir -p /out && pyreverse -o png -p pricing -d /out app/app.py app/test_app.py
FROM debian:trixie-slim AS tex
RUN apt-get update && apt-get install -y --no-install-recommends \
texlive-latex-base texlive-latex-recommended \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /doc
ARG SEMVER=0.0.0 COMMIT=unknown BRANCH=unknown BUILD_URL=unknown BUILD_DATE=unknown
COPY docs/release-notes.tex docs/unittest.log ./
COPY --from=uml /out/ ./
RUN sed -i -e "s|@SEMVER@|${SEMVER}|g" -e "s|@COMMIT@|${COMMIT}|g" -e "s|@BRANCH@|${BRANCH}|g" \
-e "s|@BUILD_URL@|${BUILD_URL}|g" -e "s|@DATE@|${BUILD_DATE}|g" release-notes.tex \
&& pdflatex -interaction=nonstopmode -halt-on-error release-notes.tex >/dev/null \
&& pdflatex -interaction=nonstopmode -halt-on-error release-notes.tex | tail -2
FROM scratch AS out
COPY --from=tex /doc/release-notes.pdf /doc/classes_pricing.png /doc/packages_pricing.png /
+5
View File
@@ -0,0 +1,5 @@
*
!app/app.py
!app/test_app.py
!docs/release-notes.tex
!docs/unittest.log
+32
View File
@@ -0,0 +1,32 @@
% Release notes for one pipeline build. Placeholders @...@ are filled by docs/Dockerfile.
\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{verbatim}
\usepackage{hyperref}
\title{Startup Pricing Service --- Release Notes \\ \large Version @SEMVER@}
\author{SSW 590 StartupTeam (generated by Jenkins)}
\date{@DATE@}
\begin{document}
\maketitle
\section*{Build}
\begin{tabular}{ll}
\hline
Semantic version & \texttt{@SEMVER@} (major.minor.changelist; changelist = Jenkins build number) \\
Source commit & \texttt{@COMMIT@} \\
Branch & \texttt{@BRANCH@} \\
Jenkins build & \url{@BUILD_URL@} \\
Container image & \texttt{git.ssw590.abrdns.com/startupteam/pricing:@SEMVER@} \\
\hline
\end{tabular}
\section*{Automated test results}
\small\verbatiminput{unittest.log}\normalsize
\section*{Architecture (generated from source by Pyreverse)}
\begin{center}
\includegraphics[width=0.6\linewidth,height=0.3\textheight,keepaspectratio]{classes_pricing.png}\\[1ex]
Class diagram of \texttt{app} and \texttt{test\_app}
\vspace{2ex}
\includegraphics[width=0.3\linewidth,keepaspectratio]{packages_pricing.png}\\[1ex]
Module (package) dependency diagram
\end{center}
\end{document}
+8
View File
@@ -0,0 +1,8 @@
# Copy to a release-specific file and replace EVERY placeholder.
target_env: staging
release_image: gitea.example.edu/team/pricing@sha256:REPLACE_DIGEST
expected_version: v1
expected_commit: REPLACE_FULL_GIT_COMMIT
expected_total: 30
public_url: https://staging.example.edu
proxy_network: REPLACE_EXISTING_PROXY_NETWORK
+14
View File
@@ -0,0 +1,14 @@
# Release record: v1 production. Metadata only; no credentials.
# Corrected 2026-11-12: the original v1 image (sha256:3c0d12eb..., Jenkins #7) was overwritten in
# the registry when Jenkins #10 rebuilt the same commit and re-pushed the same tag. This digest is
# that rebuild of the same reviewed source commit; it passed every gate and the staging smoke test in #10.
target_env: production
release_image: git.ssw590.abrdns.com/startupteam/pricing@sha256:d4d894df4634b088e6d52cbae2128510a05d0e4e1d972f4d64ba959423c07c97
expected_version: v1
expected_commit: d4c012560d5096f399224d5b5f6516a5cb2158a4
expected_total: 30
public_url: https://app.ssw590.abrdns.com
proxy_network: startup_private
config_commit: d4c012560d5096f399224d5b5f6516a5cb2158a4
jenkins_build: https://ci.ssw590.abrdns.com/job/pricing-delivery/10/
recorded_at: 2026-11-12, see Jenkins #10
+14
View File
@@ -0,0 +1,14 @@
# Release record: v1 staging. Metadata only; no credentials.
# Corrected 2026-11-12: the original v1 image (sha256:3c0d12eb..., Jenkins #7) was overwritten in
# the registry when Jenkins #10 rebuilt the same commit and re-pushed the same tag. This digest is
# that rebuild of the same reviewed source commit; it passed every gate and the staging smoke test in #10.
target_env: staging
release_image: git.ssw590.abrdns.com/startupteam/pricing@sha256:d4d894df4634b088e6d52cbae2128510a05d0e4e1d972f4d64ba959423c07c97
expected_version: v1
expected_commit: d4c012560d5096f399224d5b5f6516a5cb2158a4
expected_total: 30
public_url: https://staging.ssw590.abrdns.com
proxy_network: startup_private
config_commit: d4c012560d5096f399224d5b5f6516a5cb2158a4
jenkins_build: https://ci.ssw590.abrdns.com/job/pricing-delivery/10/
recorded_at: 2026-11-12, see Jenkins #10
+11
View File
@@ -0,0 +1,11 @@
# Release record: v2 production. Metadata only; no credentials.
target_env: production
release_image: git.ssw590.abrdns.com/startupteam/pricing@sha256:adf58a4abcb03be98cce394d5fde1794ae77525d2e1882a8be3c59c8c3556d92
expected_version: v2
expected_commit: 0465bde4017a3d1f9e3b523dcdc065154789cad7
expected_total: 36
public_url: https://app.ssw590.abrdns.com
proxy_network: startup_private
config_commit: 0465bde4017a3d1f9e3b523dcdc065154789cad7
jenkins_build: https://ci.ssw590.abrdns.com/job/pricing-delivery/11/
recorded_at: 2026-11-12, see Jenkins #11
+11
View File
@@ -0,0 +1,11 @@
# Release record: v2 staging. Metadata only; no credentials.
target_env: staging
release_image: git.ssw590.abrdns.com/startupteam/pricing@sha256:adf58a4abcb03be98cce394d5fde1794ae77525d2e1882a8be3c59c8c3556d92
expected_version: v2
expected_commit: 0465bde4017a3d1f9e3b523dcdc065154789cad7
expected_total: 36
public_url: https://staging.ssw590.abrdns.com
proxy_network: startup_private
config_commit: 0465bde4017a3d1f9e3b523dcdc065154789cad7
jenkins_build: https://ci.ssw590.abrdns.com/job/pricing-delivery/11/
recorded_at: 2026-11-12, see Jenkins #11
+56
View File
@@ -0,0 +1,56 @@
# Time-limited exceptions to the image-scan gate (HIGH/CRITICAL blocks the release).
# Policy (pricing/README.md, "Security gate policy"):
# * Only findings with NO fixed version in Debian 13 may be listed here, each with a statement.
# * Every entry expires; after expiry the gate fails again until the finding is re-triaged.
# * Fixable findings are fixed (see app/Dockerfile), never listed here.
# Triage: SB, 2026-11-12, from Jenkins pricing-delivery #1 (image 12621da), Trivy 0.69.3.
# Compensating controls for all entries: the service runs as UID 10001, read-only root FS,
# cap_drop ALL, no-new-privileges, no shell access path, no host mounts, private network only.
# Approval: requested from the instructor as a time-limited exception (Chapter 6.4.5).
vulnerabilities:
# util-linux family (bsdutils, libblkid1, liblastlog2-2, libmount1, libsmartcols1, libuuid1,
# login, mount, util-linux): mount helpers / nsenter. Not invoked by the service; mounting
# and nsenter need privileges the container does not have.
- id: CVE-2026-76642
statement: "util-linux mount post-hooks; status affected, no Debian 13 fix; mount not used, no CAP_SYS_ADMIN"
expired_at: 2026-12-15
- id: CVE-2026-78408
statement: "util-linux nsenter cgroup; status affected, no fix; nsenter not used, all capabilities dropped"
expired_at: 2026-12-15
- id: CVE-2026-78409
statement: "util-linux X-mount.subdir; status affected, no fix; mount not used"
expired_at: 2026-12-15
- id: CVE-2026-78410
statement: "util-linux restricted bind mounts; status affected, no fix; mount not used"
expired_at: 2026-12-15
- id: CVE-2026-54369
statement: "libacl symlink traversal; status affected, no fix; app does not call ACL functions, read-only FS"
expired_at: 2026-12-15
- id: CVE-2025-69720
statement: "ncurses buffer overflow; status affected, no fix; no terminal UI in the service"
expired_at: 2026-12-15
- id: CVE-2026-119373
statement: "sqlite FTS5 DoS; status affected, no fix; the service does not use sqlite"
expired_at: 2026-12-15
- id: CVE-2026-119374
statement: "sqlite FTS5 corrupted index; status affected, no fix; the service does not use sqlite"
expired_at: 2026-12-15
- id: CVE-2026-119379
statement: "sqlite session changesets; status affected, no fix; the service does not use sqlite"
expired_at: 2026-12-15
- id: CVE-2026-16742
statement: "systemd-homed (libsystemd0, libudev1); status affected, no fix; no systemd in the container"
expired_at: 2026-12-15
- id: CVE-2026-9538
statement: "perl Archive::Tar DoS (perl-base); Debian status fix_deferred; perl not used by the service"
expired_at: 2026-12-15
# Triage: SB, 2026-11-30, from Jenkins pricing-delivery #20 (branch feature/zammad-support), Trivy 0.69.3.
# OpenSSL (libssl3t64, openssl, openssl-provider-legacy): QUIC-only denial-of-service bugs.
# Debian status fix_deferred (no fixed version). The service speaks plain HTTP/1.1 (gunicorn)
# on a private network behind Caddy and never opens a QUIC connection.
- id: CVE-2026-107494
statement: "OpenSSL QUIC unbounded frame queueing DoS; Debian fix_deferred, no fix; service does not use QUIC"
expired_at: 2026-12-15
- id: CVE-2026-124709
statement: "OpenSSL QUIC stream memory leak DoS; Debian fix_deferred, no fix; service does not use QUIC"
expired_at: 2026-12-15
+3
View File
@@ -0,0 +1,3 @@
support.ssw590.abrdns.com {
reverse_proxy zammad-nginx:8080
}
+28
View File
@@ -0,0 +1,28 @@
# Zammad support desk (Chapter 7)
Upstream: https://github.com/zammad/zammad-docker-compose at commit 67141451b6239190f7a616231bff20b8b0ccbd8a (detached).
Droplet path: /root/dos-support/zammad-docker-compose (Compose project `dos-support`).
Images: ghcr.io/zammad/zammad:7.3.0-0011, elasticsearch:9.5.7, postgres:17.12-alpine, redis:8.12-alpine, memcached:1.6.45-alpine.
Scenario: scenarios/add-external-network-to-nginx.yml; only zammad-nginx joins `startup_private`; no host ports published.
URL: https://support.ssw590.abrdns.com (Caddy route in Caddyfile.support; TLS by Caddy/Let's Encrypt).
## Files here
- env.example: the real .env with passwords replaced (real file: mode 600 on the droplet, never committed)
- Caddyfile.support: block appended to /opt/startup/Caddyfile
- sysctl-99-zammad.conf: /etc/sysctl.d/99-zammad.conf (Elasticsearch prerequisite)
## Operate (run in /root/dos-support/zammad-docker-compose)
- status: docker compose ps -a
- start / stop: docker compose up -d / docker compose stop
- restart web only: docker compose restart zammad-nginx
- NEVER: docker compose down -v (deletes the named volumes)
## Data and backups
Volumes: dos-support_postgresql-data, dos-support_elasticsearch-data, dos-support_redis-data, dos-support_zammad-storage, dos-support_zammad-backup.
zammad-backup writes <timestamp>_zammad_db.psql.gz and <timestamp>_zammad_files.tar.gz to the zammad-backup volume daily (BACKUP_TIME 03:00 container time, HOLD_DAYS 10).
One-off backup: docker compose run --rm --env BACKUP_ONCE=true zammad-backup
Restore: follow the Zammad "Backup & Restore (Docker)" guide for this release (copy the .gz files to /var/tmp/zammad/restore, start the stack, rebuild the search index). Backups stay on the droplet; they are not off-site.
## Monitoring
https://support.ssw590.abrdns.com/ is a target of the existing `https` blackbox job (monitoring/prometheus/prometheus.yml); panels 8-10 in monitoring/grafana/dashboards/ssw590-ops.json.
Tracking: issue #22, Zammad ticket #78003.
+15
View File
@@ -0,0 +1,15 @@
COMPOSE_PROJECT_NAME=dos-support
COMPOSE_FILE=docker-compose.yml:scenarios/add-external-network-to-nginx.yml
ZAMMAD_NGINX_EXTERNAL_NETWORK=startup_private
ZAMMAD_FQDN=support.ssw590.abrdns.com
ZAMMAD_HTTP_TYPE=https
NGINX_SERVER_SCHEME=https
RAILS_TRUSTED_PROXIES=172.18.0.6
VERSION=7.3.0-0011
ELASTICSEARCH_VERSION=9.5.7
MEMCACHE_VERSION=1.6.45-alpine
REDIS_VERSION=8.12-alpine
POSTGRES_VERSION=17.12-alpine
POSTGRES_PASS=CHANGE_ME_openssl_rand_hex_24
POSTGRES_SUPERUSER_PASS=CHANGE_ME_openssl_rand_hex_24
ELASTICSEARCH_PASS=CHANGE_ME_openssl_rand_hex_24
+1
View File
@@ -0,0 +1 @@
vm.max_map_count=262144