Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d1996c0ab | ||
|
|
34c4c7488a | ||
|
|
11270cfced | ||
|
|
249488d6fc | ||
|
|
336eaaefa7 | ||
|
|
b6cf080618 | ||
|
|
d3a5e6bc73 | ||
|
|
9b0dc4dc52 | ||
|
|
d54d801020 | ||
|
|
ac18f11186 | ||
|
|
6152f4777b | ||
|
|
34bd5e6146 | ||
|
|
92bc9545e2 | ||
|
|
e4f3ce5dfb | ||
|
|
1149e9fbc3 | ||
|
|
420ba4c56b | ||
|
|
9381d2aa9a | ||
|
|
52b297c2f3 | ||
|
|
ad35197ee4 |
@@ -91,5 +91,7 @@ Thumbs.db
|
||||
*.key
|
||||
secrets.*
|
||||
|
||||
# Source images, the reference template, and the reviewed root submission PDF
|
||||
# are intentionally not ignored.
|
||||
# Source images and the reference template remain versioned.
|
||||
# Local manual builds replace one deliverable; do not commit generated PDFs.
|
||||
/manual/2026F-SSW-590-DevOps-Group-1.pdf
|
||||
/manual/latex/devopsAssignment.pdf
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
pipeline {
|
||||
agent any
|
||||
options { skipDefaultCheckout() }
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps { checkout scm }
|
||||
}
|
||||
stage('Syntax check') {
|
||||
steps { sh 'python3 -m py_compile pricing.py' }
|
||||
}
|
||||
stage('Test') {
|
||||
steps { sh 'python3 -m unittest discover -s tests -v' }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
# Jenkins plugin and pipeline capacity experiment
|
||||
|
||||
Prepared for Vincent Sun and Billy Ye on October 21, 2026. This disposable test
|
||||
passed locally in Docker Desktop; it has NOT run on The-Ocean and is not the
|
||||
Assignment 6 deployment. See `VALIDATION.md` for the evidence and limitations.
|
||||
|
||||
## The question we are answering
|
||||
|
||||
Can The-Ocean's existing 512 MB plan run the Jenkins features we need, together
|
||||
with Gitea, under the limits used in the earlier core-only experiment?
|
||||
|
||||
Jenkins core is the base server. Plugins add features to it. Pipeline supplies
|
||||
the job execution engine and steps; the Gitea connector supplies integration
|
||||
with Gitea. A plugin can download successfully but fail to load because of
|
||||
incompatible dependencies or insufficient memory. Loading successfully also
|
||||
does not prove that a build can run. We check these separately.
|
||||
|
||||
The previous core-only experiment started Jenkins, but its final accounting
|
||||
included about 212 MiB swap as well as 80 MiB RAM. Its raw 60-second PASS was
|
||||
qualified because the successful HTTP samples spanned only 54 seconds.
|
||||
|
||||
## What, why and how
|
||||
|
||||
| Check | Why it matters | How we test / pass criterion |
|
||||
|---|---|---|
|
||||
| Fresh baseline | Yesterday's resources may differ today | Correct hostname/root session, available RAM >=128 MiB, swap free >=512 MiB, enough Docker disk, unused test port, Gitea HTTP 200 |
|
||||
| Prepare plugins on the laptop | Catalog processing exceeded the old 128 MiB installer heap locally | Official installer resolves the selected plugins in a separate laptop container with 768 MiB RAM / 512 MiB heap; exact roots, all resolved versions and archive hashes recorded |
|
||||
| Tools and plugin installation on the target | The useful system needs more than Jenkins core | In a fresh capped container, install Python/Git and copy the verified prepared archives; inspect the installed versions before Jenkins starts |
|
||||
| Plugin loading | Files on disk are not evidence that Jenkins loaded them | After initialization, verify requested plugins at expected versions, every installed plugin active and no failed-plugin entries |
|
||||
| Healthy idle | A momentary login response is too weak | HTTP `/login` returns 200 over >=60 seconds of sampled observations AFTER initialization and plugin verification; any failed probe resets the clock |
|
||||
| Passing pipeline | Exercise actual execution and unit tests | One executor runs dependency checks, a fresh local fixture, Python syntax checking and two unit tests; Jenkins reports SUCCESS |
|
||||
| Controlled failure | Prove the tests actually detect a defect | Change multiplication to addition only in the disposable workspace; Jenkins reports FAILURE and console proves the intended `13 != 30` assertion, not an unrelated infrastructure error |
|
||||
| Repair | Prove recovery works without restarting the service | Recreate the original fixture in a fresh workspace on the same job; the two tests run and Jenkins reports SUCCESS |
|
||||
| Shared-host protection | Jenkins must not consume all the host's resources | Repeatedly check host available RAM/free swap, Gitea HTTP 200, container RAM/swap, CPU throttling and OOM counters; abort on guard failure |
|
||||
| Cleanup | Leave existing coursework services intact | Remove only this owner-labelled test container and its anonymous home volume; preserve evidence and the base image; check Gitea afterward |
|
||||
|
||||
This is a small selected plugin set, not the smallest theoretically possible
|
||||
dependency graph. `workflow-aggregator` is a suite, so two requested IDs will
|
||||
produce more than two installed plugins. The current root requests are:
|
||||
|
||||
```text
|
||||
workflow-aggregator:608.v67378e9d3db_1
|
||||
gitea:286.v0740a_413c1eb_
|
||||
```
|
||||
|
||||
The prepared local bundle contains 59 plugin archives (45,336,313 bytes). Two
|
||||
requested features therefore do not mean two loaded files. The official plugin
|
||||
pages checked October 21 list minimum Jenkins versions
|
||||
2.479.3 and 2.528.3 respectively, below the recorded 2.580.1 core. That baseline
|
||||
comparison is only a preliminary check; dependency resolution and actual loading
|
||||
are still tested. Laptop preparation uses the official bundled `jenkins-plugin-cli`.
|
||||
Current dependencies are resolved (`--latest true`) rather than deliberately
|
||||
installing the old aggregator's minimum dependency versions. Requested roots
|
||||
are checked for an exact match; every resolved archive version and SHA-256 goes
|
||||
into the prepared `manifest.json`, with a full `plugins.lock` beside it. The
|
||||
target verifies the hashes before starting Docker, then inventories the copied
|
||||
archives again as `plugins-resolved.json` / `plugins-resolved.lock`.
|
||||
Keep installer security warnings visible in prepared `installer.txt` and review them before
|
||||
any real deployment. No flag hides warnings or skips failed plugins.
|
||||
|
||||
New dependency preparation and Debian package versions can change between runs.
|
||||
Reusing the SAME prepared bundle fixes the plugin archives and hashes for the
|
||||
target comparison; Python/Git apt versions remain recorded, not fully locked.
|
||||
Retain the lock file/hashes and package-version output. Do not silently
|
||||
substitute a different image/plugin set and compare it as the same experiment.
|
||||
|
||||
## Isolation and resource limits
|
||||
|
||||
- Same official core image tag as before, now also pinned to its recorded digest:
|
||||
`jenkins/jenkins:2.580.1-jdk21@sha256:a660310e39ade10631f774bacd5219de767dfd08947ea5c32a739b5e5bb382c1`.
|
||||
- 256 MiB container RAM; 512 MiB combined RAM plus swap, allowing up to 256 MiB
|
||||
container swap. Half one CPU, 256 processes, Java heap 32-128 MiB and Serial GC.
|
||||
- These target limits cover Python/Git installation, copying the prepared
|
||||
plugins, AND Jenkins/Python pipeline runtime. Plugin catalog resolution and
|
||||
downloads are a SEPARATE laptop-only preparation: 768 MiB RAM, 1 GiB combined
|
||||
RAM+swap, 512 MiB Java heap, one CPU, no service port, fifteen-minute timeout.
|
||||
Those preparation limits are not proposed for the 512 MB droplet. The base-image
|
||||
pull is also separate, reused if cached, and bounded to five minutes.
|
||||
- Existing host swap, packages, proxy, firewall, Gitea data and containers are
|
||||
not changed. The installer runs as root inside the temporary container only;
|
||||
the Jenkins process and its builds then run as the container's `jenkins` user.
|
||||
- Only this source directory and the prepared plugin directory are mounted,
|
||||
both read-only. No Docker socket, real
|
||||
credential, runner registration, production checkout or existing Jenkins home.
|
||||
- Only `127.0.0.1:18080` is published. Nothing is attached to Caddy or a public
|
||||
Jenkins hostname. The disposable instance has authentication enabled and
|
||||
anonymous read disabled. Its random test-account password is generated inside
|
||||
Jenkins, never printed/read/exported, and discarded with the temporary home.
|
||||
Setup-wizard automation is specific to this disposable instance.
|
||||
- One built-in executor runs only this reviewed local fixture. This is an explicit
|
||||
capacity-test choice, not approval to run arbitrary PR code on a production
|
||||
controller. No separate agent is tested here.
|
||||
- A sampled host floor of 48 MiB available RAM or 128 MiB free swap aborts the
|
||||
run; any sampled Gitea non-200, container OOM event or unexpected exit also
|
||||
aborts. These are sampled best-effort guards, not a guarantee that Gitea can
|
||||
never be affected between probes. A failed health request alone does not
|
||||
establish that Jenkins caused the failure.
|
||||
- Installation timeout: 20 minutes. Startup/idle timeout: 15 minutes. Pipeline
|
||||
phase: 10 minutes; each build has a three-minute outer wait. Overall: 45 minutes.
|
||||
A detached watchdog attempts targeted cleanup after 46 minutes if SSH drops.
|
||||
Normal interruption also runs cleanup. Check `cleanup_ok` and inspect leftovers
|
||||
after machine/Docker failure; no script can guarantee cleanup of a stopped host.
|
||||
- Requires Linux cgroup v2, Docker, Python 3.8+ on the HOST and root on The-Ocean.
|
||||
Ubuntu 24.04 normally provides Python, but the preflight must confirm it.
|
||||
|
||||
The explicit Windows `--local-smoke-test` mode applies the same CONTAINER runtime
|
||||
limits but does not run the droplet host RAM/swap/disk guards or Gitea checks.
|
||||
Those fields are recorded as null, not invented measurements. Docker Desktop's
|
||||
VM has different resources and does not host the real Gitea service, so local
|
||||
success does not answer whether Jenkins and Gitea can share the droplet.
|
||||
|
||||
The experiment adds no cloud instance, subscription or resize. It uses the team's
|
||||
existing droplet, disk and ordinary package/plugin/image download traffic; provider
|
||||
transfer billing, if applicable, remains subject to the existing account plan.
|
||||
Vincent/Billy own execution and cleanup. No maintenance/reboot is performed.
|
||||
|
||||
## Run when SSH access is restored
|
||||
|
||||
For the local regression checks only, run `python ci/jenkins-capacity/test_harness.py`
|
||||
from the repository on Windows, or use `python3` on Linux. These standard-library
|
||||
tests need no Docker or cloud access and do not launch Jenkins. They cannot
|
||||
replace the real experiment below.
|
||||
|
||||
First collect/review the baseline as discussed. This script intentionally refuses
|
||||
the `--run-on-the-ocean` option on Vincent's laptop or a differently named host.
|
||||
Do not change that guard to obtain a false droplet PASS. Docker Desktop is not
|
||||
needed to upload/run the PREPARED package; Docker on the droplet is needed.
|
||||
|
||||
Use the prepared ZIP, which includes a `jenkins-capacity` directory with its
|
||||
`prepared-plugins` subdirectory. Extract it to a new task-local folder. From
|
||||
**PowerShell in the extracted ZIP's parent folder**:
|
||||
|
||||
```powershell
|
||||
scp -i "$env:USERPROFILE\.ssh\digitalocean" -r .\jenkins-capacity root@147.182.178.136:/root/ssw590-plugin-test
|
||||
ssh -i "$env:USERPROFILE\.ssh\digitalocean" root@147.182.178.136
|
||||
```
|
||||
|
||||
The SCP command assumes `/root/ssw590-plugin-test` does not already exist. If it
|
||||
does, inspect its contents before copying; SCP may nest the source directory.
|
||||
Upload the whole directory, not only `run_test.py`. Billy uses his own trusted
|
||||
SSH key, not Vincent's key path.
|
||||
|
||||
Then **inside the droplet's Linux terminal**:
|
||||
|
||||
```sh
|
||||
cd /root/ssw590-plugin-test
|
||||
python3 --version
|
||||
python3 run_test.py --help
|
||||
python3 run_test.py --run-on-the-ocean
|
||||
```
|
||||
|
||||
Expect progress lines naming `tools`, `plugins`, `startup/ready`, and
|
||||
`startup/pipelines`, followed by `result.json` and the evidence path. During
|
||||
installation, Jenkins HTTP is reported as 0 because Jenkins has not started;
|
||||
Gitea should remain 200. You can stop with Ctrl+C; let cleanup finish.
|
||||
|
||||
Evidence goes under `/root/ssw590-capacity-evidence/plugins-<UTC>-<PID>/`.
|
||||
Download that exact printed directory with SCP for review. It contains baseline,
|
||||
input hashes, base-image identity, resource samples, checkpoint duration, resolved
|
||||
plugins, controlled build logs, final state and result. It deliberately excludes
|
||||
raw Jenkins controller logs, the credential-bearing home and private keys.
|
||||
|
||||
For a NEW bundle from source on Windows (not needed to use the packaged one):
|
||||
|
||||
```powershell
|
||||
python ci/jenkins-capacity/prepare_plugins.py --output build/jenkins-plugin-bundle
|
||||
python ci/jenkins-capacity/run_test.py --local-smoke-test --plugin-bundle build/jenkins-plugin-bundle
|
||||
```
|
||||
|
||||
The preparation command refuses to overwrite an existing bundle. Preserve or
|
||||
review the old bundle first. In the repository the archives live under ignored
|
||||
`build/`; they are packaged into `prepared-plugins` for upload, not committed.
|
||||
|
||||
Interpret the result by phase. Preparation failure can be a download, dependency,
|
||||
disk or memory problem; it does not automatically mean Jenkins cannot run.
|
||||
Target installation failure may come from apt/tools or copying/unpacking plugins.
|
||||
Startup failure can be plugin compatibility or resource pressure. An intentional
|
||||
fixture FAILURE is expected only if the correct unit-test assertion is present.
|
||||
Check OOM/CPU/swap and installer output before attributing a cause. A PASS with
|
||||
heavy swap or throttling demonstrates feasibility under this small test, not
|
||||
comfortable capacity, long-term reliability, concurrency or production readiness.
|
||||
|
||||
## What a PASS does not prove
|
||||
|
||||
The Gitea plugin must load here, but this experiment does not configure or exercise
|
||||
Gitea discovery, SCM checkout, PR head selection, webhooks, credentials, status
|
||||
reporting or branch protection. Git is installed and its version checked; no
|
||||
repository is cloned. The pipeline is the bundled local fixture, not yet the
|
||||
assignment's root repository Jenkinsfile. The fixture's repair is not a real
|
||||
issue-linked reviewed PR. No HTTPS deployment, restart persistence, real admin
|
||||
accounts, concurrent runner test, final report chapter or assignment completion
|
||||
is claimed. Those are subsequent implementation/evidence steps.
|
||||
|
||||
## Primary references
|
||||
|
||||
- [Official Jenkins Docker image and plugin customization](https://github.com/jenkinsci/docker)
|
||||
- [Plugin installation manager options and dependency behavior](https://github.com/jenkinsci/plugin-installation-manager-tool)
|
||||
- [Pipeline suite](https://plugins.jenkins.io/workflow-aggregator/)
|
||||
- [Gitea connector](https://plugins.jenkins.io/gitea/)
|
||||
- [Groovy initialization hooks](https://www.jenkins.io/doc/book/managing/groovy-hook-scripts/)
|
||||
- [Controller isolation and built-in executor risks](https://www.jenkins.io/doc/book/security/controller-isolation/)
|
||||
- [Docker RAM, swap and CPU constraints](https://docs.docker.com/engine/containers/resource_constraints/)
|
||||
@@ -0,0 +1,73 @@
|
||||
# Verification, October 21, 2026
|
||||
|
||||
**Prepared and passed in Windows Docker Desktop. NOT run on The-Ocean.**
|
||||
|
||||
## Actual Docker results
|
||||
|
||||
1. Initial all-in-one local attempt, `plugins-20261021T232534Z-28212`: Python/Git
|
||||
installation succeeded, but `jenkins-plugin-cli` failed with Java heap space
|
||||
exhaustion while fetching the plugin-version catalog at the original 128 MiB
|
||||
heap. Container exit code was 1; Docker `OOMKilled` was false. This was a JVM
|
||||
heap failure, not a kernel container kill and not a Jenkins runtime test.
|
||||
Cleanup succeeded. Original installer output/result were preserved.
|
||||
2. Separate local plugin preparation: official installer, 768 MiB container RAM,
|
||||
1 GiB combined RAM+swap, 512 MiB Java heap, one CPU. Successfully resolved 59
|
||||
archives totaling 45,336,313 bytes, with exact requested root versions and a
|
||||
SHA-256/version manifest. The preparation container was removed. This proves
|
||||
that these preparation bounds worked, not the minimum memory the installer
|
||||
needs. It did not start Jenkins.
|
||||
3. Revised runtime test, `plugins-20261021T233125Z-27744`: SAME original runtime
|
||||
limits (256 MiB RAM, 512 MiB combined RAM+swap, half a CPU, 128 MiB Java heap).
|
||||
All 59 plugins were active, no failed plugins were reported, and healthy HTTP
|
||||
samples spanned **65.39 seconds** before jobs started. Build 1 was SUCCESS;
|
||||
build 2 was FAILURE with the intended `13 != 30` assertion and two unit tests
|
||||
executed; build 3 repaired the calculation and was SUCCESS. Final result PASS,
|
||||
cleanup true. A subsequent owner-label query found no experiment containers.
|
||||
|
||||
Twenty runtime samples recorded peak cgroup RAM 255.99 MiB, peak swap 137.63 MiB,
|
||||
and peak SIMULTANEOUS RAM+swap 389.51 MiB. The maxima of RAM and swap need not occur
|
||||
at the same time. Container OOM/OOM-kill events were zero; the RAM cap was reached
|
||||
repeatedly and CPU throttling occurred. These results demonstrate this small
|
||||
runtime exercise on the laptop, not spare capacity or concurrent Gitea safety.
|
||||
|
||||
Docker Desktop reported 16 CPUs and about 13.5 GiB VM memory. Local mode deliberately
|
||||
did not measure the droplet's host memory, swap, disk or Gitea health: those fields
|
||||
are null. The real droplet has about 458 MiB RAM and runs Gitea/Caddy. Its guarded
|
||||
run remains necessary. No new cloud resource, firewall change or reboot occurred.
|
||||
|
||||
Raw local evidence remains under ignored `build/evidence/jenkins-plugin-local/`;
|
||||
prepared binaries/manifest are under ignored `build/jenkins-plugin-bundle/`.
|
||||
The shareable ZIP includes the prepared archives and selected non-secret local
|
||||
evidence. No controller logs, Jenkins home, token, SSH key or generated test
|
||||
password is included. The official base image is cached for reuse; the temporary
|
||||
containers and anonymous homes were removed.
|
||||
|
||||
## Local regression and static checks
|
||||
|
||||
- Nine Python regression/fault checks passed: the previous 54-second false PASS,
|
||||
failed-probe timer reset, monitor's complete idle gate, low memory/swap aborts,
|
||||
refusal to delete another owner's container, cleanup despite diagnostic errors,
|
||||
separate cgroup accounting, folded plugin manifests/exact root versions, and
|
||||
actual Python fixture pass/failure/repair.
|
||||
- Bash bootstrap syntax was checked and actual Docker execution succeeded.
|
||||
- Opted-in droplet execution on Windows was rejected before Docker activity;
|
||||
the container bootstrap also refused execution outside its test container.
|
||||
- Python sources parsed and Linux inputs used LF endings.
|
||||
- Plugin root versions/minimum core baselines were checked against official
|
||||
Jenkins pages. Actual installation and activation supplied stronger evidence.
|
||||
|
||||
## Still unverified
|
||||
|
||||
- Droplet capacity with Gitea/Caddy, host pressure guards, site checks, target apt
|
||||
availability and cleanup/watchdog behavior after a real SSH disconnect.
|
||||
- Gitea discovery/SCM checkout/PR revision selection/webhooks/status reporting,
|
||||
merge protection, a production build boundary, HTTPS deployment and persistence.
|
||||
- The real reviewed failure/repair PR and Assignment 6 report chapter/submission.
|
||||
|
||||
SSH and the web console time out from school. The attached Cloud Firewall visibly
|
||||
allowed the measured school IPv4; Gitea HTTPS returned 200 while direct TCP 22
|
||||
timed out. This does not establish where filtering occurs. Docker was initially
|
||||
off, then Vincent enabled it and authorized using it for local verification.
|
||||
|
||||
This directory supplements the earlier October 21 Billy/Claude handoff, which
|
||||
predates this new test and manual record. No commit or push was performed.
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
# Runs INSIDE the newly created disposable container, never on the host.
|
||||
set -euo pipefail
|
||||
[ "${SSW590_DISPOSABLE_TEST:-}" = 1 ] && [ -f /.dockerenv ] && [ -d /opt/ssw590-input ] || {
|
||||
echo 'Refusing: this bootstrap runs only inside the disposable test container.' >&2
|
||||
exit 1
|
||||
}
|
||||
umask 022
|
||||
mkdir -p /tmp/ssw590
|
||||
chmod 755 /tmp/ssw590
|
||||
echo tools > /tmp/ssw590/phase
|
||||
{
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update
|
||||
apt-get install --no-install-recommends -y python3 git util-linux
|
||||
apt-get clean
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
python3 --version
|
||||
git --version
|
||||
echo plugins > /tmp/ssw590/phase
|
||||
mkdir -p /usr/share/jenkins/ref/plugins /usr/share/jenkins/ref/init.groovy.d
|
||||
chown jenkins:jenkins /usr/share/jenkins/ref/plugins
|
||||
# Catalog resolution is prepared on the laptop, outside the runtime limits.
|
||||
# The host verifies this bundle's hashes before mounting it read-only.
|
||||
cp /opt/ssw590-plugins/*.jpi /usr/share/jenkins/ref/plugins/
|
||||
chown -R jenkins:jenkins /usr/share/jenkins/ref/plugins
|
||||
python3 /opt/ssw590-input/inventory.py /usr/share/jenkins/ref/plugins \
|
||||
/opt/ssw590-input/plugins.txt > /tmp/ssw590/plugins-resolved.json
|
||||
python3 - <<'PY' > /tmp/ssw590/plugins-resolved.lock
|
||||
import json
|
||||
for p in json.load(open('/tmp/ssw590/plugins-resolved.json')):
|
||||
print(p['id'] + ':' + p['version'])
|
||||
PY
|
||||
cp /opt/ssw590-input/init.groovy /usr/share/jenkins/ref/init.groovy.d/90-capacity.groovy
|
||||
chown -R jenkins:jenkins /tmp/ssw590
|
||||
} > /tmp/ssw590/install.txt 2>&1
|
||||
echo startup > /tmp/ssw590/phase
|
||||
# Replace the preparer with the normal official Jenkins launcher, as non-root.
|
||||
exec runuser -u jenkins -- /usr/bin/tini -- /usr/local/bin/jenkins.sh
|
||||
@@ -0,0 +1,27 @@
|
||||
// Disposable, locally supplied fixture; no SCM credentials or production checkout.
|
||||
node {
|
||||
stage('Dependencies') {
|
||||
sh 'python3 --version && git --version'
|
||||
}
|
||||
stage('Fresh fixture') {
|
||||
// Delete only this disposable job workspace, inside the test container.
|
||||
deleteDir()
|
||||
sh 'cp -R /opt/ssw590-input/fixtures/. .'
|
||||
if (params.BREAK_CALCULATION) {
|
||||
sh '''python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
p = Path('pricing.py')
|
||||
s = p.read_text()
|
||||
assert s.count('return unit_price * quantity') == 1
|
||||
p.write_text(s.replace('return unit_price * quantity', 'return unit_price + quantity'))
|
||||
PY'''
|
||||
}
|
||||
sh 'sha256sum pricing.py'
|
||||
}
|
||||
stage('Syntax') {
|
||||
sh 'python3 -m py_compile pricing.py'
|
||||
}
|
||||
stage('Unit tests') {
|
||||
sh 'python3 -m unittest discover -s tests -v'
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
def total_price(unit_price, quantity):
|
||||
if quantity < 1:
|
||||
raise ValueError("Quantity must be positive")
|
||||
return unit_price * quantity
|
||||
@@ -0,0 +1,12 @@
|
||||
import unittest
|
||||
|
||||
from pricing import total_price
|
||||
|
||||
|
||||
class PricingTests(unittest.TestCase):
|
||||
def test_total(self):
|
||||
self.assertEqual(total_price(10, 3), 30)
|
||||
|
||||
def test_invalid_quantity(self):
|
||||
with self.assertRaises(ValueError):
|
||||
total_price(10, 0)
|
||||
@@ -0,0 +1,106 @@
|
||||
import groovy.json.JsonOutput
|
||||
import hudson.init.InitMilestone
|
||||
import hudson.model.BooleanParameterDefinition
|
||||
import hudson.model.BooleanParameterValue
|
||||
import hudson.model.ParametersAction
|
||||
import hudson.model.ParametersDefinitionProperty
|
||||
import hudson.security.FullControlOnceLoggedInAuthorizationStrategy
|
||||
import hudson.security.HudsonPrivateSecurityRealm
|
||||
import hudson.security.ACL
|
||||
import jenkins.model.Jenkins
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
// Trusted administrator bootstrap, only in a new temporary home. Never log secrets.
|
||||
def j = Jenkins.get()
|
||||
def realm = new HudsonPrivateSecurityRealm(false)
|
||||
realm.createAccount('capacity-test', UUID.randomUUID().toString() + UUID.randomUUID().toString())
|
||||
j.setSecurityRealm(realm)
|
||||
def authorization = new FullControlOnceLoggedInAuthorizationStrategy()
|
||||
authorization.setAllowAnonymousRead(false)
|
||||
j.setAuthorizationStrategy(authorization)
|
||||
j.setNumExecutors(1)
|
||||
j.setQuietPeriod(0)
|
||||
j.save()
|
||||
|
||||
def root = new File('/tmp/ssw590')
|
||||
def state = [phase: 'initializing', builds: []]
|
||||
def writeState = {
|
||||
def temporary = new File(root, 'status.next')
|
||||
temporary.text = JsonOutput.toJson(state)
|
||||
java.nio.file.Files.move(temporary.toPath(), new File(root, 'status.json').toPath(),
|
||||
java.nio.file.StandardCopyOption.REPLACE_EXISTING,
|
||||
java.nio.file.StandardCopyOption.ATOMIC_MOVE)
|
||||
}
|
||||
writeState()
|
||||
|
||||
Thread.startDaemon('ssw590-disposable-test') {
|
||||
// The trusted bootstrap worker needs the same system identity as the init hook.
|
||||
def securityContext = ACL.as2(ACL.SYSTEM2)
|
||||
try {
|
||||
while (j.getInitLevel() != InitMilestone.COMPLETED) { Thread.sleep(1000) }
|
||||
state.plugins = j.pluginManager.plugins.collect {
|
||||
[id: it.shortName, version: it.version, active: it.isActive()]
|
||||
}
|
||||
state.failedPlugins = j.pluginManager.failedPlugins.collect { it.name }
|
||||
def requested = new File('/opt/ssw590-input/plugins.txt').readLines().findAll { it.trim() }
|
||||
requested.each { entry ->
|
||||
def (id, version) = entry.trim().split(':', 2)
|
||||
def p = j.pluginManager.getPlugin(id)
|
||||
if (p == null || !p.isActive() || p.version != version) {
|
||||
throw new IllegalStateException('Requested plugin not active at expected version: ' + id)
|
||||
}
|
||||
}
|
||||
if (state.failedPlugins || state.plugins.any { !it.active }) {
|
||||
throw new IllegalStateException('Plugin load failure; inspect recorded inventory')
|
||||
}
|
||||
// Access plugin classes only after checking that they loaded.
|
||||
def jobClass = j.pluginManager.uberClassLoader.loadClass('org.jenkinsci.plugins.workflow.job.WorkflowJob')
|
||||
def definitionClass = j.pluginManager.uberClassLoader.loadClass('org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition')
|
||||
def job = j.createProject(jobClass, 'capacity-pricing')
|
||||
job.addProperty(new ParametersDefinitionProperty(
|
||||
new BooleanParameterDefinition('BREAK_CALCULATION', false, 'Disposable failure exercise')))
|
||||
job.setDefinition(definitionClass.getConstructor(String.class, Boolean.TYPE).newInstance(
|
||||
new File('/opt/ssw590-input/fixtures/Jenkinsfile').text, true))
|
||||
job.save()
|
||||
state.phase = 'ready'
|
||||
writeState()
|
||||
// Host must observe >=60 seconds of healthy HTTP AFTER plugin checks first.
|
||||
while (!new File(root, 'start-jobs').exists()) { Thread.sleep(1000) }
|
||||
state.phase = 'pipelines'
|
||||
writeState()
|
||||
def cases = [[name: 'pass', broken: false, expected: 'SUCCESS'],
|
||||
[name: 'intentional-failure', broken: true, expected: 'FAILURE'],
|
||||
[name: 'repair', broken: false, expected: 'SUCCESS']]
|
||||
for (testCase in cases) {
|
||||
def future = job.scheduleBuild2(0, new ParametersAction(
|
||||
new BooleanParameterValue('BREAK_CALCULATION', testCase.broken)))
|
||||
if (future == null) { throw new IllegalStateException('Build could not be scheduled') }
|
||||
def build = future.get(180, TimeUnit.SECONDS)
|
||||
// Only these known fixture-job logs are copied, never controller logs.
|
||||
def console = build.getLog(500).join('\n') + '\n'
|
||||
new File(root, testCase.name + '-console.txt').text = console
|
||||
def observed = build.result.toString()
|
||||
state.builds << [name: testCase.name, number: build.number,
|
||||
expected: testCase.expected, actual: observed]
|
||||
writeState()
|
||||
if (observed != testCase.expected) {
|
||||
throw new IllegalStateException('Unexpected fixture build result: ' + testCase.name)
|
||||
}
|
||||
if (!console.contains('Ran 2 tests')) {
|
||||
throw new IllegalStateException('Unit tests did not actually execute')
|
||||
}
|
||||
if (testCase.broken && (!console.contains('13 != 30') || !console.contains('FAILED (failures=1)'))) {
|
||||
throw new IllegalStateException('Failure was not the intended calculation assertion')
|
||||
}
|
||||
}
|
||||
state.phase = 'complete'
|
||||
writeState()
|
||||
} catch (Throwable failure) {
|
||||
state.phase = 'failed'
|
||||
// Fixed harness error text/type; do not dump arbitrary stack traces or secrets.
|
||||
state.errorType = failure.class.name
|
||||
writeState()
|
||||
} finally {
|
||||
securityContext.close()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
"""Inspect downloaded plugin archives without loading Jenkins or reading secrets."""
|
||||
import email.parser
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import zipfile
|
||||
|
||||
|
||||
def inventory(directory, requested):
|
||||
entries = []
|
||||
for path in sorted(Path(directory).glob("*.jpi")):
|
||||
with zipfile.ZipFile(path) as archive:
|
||||
raw = archive.read("META-INF/MANIFEST.MF").decode("utf-8")
|
||||
# JAR manifests fold lines by prefixing continuation lines with one space.
|
||||
unfolded = raw.replace("\r\n ", "").replace("\n ", "")
|
||||
manifest = email.parser.Parser().parsestr(unfolded)
|
||||
with path.open("rb") as stream:
|
||||
digest = hashlib.file_digest(stream, "sha256").hexdigest() if hasattr(hashlib, "file_digest") else None
|
||||
if digest is None:
|
||||
h = hashlib.sha256()
|
||||
with path.open("rb") as stream:
|
||||
for block in iter(lambda: stream.read(1024 * 1024), b""):
|
||||
h.update(block)
|
||||
digest = h.hexdigest()
|
||||
entries.append({"id": manifest["Short-Name"], "version": manifest["Plugin-Version"],
|
||||
"requires_jenkins": manifest["Jenkins-Version"], "sha256": digest})
|
||||
versions = {p["id"]: p["version"] for p in entries}
|
||||
roots = [line.strip().split(":") for line in Path(requested).read_text().splitlines() if line.strip()]
|
||||
for name, version in roots:
|
||||
if versions.get(name) != version:
|
||||
raise ValueError(f"Requested root version was not installed exactly: {name}:{version}")
|
||||
if not entries:
|
||||
raise ValueError("No plugin archives found")
|
||||
return entries
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(json.dumps(inventory(sys.argv[1], sys.argv[2]), indent=2))
|
||||
@@ -0,0 +1,2 @@
|
||||
workflow-aggregator:608.v67378e9d3db_1
|
||||
gitea:286.v0740a_413c1eb_
|
||||
@@ -0,0 +1,74 @@
|
||||
"""Resolve plugins on Windows Docker Desktop, never on the small droplet.
|
||||
|
||||
This launches only the official plugin installer, not Jenkins. The output is
|
||||
non-secret plugin archives plus a hash/version manifest for the runtime test.
|
||||
"""
|
||||
import argparse
|
||||
from datetime import datetime, timezone
|
||||
import json
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import inventory
|
||||
from run_test import IMAGE, LABEL, command, remove_owned
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--output", type=Path, required=True, help="NEW local plugin-bundle directory")
|
||||
args = parser.parse_args()
|
||||
if sys.platform != "win32":
|
||||
parser.error("Prepare on Windows Docker Desktop; do not run this on the 512 MB droplet")
|
||||
output = args.output.resolve()
|
||||
if output.exists():
|
||||
parser.error("Output already exists; preserve or review it before preparing another bundle")
|
||||
bundle = Path(__file__).resolve().parent
|
||||
owner = "prepare-" + datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ").lower()
|
||||
container = None
|
||||
output.mkdir(parents=True)
|
||||
metadata = {"status": "INCOMPLETE", "environment": "Windows Docker Desktop plugin preparation only",
|
||||
"base_image": IMAGE, "ram_mib": 768, "ram_plus_swap_mib": 1024,
|
||||
"heap_max_mib": 512, "cpu": 1, "jenkins_started": False}
|
||||
try:
|
||||
if command("docker", "info", "--format", "{{.OSType}}").stdout.strip() != "linux":
|
||||
raise RuntimeError("Use Docker Desktop's Linux engine")
|
||||
if command("docker", "image", "inspect", IMAGE, check=False).returncode:
|
||||
command("docker", "pull", IMAGE, timeout=300)
|
||||
container = "ssw590-jenkins-" + owner
|
||||
container = command("docker", "create", "--name", container,
|
||||
"--label", f"{LABEL}={owner}", "--restart", "no",
|
||||
"--memory", "768m", "--memory-swap", "1024m", "--cpus", "1", "--pids-limit", "256",
|
||||
"--mount", f"type=bind,src={bundle},dst=/opt/ssw590-input,readonly",
|
||||
"--env", "JAVA_OPTS=-Xms32m -Xmx512m -XX:+UseSerialGC",
|
||||
"--entrypoint", "/bin/bash", IMAGE, "-c",
|
||||
"mkdir -p /tmp/ssw590-prepared/plugins; "
|
||||
"jenkins-plugin-cli --war /usr/share/jenkins/jenkins.war "
|
||||
"--plugin-file /opt/ssw590-input/plugins.txt "
|
||||
"--plugin-download-directory /tmp/ssw590-prepared/plugins --latest true --list "
|
||||
"> /tmp/ssw590-prepared/installer.txt 2>&1").stdout.strip()
|
||||
with (output / "preparer-process.txt").open("w") as log:
|
||||
subprocess.run(["docker", "start", "--attach", container], stdout=log,
|
||||
stderr=subprocess.STDOUT, timeout=900, check=True)
|
||||
command("docker", "cp", container + ":/tmp/ssw590-prepared/plugins/.", str(output), timeout=60)
|
||||
command("docker", "cp", container + ":/tmp/ssw590-prepared/installer.txt", str(output / "installer.txt"))
|
||||
plugins = inventory.inventory(output, bundle / "plugins.txt")
|
||||
(output / "manifest.json").write_text(json.dumps({"base_image": IMAGE, "plugins": plugins}, indent=2) + "\n")
|
||||
(output / "plugins.lock").write_text("".join(p["id"] + ":" + p["version"] + "\n" for p in plugins))
|
||||
metadata.update(status="PASS", plugin_count=len(plugins))
|
||||
except Exception as error:
|
||||
metadata.update(status="FAILED", reason=str(error))
|
||||
if container:
|
||||
command("docker", "cp", container + ":/tmp/ssw590-prepared/installer.txt",
|
||||
str(output / "installer.txt"), check=False)
|
||||
finally:
|
||||
metadata["cleanup_ok"] = remove_owned(container, owner) if container else True
|
||||
if not metadata["cleanup_ok"]:
|
||||
metadata["status"] = "NEEDS_ATTENTION"
|
||||
(output / "preparation.json").write_text(json.dumps(metadata, indent=2) + "\n")
|
||||
print(json.dumps(metadata, indent=2))
|
||||
return 0 if metadata["status"] == "PASS" else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,402 @@
|
||||
"""Bounded, disposable Jenkins plugin/pipeline experiment for The-Ocean.
|
||||
|
||||
No SSH, real account credentials, production mounts or host package changes are used.
|
||||
Run --help for opt-in The-Ocean execution or Windows Docker Desktop validation.
|
||||
"""
|
||||
import argparse
|
||||
from datetime import datetime, timezone
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import signal
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
import inventory
|
||||
|
||||
IMAGE = ("jenkins/jenkins:2.580.1-jdk21@sha256:"
|
||||
"a660310e39ade10631f774bacd5219de767dfd08947ea5c32a739b5e5bb382c1")
|
||||
LABEL = "ssw590.capacity-owner"
|
||||
SITE = "https://git.yebilly.me"
|
||||
PORT = 18080
|
||||
BOUNDS = ["--memory", "256m", "--memory-swap", "512m", "--cpus", "0.5", "--pids-limit", "256"]
|
||||
INSTALL_SECONDS = 1200
|
||||
STARTUP_SECONDS = 900
|
||||
PIPELINE_SECONDS = 600
|
||||
TOTAL_SECONDS = 2700
|
||||
IDLE_SECONDS = 60
|
||||
OPENER = urllib.request.build_opener(urllib.request.ProxyHandler({}))
|
||||
|
||||
|
||||
class Abort(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def utc():
|
||||
return datetime.now(timezone.utc).isoformat(timespec="seconds")
|
||||
|
||||
|
||||
def command(*args, timeout=15, check=True):
|
||||
result = subprocess.run(args, capture_output=True, text=True, timeout=timeout)
|
||||
if check and result.returncode:
|
||||
# All invoked commands have non-secret arguments and output by construction.
|
||||
raise Abort(f"Command failed: {args[0]} {args[1:3]}: {result.stderr.strip()[:500]}")
|
||||
return result
|
||||
|
||||
|
||||
def http_code(url):
|
||||
try:
|
||||
with OPENER.open(url, timeout=6) as response:
|
||||
return response.status
|
||||
except urllib.error.HTTPError as error:
|
||||
return error.code
|
||||
except (urllib.error.URLError, TimeoutError, OSError):
|
||||
return 0
|
||||
|
||||
|
||||
def host_memory():
|
||||
fields = {}
|
||||
for line in Path("/proc/meminfo").read_text().splitlines():
|
||||
key, value = line.split(":", 1)
|
||||
fields[key] = int(value.strip().split()[0])
|
||||
return fields["MemAvailable"], fields["SwapFree"]
|
||||
|
||||
|
||||
def resource_guard(available, swap_free, initial=False):
|
||||
memory_floor, swap_floor = (131072, 524288) if initial else (49152, 131072)
|
||||
if available < memory_floor:
|
||||
raise Abort(f"Host available RAM below {memory_floor // 1024} MiB")
|
||||
if swap_free < swap_floor:
|
||||
raise Abort(f"Host free swap below {swap_floor // 1024} MiB")
|
||||
|
||||
|
||||
def advance_idle(previous, completed_at, healthy):
|
||||
"""The clock starts AFTER a successful HTTP probe, and resets on failure."""
|
||||
if not healthy:
|
||||
return None, False
|
||||
started = completed_at if previous is None else previous
|
||||
return started, completed_at - started >= IDLE_SECONDS
|
||||
|
||||
|
||||
def parse_cgroup(raw):
|
||||
result = {}
|
||||
section = None
|
||||
for line in raw.splitlines():
|
||||
if line in ("memory.current", "memory.swap.current", "memory.events", "cpu.stat"):
|
||||
section = line
|
||||
result[section] = {} if section in ("memory.events", "cpu.stat") else None
|
||||
elif section in ("memory.events", "cpu.stat"):
|
||||
key, value = line.split()
|
||||
result[section][key] = int(value)
|
||||
elif section:
|
||||
result[section] = int(line)
|
||||
if any(result.get(key) is None for key in ("memory.current", "memory.swap.current", "memory.events", "cpu.stat")):
|
||||
raise Abort("Incomplete cgroup accounting")
|
||||
return result
|
||||
|
||||
|
||||
def owned_container(container, owner):
|
||||
result = command("docker", "inspect", "--format", '{{index .Config.Labels "' + LABEL + '"}}',
|
||||
container, check=False)
|
||||
return result.returncode == 0 and result.stdout.strip() == owner
|
||||
|
||||
|
||||
def remove_owned(container, owner):
|
||||
if not owned_container(container, owner):
|
||||
return False
|
||||
command("docker", "stop", "--time", "10", container, timeout=20, check=False)
|
||||
result = command("docker", "rm", "--force", "--volumes", container, timeout=20, check=False)
|
||||
return result.returncode == 0
|
||||
|
||||
|
||||
def watchdog(container, owner, evidence):
|
||||
# Detached from SSH. This child can delete ONLY this exact, owner-labelled test.
|
||||
time.sleep(TOTAL_SECONDS + 60)
|
||||
if owned_container(container, owner):
|
||||
removed = remove_owned(container, owner)
|
||||
(evidence / "watchdog.txt").write_text(f"{utc()} deadline expired; removed={removed}\n")
|
||||
|
||||
|
||||
class Experiment:
|
||||
def __init__(self, bundle, evidence, local=False, plugin_bundle=None):
|
||||
self.bundle = bundle.resolve()
|
||||
self.evidence = evidence
|
||||
self.local = local
|
||||
self.plugin_bundle = (plugin_bundle or self.bundle / "prepared-plugins").resolve()
|
||||
self.owner = evidence.name
|
||||
self.name = "ssw590-jenkins-plugins-" + self.owner.lower()
|
||||
self.container = None
|
||||
self.guard = None
|
||||
self.result = {"status": "INCOMPLETE", "started": utc(), "scope": "disposable plugin/pipeline capacity",
|
||||
"environment": "local Docker Desktop; NOT droplet capacity" if local else "The-Ocean"}
|
||||
|
||||
def save(self, filename, value):
|
||||
(self.evidence / filename).write_text(json.dumps(value, indent=2) + "\n")
|
||||
|
||||
def preflight(self):
|
||||
manifest = json.loads((self.plugin_bundle / "manifest.json").read_text())
|
||||
if manifest.get("base_image") != IMAGE:
|
||||
raise Abort("Plugin bundle was prepared for a different base image")
|
||||
if manifest.get("plugins") != inventory.inventory(self.plugin_bundle, self.bundle / "plugins.txt"):
|
||||
raise Abort("Plugin bundle version/hash verification failed")
|
||||
self.save("prepared-plugin-manifest.json", manifest)
|
||||
if self.local:
|
||||
if sys.platform != "win32":
|
||||
raise Abort("The local smoke-test option is for Windows Docker Desktop only")
|
||||
else:
|
||||
if sys.platform != "linux" or os.geteuid() != 0:
|
||||
raise Abort("Run as root inside the authorized The-Ocean Linux SSH session")
|
||||
if socket.gethostname().lower() != "the-ocean":
|
||||
raise Abort("Unexpected host; this experiment is restricted to The-Ocean")
|
||||
for tool in (("docker",) if self.local else ("docker", "free", "df", "swapon")):
|
||||
if not shutil.which(tool):
|
||||
raise Abort("Missing host command: " + tool)
|
||||
if command("docker", "info", "--format", "{{.CgroupVersion}}").stdout.strip() != "2":
|
||||
raise Abort("This recorder requires cgroup version 2")
|
||||
if not self.local:
|
||||
resource_guard(*host_memory(), initial=True)
|
||||
if http_code(SITE) != 200:
|
||||
raise Abort("Baseline Gitea HTTP check failed")
|
||||
with socket.socket() as probe:
|
||||
probe.bind(("127.0.0.1", PORT))
|
||||
# One plugin experiment at a time, even before its HTTP port is published.
|
||||
existing = command("docker", "ps", "-aq", "--filter", "label=ssw590.purpose=jenkins-plugin-capacity").stdout.strip()
|
||||
if existing:
|
||||
raise Abort("Another plugin-test container exists; inspect it before continuing")
|
||||
if ":18080->" in command("docker", "ps", "--format", "{{.Ports}}").stdout:
|
||||
raise Abort("A Docker container already publishes the test port")
|
||||
present = command("docker", "image", "inspect", IMAGE, check=False).returncode == 0
|
||||
docker_root = command("docker", "info", "--format", "{{.DockerRootDir}}").stdout.strip()
|
||||
disk_floor = (2 if present else 3) * 1024 ** 3
|
||||
if not self.local and shutil.disk_usage(docker_root).free < disk_floor:
|
||||
raise Abort(f"Less than {disk_floor // 1024 ** 3} GiB free in Docker storage")
|
||||
self.save("baseline.json", {"utc": utc(), "hostname": socket.gethostname(),
|
||||
"environment": self.result["environment"],
|
||||
"memory_available_kib": None if self.local else host_memory()[0],
|
||||
"swap_free_kib": None if self.local else host_memory()[1],
|
||||
"docker_free_bytes": None if self.local else shutil.disk_usage(docker_root).free,
|
||||
"docker_engine": command("docker", "info", "--format", "OS={{.OSType}} CPUs={{.NCPU}} MemoryBytes={{.MemTotal}}").stdout,
|
||||
"containers": command("docker", "ps", "--format", "{{.Names}} {{.Image}} {{.Status}} {{.Ports}}").stdout,
|
||||
"memory": None if self.local else command("free", "-m").stdout,
|
||||
"swap": None if self.local else command("swapon", "--show").stdout,
|
||||
"disk": None if self.local else command("df", "-h", docker_root).stdout,
|
||||
"reboot_required": None if self.local else Path("/var/run/reboot-required").exists()})
|
||||
if not present:
|
||||
# Explicitly separate the pull from constrained plugin/runtime measurements.
|
||||
with (self.evidence / "image-pull.txt").open("w") as output:
|
||||
subprocess.run(["docker", "pull", IMAGE], stdout=output, stderr=subprocess.STDOUT,
|
||||
timeout=300, check=True)
|
||||
if not self.local:
|
||||
resource_guard(*host_memory(), initial=True)
|
||||
self.save("image.json", json.loads(command("docker", "image", "inspect", "--format",
|
||||
'{"id":{{json .Id}},"digests":{{json .RepoDigests}},"bytes":{{.Size}}}', IMAGE).stdout))
|
||||
|
||||
def create(self):
|
||||
# Nothing under ~/gitea, no real Jenkins home, socket, tokens or runner state.
|
||||
# Preserve a cleanup handle even if Docker creates it but the CLI times out.
|
||||
self.container = self.name
|
||||
self.container = command("docker", "create", "--name", self.name,
|
||||
"--label", "ssw590.purpose=jenkins-plugin-capacity", "--label", f"{LABEL}={self.owner}",
|
||||
"--restart", "no", *BOUNDS, "--publish", f"127.0.0.1:{PORT}:8080",
|
||||
"--log-driver", "json-file", "--log-opt", "max-size=1m", "--log-opt", "max-file=1",
|
||||
"--mount", f"type=bind,src={self.bundle},dst=/opt/ssw590-input,readonly",
|
||||
"--mount", f"type=bind,src={self.plugin_bundle},dst=/opt/ssw590-plugins,readonly",
|
||||
"--env", "SSW590_DISPOSABLE_TEST=1",
|
||||
"--env", "JAVA_OPTS=-Xms32m -Xmx128m -XX:+UseSerialGC -Djenkins.install.runSetupWizard=false",
|
||||
"--user", "root", "--entrypoint", "/bin/bash", IMAGE,
|
||||
"/opt/ssw590-input/container.sh").stdout.strip()
|
||||
if not self.container:
|
||||
raise Abort("Docker did not return a container ID")
|
||||
self.save("test-config.json", {"base_image": IMAGE, "container_id": self.container,
|
||||
"container_name": self.name, "owner": self.owner,
|
||||
"ram_mib": 256, "ram_plus_swap_mib": 512, "cpu": 0.5, "pids": 256,
|
||||
"heap_max_mib": 128, "idle_seconds": IDLE_SECONDS, "total_timeout_seconds": TOTAL_SECONDS,
|
||||
"requested_plugins": (self.bundle / "plugins.txt").read_text().splitlines(),
|
||||
"scope_excludes": ["SCM checkout", "webhook", "status reporting", "merge gate", "production deployment"]})
|
||||
# Start the independent cleanup deadline before launching the container.
|
||||
self.guard = subprocess.Popen([sys.executable, str(Path(__file__).resolve()), "--watchdog",
|
||||
self.container, self.owner, str(self.evidence)], stdin=subprocess.DEVNULL,
|
||||
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, start_new_session=os.name != "nt",
|
||||
creationflags=subprocess.CREATE_NO_WINDOW if os.name == "nt" else 0)
|
||||
command("docker", "start", self.container)
|
||||
|
||||
def read_file(self, name):
|
||||
result = command("docker", "exec", self.container, "cat", "/tmp/ssw590/" + name,
|
||||
timeout=8, check=False)
|
||||
return result.stdout.strip() if result.returncode == 0 else ""
|
||||
|
||||
def sample(self):
|
||||
available, swap_free = (None, None) if self.local else host_memory()
|
||||
if not self.local:
|
||||
resource_guard(available, swap_free)
|
||||
if http_code(SITE) != 200:
|
||||
raise Abort("Gitea sampled HTTP check failed; cause not established")
|
||||
running = command("docker", "inspect", "--format", "{{.State.Running}}", self.container).stdout.strip()
|
||||
if running != "true":
|
||||
raise Abort("Test container exited; inspect final state/install diagnostics")
|
||||
phase = self.read_file("phase") or "initializing"
|
||||
raw_status = self.read_file("status.json")
|
||||
status = json.loads(raw_status) if raw_status else {}
|
||||
code = http_code(f"http://127.0.0.1:{PORT}/login") if phase == "startup" else 0
|
||||
# Timestamp AFTER the HTTP response, avoiding the prior 54-second false pass.
|
||||
completed_at = time.monotonic()
|
||||
http_utc = utc()
|
||||
stats = command("docker", "stats", "--no-stream", "--format", "{{json .}}", self.container,
|
||||
timeout=10).stdout.strip()
|
||||
counters = command("docker", "exec", self.container, "sh", "-c",
|
||||
'for f in memory.current memory.swap.current memory.events cpu.stat; do '
|
||||
'echo "$f"; cat "/sys/fs/cgroup/$f"; done', timeout=8, check=False)
|
||||
if counters.returncode:
|
||||
raise Abort("Cannot read cgroup v2 memory/swap/CPU counters")
|
||||
accounting = parse_cgroup(counters.stdout)
|
||||
record = {"utc": http_utc, "http_completed_monotonic_seconds": completed_at,
|
||||
"phase": phase, "jenkins_phase": status.get("phase"),
|
||||
"host_available_kib": available, "host_swap_free_kib": swap_free,
|
||||
"gitea_http": None if self.local else 200, "jenkins_login_http": code,
|
||||
"docker_stats": json.loads(stats), "cgroup": accounting}
|
||||
with (self.evidence / "samples.jsonl").open("a") as output:
|
||||
output.write(json.dumps(record) + "\n")
|
||||
if accounting["memory.events"].get("oom", 0) or accounting["memory.events"].get("oom_kill", 0):
|
||||
raise Abort("Container recorded an out-of-memory event")
|
||||
host_summary = "host guards/Gitea check: droplet-only" if self.local else f"available={available // 1024}MiB swap-free={swap_free // 1024}MiB GiteaHTTP=200"
|
||||
print(f"{record['utc']} {phase}/{status.get('phase', '-')} JenkinsHTTP={code} {host_summary}", flush=True)
|
||||
return phase, status, code, completed_at
|
||||
|
||||
def monitor(self):
|
||||
begin = time.monotonic()
|
||||
startup = pipelines = idle = None
|
||||
with (self.evidence / "checkpoints.jsonl").open("a") as checkpoints:
|
||||
while True:
|
||||
phase, status, code, now = self.sample()
|
||||
if now - begin > TOTAL_SECONDS:
|
||||
raise Abort("Overall experiment deadline exceeded")
|
||||
if status.get("phase") == "failed":
|
||||
self.save("jenkins-status.json", status)
|
||||
raise Abort("Jenkins harness failed: " + status.get("errorType", "unknown"))
|
||||
if phase != "startup":
|
||||
if now - begin > INSTALL_SECONDS:
|
||||
raise Abort("Tool/plugin installation deadline exceeded")
|
||||
else:
|
||||
if startup is None:
|
||||
startup = now
|
||||
if pipelines is None:
|
||||
healthy = status.get("phase") == "ready" and code == 200
|
||||
idle, passed = advance_idle(idle, now, healthy)
|
||||
if passed:
|
||||
checkpoints.write(json.dumps({"checkpoint": "plugins-and-idle", "utc": utc(),
|
||||
"observed_seconds": now - idle}) + "\n")
|
||||
checkpoints.flush()
|
||||
self.save("jenkins-status-at-idle.json", status)
|
||||
command("docker", "exec", self.container, "touch", "/tmp/ssw590/start-jobs")
|
||||
pipelines = now
|
||||
elif now - startup > STARTUP_SECONDS:
|
||||
raise Abort("Plugin startup/healthy-idle deadline exceeded")
|
||||
else:
|
||||
if code != 200:
|
||||
raise Abort("Jenkins HTTP check failed during pipeline exercise")
|
||||
if now - pipelines > PIPELINE_SECONDS:
|
||||
raise Abort("Pipeline exercise deadline exceeded")
|
||||
if status.get("phase") == "complete":
|
||||
builds = status.get("builds", [])
|
||||
if [b.get("actual") for b in builds] != ["SUCCESS", "FAILURE", "SUCCESS"]:
|
||||
raise Abort("Missing expected pass/fail/repair results")
|
||||
self.save("jenkins-status.json", status)
|
||||
self.result.update(status="PASS", details="Plugins active; >=60-second observed healthy idle; pass/fail/repair fixture pipeline")
|
||||
return
|
||||
time.sleep(5)
|
||||
|
||||
def cleanup(self):
|
||||
cleanup_ok = True
|
||||
if self.container:
|
||||
try:
|
||||
if not owned_container(self.container, self.owner):
|
||||
raise Abort("Cleanup ownership check failed; refusing container deletion")
|
||||
final = command("docker", "inspect", "--format", "{{json .State}}", self.container, check=False)
|
||||
if final.returncode == 0:
|
||||
self.save("final-container-state.json", json.loads(final.stdout))
|
||||
# Explicit allowlist; no raw controller logs or Jenkins home/credentials.
|
||||
for name in ("install.txt", "plugins-resolved.json", "plugins-resolved.lock", "status.json",
|
||||
"pass-console.txt", "intentional-failure-console.txt", "repair-console.txt"):
|
||||
command("docker", "cp", self.container + ":/tmp/ssw590/" + name,
|
||||
str(self.evidence / name), timeout=15, check=False)
|
||||
# Even if a diagnostic copy failed, finally below removes owned resources.
|
||||
except Exception as error:
|
||||
self.result["capture_error"] = str(error)
|
||||
finally:
|
||||
try:
|
||||
cleanup_ok = remove_owned(self.container, self.owner)
|
||||
except Exception as error:
|
||||
cleanup_ok = False
|
||||
self.result["cleanup_error"] = str(error)
|
||||
if self.guard and cleanup_ok:
|
||||
self.guard.terminate()
|
||||
try:
|
||||
self.guard.wait(timeout=3)
|
||||
except subprocess.TimeoutExpired:
|
||||
self.guard.kill()
|
||||
self.guard.wait()
|
||||
self.result.update(finished=utc(), cleanup_ok=cleanup_ok, gitea_http_after=None if self.local else http_code(SITE))
|
||||
if self.result["status"] == "PASS":
|
||||
required = ("install.txt", "plugins-resolved.json", "plugins-resolved.lock", "status.json",
|
||||
"pass-console.txt", "intentional-failure-console.txt", "repair-console.txt")
|
||||
missing = [name for name in required if not (self.evidence / name).is_file()]
|
||||
if missing or self.result.get("capture_error"):
|
||||
self.result.update(status="NEEDS_ATTENTION", missing_evidence=missing)
|
||||
if not cleanup_ok or (not self.local and self.result["gitea_http_after"] != 200):
|
||||
self.result["status"] = "NEEDS_ATTENTION"
|
||||
self.save("result.json", self.result)
|
||||
print(json.dumps(self.result, indent=2), flush=True)
|
||||
print("Evidence: " + str(self.evidence), flush=True)
|
||||
|
||||
|
||||
def main():
|
||||
# This internal branch is intentionally unavailable from the public parser.
|
||||
if len(sys.argv) == 5 and sys.argv[1] == "--watchdog":
|
||||
watchdog(sys.argv[2], sys.argv[3], Path(sys.argv[4]))
|
||||
return 0
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
modes = parser.add_mutually_exclusive_group()
|
||||
modes.add_argument("--run-on-the-ocean", action="store_true", help="Execute the bounded experiment on the authorized droplet")
|
||||
modes.add_argument("--local-smoke-test", action="store_true", help="Windows Docker Desktop runtime check; NOT droplet capacity")
|
||||
parser.add_argument("--plugin-bundle", type=Path, help="Prepared archives directory; default: prepared-plugins beside this script")
|
||||
args = parser.parse_args()
|
||||
if not (args.run_on_the_ocean or args.local_smoke_test):
|
||||
parser.print_help()
|
||||
return 0
|
||||
if args.run_on_the_ocean and (sys.platform != "linux" or os.geteuid() != 0 or socket.gethostname().lower() != "the-ocean"):
|
||||
parser.error("Execution requires the root session on The-Ocean")
|
||||
os.umask(0o077)
|
||||
bundle = Path(__file__).resolve().parent
|
||||
evidence_root = bundle.parents[1] / "build/evidence/jenkins-plugin-local" if args.local_smoke_test else Path("/root/ssw590-capacity-evidence")
|
||||
evidence = evidence_root / ("plugins-" + datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ") + "-" + str(os.getpid()))
|
||||
evidence.mkdir(parents=True, exist_ok=False)
|
||||
experiment = Experiment(bundle, evidence, local=args.local_smoke_test, plugin_bundle=args.plugin_bundle)
|
||||
# Keep source versions with measurements, but never copy unrelated repository data.
|
||||
experiment.save("input-hashes.json", {str(p.relative_to(bundle)): hashlib.sha256(p.read_bytes()).hexdigest()
|
||||
for p in bundle.rglob("*") if p.is_file() and "__pycache__" not in p.parts})
|
||||
def interrupted(signum, frame):
|
||||
raise Abort("Interrupted by signal " + str(signum))
|
||||
watched_signals = [signal.SIGINT, signal.SIGTERM] + ([signal.SIGHUP] if hasattr(signal, "SIGHUP") else [])
|
||||
for sig in watched_signals:
|
||||
signal.signal(sig, interrupted)
|
||||
try:
|
||||
experiment.preflight()
|
||||
experiment.create()
|
||||
experiment.monitor()
|
||||
except Exception as error:
|
||||
experiment.result.update(status="FAILED_OR_ABORTED", reason=str(error))
|
||||
finally:
|
||||
# Prevent a second disconnect signal interrupting resource cleanup.
|
||||
for sig in watched_signals:
|
||||
signal.signal(sig, signal.SIG_IGN)
|
||||
experiment.cleanup()
|
||||
return 0 if experiment.result["status"] == "PASS" else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,122 @@
|
||||
"""Local fault/regression checks; these do not emulate a Jenkins runtime."""
|
||||
import contextlib
|
||||
import io
|
||||
import json
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
import zipfile
|
||||
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
sys.path.insert(0, str(ROOT))
|
||||
import run_test as harness
|
||||
import inventory
|
||||
|
||||
|
||||
class TimingAndProtectionTests(unittest.TestCase):
|
||||
def test_previous_54_second_false_pass_is_rejected(self):
|
||||
started, passed = harness.advance_idle(None, 100, True)
|
||||
self.assertFalse(passed)
|
||||
self.assertFalse(harness.advance_idle(started, 154, True)[1])
|
||||
self.assertTrue(harness.advance_idle(started, 160, True)[1])
|
||||
|
||||
def test_failed_probe_restarts_the_idle_window(self):
|
||||
started, _ = harness.advance_idle(None, 100, True)
|
||||
started, passed = harness.advance_idle(started, 159, False)
|
||||
self.assertIsNone(started)
|
||||
started, passed = harness.advance_idle(started, 170, True)
|
||||
self.assertFalse(passed)
|
||||
self.assertFalse(harness.advance_idle(started, 229, True)[1])
|
||||
self.assertTrue(harness.advance_idle(started, 230, True)[1])
|
||||
|
||||
def test_low_memory_or_swap_stops_the_experiment(self):
|
||||
for available, swap in [(49151, 999999), (999999, 131071)]:
|
||||
with self.assertRaises(harness.Abort):
|
||||
harness.resource_guard(available, swap)
|
||||
with self.assertRaises(harness.Abort):
|
||||
harness.resource_guard(131071, 524288, initial=True)
|
||||
harness.resource_guard(131072, 524288, initial=True)
|
||||
|
||||
def test_cleanup_refuses_other_owners(self):
|
||||
wrong_owner = subprocess.CompletedProcess([], 0, stdout="someone-else\n", stderr="")
|
||||
with patch.object(harness, "command", return_value=wrong_owner) as commands:
|
||||
self.assertFalse(harness.remove_owned("unrelated-container", "our-run"))
|
||||
self.assertEqual(commands.call_count, 1)
|
||||
self.assertEqual(commands.call_args.args[:2], ("docker", "inspect"))
|
||||
|
||||
def test_cgroup_ram_swap_and_cpu_are_separate(self):
|
||||
raw = "memory.current\n83513344\nmemory.swap.current\n221806592\nmemory.events\noom 0\noom_kill 0\ncpu.stat\nnr_periods 2090\nnr_throttled 1052\n"
|
||||
result = harness.parse_cgroup(raw)
|
||||
self.assertEqual(result["memory.current"] + result["memory.swap.current"], 305319936)
|
||||
self.assertEqual(result["cpu.stat"]["nr_throttled"], 1052)
|
||||
with self.assertRaises(harness.Abort):
|
||||
harness.parse_cgroup("memory.current\n10\n")
|
||||
|
||||
|
||||
class EvidenceAndFixtureTests(unittest.TestCase):
|
||||
def test_monitor_waits_full_window_before_starting_jobs(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
run = harness.Experiment(ROOT, Path(temporary))
|
||||
run.container = 'our-test-id'
|
||||
completed = {"phase": "complete", "builds": [{"actual": r} for r in ["SUCCESS", "FAILURE", "SUCCESS"]]}
|
||||
samples = [("startup", {"phase": "ready"}, 200, t) for t in (100, 154, 160)]
|
||||
samples.append(("startup", completed, 200, 170))
|
||||
with patch.object(run, "sample", side_effect=samples), patch.object(harness.time, "monotonic", return_value=0), \
|
||||
patch.object(harness.time, "sleep"), patch.object(harness, "command") as commands:
|
||||
run.monitor()
|
||||
commands.assert_called_once_with("docker", "exec", 'our-test-id', "touch", "/tmp/ssw590/start-jobs")
|
||||
checkpoint = json.loads((Path(temporary) / "checkpoints.jsonl").read_text())
|
||||
self.assertEqual(checkpoint["observed_seconds"], 60)
|
||||
self.assertEqual(run.result["status"], "PASS")
|
||||
|
||||
def test_diagnostic_error_does_not_skip_targeted_cleanup(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
run = harness.Experiment(ROOT, Path(temporary))
|
||||
run.container = 'our-test-id'
|
||||
with patch.object(harness, "owned_container", return_value=True), \
|
||||
patch.object(harness, "command", side_effect=TimeoutError("diagnostic timed out")), \
|
||||
patch.object(harness, "remove_owned", return_value=True) as remove, \
|
||||
patch.object(harness, "http_code", return_value=200), contextlib.redirect_stdout(io.StringIO()):
|
||||
run.cleanup()
|
||||
remove.assert_called_once_with('our-test-id', run.owner)
|
||||
self.assertTrue(run.result["cleanup_ok"])
|
||||
|
||||
def test_folded_plugin_manifest_and_root_mismatch(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
root = Path(temporary)
|
||||
requested = root / "plugins.txt"
|
||||
requested.write_text("gitea:286.v0740a_413c1eb_\n")
|
||||
with zipfile.ZipFile(root / "gitea.jpi", "w") as archive:
|
||||
archive.writestr("META-INF/MANIFEST.MF", "Manifest-Version: 1.0\r\nShort-Name: gitea\r\nPlugin-Version: 286.v0740a_\r\n 413c1eb_\r\nJenkins-Version: 2.528.3\r\n\r\n")
|
||||
result = inventory.inventory(root, requested)
|
||||
self.assertEqual(result[0]["version"], "286.v0740a_413c1eb_")
|
||||
self.assertEqual(len(result[0]["sha256"]), 64)
|
||||
requested.write_text("gitea:wrong\n")
|
||||
with self.assertRaises(ValueError):
|
||||
inventory.inventory(root, requested)
|
||||
|
||||
def test_real_python_fixture_pass_failure_and_repair(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
working = Path(temporary)
|
||||
shutil.copytree(ROOT / "fixtures", working, dirs_exist_ok=True)
|
||||
pricing = working / "pricing.py"
|
||||
original = pricing.read_text()
|
||||
for broken, expected in ((False, 0), (True, 1), (False, 0)):
|
||||
pricing.write_text(original.replace("return unit_price * quantity", "return unit_price + quantity") if broken else original)
|
||||
# Fresh process and no stale bytecode even if file timestamps collide.
|
||||
shutil.rmtree(working / "__pycache__", ignore_errors=True)
|
||||
run = subprocess.run([sys.executable, "-B", "-m", "unittest", "discover", "-s", "tests", "-v"],
|
||||
cwd=working, capture_output=True, text=True)
|
||||
self.assertEqual(run.returncode, expected, run.stderr)
|
||||
self.assertIn("Ran 2 tests", run.stderr)
|
||||
if broken:
|
||||
self.assertIn("13 != 30", run.stderr)
|
||||
self.assertIn("FAILED (failures=1)", run.stderr)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
@@ -6,3 +6,20 @@ git.yebilly.me {
|
||||
colors.yebilly.me {
|
||||
reverse_proxy color-buttons-app:3000
|
||||
}
|
||||
|
||||
# Jenkins: Stevens campus network (155.246.0.0/16) plus team and approved grader
|
||||
# IPs from CI_TEAM_IPS in the untracked .env. Everyone else gets 403 before login.
|
||||
# The Stevens VPN is split-tunnel, so it does not give visitors a 155.246.x.x address.
|
||||
# 172.30.90.10 is Blackbox Exporter on the private probe network (monitoring/compose.yaml).
|
||||
ci.yebilly.me {
|
||||
@denied not remote_ip 155.246.0.0/16 172.30.90.10/32 {$CI_TEAM_IPS}
|
||||
respond @denied 403
|
||||
reverse_proxy jenkins:8080
|
||||
}
|
||||
|
||||
# Grafana (Assignment 7): same allowlist as Jenkins, then Grafana's own login.
|
||||
metrics.yebilly.me {
|
||||
@denied not remote_ip 155.246.0.0/16 {$CI_TEAM_IPS}
|
||||
respond @denied 403
|
||||
reverse_proxy grafana:3000
|
||||
}
|
||||
|
||||
@@ -149,3 +149,39 @@ port; Caddy reaches it on the private `gitea_web` network.
|
||||
```
|
||||
|
||||
Remove it with `docker rm -f color-buttons-app`, delete the block, and reload.
|
||||
|
||||
## Jenkins CI (Assignment 6 / Instructor Manual Chapter 4)
|
||||
|
||||
`jenkins/Dockerfile` extends the official `jenkins/jenkins:2.580.1-lts-jdk21`
|
||||
image (digest pinned) with `python3` and the plugins in `jenkins/plugins.txt`.
|
||||
Builds run on the controller's single executor. Jenkins publishes no port:
|
||||
browsers reach it through Caddy at `https://ci.yebilly.me/login`, and the Gitea
|
||||
webhook reaches `http://jenkins:8080/gitea-webhook/post` on the private network.
|
||||
|
||||
1. DNS: `A` record `ci` -> droplet IPv4.
|
||||
2. On the droplet, put team source IPs in the untracked `~/gitea/.env`
|
||||
(space separated CIDRs; Stevens 155.246.0.0/16 is already in the Caddyfile):
|
||||
```bash
|
||||
echo 'CI_TEAM_IPS=203.0.113.7/32' > ~/gitea/.env # example address
|
||||
```
|
||||
3. Copy `docker-compose.yml`, `Caddyfile` (with `cat >`, see above) and the
|
||||
`jenkins/` folder, then:
|
||||
```bash
|
||||
cd ~/gitea
|
||||
docker compose build jenkins
|
||||
docker compose up -d jenkins
|
||||
docker compose up -d --force-recreate gitea caddy # webhook allowlist + CI_TEAM_IPS + alias
|
||||
```
|
||||
4. Unlock Jenkins with `docker compose exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword`
|
||||
(read it yourself; never paste it anywhere), install **no** suggested
|
||||
plugins, create one named administrator per teammate, and set the Jenkins
|
||||
URL to `https://ci.yebilly.me/`.
|
||||
|
||||
Operate:
|
||||
|
||||
```bash
|
||||
docker compose restart jenkins # settings and jobs live in the jenkins-home volume
|
||||
docker compose logs --tail 100 jenkins # failed build or webhook: check here, then
|
||||
# Gitea repo Settings -> Webhooks -> Recent Deliveries
|
||||
docker stats --no-stream; free -m # memory pressure on the 512 MB droplet
|
||||
```
|
||||
|
||||
@@ -12,6 +12,7 @@ services:
|
||||
- GITEA__server__ROOT_URL=https://git.yebilly.me/
|
||||
- GITEA__server__HTTP_PORT=3000
|
||||
- GITEA__server__DISABLE_SSH=true # Git over HTTPS only
|
||||
- GITEA__webhook__ALLOWED_HOST_LIST=jenkins # only private webhook target allowed
|
||||
volumes:
|
||||
- gitea-data:/data
|
||||
networks: [web]
|
||||
@@ -27,13 +28,51 @@ services:
|
||||
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
||||
- caddy-data:/data # certificates + ACME account
|
||||
- caddy-config:/config
|
||||
networks: [web]
|
||||
environment:
|
||||
- CI_TEAM_IPS=${CI_TEAM_IPS:-} # team source IPs for ci.yebilly.me, kept in untracked .env
|
||||
networks:
|
||||
web:
|
||||
# Jenkins resolves git.yebilly.me to Caddy here, so checkout and status
|
||||
# calls stay on the droplet instead of hairpinning through the public IP.
|
||||
aliases: [git.yebilly.me]
|
||||
probe:
|
||||
# Blackbox Exporter (monitoring/compose.yaml) probes both sites through Caddy here.
|
||||
aliases: [git.yebilly.me, ci.yebilly.me]
|
||||
depends_on: [gitea]
|
||||
|
||||
# Jenkins LTS controller (Assignment 6). Builds run on its single executor.
|
||||
# Bounded so Gitea keeps memory on the 512 MB droplet.
|
||||
jenkins:
|
||||
build: ./jenkins
|
||||
image: ssw590-jenkins:2.580.1
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
# The capacity test's 128 MiB heap ran builds, but the web UI hit "OutOfMemoryError:
|
||||
# Java heap space" once the update-center catalog loaded (2026-10-22), so the
|
||||
# persistent service gets twice the test bounds on the 1 GiB droplet.
|
||||
- JAVA_OPTS=-Xms64m -Xmx256m -XX:+UseSerialGC -Djava.awt.headless=true
|
||||
volumes:
|
||||
- jenkins-home:/var/jenkins_home
|
||||
networks: [web]
|
||||
mem_limit: 512m
|
||||
memswap_limit: 768m
|
||||
cpus: 0.75
|
||||
pids_limit: 256
|
||||
# ponytail: no ports: on purpose -- Caddy and the Gitea webhook reach jenkins:8080 privately;
|
||||
# agent port 50000 is never published.
|
||||
|
||||
volumes:
|
||||
gitea-data:
|
||||
caddy-data:
|
||||
caddy-config:
|
||||
jenkins-home:
|
||||
|
||||
networks:
|
||||
web:
|
||||
# Fixed subnet so Blackbox Exporter can have a fixed address (172.30.90.10), the only
|
||||
# private address the ci.yebilly.me allowlist admits. The web subnet stays denied:
|
||||
# Docker's proxy presents IPv6 and hairpin visitors as its gateway, 172.18.0.1.
|
||||
probe:
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.30.90.0/28
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# Official Jenkins LTS image plus what the controller executor needs to run the
|
||||
# pipeline: python3 for the tests and the pinned plugin lockfile.
|
||||
FROM jenkins/jenkins:2.580.1-lts-jdk21@sha256:a660310e39ade10631f774bacd5219de767dfd08947ea5c32a739b5e5bb382c1
|
||||
|
||||
USER root
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends python3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
USER jenkins
|
||||
|
||||
# ponytail: curl + sha256sum instead of jenkins-plugin-cli, which needs >128 MiB heap
|
||||
# just to parse the update-center JSON on a 512 MB droplet.
|
||||
COPY plugins.txt /tmp/plugins.txt
|
||||
RUN mkdir -p /usr/share/jenkins/ref/plugins && cd /usr/share/jenkins/ref/plugins \
|
||||
&& tr -d '\r' < /tmp/plugins.txt | grep -Ev '^(#|$)' | while IFS=: read -r name ver sha; do \
|
||||
curl -fsSL -o "$name.jpi" "https://updates.jenkins.io/download/plugins/$name/$ver/$name.hpi" \
|
||||
&& echo "$sha $name.jpi" | sha256sum -c --quiet || exit 1; \
|
||||
done
|
||||
@@ -0,0 +1,71 @@
|
||||
# Lockfile copied from the team's prepared plugin bundle (Vincent Sun, 2026-10-21): roots
|
||||
# workflow-aggregator:608.v67378e9d3db_1 and gitea:286.v0740a_413c1eb_ plus every resolved
|
||||
# dependency, the same set exercised by ci/jenkins-capacity. Format name:version:sha256.
|
||||
# Regenerate the whole file from a new bundle manifest rather than hand-editing one line.
|
||||
# Added 2026-10-22: matrix-auth:3.3 for named Jenkins roles (its only dependency, ionicons-api,
|
||||
# was already in the bundle at the required version).
|
||||
# Added 2026-10-23: pipeline-graph-view (stage view of each run) with its new dependencies
|
||||
# jackson3-api and snakeyaml-engine-api; other required versions were already satisfied.
|
||||
apache-httpcomponents-client-4-api:4.5.14-269.vfa_2321039a_83:cea2f61cc72890b962fd4b767c31778c6cb30015b4a8758b4c26b62e51ca9533
|
||||
asm-api:9.11.1-226.vff833a_e4c58e:ba315fe727be0311cd5115205a09a2abb550b73287cc4ee07af5f7ef6502f1f8
|
||||
authentication-tokens:1.144.v5ff4a_5ec5c33:8069074af688b102703410045a11394fb8d2f52c2cc2d7abd3067e3adff5fc24
|
||||
bouncycastle-api:2.30.1.86.2-310.v4655f6742752:57cc5cf1585f9a8f29c5a1e3985f07dace5d5359545d788e72ecaa3636515a58
|
||||
branch-api:2.1303.v9f3b_95dc329d:6ecfc3d335cec791008a2d06ca933c6ccc97db1c14a4aee5030affebb97482e0
|
||||
caffeine-api:3.3.1-214.v18eb_56b_34920:768ed05774f12d85bf8ecff5d509f037810d1359de8b4fb1385624f6f547c90b
|
||||
cloudbees-folder:6.1106.v3a_d9a_6d2465e:4ccfcfe145a1b36aef61f19187e8aa74eb3c90fdb9c9bfce865e09aa13c8a70a
|
||||
commons-lang3-api:3.21.0-122.v6a_ea_4fd34049:4d6194f8d3b3f2b69264f0403fe5a51846236a41f4e363f6aae45f82f7761657
|
||||
commons-text-api:1.15.0-218.va_61573470393:ae2abdf957694f4aa39b9ba0b539edabc384f3da277551879e34ffb22fb13764
|
||||
credentials-binding:728.v902a_273b_8947:bd7d1a187e35c8e2b6619cd50f2f8c5d28aafc4ef8fd9de572fb2cfa464f466d
|
||||
credentials:1514.vb_01eb_014e7d4:b6e0a05d107fe492bb57baea75fb585fb65dd90c2456a6432b90b87226997457
|
||||
display-url-api:2.217.va_6b_de84cc74b_:07eeaae738b451bade4756900b48561c6c493a42c7ba07a45b22a2dce71ac0ca
|
||||
durable-task:686.v80ff80875b_82:1f5bb92ee5784ee01a4e4e0307e806fa1e260db8aceba56fe8d277e939278dfa
|
||||
git-client:6.6.1:69ab80e3bd51e2e4e676a18722c02c7b163eb11a758b52ecf179d58e1ca1738f
|
||||
git:5.11.0:bf4639abb65e6ca210bd0d7cb9b6570e93717894bdcd008b2e7e5a916dd818f6
|
||||
gitea:286.v0740a_413c1eb_:242e091be9cbbd289546c65a85cf948670de2b3020db573e162926a97c3b5837
|
||||
gson-api:2.14.0-201.v8eefe5515533:6940cd0f795f72371fd5644d885db9ec0a2077985ac55de85d19ab3b1fac2bb7
|
||||
handy-uri-templates-2-api:2.1.8-38.vcea_5d521d5f3:2e5881410b0bca648fb78c890bfd8b83c46e4ff4c778235cb58e28b45d89b10e
|
||||
instance-identity:203.v15e81a_1b_7a_38:df2b3205a6177248f12b294650a60405f65ba2cd503ca9599b2dcb72c1de5018
|
||||
ionicons-api:94.vcc3065403257:95f3504375d628d887425ccdf32d5606a230261ee42dc683f13958d8e973ac3f
|
||||
jackson-annotations2-api:2.22-19.v10a_a_582ea_26e:f13d0a17af6f8c8939a6edd30952006b77dca4760b1f40e0289c363918b7d17d
|
||||
jackson2-api:2.22.3-447.v6a_93ce7d2c82:ce2cfb7a5ad6e66aea9a5b6c4a5ea0622bfc5c05db5db8918581ae7f1d10ff33
|
||||
jackson3-api:3.2.4-103.vf5a_b_3f4ea_cec:4397f73c11ba5085a40280555b519c9427cf8d69d63d5d60f4f623f72f953fe2
|
||||
jakarta-activation-api:2.1.4-1:e62298341742f14b374045387ba641ad8a19376793c76bdafebb4a05b5099712
|
||||
jakarta-mail-api:2.1.5-1:244735ea85a51332c079d235a5713e70d3810bea62332894002acc39914ce11b
|
||||
jakarta-xml-bind-api:4.0.9-19.v2b_a_5b_44d9a_1c:2f59227936687ec00f7ea62b550e7a6e9c86cda3423f3567ffe66bbdf235ffb5
|
||||
javax-activation-api:1.2.0-8:e96e88c52edf07ba00fb45b26cc411a7a95fa3d4491aaa1a5d36637665880560
|
||||
jaxb:2.3.9-143.v5979df3304e6:38ddf4cf5db61a591044130c2f7ccb2b7aa9abebc8fcd8a6953f8da550d002ed
|
||||
joda-time-api:2.15.0-208.v6b_084e7a_d9f0:427513635d122f62fcd8e52af08cc895913b9a70568e7665a3ce8fc1a4871ddf
|
||||
json-api:20260814-226.v20f9685d642c:c5ac5ecfddd35c07087b3333ae05ec4167a70abae8bf0ebcb7338b6b54540889
|
||||
mailer:534.v1b_36f5864073:5426a66a3f879d25fcb4baff678a28422afbabff22cd6e4f0f998fc67a3dc3fa
|
||||
matrix-auth:3.3:b8f7a916f1de0872d4c16264bcf9604fdb5b2da1827764745946c7ac5f613948
|
||||
mina-sshd-api-common:2.19.0-192.v2b_a_7b_2c1dc71:887ebd645e43919b6113201257821b990fc923f375382a5dada0c089e49b85bc
|
||||
mina-sshd-api-core:2.19.0-192.v2b_a_7b_2c1dc71:5039ea17ea1aa9e349712ccc1e036c38ea9f20f722affc220c2c751369f32495
|
||||
pipeline-build-step:601.v6d4c6d1a_9dc7:1b61a1820844f3f72f9dfcd6d7eeab66fa0fbcee5e3923b912cd1ed10fbf63c5
|
||||
pipeline-graph-view:1053.v9df19e6ceed2:4a92651101fb02e0db24170211ef1b4cc14b7d3c20df51a2fa61807f75bff8ff
|
||||
pipeline-groovy-lib:822.vc95f70dea_db_7:a633824da17e95fe2a9f03e8d951a771c70a729e987fc51874146723f3b6343b
|
||||
pipeline-input-step:560.v56198a_642157:7c61bb745ecd1e4e5c7864dc7c8352148d9b2281bcca5a48fd3a7cca7290a135
|
||||
pipeline-milestone-step:152.v6e22b_8cfc66c:cb3187809e219f01b42068f277058a818033f3cfd14da7ec59c86f028fc38386
|
||||
pipeline-model-api:2.2293.v6e7193cec599:cdd72a69bf2863a1683b282febd0256d5d266111134c3803a8c4a051b6b4c133
|
||||
pipeline-model-definition:2.2293.v6e7193cec599:9f4f62e0a13fefc9c5736a20ad5124af2a324357294fd8ea8d8f848b7c497f92
|
||||
pipeline-model-extensions:2.2293.v6e7193cec599:00fbf0938ef13f6aedaa0900ec4cd03fcc986e34b1820bf13f761c2f29831861
|
||||
pipeline-stage-step:345.va_96187909426:2eba433b28f2dfc90519e233b14264890f97b93b78e25c664d56607141fcd94b
|
||||
pipeline-stage-tags-metadata:2.2293.v6e7193cec599:032f011fc50cb273b300d44fb6c2800e3dbdf0d78548b15e0f192ba7cc95d178
|
||||
plain-credentials:199.v9f8e1f741799:b5e5e35cf93ad3b818a983916cbcdf3f7866699410a4df923e6a2968ecc3a448
|
||||
scm-api:728.vc30dcf7a_0df5:1336472987daa2fa912210aba00e1e37b739ce03f75c973a6794d1a0f55c0326
|
||||
script-security:1436.v1082791135e4:c2292e200c5796675c16d19325469aac4a5460c7ad23974952b9823f62066f6a
|
||||
snakeyaml-api:2.7-152.vc672728cf536:bfa595a283634c8dd63aa8d1b039cf3d3f52e0952048058fc0b9a4826ca06508
|
||||
snakeyaml-engine-api:3.2-18.v885ed7ff698f:89c14c0ac2816c1efc192dd333b4b26d97ae58d2ab1d492e8b52feca406e220e
|
||||
ssh-credentials:372.va_250881b_08cd:7b4d035b05b331038f3dfa99ddfef0cabbacede8f0ad2a6ca9611fb0844108a9
|
||||
structs:362.va_b_695ef4fdf9:a0a5db44f2cb082a9ec6572c088340521f033fff8c351fc7eba9ef7f07dbbf8d
|
||||
variant:70.va_d9f17f859e0:12e214ea694469a4461b55881ecb4074ae5dfb04797dbc0dad390f6f4bc75aaf
|
||||
woodstox-core-api:7.3.0-16.v017f30ed004c:fca0ce7cd19274833df226cd6746d71ce4025b784a81bd5b8512730f5d34a9df
|
||||
workflow-aggregator:608.v67378e9d3db_1:7b94227c1afa01bb262c14919ad4a333412f1b51d947c0f21909ec2daff357dc
|
||||
workflow-api:1413.v2ff1a_5e720fa_:f4adbd6b34a2a0b643a12b898110bd976350142eff6322efda21efacbccb6835
|
||||
workflow-basic-steps:1098.v808b_fd7f8cf4:93449eb494658d065d097e8c54f707c98c9ce3e54da2fb98281b0a0487154eaf
|
||||
workflow-cps:4395.v738456a_5da_6b_:2af278f3012f294165db715bfa608045feaf781a6c7c85b5d7ab1ee5b707f021
|
||||
workflow-durable-task-step:1479.v56e587f413a_7:a0f0f1464ce3592f76d0f0079ce9fc2d4272594f995bf3d1a7ede4cd5031452e
|
||||
workflow-job:1609.v8926e7962024:1f63a3dc4e9f8bfbde7b759530da4073e105a92fee3b647962d981de223ac8f5
|
||||
workflow-multibranch:842.v3a_b_59b_57b_e6e:af26afd93b5d730d203d8f58d1e104712ad1a7ddcf6837886d3272b1c0057e46
|
||||
workflow-scm-step:487.v41313a_96b_65d:532fc247cba83845df3c7fccaabfc3cb1f637729b145211728bcb974a3a67552
|
||||
workflow-step-api:724.v538c2362b_dfb_:887491de444174228471993b0b2db958db2e7fb577857c8516c58e9618049896
|
||||
workflow-support:1015.v785e5a_b_b_8b_22:914ee717ab8c1d60d0d3ea49a1af11e4ea65c1e74c0b44dc3522f9a2fe5b2a8e
|
||||
@@ -14,7 +14,34 @@ discuss repository visibility with the other group member before publication.
|
||||
No registration token, runner identity file, private key, or account credential
|
||||
is copied. Hints-only Hosts/Passwords records are retained.
|
||||
|
||||
## Build and status
|
||||
## Local PDF for review and submission
|
||||
|
||||
From repository root, use the existing TinyTeX installation:
|
||||
|
||||
```powershell
|
||||
./manual/latex/makefilePowerShell.ps1 -Action pdf
|
||||
```
|
||||
|
||||
The helper detects the shared `../Tools/LaTeX/TinyTeX` installation. For a
|
||||
different existing installation, set `DEVOPS_LATEX_BIN` to its `bin/windows`
|
||||
directory first. It runs the full bibliography, glossary, acronym, index,
|
||||
and cross-reference sequence and replaces
|
||||
`manual/2026F-SSW-590-DevOps-Group-1.pdf`. That PDF and compiler intermediates
|
||||
are ignored by Git; sources and evidence remain versioned. Docker and an
|
||||
Actions artifact download are unnecessary for this local build. Local builds
|
||||
show the human document version without claiming an Actions run number.
|
||||
|
||||
After reviewing the PDF, remove generated LaTeX intermediates with:
|
||||
|
||||
```powershell
|
||||
./manual/latex/makefilePowerShell.ps1 -Action clean
|
||||
```
|
||||
|
||||
The PDF is retained. Continue using Gitea Actions for automated build evidence;
|
||||
keep historical run artifacts already required by the manual. New local
|
||||
revisions reuse this one PDF rather than creating more run folders.
|
||||
|
||||
## Historical Assignment 5 build evidence
|
||||
|
||||
See [compiler and workflow instructions](../ci/manual/README.md).
|
||||
Gitea run 1 succeeded for commit `828f6c5` (issue #12), including checkout,
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
This group document records the SSW 590 coursework and its supporting
|
||||
commands, designs, and evidence. Assignment 5 automates compilation of the
|
||||
LaTeX manual through Gitea Actions, using a repository-scoped Docker runner
|
||||
on Vincent's laptop while Gitea remains on the DigitalOcean droplet. The
|
||||
workflow checks out the triggering revision, compiles with a recorded TeX
|
||||
Live toolchain, adds run and commit identifiers to the PDF version, and
|
||||
uploads the PDF and build diagnostics. Two successful source-change runs,
|
||||
an intentional compiler failure, and a successful repair demonstrate the
|
||||
workflow. Earlier chapters retain the group's prior assignment results.
|
||||
commands, designs, and evidence. Assignment 7 introduces site reliability
|
||||
engineering: Prometheus, Grafana OSS, Node Exporter, and Blackbox Exporter
|
||||
run as four pinned containers beside Gitea and Jenkins on the 1\,GiB
|
||||
DigitalOcean droplet, with Grafana at \url{https://metrics.yebilly.me/login}
|
||||
for approved networks only. A dashboard shows host CPU, memory, and disk and
|
||||
the HTTPS availability of Gitea and Jenkins. A 99\% availability objective is
|
||||
defined and measured, and three alert rules (service availability, disk
|
||||
space, and collection health) notify the team's Discord channel. Each was
|
||||
shown firing and resolving; the availability rule through a planned Jenkins
|
||||
outage that was detected in about two minutes and recovered about a minute
|
||||
after restart. Earlier chapters retain the group's prior assignment
|
||||
results, including the Jenkins merge gate and the Gitea Actions manual build.
|
||||
|
||||
@@ -521,3 +521,261 @@ replace review of the final workflow-generated PDF. No commit, push,
|
||||
merge, issue closure, or submission was performed by Codex. Final evidence
|
||||
update push, successful artifact review, group pull-request review/merge,
|
||||
issue \#12 closure, and submission remain human workflow steps.
|
||||
|
||||
\section{Assignment 6 Jenkins Capacity and Test Preparation}
|
||||
Date: October 19--21, 2026; Tool: OpenAI Codex; Human: Vincent Sun.
|
||||
Inputs: instructor manual version 1.38 supplied by Vincent, the authorized
|
||||
DigitalOcean droplet view, repository instructions, Vincent's reported resize
|
||||
constraint and choice to test the existing droplet, terminal screenshots, and
|
||||
downloaded capacity measurements. Codex prepared isolated core-only experiments;
|
||||
Vincent ran them through his authenticated SSH connection. The first timed out.
|
||||
After Vincent authorized stopping the graded Color Buttons app, the second
|
||||
demonstrated core startup and 24 successful sampled Gitea HTTP checks. No kernel
|
||||
out-of-memory event was recorded; final container accounting nevertheless
|
||||
included about 80\,MiB RAM plus 212\,MiB swap. This is not evidence of plugin or
|
||||
build capacity. Human/AI correction: the raw result claimed a 60-second idle
|
||||
window, but recorded successful HTTP samples span only 54 seconds. Codex
|
||||
preserved the evidence and prepared a corrected, unexecuted core script whose
|
||||
timer starts after a successful response.
|
||||
|
||||
Vincent requested a portable human/Claude handoff for Billy Ye. Codex assembled
|
||||
selected non-secret references, original evidence, scripts, structured state,
|
||||
the prior team PDF and integrity hashes. The instructor PDF was missing at its
|
||||
previous location when packaging; that limitation was identified explicitly.
|
||||
On October 21, Vincent reported school-network connection timeouts. Read-only
|
||||
checks confirmed that the attached Cloud Firewall allowed the measured source
|
||||
IPv4, Gitea HTTPS responded, and TCP 22 timed out. The location/cause of filtering
|
||||
was not proven. No firewall change, reboot or package upgrade was made by Codex.
|
||||
|
||||
Vincent asked Codex to prepare and explain the next test. The versioned test
|
||||
sources include a host-side Python controller, disposable container
|
||||
bootstrap, explicit Pipeline/Gitea plugin requests, plugin archive inventory,
|
||||
trusted initialization hook, sample Python pipeline, fault/regression checks
|
||||
and a readable runbook. The prepared test covers constrained installation,
|
||||
plugin activation, a corrected 60-second healthy observation, then serial
|
||||
passing, intentionally failing and repaired calculation tests. It retains
|
||||
resource and Gitea checks, separate RAM/swap accounting, targeted cleanup and
|
||||
a detached deadline. It adds no production credential, public Jenkins endpoint,
|
||||
webhook, merge check, persistent service or paid resource. The controller's
|
||||
single executor is restricted by the experiment's trusted local fixture; it
|
||||
does not establish the final production build boundary.
|
||||
|
||||
Verification used: nine local Python regression/fault checks passed, including
|
||||
the actual sample application's pass/failure/repair sequence; Git Bash accepted
|
||||
the bootstrap syntax. Official plugin documentation supplied version/baseline
|
||||
checks. Docker was initially off; Vincent then enabled it and authorized local
|
||||
verification. The first local attempt exhausted the installer's 128\,MiB Java
|
||||
heap while reading the plugin catalog, before Jenkins started; Docker did not
|
||||
report a kernel OOM kill. Codex separated laptop-only plugin preparation
|
||||
(768\,MiB RAM, 512\,MiB heap) from runtime. The official installer prepared
|
||||
59 versioned and hashed plugin archives, and its temporary container was removed.
|
||||
|
||||
The revised runtime kept the original limits: 256\,MiB RAM, 512\,MiB for RAM
|
||||
plus swap, half a CPU and a 128\,MiB heap. All 59 plugins loaded; healthy HTTP
|
||||
samples spanned 65.39 seconds before the job ran. Three serial Jenkins builds
|
||||
produced success, the intended unit-test failure, and repaired success. Peak
|
||||
simultaneous accounted RAM plus swap was about 389.5\,MiB, with zero recorded
|
||||
container OOM events. Cleanup succeeded and no experiment containers remained.
|
||||
This demonstrates local Jenkins execution, not capacity beside Gitea on the
|
||||
droplet. The laptop Docker VM had substantially more host resources; local mode
|
||||
recorded the unmeasured droplet host/Gitea fields as null. Original failed and
|
||||
successful evidence was retained. The upload package includes the resolved
|
||||
plugin archives so the droplet need not repeat the larger catalog-resolution
|
||||
step. Remaining work includes the guarded droplet run, actual Gitea integration and
|
||||
merge-gate exercise, and the Assignment 6 report chapter. Hosts and Passwords
|
||||
tables remain unchanged because no persistent service or real integration
|
||||
credential was added. Existing deployment files and evidence were preserved;
|
||||
no commit, push, merge or submission was performed by Codex.
|
||||
|
||||
\section{Assignment 6 Jenkins Deployment, Merge Gate, and Chapter}
|
||||
Date: October 21--23, 2026; Tool: Anthropic Claude Code (Claude Opus 5.5);
|
||||
Human: Billy Ye, with Vincent Sun as reviewer.
|
||||
Inputs: instructor manual version 1.38 (Chapter 4), Vincent's two handoff
|
||||
packages (capacity evidence, the prepared \texttt{ci/jenkins-capacity} test
|
||||
and plugin bundle, and the patch for the preceding record), the repository
|
||||
and its AI guidance, Billy's decisions (Jenkins on the existing droplet,
|
||||
Claude runs droplet commands over SSH with Billy approving each step,
|
||||
browser allowlist of Stevens 155.246.0.0/16 plus team addresses, and the
|
||||
instructor's Python pricing example), and Billy's dated screenshots. Billy
|
||||
loaded his SSH key into the Windows agent and typed its passphrase himself;
|
||||
Claude never saw the passphrase, the Jenkins initial password, any account
|
||||
password, or the \texttt{jenkins-bot} token.
|
||||
|
||||
Claude read the droplet state, ran Vincent's guarded test unchanged
|
||||
(first run aborted on upload permissions it introduced; fixed with
|
||||
\texttt{chmod}; second run passed), wrote the Dockerfile, plugin lockfile,
|
||||
Compose, Caddy, and README changes, deployed Jenkins after backing up the Compose and Caddy files and with a
|
||||
monitored rollout, and pushed the feature commits after Billy asked.
|
||||
Billy performed every web-interface step (DNS, Jenkins setup and security,
|
||||
bot account and token, credential, job, webhook, branch protection, PR
|
||||
creation, merge); Vincent reviewed and approved PR~\#15.
|
||||
|
||||
Human/AI corrections: the plugin installer exhausted a 128\,MiB heap, so
|
||||
Claude replaced it with hashed \texttt{curl} downloads; the 128\,MiB runtime
|
||||
heap hung the web interface, so Claude doubled the container limits with a
|
||||
recorded reason; Claude had dropped \texttt{matrix-auth} when adopting
|
||||
Vincent's bundle, which Billy discovered when the option was missing, and
|
||||
it was added; Billy's question about the build-view screenshot showed no
|
||||
stage view was installed, so \texttt{pipeline-graph-view} was added. Claude
|
||||
redacted a Jenkins reporting-endpoint ID and personal browser details from
|
||||
screenshots.
|
||||
|
||||
Outputs used: the deployment files and application/test/\texttt{Jenkinsfile}
|
||||
in PR~\#15; the command log retained under ignored
|
||||
\texttt{build/evidence/}; \ChapterRef{JenkinsCI}; updated Hosts and Passwords
|
||||
tables; glossary terms; title page, abstract, Document History; this record.
|
||||
Unresolved: three theme plugins installed through the web interface are not
|
||||
in the lockfile; the course deadline was reported as Friday but not checked
|
||||
on the course page by Claude; the final PDF needs the Gitea Actions runner
|
||||
on Vincent's laptop. No submission was performed by Claude.
|
||||
|
||||
\section{Assignment 6 Access-Path Correction}
|
||||
Date: October 23, 2026; Tool: Anthropic Claude Code (Claude Opus 5.5);
|
||||
Human: Billy Ye.
|
||||
Inputs: an independent model review of the version 4.0 PDF, which noted that
|
||||
the instructor access path (campus or Stevens VPN) had not been tested;
|
||||
Billy's GlobalProtect connection to \texttt{sitvpn.stevens.edu} and his
|
||||
redacted settings screenshot. Claude checked the public address and routing
|
||||
table on Billy's laptop while the VPN was connected: the address was
|
||||
unchanged and only 155.246.0.0/16 used the VPN adapter, so the VPN is
|
||||
split-tunnel. Human decision: state the campus network plus addresses added
|
||||
on request as the approved path. Outputs used: corrected access-path text,
|
||||
an exposure-table row, the GlobalProtect figure, the Caddyfile comment,
|
||||
version 4.1 and its history row. Billy's residential address was kept out of
|
||||
the report. Vincent then tested from campus Wi-Fi \texttt{Stevens-Net}
|
||||
(public address 155.246.151.38) and the sign-in page loaded; Claude combined
|
||||
his screenshots into one figure, blurring the password field and profile
|
||||
icon. A friend reportedly on campus saw a blank page (the 403); his network
|
||||
and address were not recorded, so no conclusion is drawn from it.
|
||||
|
||||
\section{Assignment 6 Run-9 Review and Final Corrections}
|
||||
Date: October 23, 2026; Tool: OpenAI Codex; Human: Vincent Sun.
|
||||
Inputs: Vincent's request to review the run-9 PDF, instructor manual version
|
||||
1.38, the repository's AI guidance, public Gitea commit/status/review records,
|
||||
and Vincent's approval to correct the documentation while leaving the three
|
||||
theme plugins unchanged. Codex reviewed the Jenkins chapter, updated tables,
|
||||
history, and AI records visually; checked the artifact ZIP and PDF links;
|
||||
and confirmed the recorded failed/repaired statuses, approval, and merge
|
||||
against Gitea. A read-only HTTPS check returned the Jenkins sign-in page
|
||||
with certificate verification passing. No authenticated Jenkins inspection
|
||||
or new droplet experiment was performed during this review.
|
||||
|
||||
Human/AI corrections: the PDF linked a 60-plugin lockfile at the initial
|
||||
deployment merge while describing the later 63-plugin set. Codex changed
|
||||
that link to the recorded revision \texttt{ac18f11}, retaining historical
|
||||
PR and run links. It clarified that \emph{Build Now} uses the revision
|
||||
selected for that run and does not establish a clean workspace or the same
|
||||
commit as an earlier run; clean local reproduction now calls for a fresh
|
||||
clone and the recorded commit ID. It separated the observed delivery timeout
|
||||
from the suspected CPU/discovery cause and made timeout tuning conditional.
|
||||
At Vincent's direction, the theme plugins were left unchanged; the existing
|
||||
security-check result is explicitly limited to its 63 checked versions.
|
||||
|
||||
Outputs used: these corrections in \ChapterRef{JenkinsCI}, version 4.2,
|
||||
the dated Document History entry, and this record. Prior Billy/Claude
|
||||
records and original run-9 evidence are preserved. Hosts and Passwords
|
||||
tables are unchanged because no deployed service, account, or credential
|
||||
changed. The revision is checked through the complete local TinyTeX build,
|
||||
diagnostic inspection, and visual review of the affected PDF pages.
|
||||
No commit, push, remote configuration change, or submission is performed
|
||||
as part of this correction.
|
||||
|
||||
\section{Assignment 7 Monitoring Deployment, Tests, and Chapter}
|
||||
Date: October 27--28, 2026; Tool: Anthropic Claude Code (Claude Opus 5.5);
|
||||
Human: Billy Ye, with Vincent Sun as verifier and reviewer.
|
||||
Inputs: instructor manual version 1.42 (Chapter 5), found in Billy's
|
||||
downloads after Billy asked to implement ``chapter 5 of this manual''; the
|
||||
repository and its AI guidance; Billy's decisions (measure capacity before
|
||||
any resize and then try a capped deployment on the 1\,GiB plan, alerts to a
|
||||
Discord webhook, hostname \texttt{metrics.yebilly.me}, Claude running droplet
|
||||
commands over SSH with Billy approving each step, disabling four unused host
|
||||
services after Claude showed the disk and boot checks); Billy's DNS record,
|
||||
Discord channel and webhook, issue \#19, secrets file, Grafana login,
|
||||
screenshots, pushes, and improvement issues \#20 and \#21.
|
||||
|
||||
Claude synced both checkouts, measured the baseline, chose and verified
|
||||
pinned image digests, wrote the \texttt{monitoring/} configuration, the
|
||||
Caddy and Compose changes, the dashboard, alert rules, and README runbooks;
|
||||
validated them locally (Compose, \texttt{promtool}, \texttt{caddy validate},
|
||||
and a throwaway Grafana run); deployed them after backing up the Caddy files;
|
||||
ran the exposure, contact-point, capacity-alert, outage, persistence, and SLO
|
||||
queries; and wrote \ChapterRef{SREMonitoring}, the Hosts and Passwords
|
||||
updates, glossary terms, title page, abstract, and Document History. Billy
|
||||
typed every secret himself: Claude never saw the Grafana password or the
|
||||
webhook URL. API calls read the password from the Grafana container's
|
||||
environment without printing it.
|
||||
|
||||
Human/AI corrections: the local Grafana run rejected an alert template
|
||||
written with \texttt{\$\$labels}; the deployed Grafana could not read its
|
||||
configuration after the Windows upload (fixed with \texttt{chmod}); Grafana~13
|
||||
had removed the old contact-point test endpoint, so the replacement was found
|
||||
from its own error message; one Grafana login from Claude failed because a
|
||||
password was read from the file with untrimmed whitespace; the first
|
||||
build-check before the outage matched the \texttt{ps} header and aborted
|
||||
before anything was stopped; one SLO query was first evaluated at the wrong
|
||||
time and was rerun; Billy's partial home IP address was removed from the
|
||||
evidence file before commit; the push from Claude's shell failed
|
||||
authentication, so Billy pushed and re-authorized Git Credential Manager.
|
||||
Billy's questions about the CPU readings led to the I/O-wait finding and the
|
||||
dashboard change.
|
||||
|
||||
Review and corrections: at Billy's request, Claude had an independent
|
||||
subagent audit the chapter against the instructor's requirements. Claude
|
||||
checked its findings against the evidence (two of its ``unsupported''
|
||||
claims were supported by earlier output and a figure) and, with Billy's
|
||||
approval, added a collection-health rule and tested it by stopping Blackbox
|
||||
Exporter, ran Blackbox Exporter as non-root, compared CPU counters with
|
||||
\texttt{/proc/stat}, and corrected four figures and the overstated
|
||||
no-data claim. Billy replaced the Grafana administrator password himself;
|
||||
Claude confirmed the old value was rejected and removed it from the
|
||||
secrets file without printing it.
|
||||
|
||||
Outputs used: commits \texttt{d3a5e6b} and \texttt{b6cf080}, the chapter
|
||||
commits on \texttt{feature/issue-19-monitoring} (PR \#22);
|
||||
\texttt{monitoring/EVIDENCE.md}; \ChapterRef{SREMonitoring}; this record.
|
||||
Assumptions and unresolved items: the title-page assignment title comes
|
||||
from the Canvas page Billy showed (``\#7 Grafana and Promethous SRE --
|
||||
Group''), with the spelling of Prometheus corrected; the acknowledgement was given to Claude before the restart, and
|
||||
Billy's Discord reply came later; Billy created Vincent's Grafana
|
||||
account \texttt{vsun1} as Viewer; the 24-hour SLO was not evaluated; the manual-PDF build needs
|
||||
Vincent's runner when the branch is merged. No pull request, merge, or
|
||||
submission was performed by Claude.
|
||||
|
||||
\section{Assignment 7 Run-11 Review, TCP Evidence, and Final Corrections}
|
||||
Date: October 28, 2026; Tool: OpenAI Codex; Human: Vincent Sun.
|
||||
Inputs: Vincent's request to double-check Billy's completed Assignment 7,
|
||||
instructor manual version 1.42 Chapter 5, the run-11 artifact, repository AI
|
||||
guidance, versioned monitoring configuration and evidence, and public Gitea
|
||||
statuses and reviews. Vincent authorized the corrections and requested one
|
||||
locally compiled PDF in the repository, excluded from Git. Codex inspected
|
||||
the chapter and supporting figures, compared configuration and dashboard
|
||||
queries with the rubric, and verified the final PR head, approval, merge,
|
||||
and successful run-11 status. Chrome connected to Gitea; a subsequent
|
||||
project-tab operation timed out, so no authenticated Jenkins/Grafana audit
|
||||
or remote settings change was performed in this correction.
|
||||
|
||||
Human/AI corrections: Codex identified changing branch links, incomplete TCP
|
||||
evidence from HTTP code 000, outdated review timestamps, and conclusions
|
||||
stronger than the timing, sampling, or resource measurements supported.
|
||||
Vincent ran the supplied external PowerShell loop on his laptop and moved
|
||||
its CSV into the repository's ignored evidence directory. All 18 outcomes
|
||||
matched: TCP 80/443 succeeded and seven private ports failed on both IPv4
|
||||
and IPv6. Codex preserved the raw file and made a versioned copy replacing
|
||||
only the local Wi-Fi name with a generic network description. The reusable
|
||||
script preserves that loop with parameters; its syntax is checked without
|
||||
claiming another network test. The CSV timestamps are completion times.
|
||||
|
||||
Outputs used: version 5.1; the new TCP table and reproduction command;
|
||||
deployment links pinned to merge \texttt{34c4c74}; final approval/check and
|
||||
run-11 links; qualified notification-delay, missing-sample, and memory-pressure
|
||||
conclusions; a Document History entry; and this record. The local build helper
|
||||
now discovers the shared TinyTeX path from the actual repository nesting;
|
||||
local build instructions and PDF ignore rules retain one replaceable PDF.
|
||||
The complete TinyTeX build includes the bibliography, glossary, acronym list,
|
||||
index, and final reference passes, followed by diagnostic and visual review.
|
||||
Billy/Claude records and original evidence are preserved. Hosts and Passwords
|
||||
tables are unchanged because no deployed service, account, or credential
|
||||
changed. The missed pre-deployment build observation remains a limitation;
|
||||
later results do not recreate it. Commits, pushes, peer approval, and submission
|
||||
remain with the group. This local revision is not described as an Actions
|
||||
artifact or as already approved in Gitea.
|
||||
|
||||
@@ -34,16 +34,16 @@
|
||||
\definecolor{devopsLightBlue}{RGB}{232,240,247}
|
||||
|
||||
% Replace these values for each assignment.
|
||||
\newcommand{\AssignmentTitle}{LaTeX Auto-Compilation with Gitea -- Group}
|
||||
\newcommand{\AssignmentNumber}{5}
|
||||
\newcommand{\DocumentVersion}{3.4}
|
||||
\newcommand{\AssignmentTitle}{Grafana and Prometheus SRE -- Group}
|
||||
\newcommand{\AssignmentNumber}{7}
|
||||
\newcommand{\DocumentVersion}{5.1}
|
||||
\newcommand{\DocumentStatus}{Draft}
|
||||
\newcommand{\CourseNumber}{SSW 590}
|
||||
\newcommand{\CourseName}{DevOps}
|
||||
\newcommand{\Authors}{Vincent Sun and Billy Ye}
|
||||
\newcommand{\Organization}{Stevens Institute of Technology}
|
||||
\newcommand{\DocumentDate}{10/7/2026}
|
||||
\newcommand{\DueDate}{Wednesday by 11:59pm}
|
||||
\newcommand{\DocumentDate}{10/28/2026}
|
||||
\newcommand{\DueDate}{Friday by 11:59pm}
|
||||
% CI writes this ignored file in its checkout; ordinary local builds stay unchanged.
|
||||
\providecommand{\CIBuildSuffix}{}
|
||||
\InputIfFileExists{ci-build-metadata.tex}{}{}
|
||||
@@ -146,11 +146,13 @@
|
||||
\include{devopsProjectProposal}
|
||||
\include{devopsGitea}
|
||||
\include{devopsAutomatedManualBuild}
|
||||
\include{devopsJenkins}
|
||||
\include{devopsSRE}
|
||||
\include{devopsHostsPasswords}
|
||||
|
||||
% Restore when a chapter cites devopsReferences.bib.
|
||||
%\bibliographystyle{IEEEtran}
|
||||
%\bibliography{devopsReferences}
|
||||
\bibliographystyle{IEEEtran}
|
||||
\bibliography{devopsReferences}
|
||||
|
||||
\appendix
|
||||
\include{devopsDocumentGuide}
|
||||
|
||||
@@ -346,4 +346,11 @@ review the resulting successful workflow PDF and retain that final artifact
|
||||
for submission. Pull-request review/merge and issue \#12 closure are still
|
||||
pending; no approval or submission is claimed here.
|
||||
|
||||
\textbf{Status update, October 22, 2026:} the pending steps above have since
|
||||
completed.
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/pulls/13}{PR~\#13}
|
||||
was merged and issue \#12 is closed (re-checked in Gitea on October 22), and
|
||||
the merged-\texttt{main} workflow run~6 passed (verified by Vincent on
|
||||
October 21). The paragraph above is kept as the version 3.4 record.
|
||||
|
||||
\endgroup
|
||||
|
||||
@@ -12,26 +12,32 @@ link each entry to the changed chapter, table, figure, or controlled artifact.
|
||||
\multicolumn{4}{l}{\small\itshape Document Update History (continued)}\\
|
||||
\toprule \textbf{Date / Version} & \textbf{Author Initials} & \textbf{Change} & \textbf{Changed At}\\ \midrule
|
||||
\endhead \bottomrule \endlastfoot
|
||||
October 7, 2026 / 3.4 & VS, Codex & Added the successful run-4 repair screenshots and verified its commit, PDF version, artifact contents, and SHA-256; completed the failure/repair evidence. Replaced the abstract's template instructions with an Assignment 5 summary. Hosts and Passwords tables are unchanged from 3.3; final workflow PDF review and submission remain pending. & Title and abstract, \ChapterRef{AutomatedManualBuild}, \ChapterRef{AIPromptLog}\\
|
||||
October 7, 2026 / 3.3 & VS, Codex & Recorded successful run 2 and intentional failure run 3 with screenshots and downloaded diagnostic verification; removed the test error for a repair push. Updated both the Hosts section and hints-only Passwords table for the local runner; passing repair evidence and final artifact review remain pending. & \ChapterRef{AutomatedManualBuild}, \ChapterRef{HostsPasswords}, \ChapterRef{AIPromptLog}\\
|
||||
October 7, 2026 / 3.2 & VS, Codex & Set the Assignment 5 title, number, and date after successful Gitea run 1; retained its original PDF and evidence. The new title omits the duplicate LMS suffix. Added the draft Automated Manual Build chapter with the workflow and first-PDF screenshots. Hosts and Passwords tables are unchanged; remaining workflow tests and runner records are pending. & Title page, \ChapterRef{AutomatedManualBuild}, \ChapterRef{AIPromptLog}\\
|
||||
October 7, 2026 / preparation & VS, Codex & Prepared the Assignment 5 local runner, compiler image, and push workflow; verified local compilation, failure/repair, and revision checks. Corrected Windows glossary/index regeneration after layout settles. Real workflow artifacts and the assignment chapter remain pending. Document version, Hosts table, and Passwords table are unchanged. & \ChapterRef{AIPromptLog}\\
|
||||
September 29, 2026 / 3.1 & BY, Claude & Restored the Assignment 3 Color Buttons site at \texttt{colors.yebilly.me} behind the same Caddy proxy (no published port, 96\,MiB memory cap, graceful reload without restarting Gitea); versioned the change through reviewed PR~\#11 (closes issue~\#10); updated the Caddyfile excerpt and verification note, and \textbf{updated the Hosts table} with the new hostname, URL, and private service. The Passwords table is unchanged. & \ChapterRef{GiteaFoundation}, \ChapterRef{HostsPasswords}\\
|
||||
September 28, 2026 / 3.0 & BY, VS, Claude & Assignment 4: deployed pinned Gitea 1.27.3 with SQLite behind Caddy and Let's Encrypt at \texttt{git.yebilly.me} (Student Pack domain), applied the \texttt{gitea-fw} Cloud Firewall, and recorded DNS, persistence, certificate-renewal, external-exposure, and issue-to-merge evidence; \textbf{created the Hosts table and the Passwords (hints-only) table}; added TLS, SSH, and ACME glossary terms and set the Assignment 4 title page. & \ChapterRef{GiteaFoundation}, \ChapterRef{HostsPasswords}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 2.6 & VS, Codex & Kept each proposed SWOT table with its tool heading and removed the forced page break that separated the comparison charts. & \ChapterRef{ProjectProposal}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 2.5 & VS, Codex & Clarified that AdGuard Home and Pi-hole can be compared through direct Ubuntu installation or containers; made Docker Compose optional and aligned the deployment workflow and SWOT wording. & \ChapterRef{ProjectProposal}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 2.4 & VS, Codex & Removed the provisional TikZ dashboard figure and marked the dashboard approach as subject to change after the group consults the professor; retained the proposed operational checks. & \ChapterRef{ProjectProposal}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 2.3 & VS, Codex & Simplified the proposed operations dashboard around DigitalOcean Insights and planned VPN stability-under-load and DNS ad-block tests; updated the TikZ mockup to distinguish host graphs from service-check results. & \ChapterRef{ProjectProposal}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 2.2 & VS, Codex & Added a TikZ mockup of the proposed operational dashboard, with placeholder values and planned comparison filters; clarified that live measurements and a running dashboard remain future project work. & \ChapterRef{ProjectProposal}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 2.1 & VS, Codex & Added second-device LaTeX Docker evidence: a versioned one-go PowerShell helper, the successful build/run screenshot, a folder listing, and the opened PDF; documented retained logs and distinct run values. & \ChapterRef{LaTeXDocker}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 2.0 & VS, Codex & Drafted the Project Proposal for a resource-constrained personal VPN and DNS gateway, including proposed tools, comparison tests, dashboard, security plan, feasibility limits, and four provisional SWOT charts; updated the glossary and rebuilt the report. & \ChapterRef{ProjectProposal}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 1.9 & BY, Claude & Added the LaTeX Docker chapter (Assignment 3, Task 4): a Debian TeX Live Dockerfile, a sample document, and the local build and compile evidence; removed title-page placeholder brackets and corrected the due date. & \ChapterRef{LaTeXDocker}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 1.8 & BY, Claude & Added the Digital Ocean Docker Deployment chapter (Assignment 3, Tasks 1--3) with screenshots, converted Assignment 2 terminal output to framed \texttt{Verbatim} blocks, set the Assignment 3 title-page values, and added the \texttt{minted}/TikZ packages and \texttt{-shell-escape} build flag they require. & \ChapterRef{DigitalOceanDockerDeployment}, \ChapterRef{AIAgentGuide}, \ChapterRef{AIPromptLog}\\
|
||||
September 20, 2026 / 1.7 & VS, Codex & Clarified that the Projects folder layout is optional, distinguished user-terminal compiler operation from AI sandbox access, and documented explicit TinyTeX path and short-path workarounds while retaining MiKTeX only as an existing fallback. & \ChapterRef{AIAgentGuide}, \ChapterRef{DocumentGuide}, \ChapterRef{AIPromptLog}\\
|
||||
September 19, 2026 / 1.6 & VS, Codex & Relocated the shared TinyTeX toolchain, documented per-user TinyTeX setup, and automated complete local compilation including bibliography, glossary, acronym, and index passes. & \ChapterRef{AIAgentGuide}\\
|
||||
September 19, 2026 / 1.5 & VS, Codex & Established the Group 1 repository structure, preserved the original instructor template as a separate reference snapshot, and added the AI Agent Requirements appendix and repository routing files. & \ChapterRef{AIAgentRequirements}, \ChapterRef{AIAgentGuide}, \ChapterRef{AIPromptLog}\\
|
||||
September 15, 2026 / 1.4 & VS, Codex & Completed Sections C, F, G, H, I, and J (Questions 13--16 and 24--40), including verified Linux-environment evidence, explanations, compilation, visual review, and the corresponding AI prompt-log records. & \ChapterRef{LinuxCommands}, \ChapterRef{AIPromptLog}\\
|
||||
September 15, 2026 / 1.3 & BY, Claude & Completed Sections A, B, D, and E (Questions 1--12 and 17--23), including environment-setup evidence, explanations, and LaTeX formatting, with the corresponding Claude assistance record retained as written. & \ChapterRef{LinuxCommands}, \ChapterRef{AIPromptLog}\\
|
||||
October 28, 2026 / 5.1 & VS, CDX & Reviewed run-11 against instructor Chapter 5; added Vincent's external IPv4/IPv6 TCP retest (18 expected outcomes), pinned deployment links to the reviewed merge, recorded final PR approval and CI/build results, and qualified timing, sampling, and memory-pressure conclusions. Documented local TinyTeX builds to one ignored PDF. Hosts and Passwords tables are unchanged because no deployed service, account, or credential changed. & \ChapterRef{SREMonitoring}, \ChapterRef{AIPromptLog}\\
|
||||
October 28, 2026 / 5.0 & BY, CD & Assignment 7: added \ChapterRef{SREMonitoring}. Deployed Prometheus, Grafana OSS, Node Exporter, and Blackbox Exporter on The-Ocean (pinned by digest, memory-capped, no host ports) after a capacity trial on the 1\,GiB plan; disabled four unused host services and added a second swap file; added \texttt{metrics.yebilly.me} behind the Jenkins allowlist and a private probe network. Recorded the dashboard, normal-build comparison, SLI/SLO worked example and measured window, contact-point, capacity-alert, collection-health, and Jenkins-outage tests with Discord notifications, restart persistence, blameless review, and improvement issues \#20 and \#21. After an independent review of the draft: added the collection-health rule and its test, replaced the initial Grafana administrator password, ran Blackbox Exporter as non-root, and added runbooks, network and storage detail in the diagram, host CPU checks, a targets table, citations with a Bibliography, and four corrected figures. \textbf{Updated the Hosts table} (monitoring containers, ports, volumes, \texttt{metrics} DNS, swap, monitoring and backup status) and \textbf{the Passwords table} (Grafana accounts, monitoring secrets file, Discord webhook). Set the Assignment 7 title page and abstract; added glossary terms. & Title and abstract, \ChapterRef{SREMonitoring}, \ChapterRef{HostsPasswords}, \ChapterRef{AIPromptLog}\\
|
||||
October 23, 2026 / 4.2 & VS, CDX & Corrected the Jenkins lockfile link to the recorded 63-plugin revision; clarified clean reproduction, Jenkins revision selection, and the unconfirmed webhook-timeout cause. Scoped the existing update-check result to the 63 checked plugins. Theme plugins are unchanged at Vincent's direction. Hosts and Passwords tables are unchanged because no service, account, or credential changed. & \ChapterRef{JenkinsCI}, \ChapterRef{AIPromptLog}\\
|
||||
October 23, 2026 / 4.1 & BY, CD & Corrected the Jenkins instructor access path to the Stevens campus network, with off-campus graders' addresses added on request; recorded the GlobalProtect test showing the Stevens VPN is split-tunnel and therefore not an access path, and Vincent's passing campus test on \texttt{Stevens-Net}; added the real webhook delivery table and diagnosis of one timed-out delivery, UML stereotypes on the deployment diagram, the stored Jenkins URL, free disk space, reconciled plugin counts, and corrected wording on push rights, resource limits, and corrective actions. Shortened AI initials in this table (CDX for Codex, CD for Claude). Hosts and Passwords tables are unchanged. & \ChapterRef{JenkinsCI}, \ChapterRef{AIPromptLog}\\
|
||||
October 22--23, 2026 / 4.0 & BY, VS, CD & Assignment 6: ran the guarded Jenkins capacity test on the resized 1\,GiB droplet; deployed Jenkins 2.580.1 LTS with a hashed plugin lockfile behind Caddy at \texttt{ci.yebilly.me} (Stevens and team allowlist); integrated Gitea via a private webhook and the \texttt{jenkins-bot} identity; required check \texttt{vpn-dns-gateway/pipeline/pr-main} on \texttt{main}; recorded PR~\#15's pass, blocked failure, repair, review, and merge, the restart-persistence and IPv4/IPv6 exposure tests, and the plugin-update check. \textbf{Updated the Hosts table} (resize, Jenkins, \texttt{ci} DNS, Color Buttons retired) and \textbf{the Passwords table} (Jenkins administrators, \texttt{jenkins-bot} account and token, CI allowlist file). Added glossary terms, set the Assignment 6 title page and abstract, and noted the completed Assignment 5 merge. & Title and abstract, \ChapterRef{JenkinsCI}, \ChapterRef{HostsPasswords}, \ChapterRef{AutomatedManualBuild}, \ChapterRef{AIPromptLog}\\
|
||||
October 21, 2026 / preparation & VS, CDX & Recorded core-test timing qualification and the Billy/Claude handoff; prepared the plugin/pipeline test and verified it locally after separating plugin resolution from runtime. The droplet run remains unverified. Hosts and Passwords tables are unchanged because no persistent Jenkins service or real integration credential was added. & \ChapterRef{AIPromptLog}\\
|
||||
October 7, 2026 / 3.4 & VS, CDX & Added the successful run-4 repair screenshots and verified its commit, PDF version, artifact contents, and SHA-256; completed the failure/repair evidence. Replaced the abstract's template instructions with an Assignment 5 summary. Hosts and Passwords tables are unchanged from 3.3; final workflow PDF review and submission remain pending. & Title and abstract, \ChapterRef{AutomatedManualBuild}, \ChapterRef{AIPromptLog}\\
|
||||
October 7, 2026 / 3.3 & VS, CDX & Recorded successful run 2 and intentional failure run 3 with screenshots and downloaded diagnostic verification; removed the test error for a repair push. Updated both the Hosts section and hints-only Passwords table for the local runner; passing repair evidence and final artifact review remain pending. & \ChapterRef{AutomatedManualBuild}, \ChapterRef{HostsPasswords}, \ChapterRef{AIPromptLog}\\
|
||||
October 7, 2026 / 3.2 & VS, CDX & Set the Assignment 5 title, number, and date after successful Gitea run 1; retained its original PDF and evidence. The new title omits the duplicate LMS suffix. Added the draft Automated Manual Build chapter with the workflow and first-PDF screenshots. Hosts and Passwords tables are unchanged; remaining workflow tests and runner records are pending. & Title page, \ChapterRef{AutomatedManualBuild}, \ChapterRef{AIPromptLog}\\
|
||||
October 7, 2026 / preparation & VS, CDX & Prepared the Assignment 5 local runner, compiler image, and push workflow; verified local compilation, failure/repair, and revision checks. Corrected Windows glossary/index regeneration after layout settles. Real workflow artifacts and the assignment chapter remain pending. Document version, Hosts table, and Passwords table are unchanged. & \ChapterRef{AIPromptLog}\\
|
||||
September 29, 2026 / 3.1 & BY, CD & Restored the Assignment 3 Color Buttons site at \texttt{colors.yebilly.me} behind the same Caddy proxy (no published port, 96\,MiB memory cap, graceful reload without restarting Gitea); versioned the change through reviewed PR~\#11 (closes issue~\#10); updated the Caddyfile excerpt and verification note, and \textbf{updated the Hosts table} with the new hostname, URL, and private service. The Passwords table is unchanged. & \ChapterRef{GiteaFoundation}, \ChapterRef{HostsPasswords}\\
|
||||
September 28, 2026 / 3.0 & BY, VS, CD & Assignment 4: deployed pinned Gitea 1.27.3 with SQLite behind Caddy and Let's Encrypt at \texttt{git.yebilly.me} (Student Pack domain), applied the \texttt{gitea-fw} Cloud Firewall, and recorded DNS, persistence, certificate-renewal, external-exposure, and issue-to-merge evidence; \textbf{created the Hosts table and the Passwords (hints-only) table}; added TLS, SSH, and ACME glossary terms and set the Assignment 4 title page. & \ChapterRef{GiteaFoundation}, \ChapterRef{HostsPasswords}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 2.6 & VS, CDX & Kept each proposed SWOT table with its tool heading and removed the forced page break that separated the comparison charts. & \ChapterRef{ProjectProposal}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 2.5 & VS, CDX & Clarified that AdGuard Home and Pi-hole can be compared through direct Ubuntu installation or containers; made Docker Compose optional and aligned the deployment workflow and SWOT wording. & \ChapterRef{ProjectProposal}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 2.4 & VS, CDX & Removed the provisional TikZ dashboard figure and marked the dashboard approach as subject to change after the group consults the professor; retained the proposed operational checks. & \ChapterRef{ProjectProposal}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 2.3 & VS, CDX & Simplified the proposed operations dashboard around DigitalOcean Insights and planned VPN stability-under-load and DNS ad-block tests; updated the TikZ mockup to distinguish host graphs from service-check results. & \ChapterRef{ProjectProposal}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 2.2 & VS, CDX & Added a TikZ mockup of the proposed operational dashboard, with placeholder values and planned comparison filters; clarified that live measurements and a running dashboard remain future project work. & \ChapterRef{ProjectProposal}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 2.1 & VS, CDX & Added second-device LaTeX Docker evidence: a versioned one-go PowerShell helper, the successful build/run screenshot, a folder listing, and the opened PDF; documented retained logs and distinct run values. & \ChapterRef{LaTeXDocker}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 2.0 & VS, CDX & Drafted the Project Proposal for a resource-constrained personal VPN and DNS gateway, including proposed tools, comparison tests, dashboard, security plan, feasibility limits, and four provisional SWOT charts; updated the glossary and rebuilt the report. & \ChapterRef{ProjectProposal}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 1.9 & BY, CD & Added the LaTeX Docker chapter (Assignment 3, Task 4): a Debian TeX Live Dockerfile, a sample document, and the local build and compile evidence; removed title-page placeholder brackets and corrected the due date. & \ChapterRef{LaTeXDocker}, \ChapterRef{AIPromptLog}\\
|
||||
September 24, 2026 / 1.8 & BY, CD & Added the Digital Ocean Docker Deployment chapter (Assignment 3, Tasks 1--3) with screenshots, converted Assignment 2 terminal output to framed \texttt{Verbatim} blocks, set the Assignment 3 title-page values, and added the \texttt{minted}/TikZ packages and \texttt{-shell-escape} build flag they require. & \ChapterRef{DigitalOceanDockerDeployment}, \ChapterRef{AIAgentGuide}, \ChapterRef{AIPromptLog}\\
|
||||
September 20, 2026 / 1.7 & VS, CDX & Clarified that the Projects folder layout is optional, distinguished user-terminal compiler operation from AI sandbox access, and documented explicit TinyTeX path and short-path workarounds while retaining MiKTeX only as an existing fallback. & \ChapterRef{AIAgentGuide}, \ChapterRef{DocumentGuide}, \ChapterRef{AIPromptLog}\\
|
||||
September 19, 2026 / 1.6 & VS, CDX & Relocated the shared TinyTeX toolchain, documented per-user TinyTeX setup, and automated complete local compilation including bibliography, glossary, acronym, and index passes. & \ChapterRef{AIAgentGuide}\\
|
||||
September 19, 2026 / 1.5 & VS, CDX & Established the Group 1 repository structure, preserved the original instructor template as a separate reference snapshot, and added the AI Agent Requirements appendix and repository routing files. & \ChapterRef{AIAgentRequirements}, \ChapterRef{AIAgentGuide}, \ChapterRef{AIPromptLog}\\
|
||||
September 15, 2026 / 1.4 & VS, CDX & Completed Sections C, F, G, H, I, and J (Questions 13--16 and 24--40), including verified Linux-environment evidence, explanations, compilation, visual review, and the corresponding AI prompt-log records. & \ChapterRef{LinuxCommands}, \ChapterRef{AIPromptLog}\\
|
||||
September 15, 2026 / 1.3 & BY, CD & Completed Sections A, B, D, and E (Questions 1--12 and 17--23), including environment-setup evidence, explanations, and LaTeX formatting, with the corresponding Claude assistance record retained as written. & \ChapterRef{LinuxCommands}, \ChapterRef{AIPromptLog}\\
|
||||
September 2, 2026 / 1.2 & DDM, CDX & Added macOS MacTeX and Windows MiKTeX installation, verification, compilation, cleanup, and troubleshooting instructions to the Document Authoring Guide appendix. & \ChapterRef{DocumentGuide}\\
|
||||
September 2, 2026 / 1.1 & DDM, CDX & Reorganized the example assignment as one chapter with activity, workflow, evidence, retrospective, and submission sections so each homework can follow the same chapter pattern. & Omitted chapter\\
|
||||
September 2, 2026 / 1.0 & DDM, CDX & Created the reusable SSW 590 DevOps assignment template from the architecture template infrastructure; replaced requirements and design chapters with activity, workflow, evidence, retrospective, and submission chapters. & Omitted chapters, \ChapterRef{AIAgentGuide}\\
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
\newacronym{cd}{CD}{continuous delivery or continuous deployment}
|
||||
\newacronym{iac}{IaC}{infrastructure as code}
|
||||
\newacronym{slo}{SLO}{service-level objective}
|
||||
\newacronym{sli}{SLI}{service-level indicator}
|
||||
\newacronym{sla}{SLA}{service-level agreement}
|
||||
\newacronym{sre}{SRE}{site reliability engineering}
|
||||
\newacronym{vpn}{VPN}{virtual private network}
|
||||
\newacronym{dns}{DNS}{Domain Name System}
|
||||
\newacronym{swot}{SWOT}{strengths, weaknesses, opportunities, and threats}
|
||||
@@ -23,3 +26,16 @@
|
||||
|
||||
\newglossaryentry{build-runner}{name={build runner},description={A registered worker that receives workflow jobs and executes them in its configured environment}}
|
||||
\newglossaryentry{build-artifact}{name={build artifact},description={A file retained by a workflow run for download, such as a compiled PDF or diagnostic log; retention may be limited}}
|
||||
|
||||
\newglossaryentry{webhook}{name={webhook},description={An HTTP request that one service sends automatically to another when an event occurs, such as Gitea notifying Jenkins of a push or pull-request update}}
|
||||
\newglossaryentry{status-check}{name={status check},description={A named pass/fail result that a CI system attaches to a commit through the Git server's commit-status API; Gitea shows it on pull requests}}
|
||||
\newglossaryentry{branch-protection}{name={branch protection},description={Repository rules on a branch, such as disallowing direct pushes and requiring status checks and approvals before a pull request can merge}}
|
||||
\newglossaryentry{jenkinsfile}{name={Jenkinsfile},description={A version-controlled file at the repository root that defines a Jenkins pipeline's stages and steps}}
|
||||
\newglossaryentry{controller}{name={controller},description={The central Jenkins server that serves the web interface, stores configuration, and schedules builds; it can also run builds on its own executors}}
|
||||
\newglossaryentry{build-agent}{name={build agent},description={A separate machine or container that connects to a Jenkins controller and runs builds, isolating build code from the controller}}
|
||||
|
||||
\newglossaryentry{error-budget}{name={error budget},description={The amount of failure an SLO still allows in its window; for a 99\% target over 2,880 probes, 28.8 failed probes}}
|
||||
\newglossaryentry{exporter}{name={exporter},description={A small service that exposes measurements of another system, such as a host or a probed website, in Prometheus format for scraping}}
|
||||
\newglossaryentry{scrape}{name={scrape},description={Prometheus's periodic HTTP request to a target's metrics endpoint, which records each returned value with a timestamp}}
|
||||
\newglossaryentry{contact-point}{name={contact point},description={A Grafana alerting destination, such as a Discord channel, that receives firing and resolved notifications}}
|
||||
\newglossaryentry{blameless-review}{name={blameless review},description={An incident review that records impact, timeline, cause, and improvements without assigning personal blame}}
|
||||
|
||||
@@ -10,35 +10,67 @@ password, token, recovery code, or private key. Distinct services use distinct
|
||||
credentials, which are stored outside this manual and outside every
|
||||
repository. Both tables were created on 28 September 2026 for Assignment 4
|
||||
(\ChapterRef{GiteaFoundation}). The local runner host and its identity hint
|
||||
were added on October 7, 2026 for \ChapterRef{AutomatedManualBuild}.
|
||||
were added on October 7, 2026 for \ChapterRef{AutomatedManualBuild}. On
|
||||
October 22--23, 2026 (\ChapterRef{JenkinsCI}) the droplet record was updated
|
||||
for the 1\,GiB resize, the Jenkins service, and \texttt{ci.yebilly.me}; the
|
||||
Color Buttons app was marked retired; and the Passwords table gained the
|
||||
Jenkins administrators, the \texttt{jenkins-bot} Gitea account, and its token.
|
||||
On October 28, 2026 (\ChapterRef{SREMonitoring}) the droplet record gained
|
||||
the four monitoring containers, \texttt{metrics.yebilly.me}, the second swap
|
||||
file, and real monitoring status; the Passwords table gained the Grafana
|
||||
accounts, the monitoring secrets file, and the Discord webhook.
|
||||
|
||||
\section{Hosts}
|
||||
\small
|
||||
\begin{tabularx}{\linewidth}{@{}L{3.3cm}Y@{}}
|
||||
\caption{Hosts\label{Table:Hosts}}\\
|
||||
\toprule \textbf{Field} & \textbf{Droplet The-Ocean (git.yebilly.me, colors.yebilly.me)}\\ \midrule
|
||||
\toprule \textbf{Field} & \textbf{Droplet The-Ocean (git, ci, metrics .yebilly.me)}\\ \midrule
|
||||
\endfirsthead
|
||||
\toprule \textbf{Field} & \textbf{Droplet The-Ocean (git.yebilly.me, colors.yebilly.me)}\\ \midrule
|
||||
\toprule \textbf{Field} & \textbf{Droplet The-Ocean (git, ci, metrics .yebilly.me)}\\ \midrule
|
||||
\endhead
|
||||
\bottomrule \endlastfoot
|
||||
Role & Gitea work hub (Gitea 1.27.3 behind Caddy 2.11.4 TLS proxy); since
|
||||
29 Sep 2026 also the Assignment 3 Color Buttons site\\
|
||||
22 Oct 2026 also the Jenkins 2.580.1 LTS controller, which runs the CI builds;
|
||||
since 28 Oct 2026 also the monitoring stack (Prometheus 3.15.1, Grafana OSS
|
||||
13.2.5, Node Exporter 1.12.1, Blackbox Exporter 0.29.1). The Assignment 3 Color Buttons app (29 Sep 2026) is retired: container
|
||||
stopped with restart policy \texttt{no}; its Caddy route remains\\
|
||||
Environment & Course production (team use)\\
|
||||
Provider & DigitalOcean, NYC1; Ubuntu 24.04 LTS; 1 vCPU, 512\,MB RAM, 10\,GB disk\\
|
||||
Provider & DigitalOcean, NYC1; Ubuntu 24.04 LTS; 1 vCPU; resized from
|
||||
512\,MB to the 1\,GiB Basic plan in October 2026 (961\,MiB reported, 25\,GB
|
||||
plan disk); swap files \texttt{/swapfile} and \texttt{/swapfile2}, 1\,GiB
|
||||
each (second added 28 Oct 2026); \texttt{multipathd}, \texttt{fwupd},
|
||||
\texttt{udisks2}, and \texttt{ModemManager} disabled and masked\\
|
||||
Public address / DNS & IPv4 \texttt{147.182.178.136}; \texttt{A} records
|
||||
\texttt{git.yebilly.me} and \texttt{colors.yebilly.me}; public IPv6 assigned
|
||||
but not published in DNS\\
|
||||
Private services & Gitea \texttt{:3000} and \texttt{color-buttons-app}
|
||||
\texttt{:3000} (96\,MiB memory cap) on Docker network \texttt{gitea\_web}, no
|
||||
host ports; SQLite file in volume \texttt{gitea\_gitea-data}\\
|
||||
\texttt{git}, \texttt{ci}, \texttt{metrics}, and \texttt{colors} \texttt{.yebilly.me}; public
|
||||
IPv6 \texttt{2604:a880:400:d1:0:5:22d:6001} assigned but not published in DNS\\
|
||||
Private services & Gitea \texttt{:3000} and Jenkins \texttt{:8080} (512\,MiB
|
||||
RAM, 0.75 CPU cap; agent port disabled) on Docker network \texttt{gitea\_web},
|
||||
no host ports; SQLite file in volume \texttt{gitea\_gitea-data}; Jenkins state
|
||||
in volume \texttt{gitea\_jenkins-home}. Monitoring (Compose project
|
||||
\texttt{monitoring}, no host ports): Prometheus \texttt{:9090} (128\,MiB),
|
||||
Node Exporter \texttt{:9100} and Blackbox Exporter \texttt{:9115} (32\,MiB
|
||||
each; Blackbox runs as \texttt{nobody}) on network \texttt{monitoring\_monitoring}; Grafana \texttt{:3000}
|
||||
(192\,MiB) also on \texttt{gitea\_web}; Blackbox at \texttt{172.30.90.10} on
|
||||
\texttt{gitea\_probe} (172.30.90.0/28); volumes
|
||||
\texttt{monitoring\_prometheus\_data} (7\,d / 500\,MB) and
|
||||
\texttt{monitoring\_grafana\_data}\\
|
||||
Exposed ports & 443/TCP and 80/TCP to all; 22/TCP to approved team addresses only
|
||||
(Cloud Firewall \texttt{gitea-fw})\\
|
||||
(Cloud Firewall \texttt{gitea-fw}); \texttt{ci.yebilly.me} and
|
||||
\texttt{metrics.yebilly.me} answer only Stevens 155.246.0.0/16 and team
|
||||
addresses (Caddy allowlist; \texttt{ci} also the probe address), 403
|
||||
otherwise; monitoring ports 9090, 9100, 9115 not reachable\\
|
||||
Owner & BY (server administration); VS (review)\\
|
||||
HTTPS URLs & \url{https://git.yebilly.me}, \url{https://colors.yebilly.me}\\
|
||||
Backup status & No backup job; container-replacement persistence verified only
|
||||
(\ChapterRef{GiteaFoundation})\\
|
||||
Monitoring status & No alerting configured; checked manually with
|
||||
\texttt{docker compose ps}, \texttt{docker stats}, and logs\\
|
||||
HTTPS URLs & \url{https://git.yebilly.me}, \url{https://ci.yebilly.me/login},
|
||||
\url{https://metrics.yebilly.me/login}\\
|
||||
Backup status & No backup job; container-replacement persistence verified for
|
||||
Gitea (\ChapterRef{GiteaFoundation}), restart persistence for Jenkins
|
||||
(\ChapterRef{JenkinsCI}) and for Prometheus and Grafana
|
||||
(\ChapterRef{SREMonitoring}); manual volume backup procedure in
|
||||
\texttt{monitoring/README.md}\\
|
||||
Monitoring status & Prometheus and Grafana: host CPU, memory, root disk, and
|
||||
HTTPS probes of Gitea and Jenkins every 30\,s; alerts \emph{HTTPS service
|
||||
down}, \emph{Root disk space low}, and \emph{Monitoring target down} to Discord \texttt{\#devops-alerts}.
|
||||
Shares the droplet's failure domain; no external check yet (issue~\#20)\\
|
||||
\end{tabularx}
|
||||
\normalsize
|
||||
|
||||
@@ -74,6 +106,16 @@ Monitoring / backup & Runner logs and Gitea Actions checked manually; no automat
|
||||
Gitea local runner identity & VS & Docker volume \texttt{ssw590-local-runner-data}, file \texttt{/data/.runner}; generated identity, no values in Git; registration token supplied privately from repository settings & Repository runner; Docker control on VS laptop\\
|
||||
Gitea \texttt{bill} & BY & BY's password manager & Site administrator\\
|
||||
Gitea \texttt{vsun1} & VS & VS's password manager & Repository administrator\\
|
||||
Gitea \texttt{jenkins-bot} (added 22 Oct 2026) & BY & BY's password manager; used only to create its token & Write collaborator on \texttt{vpn-dns-gateway}\\
|
||||
\texttt{jenkins-bot} token \texttt{jenkins-ci} & BY & Jenkins credential ID \texttt{gitea-jenkins-bot} (System, Global), encrypted in volume \texttt{gitea\_jenkins-home}; revoke under the bot's Gitea Applications settings & Repository read/write; organization and user read\\
|
||||
Jenkins \texttt{billy} & BY & BY's password manager & Administer (all)\\
|
||||
Jenkins \texttt{vsun1} & VS & VS's password manager & Administer (all)\\
|
||||
Jenkins initial admin password & --- & One-time setup secret in \texttt{/var/jenkins\_home/secrets/}; read once by BY, superseded by named accounts & Setup only\\
|
||||
Grafana \texttt{billy} (added 28 Oct 2026) & BY & BY's password manager; the initial value set through the monitoring secrets file was replaced in Grafana on 28 Oct 2026 and removed from the file & Grafana Admin\\
|
||||
Grafana \texttt{vsun1} (added 28 Oct 2026) & VS & VS's password manager; temporary password set by BY and sent privately, to be changed by VS at first login & Viewer\\
|
||||
Monitoring secrets \texttt{.env.secret} & BY & \texttt{\textasciitilde/monitoring/.env.secret} on the droplet, mode 600, root; typed by BY; holds the Discord webhook URL (the initial Grafana admin password was removed after it was replaced); never in Git & n/a\\
|
||||
Discord webhook \texttt{Grafana} & BY & BY's password manager and the monitoring secrets file; revoke under \texttt{\#devops-alerts} $\rightarrow$ Integrations $\rightarrow$ Webhooks & Post to \texttt{\#devops-alerts}\\
|
||||
CI allowlist \texttt{.env} & BY & \texttt{\textasciitilde/gitea/.env} on the droplet, root-only; holds team and approved grader IP addresses (personal data, not a secret); grader entries are removed after grading & n/a\\
|
||||
DigitalOcean team & BY, VS & Each member's own login, in their password manager & Team member\\
|
||||
Namecheap (\texttt{yebilly.me}) & BY & BY's password manager & Domain owner\\
|
||||
Droplet \texttt{root} SSH & BY & Key-based only; private key \texttt{digiOcean} on BY's laptop; no password login & Root\\
|
||||
@@ -82,8 +124,10 @@ Gitea database (SQLite) & --- & No credential; file access limited to droplet \t
|
||||
\end{tabularx}
|
||||
\normalsize
|
||||
|
||||
Multi-factor authentication and rotation status have not yet been recorded for
|
||||
these accounts. Some credentials also have local copies on members' devices;
|
||||
Multi-factor authentication: as reported by BY on 28 Oct 2026, his Discord
|
||||
account (which owns the \texttt{\#devops-alerts} webhook) and his GitHub
|
||||
account use MFA. MFA status for the other accounts, and rotation status for
|
||||
all of them, has not yet been recorded. Some credentials also have local copies on members' devices;
|
||||
moving them into the password managers is an open follow-up.
|
||||
|
||||
\fussy
|
||||
|
||||
@@ -0,0 +1,709 @@
|
||||
\chapter{Continuous Integration with Jenkins}
|
||||
\ChapterLabel{JenkinsCI}
|
||||
\index{Jenkins}
|
||||
\index{Jenkins!merge gate}
|
||||
\index{Gitea!required status check}
|
||||
\begingroup
|
||||
\sloppy
|
||||
|
||||
This chapter records Assignment 6, \emph{Gitea + Jenkins Autobuild and
|
||||
Testing -- Group} (instructor manual version 1.38, Chapter 4). Jenkins now runs
|
||||
beside Gitea on the droplet \texttt{The-Ocean}. A pull request (PR) to
|
||||
\texttt{main} in the
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway}{Group 1 Gitea
|
||||
repository} triggers a Jenkins pipeline through a private \gls{webhook}.
|
||||
Jenkins tests the PR's latest head commit and reports a named
|
||||
\gls{status-check} to Gitea; \gls{branch-protection} on \texttt{main} blocks
|
||||
the merge until that check passes and a teammate approves. The work was
|
||||
carried out on October 21--23, 2026 (times below are UTC unless marked
|
||||
Eastern). Sections~\ref{Section:JenkinsDeployment}--\ref{Section:JenkinsQuality}
|
||||
follow the eight rubric rows in order.
|
||||
|
||||
\begin{devopsNote}[Result summary]
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/pulls/15}{PR~\#15}
|
||||
(closes
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/issues/14}{issue~\#14})
|
||||
passed on its first commit, was blocked by a deliberate unit-test failure,
|
||||
passed again after the repair, was approved by Vincent, and was merged as
|
||||
\texttt{420ba4c}. Jenkins checked out the exact PR head for every run, and
|
||||
the commit IDs match across Gitea and Jenkins (Table~\ref{Table:JenkinsSequence}).
|
||||
\end{devopsNote}
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{Jenkins Deployment and Persistence}
|
||||
\label{Section:JenkinsDeployment}
|
||||
\index{Jenkins!deployment}
|
||||
|
||||
\paragraph{Image and plugins.}
|
||||
Jenkins uses the official long-term-support (LTS) image
|
||||
\texttt{jenkins/jenkins:2.580.1-lts-jdk21}, pinned by digest
|
||||
\texttt{sha256:a660310e\ldots82c1}.\footnote{\url{https://www.jenkins.io/doc/book/installing/docker/}}
|
||||
The versioned
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/420ba4c56b1c3efa50099a85c16c750a9815091a/deploy/jenkins/Dockerfile}{\texttt{deploy/jenkins/Dockerfile}}
|
||||
adds only \texttt{python3} (Python 3.13.5; Git 2.47.3 is already in the
|
||||
image) because builds run on the controller. Plugins come from the lockfile
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/ac18f1118601157da356d09d4aa28c4084dc86eb/deploy/jenkins/plugins.txt}{\texttt{deploy/jenkins/plugins.txt}},
|
||||
which pins each listed plugin's version and SHA-256. The image build downloads each
|
||||
archive and verifies its hash. Table~\ref{Table:JenkinsPlugins} lists the
|
||||
plugins the pipeline relies on; the full lockfile holds 63 plugins including
|
||||
dependencies.
|
||||
|
||||
\begin{table}[H]
|
||||
\centering\footnotesize
|
||||
\caption{Principal Jenkins plugins (core 2.580.1)\label{Table:JenkinsPlugins}}
|
||||
\begin{tabular}{@{}L{4.4cm}L{4.4cm}L{6.0cm}@{}}
|
||||
\toprule \textbf{Plugin} & \textbf{Version} & \textbf{Purpose}\\ \midrule
|
||||
\texttt{gitea} & \texttt{286.v0740a\_413c1eb\_} & Gitea SCM source, webhook receiver, commit status\\
|
||||
\texttt{workflow-aggregator} & \texttt{608.v67378e9d3db\_1} & Pipeline suite\\
|
||||
\texttt{pipeline-model-definition} & \texttt{2.2293.v6e7193cec599} & Declarative \texttt{Jenkinsfile} syntax\\
|
||||
\texttt{workflow-multibranch} & \texttt{842.v3a\_b\_59b\_57b\_e6e} & One job per branch / PR\\
|
||||
\texttt{git} & \texttt{5.11.0} & Checkout of the selected revision\\
|
||||
\texttt{matrix-auth} & \texttt{3.3} & Named user permissions\\
|
||||
\texttt{pipeline-graph-view} & \texttt{1053.v9df19e6ceed2} & Stage view of each run\\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
\end{table}
|
||||
|
||||
\paragraph{Capacity preparation.}
|
||||
The droplet originally had 512\,MB RAM. Vincent's October 19 core-only
|
||||
experiments started Jenkins but pushed about 212\,MiB into swap, and their
|
||||
recorded idle window was only 54 seconds of successful samples (see the
|
||||
October 21 record in \ChapterRef{AIPromptLog}). Before this deployment the team
|
||||
resized \texttt{The-Ocean} to the 1\,GiB Basic plan (Linux reports 961\,MiB RAM,
|
||||
24\,GB disk, 1\,GiB swap file). On October 22 Billy ran Vincent's guarded
|
||||
plugin and pipeline test, \texttt{ci/jenkins-capacity/run\_test.py}, unchanged
|
||||
on the droplet:
|
||||
|
||||
\begin{tabularx}{\linewidth}{L{3.6cm}Y}
|
||||
\caption{Guarded capacity test on The-Ocean, October 22, 2026\label{Table:JenkinsCapacity}}\\
|
||||
\toprule \textbf{Record} & \textbf{Observed value}\\ \midrule
|
||||
Run 1 (03:02--03:04) & Aborted: \texttt{java.io.FileNotFoundException}. All 59
|
||||
plugins were active; Gitea returned 200 throughout. Cause: Windows
|
||||
\texttt{scp} uploaded the test folders as root-only, so the container's
|
||||
\texttt{jenkins} user could not read its fixtures. Fixed with
|
||||
\texttt{chmod -R u=rwX,go=rX}; the script was not changed.\\
|
||||
Run 2 (03:05--03:09) & \StatusPass: 59 plugins active, 60.6\,s healthy
|
||||
idle, builds SUCCESS / FAILURE (\texttt{13 != 30}) / SUCCESS\\
|
||||
Peak container memory & 252.8\,MiB RAM, 147.1\,MiB swap (393.9\,MiB together); no OOM events\\
|
||||
Host minimum & 238\,MiB available RAM, 824\,MiB free swap; Gitea 200 on all 30 samples\\
|
||||
CPU & Throttled in 1,689 of 2,212 periods at the 0.5-CPU limit\\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
|
||||
\paragraph{Compose service.}
|
||||
Jenkins is a third service in the existing
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/420ba4c56b1c3efa50099a85c16c750a9815091a/deploy/docker-compose.yml}{\texttt{deploy/docker-compose.yml}}
|
||||
(redacted excerpt; no secrets exist in the file):
|
||||
\begin{minted}{yaml}
|
||||
jenkins:
|
||||
build: ./jenkins
|
||||
image: ssw590-jenkins:2.580.1
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- JAVA_OPTS=-Xms64m -Xmx256m -XX:+UseSerialGC -Djava.awt.headless=true
|
||||
volumes:
|
||||
- jenkins-home:/var/jenkins_home
|
||||
networks: [web]
|
||||
mem_limit: 512m
|
||||
memswap_limit: 768m
|
||||
cpus: 0.75
|
||||
pids_limit: 256
|
||||
# no ports: Caddy and the Gitea webhook reach jenkins:8080 privately
|
||||
\end{minted}
|
||||
The first deployment kept the test's limits (256\,MiB RAM, 128\,MiB heap,
|
||||
0.5 CPU). Builds worked, but the setup wizard and plugin pages hung with
|
||||
\texttt{OutOfMemoryError: Java heap space} once Jenkins loaded the
|
||||
update-center catalog. At 03:35 the limits were raised to those shown above
|
||||
(RAM and heap doubled to 512\,MiB and 256\,MiB, RAM plus swap 512 to
|
||||
768\,MiB, CPU 0.5 to 0.75); Jenkins then answered in 45\,s instead of
|
||||
184\,s on its next start, used about
|
||||
350\,MiB, and left about 180\,MiB of host RAM available with Gitea still
|
||||
returning 200. The service runs one executor so only one build uses memory
|
||||
at a time.
|
||||
|
||||
\paragraph{Persistent state and restart test.}
|
||||
Configuration, users, credentials, jobs, and build history live in the
|
||||
\gls{named-volume} \texttt{gitea\_jenkins-home} mounted at
|
||||
\texttt{/var/jenkins\_home}; the restart policy is \texttt{unless-stopped}.
|
||||
On October 23, after the merge, Billy's session restarted the container and
|
||||
compared state before and after:
|
||||
\begin{minted}{text}
|
||||
== BEFORE 2026-10-23T00:56:21Z started=2026-10-22T03:46:07Z
|
||||
PR-15 builds=3 feature-issue-14 builds=1 main builds=1 users: billy vsun1
|
||||
de35139e5c1d2510 de1a292f55d3050a e0e1e971a6f7e1c4 36bb5fd38ecf7ac6
|
||||
== AFTER 2026-10-23T00:57:07Z (login 200 after ~25s) restart=unless-stopped
|
||||
PR-15 builds=3 feature-issue-14 builds=1 main builds=1 users: billy vsun1
|
||||
de35139e5c1d2510 de1a292f55d3050a e0e1e971a6f7e1c4 36bb5fd38ecf7ac6
|
||||
IDENTICAL: jobs, builds, users, config hashes
|
||||
\end{minted}
|
||||
The four hashes are \texttt{config.xml}, \texttt{credentials.xml}, the Gitea
|
||||
server configuration, and the job configuration. Gitea returned 200
|
||||
throughout. \textbf{Restart persistence is not a backup test}: the volume
|
||||
survives a container restart or replacement, but no copy of it exists
|
||||
elsewhere, so losing the droplet or volume would lose Jenkins' state.
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{HTTPS, Access, and Firewall}
|
||||
\label{Section:JenkinsAccess}
|
||||
\index{Jenkins!HTTPS access}
|
||||
|
||||
\paragraph{Login URL and approved access path.}
|
||||
The Jenkins login page is
|
||||
\textbf{\url{https://ci.yebilly.me/login}}. Caddy serves it only to the Stevens
|
||||
network (155.246.0.0/16, registered to Stevens Institute of Technology in
|
||||
ARIN) and the team's dorm address; every other source receives HTTP 403
|
||||
before reaching Jenkins.
|
||||
|
||||
\textbf{Instructor access:} open the URL from the Stevens campus network
|
||||
(Wi-Fi \texttt{Stevens-Net}), whose public addresses fall in 155.246.0.0/16.
|
||||
On October 23 Vincent tested this path from campus: on \texttt{Stevens-Net}
|
||||
his public address was \texttt{155.246.151.38} and the Jenkins sign-in page
|
||||
loaded (Figure~\ref{Figure:JenkinsCampus}).
|
||||
Off campus, look up your public IPv4 address at \url{https://ifconfig.me}
|
||||
and send it to Billy or Vincent; it is added to \texttt{CI\_TEAM\_IPS}, Caddy
|
||||
is recreated, and the URL then opens. No sign-in is needed to see the login
|
||||
page, and no grader account exists. This confirms web-service availability
|
||||
only, not that a pipeline works.
|
||||
|
||||
The Stevens VPN is \emph{not} an access path. On October 23 at 18:56 UTC,
|
||||
Billy connected the GlobalProtect client to \texttt{sitvpn.stevens.edu}, the
|
||||
only gateway it offers (Figure~\ref{Figure:StevensVPN}). The laptop's public
|
||||
address stayed the team's allowlisted residential address, and its routing
|
||||
table sent only 155.246.0.0/16 through the VPN adapter, while the default
|
||||
route kept using the home connection. The VPN is therefore split-tunnel:
|
||||
traffic to \texttt{ci.yebilly.me} leaves through the user's own internet
|
||||
provider, so an off-campus visitor on the VPN would receive 403.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{images/jenkins-campus-test-2026-10-23.png}
|
||||
\caption{October 23, 2026: Vincent's campus test on \texttt{Stevens-Net}.
|
||||
ifconfig.me reports public address \texttt{155.246.151.38} (the second
|
||||
forwarded address is ifconfig.me's own Google front end), and
|
||||
\texttt{ci.yebilly.me/login} shows the Jenkins sign-in page. The screenshots
|
||||
show no clock; Billy received them at 3:43 p.m.\ Eastern. The password field
|
||||
and browser profile icon are blurred.}
|
||||
\label{Figure:JenkinsCampus}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.6\linewidth]{images/stevens-vpn-split-tunnel-2026-10-23.png}
|
||||
\caption{October 23, 2026: GlobalProtect connected to the single gateway
|
||||
\texttt{sitvpn.stevens.edu} (IPSec, about 66\,KB received in 32 minutes,
|
||||
consistent with a split tunnel). Assigned and gateway IPs redacted by Billy.}
|
||||
\label{Figure:StevensVPN}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{images/jenkins-login-2026-10-21.png}
|
||||
\caption{October 21, 2026, 11:40 p.m.\ Eastern: the Jenkins sign-in page at
|
||||
\texttt{ci.yebilly.me/login} over HTTPS from the team's allowlisted address.
|
||||
Bookmarks and taskbar applications are blurred.}
|
||||
\label{Figure:JenkinsLogin}
|
||||
\end{figure}
|
||||
|
||||
\paragraph{DNS, certificate, and redirect.}
|
||||
Billy added an \texttt{A} record \texttt{ci} $\rightarrow$
|
||||
\texttt{147.182.178.136} at Namecheap (Figure~\ref{Figure:JenkinsDNS}). No
|
||||
\texttt{AAAA} record is published for \texttt{ci}. Caddy obtained the
|
||||
certificate automatically at 03:17:31 on October 22 and renews it without a
|
||||
cron job; its renewal window, reported by the certificate authority, is
|
||||
December 20--22, 2026.\footnote{\url{https://caddyserver.com/docs/automatic-https}}
|
||||
The \texttt{ci.yebilly.me} block in
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/420ba4c56b1c3efa50099a85c16c750a9815091a/deploy/Caddyfile}{\texttt{deploy/Caddyfile}} is:
|
||||
\begin{minted}{text}
|
||||
ci.yebilly.me {
|
||||
@denied not remote_ip 155.246.0.0/16 {$CI_TEAM_IPS}
|
||||
respond @denied 403
|
||||
reverse_proxy jenkins:8080
|
||||
}
|
||||
\end{minted}
|
||||
\texttt{CI\_TEAM\_IPS} is read from the untracked, root-only
|
||||
\texttt{\textasciitilde/gitea/.env}, so home addresses are not in Git. Caddy's
|
||||
\texttt{reverse\_proxy} forwards the \texttt{X-Forwarded-*} headers, and the
|
||||
Jenkins URL (\emph{Manage Jenkins $\rightarrow$ System $\rightarrow$ Jenkins
|
||||
Location}) is \texttt{https://ci.yebilly.me/}, as stored in the controller's
|
||||
configuration (read on the droplet, October 23):
|
||||
\begin{minted}{text}
|
||||
$ docker exec gitea-jenkins-1 grep jenkinsUrl \
|
||||
/var/jenkins_home/jenkins.model.JenkinsLocationConfiguration.xml
|
||||
<jenkinsUrl>https://ci.yebilly.me/</jenkinsUrl>
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{images/jenkins-dns-namecheap.png}
|
||||
\caption{October 22, 2026: Namecheap Advanced DNS for \texttt{yebilly.me},
|
||||
including the new \texttt{ci} \texttt{A} record to the droplet.}
|
||||
\label{Figure:JenkinsDNS}
|
||||
\end{figure}
|
||||
|
||||
\paragraph{External checks.}
|
||||
All tests ran from Billy's laptop, outside the droplet
|
||||
(Table~\ref{Table:JenkinsExposure}). The IPv6 tests target the droplet's
|
||||
IPv6 address directly because IPv6 is enabled on the droplet, even though DNS
|
||||
publishes only IPv4. The laptop's IPv6 address is not on the allowlist, so
|
||||
the IPv6 HTTPS test is also the non-approved-source test.
|
||||
|
||||
{\small
|
||||
\begin{tabularx}{\linewidth}{L{4.0cm}L{3.0cm}L{1.6cm}Y}
|
||||
\caption{External exposure tests\label{Table:JenkinsExposure}}\\
|
||||
\toprule \textbf{Test} & \textbf{Source / time} & \textbf{Expected} & \textbf{Actual}\\ \midrule
|
||||
HTTPS \texttt{ci\ldots/login} & IPv4, allowlisted; Oct 22 03:17:56 & 200 & 200, ``Sign in -- Jenkins'' \StatusPass\\
|
||||
HTTP \texttt{ci\ldots/login} & same & redirect & 308 to \texttt{https://\ldots/login} \StatusPass\\
|
||||
Certificate & same & valid & Let's Encrypt \texttt{YE2}, CN \texttt{ci.yebilly.me}, Oct 22, 2026 -- Jan 20, 2027 \StatusPass\\
|
||||
TCP 8080, 50000 & same & closed & closed/filtered \StatusPass\\
|
||||
TCP 3000 (Gitea backend) & IPv4; Oct 23 01:02 & closed & closed/filtered \StatusPass\\
|
||||
HTTPS \texttt{ci} via droplet IPv6 & IPv6, not allowlisted; Oct 23 01:02:42 & 403 & 403 \StatusPass\\
|
||||
HTTP \texttt{ci} via IPv6 & same & redirect & 308 \StatusPass\\
|
||||
TCP 8080, 50000, 3000 via IPv6 & same & closed & closed/filtered \StatusPass\\
|
||||
HTTPS \texttt{ci\ldots/login} from campus & \texttt{Stevens-Net}, \texttt{155.246.151.38} (Vincent); Oct 23 & 200 & Sign-in page shown \StatusPass\\
|
||||
Public IPv4 while on Stevens VPN & GlobalProtect connected; Oct 23 18:56:13 & Stevens address & Unchanged residential address; VPN is split-tunnel, so not offered as an access path \textbf{\footnotesize INFO}\\
|
||||
\bottomrule
|
||||
\end{tabularx}}
|
||||
|
||||
\paragraph{Firewalls and port mappings.}
|
||||
The DigitalOcean \gls{cloud-firewall} \texttt{gitea-fw} is unchanged from
|
||||
Assignment 4 (Figure~\ref{fig:gitea-fw-rules} in \ChapterRef{GiteaFoundation}):
|
||||
TCP 80 and 443 from all IPv4/IPv6, TCP 22 from approved team addresses only.
|
||||
No rule was added for Jenkins, because Jenkins publishes no port. The host
|
||||
firewall (\texttt{ufw}) is inactive; exposure is controlled by the Cloud
|
||||
Firewall and by Compose publishing nothing except Caddy's ports. On the
|
||||
droplet, October 23:
|
||||
\begin{minted}{text}
|
||||
caddy caddy:2.11.4-alpine 0.0.0.0:80->80/tcp, [::]:80->80/tcp, 0.0.0.0:443->443/tcp, [::]:443->443/tcp
|
||||
gitea gitea/gitea:1.27.3 22/tcp, 3000/tcp (not published)
|
||||
jenkins ssw590-jenkins:2.580.1 8080/tcp, 50000/tcp (not published)
|
||||
\end{minted}
|
||||
The inbound agent port is also disabled in Jenkins' security settings
|
||||
(\texttt{slaveAgentPort=-1}).
|
||||
|
||||
\paragraph{Accounts and roles.}
|
||||
Jenkins uses its own user database with sign-up disabled and matrix-based
|
||||
authorization (Figure~\ref{Figure:JenkinsMatrix}). \texttt{billy} (Billy Ye)
|
||||
and \texttt{vsun1} (Vincent Sun) each hold \emph{Overall/Administer};
|
||||
\emph{Anonymous} and \emph{Authenticated Users} hold nothing.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{images/jenkins-security-matrix-2026-10-21.png}
|
||||
\caption{October 21, 2026, 11:50 p.m.\ Eastern: Jenkins security with own
|
||||
user database, sign-up disabled, and matrix authorization granting
|
||||
\emph{Administer} only to the two named team accounts.}
|
||||
\label{Figure:JenkinsMatrix}
|
||||
\end{figure}
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{Gitea Trigger and Traceability}
|
||||
\label{Section:JenkinsTrigger}
|
||||
\index{webhook}
|
||||
|
||||
Figure~\ref{Figure:JenkinsDeployment} adapts the instructor's reference
|
||||
deployment to what was built. The browser path and the webhook path are
|
||||
separate: browsers reach Jenkins only through the firewall and Caddy's
|
||||
allowlist, while the webhook, checkout, and status calls never leave the
|
||||
droplet.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\resizebox{\linewidth}{!}{%
|
||||
\begin{tikzpicture}[
|
||||
box/.style={draw, rounded corners, align=center, font=\small, minimum height=1.0cm},
|
||||
lbl/.style={font=\scriptsize, fill=white, inner sep=1pt},
|
||||
arr/.style={-{Stealth}, thick}]
|
||||
\node[box] (browser) at (0,0) {\guillemotleft device\guillemotright\\Team / instructor\\browser};
|
||||
\node[box, fill=devopsLightBlue] (fw) at (4.3,0) {\guillemotleft device\guillemotright\\Cloud Firewall\\\texttt{gitea-fw}, 443 / 80};
|
||||
\node[box] (caddy) at (8.6,0) {\guillemotleft container\guillemotright\\Caddy TLS proxy\\allowlist for \texttt{ci}\\alias \texttt{git.yebilly.me}};
|
||||
\node[box] (gitea) at (13.6,2.2) {\guillemotleft container\guillemotright\\Gitea \texttt{:3000}};
|
||||
\node[box] (jenkins) at (13.6,-3.0) {\guillemotleft container\guillemotright\\Jenkins controller \texttt{:8080}\\\textbf{builds run here}\\(1 executor)};
|
||||
\node[box] (gvol) at (18.4,2.2) {\guillemotleft artifact\guillemotright\\\texttt{gitea-data}\\SQLite + repos};
|
||||
\node[box] (jvol) at (18.4,-3.0) {\guillemotleft artifact\guillemotright\\\texttt{jenkins-home}\\jobs, users,\\credentials};
|
||||
\draw[arr] (browser) -- node[lbl, above=2pt]{HTTPS} (fw);
|
||||
\draw[arr] (fw) -- (caddy);
|
||||
\draw[arr] (caddy.north) |- node[lbl, pos=0.75]{HTTP} (gitea.west);
|
||||
\draw[arr] (caddy.south) |- node[lbl, pos=0.75]{HTTP} (jenkins.west);
|
||||
\draw[arr, dashed, devopsGreen] (gitea.south) -- node[lbl, right=2pt]{1. webhook (private)} (jenkins.north);
|
||||
\draw[arr, dashed, devopsBlue] (jenkins.north west) -- node[lbl, pos=0.5, left=3pt]{2. checkout + status} (caddy.south east);
|
||||
\draw[arr] (gitea) -- (gvol);
|
||||
\draw[arr] (jenkins) -- (jvol);
|
||||
\node[draw, dashed, rounded corners, fit=(caddy) (gitea) (jenkins) (gvol) (jvol), inner sep=10pt,
|
||||
label={[font=\scriptsize]above:\guillemotleft device\guillemotright\ Droplet \texttt{The-Ocean} (1\,GiB) / \guillemotleft executionEnvironment\guillemotright\ Docker network \texttt{gitea\_web}}] {};
|
||||
\end{tikzpicture}}
|
||||
\caption{UML deployment diagram of the actual deployment, October 2026. Only
|
||||
Caddy's 80/443 are public. (1) Gitea sends the webhook to
|
||||
\texttt{http://jenkins:8080} on the private network. (2) Jenkins checks out
|
||||
code and posts statuses to \texttt{https://git.yebilly.me}, which resolves to
|
||||
Caddy inside the Docker network; Caddy forwards to Gitea. Builds run on the
|
||||
controller; there is no separate agent.}
|
||||
\label{Figure:JenkinsDeployment}
|
||||
\end{figure}
|
||||
|
||||
\paragraph{Integration identity.}
|
||||
Gitea user \texttt{jenkins-bot} is a \emph{Write} collaborator on
|
||||
\texttt{ssw590-group1/vpn-dns-gateway}, the lowest repository role that can
|
||||
post commit statuses. Its token \texttt{jenkins-ci} has repository
|
||||
read/write and organization/user read scopes only. The token is stored in
|
||||
Jenkins as credential \texttt{gitea-jenkins-bot}; Jenkins' Gitea server entry
|
||||
points to \texttt{https://git.yebilly.me} with hook management disabled.
|
||||
|
||||
\paragraph{Job and events.}
|
||||
The Multibranch Pipeline job \texttt{vpn-dns-gateway} discovers branches that
|
||||
are not also PRs, and PRs from the origin repository using \emph{the current
|
||||
pull request revision}, so Jenkins builds the PR head itself rather than a
|
||||
temporary merge. PRs from forks are not discovered. The repository webhook
|
||||
\texttt{jenkins-ci} posts JSON to
|
||||
\texttt{http://jenkins:8080/gitea-webhook/post} for \emph{Push},
|
||||
\emph{Pull Request}, and \emph{Pull Request Synchronized} events on all
|
||||
branches. Gitea's \texttt{webhook.ALLOWED\_HOST\_LIST} is set to
|
||||
\texttt{jenkins}, so Gitea may call no other private host. The first
|
||||
repository scan (October 22, 22:39:55) authenticated as the bot and reported
|
||||
no \texttt{Jenkinsfile} yet, as expected (Figure~\ref{Figure:JenkinsScan}).
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{images/jenkins-first-scan-2026-10-22.png}
|
||||
\caption{October 22, 2026, 22:39 UTC: first scan of the Multibranch job; the
|
||||
bot credential reaches \texttt{ssw590-group1/vpn-dns-gateway}, and the
|
||||
executor count is 1.}
|
||||
\label{Figure:JenkinsScan}
|
||||
\end{figure}
|
||||
|
||||
\paragraph{Delivery evidence.}
|
||||
A test delivery at 22:54:06 on October 22 returned HTTP 200 with body
|
||||
\texttt{Processed} from \texttt{Server: Jetty(12.1.13)}, that is, from Jenkins
|
||||
itself (Figure~\ref{Figure:JenkinsWebhook}). Real deliveries then started every
|
||||
run in Table~\ref{Table:JenkinsSequence}; for example, the push of
|
||||
\texttt{52b297c} produced the event ``Pull request \#15 event at 11:10:32 PM
|
||||
on Oct 22, 2026'' that started \texttt{PR-15} run~2.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{images/gitea-webhook-delivery-2026-10-22.png}
|
||||
\caption{October 22, 2026, 22:54 UTC: Gitea webhook \texttt{jenkins-ci} with
|
||||
Push, Pull Request, and Pull Request Synchronized events; test delivery
|
||||
answered 200 \texttt{Processed} by Jenkins. A Jenkins reporting-endpoint ID
|
||||
in one header is blurred.}
|
||||
\label{Figure:JenkinsWebhook}
|
||||
\end{figure}
|
||||
|
||||
All 14 deliveries to date, read from Gitea's delivery records on October 23,
|
||||
are summarized in Table~\ref{Table:JenkinsDeliveries}.
|
||||
|
||||
{\small
|
||||
\begin{tabularx}{\linewidth}{L{0.6cm}L{2.7cm}L{2.6cm}L{1.4cm}Y}
|
||||
\caption{Gitea webhook deliveries to Jenkins (UTC)\label{Table:JenkinsDeliveries}}\\
|
||||
\toprule \textbf{\#} & \textbf{Time} & \textbf{Event} & \textbf{Commit} & \textbf{Result}\\ \midrule
|
||||
1 & Oct 22 22:54:06 & test push & --- & 200 \texttt{Processed}\\
|
||||
2 & Oct 22 22:57:43 & push & \texttt{ad35197} & 200; started branch job\\
|
||||
3 & Oct 22 23:01:59 & PR \#15 opened & \texttt{ad35197} & \textbf{failed}: client timeout awaiting headers (see below)\\
|
||||
4--5 & Oct 22 23:10:32 & push, PR synchronized & \texttt{52b297c} & 200; started PR-15 run 2\\
|
||||
6--7 & Oct 22 23:15:09 & push, PR synchronized & \texttt{9381d2a} & 200; started PR-15 run 3\\
|
||||
8--9 & Oct 23 00:55:22 & PR closed, push & \texttt{9381d2a}, \texttt{420ba4c} & 200; started main run 1\\
|
||||
10--14 & Oct 23 01:21--01:24 & push, PR \#16 events & \texttt{1149e9f}, \texttt{e4f3ce5} & 200; started PR-16 run 1 and main run 2\\
|
||||
\bottomrule
|
||||
\end{tabularx}}
|
||||
|
||||
\paragraph{Diagnosing a failed delivery.}
|
||||
Delivery~3 is a real failure. Gitea recorded \texttt{Post
|
||||
"http://jenkins:8080/gitea-webhook/post": context deadline exceeded
|
||||
(Client.Timeout exceeded while awaiting headers)}. Diagnosis: Jenkins did
|
||||
receive the event, because Gitea shows PR-15's status ``Build queued'' at
|
||||
23:02:01, two seconds later, and run~1 passed at 23:02:18. Gitea did not
|
||||
receive a response before its delivery timeout. PR discovery under the
|
||||
0.75-CPU limit is a suspected cause of the delay, not a measured diagnosis.
|
||||
No action was needed because the build completed. If a build does not
|
||||
start, inspect the delivery and Jenkins logs, then use \emph{Redeliver}
|
||||
or \emph{Scan Multibranch Pipeline Now} after correcting the cause.
|
||||
Raising Gitea's \texttt{webhook.DELIVER\_TIMEOUT} may help if slow responses
|
||||
are confirmed, but does not guarantee successful delivery.
|
||||
General procedure if a push does not start a build:
|
||||
(1) open \emph{Repository Settings
|
||||
$\rightarrow$ Webhooks $\rightarrow$ jenkins-ci $\rightarrow$ Recent
|
||||
Deliveries} and read the response; (2) ``can only call allowed HTTP
|
||||
servers'' means \texttt{ALLOWED\_HOST\_LIST} was lost, so recreate the Gitea
|
||||
container from Compose; (3) a connection error means Jenkins is down, so run
|
||||
\texttt{docker compose ps} and \texttt{docker compose logs --tail 100 jenkins};
|
||||
(4) a 200 response with no build means the branch has no \texttt{Jenkinsfile}
|
||||
or the event type is not selected, so use \emph{Scan Multibranch Pipeline
|
||||
Now} in Jenkins and read its log. \emph{Redeliver} on the delivery replays
|
||||
the event after the fix.
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{Versioned Pipeline and Tests}
|
||||
\label{Section:JenkinsPipeline}
|
||||
\index{Jenkinsfile}
|
||||
|
||||
The repository root contains
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/420ba4c56b1c3efa50099a85c16c750a9815091a/Jenkinsfile}{\texttt{Jenkinsfile}},
|
||||
the instructor's permitted Python example
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/420ba4c56b1c3efa50099a85c16c750a9815091a/pricing.py}{\texttt{pricing.py}},
|
||||
and its unit tests in
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/420ba4c56b1c3efa50099a85c16c750a9815091a/tests/test_pricing.py}{\texttt{tests/test\_pricing.py}}.
|
||||
The Declarative \gls{jenkinsfile} is:
|
||||
\begin{minted}{groovy}
|
||||
pipeline {
|
||||
agent any
|
||||
options { skipDefaultCheckout() }
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps { checkout scm }
|
||||
}
|
||||
stage('Syntax check') {
|
||||
steps { sh 'python3 -m py_compile pricing.py' }
|
||||
}
|
||||
stage('Test') {
|
||||
steps { sh 'python3 -m unittest discover -s tests -v' }
|
||||
}
|
||||
}
|
||||
}
|
||||
\end{minted}
|
||||
\begin{itemize}[nosep]
|
||||
\item \textbf{Checkout} fetches the revision Jenkins selected; for PR~\#15 it
|
||||
fetched \texttt{refs/pull/15/head} and checked out the PR head.
|
||||
\item \textbf{Syntax check} compiles \texttt{pricing.py}; a syntax error fails here.
|
||||
\item \textbf{Test} runs two unit tests: \texttt{10 * 3 == 30}, and quantity 0
|
||||
raises \texttt{ValueError}. Expected passing output ends in
|
||||
\texttt{Ran 2 tests \ldots OK}; any failing assertion ends in
|
||||
\texttt{FAILED} and a non-zero exit, which fails the stage.
|
||||
\end{itemize}
|
||||
\textbf{Dependencies:} Python 3.13.5 and Git 2.47.3 come from the Debian
|
||||
packages in the Jenkins image; the tests use only the standard library.
|
||||
\textbf{Clean run:} on a machine with Python 3, clone the repository into a
|
||||
new directory and check out the recorded commit ID of the run to reproduce.
|
||||
From that repository root, run
|
||||
\texttt{python3 -m py\_compile pricing.py} then
|
||||
\texttt{python3 -m unittest discover -s tests -v} from the repository root.
|
||||
In Jenkins, \emph{Build Now} on a branch or PR job builds the revision selected
|
||||
for that run. Verify the checked-out commit ID in its log; it may differ from
|
||||
an earlier run after a new push. The pipeline's \texttt{checkout scm} step
|
||||
does not explicitly clean the workspace.
|
||||
|
||||
Figure~\ref{Figure:JenkinsStages} shows the distinct stage results of a run,
|
||||
here the deliberate failure, with the tested commit identified in its log.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{images/jenkins-pr15-build2-failure-2026-10-22.png}
|
||||
\caption{October 22, 2026: \texttt{PR-15} run~2 for commit \texttt{52b297c}
|
||||
(started by the PR event at 23:10:32 UTC). Checkout and Syntax check passed;
|
||||
Test failed with \texttt{AssertionError: 13 != 30} and exit code~1.}
|
||||
\label{Figure:JenkinsStages}
|
||||
\end{figure}
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{Required Merge Gate}
|
||||
\label{Section:JenkinsGate}
|
||||
\index{branch protection}
|
||||
|
||||
At 23:09:44 on October 22, Billy saved a branch-protection rule for
|
||||
\texttt{main} (Figure~\ref{Figure:JenkinsProtection}). Its stored settings
|
||||
are: direct push disabled; status check required with the exact context
|
||||
\textbf{\texttt{vpn-dns-gateway/pipeline/pr-main}}; one approval required;
|
||||
merge blocked on rejected reviews; stale approvals dismissed when new commits
|
||||
are pushed; administrators may not override; no bypass list.\footnote{\url{https://docs.gitea.com/usage/access-control/protected-branches}}
|
||||
|
||||
\textbf{How the status reaches Gitea:} at the start and end of each run, the
|
||||
Gitea plugin calls Gitea's commit-status API with the bot token for the
|
||||
tested commit, for example ``\texttt{[Gitea] Notifying pull request build
|
||||
status: FAILURE There was a failure building this commit}''. The context
|
||||
name is built from the job and the PR target branch. Gitea compares it with
|
||||
the protected branch's required context on the PR's latest head commit; a
|
||||
webhook delivery or a green Jenkins page alone does not satisfy the
|
||||
gate.\footnote{\url{https://plugins.jenkins.io/gitea/}}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.85\linewidth]{images/gitea-branch-protection-2026-10-22.png}
|
||||
\caption{October 22, 2026: protection rule for \texttt{main}. The required
|
||||
pattern \texttt{vpn-dns-gateway/pipeline/pr-main} is marked
|
||||
\emph{Matched} against checks Gitea has seen; administrators must follow
|
||||
the rule.}
|
||||
\label{Figure:JenkinsProtection}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.92\linewidth]{images/gitea-pr15-blocked-2026-10-22.png}
|
||||
\caption{\textbf{Merge blocked.} October 22, 2026, about 23:11 UTC: PR~\#15
|
||||
head \texttt{52b297c} fails required check
|
||||
\texttt{vpn-dns-gateway/pipeline/pr-main} (Jenkins
|
||||
\href{https://ci.yebilly.me/job/vpn-dns-gateway/job/PR-15/2/}{PR-15 run~2});
|
||||
Gitea reports that required checks were not successful and no approval is
|
||||
granted.}
|
||||
\label{Figure:JenkinsBlocked}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.92\linewidth]{images/gitea-pr15-passing-2026-10-22.png}
|
||||
\caption{\textbf{Passing after repair.} October 22, 2026, after 23:15:26 UTC:
|
||||
PR~\#15 head \texttt{9381d2a} passes required check
|
||||
\texttt{vpn-dns-gateway/pipeline/pr-main} (Jenkins
|
||||
\href{https://ci.yebilly.me/job/vpn-dns-gateway/job/PR-15/3/}{PR-15 run~3}).
|
||||
The only remaining condition is the required peer approval.}
|
||||
\label{Figure:JenkinsPassing}
|
||||
\end{figure}
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{Failure, Repair, and Review}
|
||||
\label{Section:JenkinsReview}
|
||||
|
||||
Billy opened
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/issues/14}{issue~\#14},
|
||||
pushed branch \texttt{feature/issue-14}, and opened
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/pulls/15}{PR~\#15}
|
||||
with \texttt{Closes \#14} in its description and Vincent as reviewer. The
|
||||
controlled failure changed multiplication to addition in \texttt{pricing.py}
|
||||
on the same branch; the repair restored it.
|
||||
|
||||
\clearpage
|
||||
\begin{tabularx}{\linewidth}{L{2.6cm}L{1.6cm}L{2.0cm}L{1.9cm}Y}
|
||||
\caption{PR~\#15 sequence, October 22--23, 2026 (UTC)\label{Table:JenkinsSequence}}\\
|
||||
\toprule \textbf{Event} & \textbf{Commit} & \textbf{Jenkins run} & \textbf{Check} & \textbf{Detail}\\ \midrule
|
||||
Initial push / PR & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/ad35197ee4905767b0c3d74159a8dfee29d5c37a}{\texttt{ad35197}} & PR-15 \#1 & success 23:02:18 & Jenkins service, app, tests, \texttt{Jenkinsfile}\\
|
||||
Controlled failure & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/52b297c2f33881f7b483808c0040758cee2a1d8f}{\texttt{52b297c}} & PR-15 \#2 & failure 23:10:51 & \texttt{AssertionError: 13 != 30}; merge blocked\\
|
||||
Repair & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/9381d2aa9a11cb7be1b157ea5ecb1318f9a014f0}{\texttt{9381d2a}} & PR-15 \#3 & success 23:15:26 & Multiplication restored; 2 tests OK\\
|
||||
Peer review & \texttt{9381d2a} & --- & --- & \texttt{vsun1} approved at 00:02:40, Oct 23\\
|
||||
Merge & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/420ba4c56b1c3efa50099a85c16c750a9815091a}{\texttt{420ba4c}} & main \#1 & success 00:55:37 & Merged by \texttt{bill} at 00:55:21; issue \#14 closed automatically\\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
|
||||
Each Jenkins log names the commit it checked out
|
||||
(\texttt{Checking out Revision ad35197ee490\ldots} for run~1,
|
||||
\texttt{52b297c2f338\ldots} for run~2, \texttt{9381d2aa9a11\ldots} for
|
||||
run~3), and each matches the PR head shown
|
||||
in Gitea at that time. The branch job \texttt{feature/issue-14}~\#1 also
|
||||
passed on \texttt{ad35197} before the PR existed; its context
|
||||
\texttt{vpn-dns-gateway/pipeline/head} is not the required one.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.92\linewidth]{images/gitea-pr15-merged-2026-10-22.png}
|
||||
\caption{October 23, 2026, 00:55 UTC: PR~\#15 merged into \texttt{main} as
|
||||
\texttt{420ba4c}. The timeline shows the passing, failing, and repaired
|
||||
commits and \texttt{vsun1}'s approval.}
|
||||
\label{Figure:JenkinsMerged}
|
||||
\end{figure}
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{Credentials and Build Boundary}
|
||||
\label{Section:JenkinsBoundary}
|
||||
\index{Jenkins!build boundary}
|
||||
|
||||
\paragraph{Secrets.}
|
||||
The only integration secret is the \texttt{jenkins-bot} token, stored as
|
||||
the Jenkins credential \texttt{gitea-jenkins-bot} (System, Global scope) and
|
||||
encrypted in \texttt{jenkins-home}. It never appears in Git, Compose, the
|
||||
console log (the log prints only the credential's description), or this
|
||||
manual. The initial administrator password was read once by Billy in his own
|
||||
terminal and is no longer used. Hints for all accounts are in
|
||||
Table~\ref{Table:Passwords}.
|
||||
|
||||
\paragraph{Where builds run, and the risk.}
|
||||
Builds run on the Jenkins \gls{controller} executor (one executor); there is
|
||||
no separate \gls{build-agent}, controller executors are not zero, and no agent
|
||||
port is open. Pipeline code runs as the container's \texttt{jenkins} user
|
||||
with read access to \texttt{jenkins-home}, which holds the encrypted
|
||||
credentials and their key, so a malicious \texttt{Jenkinsfile} could steal
|
||||
the bot token.\footnote{\url{https://www.jenkins.io/doc/book/security/controller-isolation/}}
|
||||
Compensating restrictions:
|
||||
\begin{itemize}[nosep]
|
||||
\item Only Billy and Vincent, plus the \texttt{jenkins-bot} identity whose
|
||||
token exists only inside Jenkins, have write access to the repository, so
|
||||
only they can change the \texttt{Jenkinsfile}; \texttt{main} accepts changes
|
||||
only through reviewed PRs, which also applies to the bot.
|
||||
\item PRs from forks are not discovered, so untrusted code never runs.
|
||||
\item No Docker socket is mounted and the container is not privileged; its
|
||||
memory, CPU, and process count are capped.
|
||||
\item The token is limited to one repository role (Write) and read-only
|
||||
organization/user scopes, and can be revoked in Gitea without touching
|
||||
Jenkins.
|
||||
\end{itemize}
|
||||
|
||||
\paragraph{Plugin-update check.}
|
||||
On October 23 at 01:03, the 63 locked plugins were compared with the Jenkins
|
||||
update center for core 2.580.1. (Counts: the capacity bundle had 59;
|
||||
\texttt{matrix-auth} and \texttt{pipeline-graph-view} with its two
|
||||
dependencies make 63 locked; Jenkins reports 66 installed, the other three
|
||||
being the theme plugins described in Section~\ref{Section:JenkinsQuality},
|
||||
which this check did not cover.) One newer version exists
|
||||
(\texttt{workflow-api} \texttt{1413.v2ff1a\_5e720fa\_} $\rightarrow$
|
||||
\texttt{1429.v7a\_1b\_efb\_a\_f7c5}); no security warning matched the 63
|
||||
checked plugin versions. The update was deferred: it is not a security fix and would change
|
||||
the tested set. Updates are applied by regenerating the lockfile, rebuilding
|
||||
the image, and recreating the container.
|
||||
|
||||
\paragraph{Troubleshooting a failed build.}
|
||||
Open the run's \emph{Pipeline Overview} to see which stage failed and its
|
||||
log. A red \emph{Test} stage with an assertion is a code failure: fix the
|
||||
code and push to the same PR. A red \emph{Checkout} usually means the token
|
||||
was revoked or Gitea is unreachable: check the credential and
|
||||
\texttt{curl https://git.yebilly.me} from inside the container. A run that
|
||||
never starts: follow the webhook steps in
|
||||
Section~\ref{Section:JenkinsTrigger}. Memory trouble (slow pages,
|
||||
\texttt{OutOfMemoryError} in \texttt{docker compose logs jenkins}): check
|
||||
\texttt{free -m} and \texttt{docker stats} and restart Jenkins with
|
||||
\texttt{docker compose restart jenkins}.
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{Manual Quality and Controls}
|
||||
\label{Section:JenkinsQuality}
|
||||
|
||||
\paragraph{Corrective actions.}
|
||||
Five problems were found and fixed during this work, each recorded with its
|
||||
evidence: (1) the official plugin installer ran out of its 128\,MiB heap while
|
||||
reading the update-center catalog, so the Dockerfile downloads the pinned
|
||||
plugins with \texttt{curl} and checks their SHA-256; (2) the first droplet
|
||||
capacity run failed on upload permissions, fixed by \texttt{chmod}; (3) the
|
||||
128\,MiB heap hung the web interface, fixed by the larger limits in
|
||||
Section~\ref{Section:JenkinsDeployment}; (4) matrix authorization was missing
|
||||
because the capacity bundle covered only Pipeline and Gitea, so
|
||||
\texttt{matrix-auth} was added and the image rebuilt; (5) no stage-by-stage
|
||||
run view was installed, so \texttt{pipeline-graph-view} was added the same
|
||||
way. Three theme plugins
|
||||
(\texttt{dark-theme}, \texttt{dracula-theme}, \texttt{theme-manager}) were
|
||||
installed from the web interface during setup and are not in the lockfile;
|
||||
they survive in \texttt{jenkins-home} but would be lost if the volume were
|
||||
recreated.
|
||||
|
||||
\paragraph{Operator restart and recovery note.}
|
||||
Run these on the droplet as \texttt{root}:
|
||||
\begin{minted}{sh}
|
||||
cd ~/gitea
|
||||
docker compose ps # all three services Up
|
||||
docker compose restart jenkins # state stays in the volume
|
||||
docker compose logs --tail 100 jenkins # startup errors, OutOfMemoryError
|
||||
# after changing deploy/jenkins/plugins.txt:
|
||||
docker compose build jenkins && docker compose up -d jenkins
|
||||
\end{minted}
|
||||
After a droplet reboot, Docker starts all three services because of their
|
||||
restart policies. Measured container starts took 25\,s (warm
|
||||
\texttt{docker compose restart}) to 45\,s (first start after the limit
|
||||
change); a full droplet reboot was not tested, so allow about a minute before
|
||||
the login page answers. Gitea does not depend on Jenkins, so a Jenkins outage only delays
|
||||
checks (PRs stay blocked until Jenkins reports).
|
||||
|
||||
\paragraph{Cost, ownership, and cleanup.}
|
||||
Jenkins adds no paid resource; it uses the droplet's 1\,GiB Basic plan
|
||||
(listed at \$6/month on DigitalOcean's pricing page on October 21, 2026; the
|
||||
account's billing was not re-checked here) and about 0.9\,GB of disk for its
|
||||
image. On October 23 the root filesystem had 18\,GB free of 24\,GB
|
||||
(\texttt{df -h /}, 25\% used). Billy administers the droplet and Jenkins; Vincent reviews. To remove
|
||||
Jenkins: delete the \texttt{main} protection's required check, stop and
|
||||
remove the service (\texttt{docker compose rm -sf jenkins}), delete the volume
|
||||
(\texttt{docker volume rm gitea\_jenkins-home}), remove the \texttt{ci} block
|
||||
from the Caddyfile and the \texttt{ci} DNS record, delete the webhook, and
|
||||
delete the \texttt{jenkins-bot} user and token.
|
||||
|
||||
\paragraph{Document controls.}
|
||||
This chapter was introduced in version 4.0 and corrected in 4.1 (access path,
|
||||
delivery evidence, wording). Document History records both and the updated
|
||||
tables in \ChapterRef{HostsPasswords}: the Hosts table adds \texttt{ci.yebilly.me},
|
||||
the Jenkins service, and the 1\,GiB resize; the Passwords table adds the
|
||||
Jenkins administrators, the \texttt{jenkins-bot} account, and its token.
|
||||
New glossary terms are indexed, and AI assistance is recorded in
|
||||
\ChapterRef{AIPromptLog}.
|
||||
|
||||
\endgroup
|
||||
@@ -4,3 +4,53 @@
|
||||
publisher = {IT Revolution Press},
|
||||
year = {2018}
|
||||
}
|
||||
|
||||
@book{SREWorkbook,
|
||||
author = {Beyer, Betsy and Murphy, Niall Richard and Rensin, David K. and Kawahara, Kent and Thorne, Stephen},
|
||||
title = {The Site Reliability Workbook: Practical Ways to Implement {SRE}},
|
||||
publisher = {O'Reilly Media},
|
||||
year = {2018},
|
||||
note = {Chapter 2, ``Implementing SLOs,'' \url{https://sre.google/workbook/implementing-slos/}, accessed Oct. 28, 2026}
|
||||
}
|
||||
|
||||
@misc{PrometheusDocs,
|
||||
author = {{Prometheus Authors}},
|
||||
title = {Prometheus Documentation: Configuration, Storage, and Querying},
|
||||
howpublished = {\url{https://prometheus.io/docs/prometheus/latest/}},
|
||||
note = {Version 3.15; accessed Oct. 28, 2026}
|
||||
}
|
||||
|
||||
@misc{NodeExporter,
|
||||
author = {{Prometheus Authors}},
|
||||
title = {Node Exporter},
|
||||
howpublished = {\url{https://github.com/prometheus/node_exporter}},
|
||||
note = {Release v1.12.1; accessed Oct. 28, 2026}
|
||||
}
|
||||
|
||||
@misc{BlackboxExporter,
|
||||
author = {{Prometheus Authors}},
|
||||
title = {Blackbox Exporter},
|
||||
howpublished = {\url{https://github.com/prometheus/blackbox_exporter}},
|
||||
note = {Release v0.29.1; accessed Oct. 28, 2026}
|
||||
}
|
||||
|
||||
@misc{GrafanaDocker,
|
||||
author = {{Grafana Labs}},
|
||||
title = {Run {Grafana} {Docker} Image},
|
||||
howpublished = {\url{https://grafana.com/docs/grafana/latest/setup-grafana/installation/docker/}},
|
||||
note = {{Grafana OSS} 13.2; accessed Oct. 28, 2026}
|
||||
}
|
||||
|
||||
@misc{GrafanaAlerting,
|
||||
author = {{Grafana Labs}},
|
||||
title = {Grafana Alerting: Provision Alerting Resources and Configure Contact Points},
|
||||
howpublished = {\url{https://grafana.com/docs/grafana/latest/alerting/set-up/provision-alerting-resources/file-provisioning/}},
|
||||
note = {{Grafana OSS} 13.2; accessed Oct. 28, 2026}
|
||||
}
|
||||
|
||||
@misc{MicrosoftTestNetConnection,
|
||||
author = {{Microsoft}},
|
||||
title = {{Test-NetConnection}},
|
||||
howpublished = {\url{https://learn.microsoft.com/en-us/powershell/module/nettcpip/test-netconnection}},
|
||||
note = {Accessed Oct. 28, 2026}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 199 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 196 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 97 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 106 KiB |
|
After Width: | Height: | Size: 156 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 161 KiB |
|
After Width: | Height: | Size: 302 KiB |
|
After Width: | Height: | Size: 454 KiB |
|
After Width: | Height: | Size: 480 KiB |
|
After Width: | Height: | Size: 426 KiB |
|
After Width: | Height: | Size: 248 KiB |
|
After Width: | Height: | Size: 163 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 274 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 252 KiB |
|
After Width: | Height: | Size: 226 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 14 KiB |
@@ -36,15 +36,16 @@ try {
|
||||
exit 0
|
||||
}
|
||||
|
||||
$repoDirectory = Split-Path -Parent $projectDirectory
|
||||
$manualDirectory = Split-Path -Parent $projectDirectory
|
||||
$repoDirectory = Split-Path -Parent $manualDirectory
|
||||
$projectsDirectory = Split-Path -Parent $repoDirectory
|
||||
$toolDirectories = @()
|
||||
if ($env:DEVOPS_LATEX_BIN) {
|
||||
$toolDirectories += $env:DEVOPS_LATEX_BIN
|
||||
}
|
||||
$toolDirectories += @(
|
||||
(Join-Path $env:APPDATA 'TinyTeX\bin\windows'),
|
||||
(Join-Path $projectsDirectory 'Tools\LaTeX\TinyTeX\bin\windows'),
|
||||
(Join-Path $env:APPDATA 'TinyTeX\bin\windows'),
|
||||
(Join-Path $env:LOCALAPPDATA 'Programs\MiKTeX\miktex\bin\x64'),
|
||||
'C:\Program Files\MiKTeX\miktex\bin\x64'
|
||||
)
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
# Assignment 7 raw evidence (droplet The-Ocean, captured by Claude over SSH, approved by Billy)
|
||||
|
||||
## Baseline 2026-10-28 04:34 UTC
|
||||
|
||||
Ubuntu 24.04.5 LTS, kernel 6.8.0-147-generic x86_64, 1 vCPU; Docker 29.8.1, Compose v5.5.1; disk /dev/vda1 24883167232 B, 18784387072 B available (25% used); gitea_web 172.18.0.0/16; global IPv6 2604:a880:400:d1:0:5:22d:6001/64, no AAAA records; uptime 6 days, load 0.05.
|
||||
|
||||
Containers: gitea-jenkins-1 325.4MiB/512MiB, gitea-caddy-1 10.85MiB, gitea-gitea-1 98.21MiB. Host RSS: java 318.1, gitea 122.0, dockerd 50.0, multipathd 26.5, containerd 23.5, caddy 16.7 MiB.
|
||||
|
||||
```
|
||||
Wed Oct 28 04:34:27 UTC 2026
|
||||
total used free shared buff/cache available
|
||||
Mem: 1008177152 778825728 101543936 3424256 281452544 229351424
|
||||
Swap: 1073737728 479457280 594280448
|
||||
Filesystem 1B-blocks Used Available Use% Mounted on
|
||||
/dev/vda1 24883167232 6082015232 18784374784 25% /
|
||||
NAME TYPE SIZE USED PRIO
|
||||
/swapfile file 1024M 457.2M -2
|
||||
gitea-jenkins-1 0.17% 326.3MiB / 512MiB
|
||||
gitea-caddy-1 0.00% 11MiB / 961.5MiB
|
||||
gitea-gitea-1 0.20% 102.9MiB / 961.5MiB
|
||||
```
|
||||
|
||||
## Unused host services disabled
|
||||
|
||||
```
|
||||
2026-10-28 04:52:51 UTC disabled+masked: multipathd(.service,.socket), fwupd(+fwupd-refresh.timer), udisks2, ModemManager
|
||||
before: Mem total 1008177152 used 798810112 available 209367040
|
||||
after (04:52:59): used 786944000 available 221233152 ; 04:53:0x: available 238510080, Mlocked 0
|
||||
apt-daily.service ran 04:52:52-04:53:24 (40.8M peak, triggered by systemd reload); after: available 364957696, swap used 503414784
|
||||
checks before change: multipath -ll empty; dmsetup ls "No devices found"; root=UUID cc6f3ac6 (/dev/vda1, LABEL cloudimg-rootfs); multipath-tools-boot not installed; initramfs multipath files 0
|
||||
post: gitea-jenkins-1, gitea-caddy-1, gitea-gitea-1 Up; git login 200 1.09s, ci login 200 0.38s
|
||||
undo: systemctl unmask multipathd fwupd udisks2 ModemManager && systemctl enable --now multipathd udisks2 ModemManager
|
||||
```
|
||||
|
||||
## Image pins chosen 2026-10-28 (registry index digests)
|
||||
|
||||
- prom/prometheus:v3.15.1 sha256:fa3302279710be2f21a8301ec17a8b4f2301fd829bd113839b3b6b02b6f191a2 (released 2026-10-21)
|
||||
- grafana/grafana:13.2.5 sha256:9f7aa1e1e3246aade5792d35a738049f7f32f89cd51d1956cf426a4e86268a84 (2026-10-27; 13.3.0 skipped as one day old)
|
||||
- quay.io/prometheus/node-exporter:v1.12.1 sha256:1b4e4438faca4dd7e001dd445d161a4a2091b0fededa84093b3a8dfeae1f1be0 (2026-07-14)
|
||||
- quay.io/prometheus/blackbox-exporter:v0.29.1 sha256:ea1c7aa3ef3f307cd03e85f34abb604478ccb90b567fc690da0cd9776da76b13 (2026-10-21)
|
||||
|
||||
## Local validation 2026-10-28 (laptop Docker 29.8.2)
|
||||
|
||||
- docker compose config --quiet: monitoring and deploy valid; promtool check config SUCCESS; caddy validate: Valid configuration.
|
||||
- Grafana smoke run: first run rejected "{{ $$labels.instance }}" (bad character $); fixed to {{ .Labels.instance }}; rerun: both rules health ok, probes Normal from laptop, disk rule Pending (NoData) without node-exporter, dashboard group1-sre in folder SRE.
|
||||
|
||||
## Deploy 2026-10-28 (UTC)
|
||||
|
||||
- Issue #19; branch feature/issue-19-monitoring from main 9b0dc4d (Jenkins pipeline/head + Automated Manual Build success on 9b0dc4d).
|
||||
- 14:40:23 second swapfile: /swapfile2 1 GiB added (fstab); swap total 2147475456 B. Disk 24883167232 B, 17710153728 B available after.
|
||||
- 14:40:40 backup ~/gitea/backup-20261028T144040Z (docker-compose.yml, Caddyfile). Staged files validated on droplet (caddy validate: Valid configuration; compose config valid). Diffs = probe network + aliases; ci allowlist +172.30.90.10/32; metrics block.
|
||||
- 14:40:57-14:41:09 `docker compose up -d --no-deps caddy` (recreate). gitea_probe 172.30.90.0/28; caddy gitea_probe=172.30.90.2 (aliases git/ci), gitea_web=172.18.0.3. Let's Encrypt: "certificate obtained successfully" metrics.yebilly.me. Laptop: git 200 0.049s, ci 200 0.289s, metrics 502 (Grafana not started).
|
||||
- docker-proxy now targets 172.30.90.2 (probe network) for 80/443; IPv6/hairpin clients would appear as 172.30.90.1, not allowlisted (only .10/32).
|
||||
- ~/monitoring copied (700). .env.secret created by Billy: 600 root; names GF_SECURITY_ADMIN_PASSWORD, DISCORD_WEBHOOK_URL; no empty values; no "$".
|
||||
- 14:50:45-14:51:51 pull. promtool: SUCCESS. RepoDigests (amd64) match pins; sizes: prometheus 381400167, grafana 1949552290, node-exporter 40992821, blackbox 58273564 B. Before up: avail 241209344 B, swap used 520241152 B; disk 39% used.
|
||||
- 14:52:04-14:52:08 `docker compose up -d`. Samples (avail MiB / swap used MiB): 14:52:23 228/578, 14:52:43 230/666, 14:53:02 159/668, 14:53:22 195/692, 14:53:40 211/700, 14:53:57 218/700, 14:54:14 189/705, 14:54:32 156/707. Peaks: grafana 136.6/192 MiB, prometheus 26.6/128, blackbox 15.3/32, node-exporter 13.6/32. No OOM in dmesg. Within abort limits.
|
||||
- Grafana "permission denied" on /etc/grafana/provisioning/* (scp-created 700 dirs). Fix 14:55: dirs 755 / files 644 under grafana, prometheus, blackbox; restart 14:55:08; provisioning datasources, alerting, dashboards finished.
|
||||
- Targets (14:5x): prometheus, node, blackbox, https x2 all up. probe_success 1 both; status 200; duration ci 0.686s, git 0.193s.
|
||||
- 14:56: rules "HTTPS service down" (ci, git Normal) and "Root disk space low" (Normal), health ok; contact point team-alerts discord url set; dashboard Group 1 SRE /d/group1-sre.
|
||||
- Host verification 14:56:37: root fs labels device=/dev/vda1 fstype=ext4 mountpoint=/; size 24883167232 = df; avail 15281520640 vs df 15281516544. MemTotal 1008177152 = free total; MemAvailable 293392384 vs free available 301010944 (seconds apart).
|
||||
- Laptop after start: git 200 0.53s, ci 200 0.064s, metrics /login 200 1.68s, metrics /metrics 302.
|
||||
|
||||
## External exposure tests 2026-10-28 14:57 UTC (Billy's laptop, home network on the team allowlist, IPv6 available)
|
||||
|
||||
- Raw ports 3000, 3001, 8080, 9090, 9100, 9115, 50000 on 147.182.178.136 and [2604:a880:400:d1:0:5:22d:6001]: all no connection (curl 000, 5 s connect timeout).
|
||||
- https://metrics.yebilly.me/metrics -> 302 to /login?redirectTo=%2Fmetrics (GF_METRICS_ENABLED=false); /api/dashboards/uid/group1-sre -> 401; /api/datasources/proxy/uid/prometheus/api/v1/query?query=up -> 401 (no anonymous access).
|
||||
- https://git.yebilly.me/metrics -> 404; https://ci.yebilly.me/prometheus/ -> 403 (no app metrics endpoints).
|
||||
- http://metrics.yebilly.me -> 308 to https.
|
||||
- IPv6 (--resolve to droplet IPv6, no AAAA records): ci /login 403, metrics /login 403, git /user/login 200. IPv4 from allowlisted laptop: ci 200, metrics 200. Confirms docker-proxy gateway (172.30.90.1) is not allowlisted.
|
||||
|
||||
## Grafana login and contact-point test 2026-10-28
|
||||
|
||||
- ~15:01 UTC (11:01 EDT): Billy logged in at https://metrics.yebilly.me as billy; dashboard Group 1 SRE showed all 7 panels with data (screenshot).
|
||||
- Contact point is provisioned, so the UI offers no Test button. Legacy POST /api/alertmanager/grafana/config/api/v1/receivers/test -> 410 Gone ("use /apis/notifications.alerting.grafana.app/v1beta1/namespaces/{namespace}/receivers/{uid}/test").
|
||||
- One failed admin auth at ~15:04 UTC from the droplet host (password read from file included compose-trimmed whitespace); later calls used the container's environment.
|
||||
- 15:05:55 UTC: POST .../receivers/dGVhbS1hbGVydHM/test with integration team-alerts-discord, secureFields.url=true -> {"status":"success","duration":"866ms"}.
|
||||
|
||||
## Normal Jenkins build vs host metrics 2026-10-28 (UTC; EDT = UTC-4)
|
||||
|
||||
- Before (15:10:40): cpu 48.6% (2m rate, during a periodic burst), MemAvailable 169.3 MiB, swap used 651.4 MiB; jenkins 348.3 MiB, 0.15% CPU.
|
||||
- Commit d3a5e6b pushed by Billy; Gitea statuses on d3a5e6b: pending 15:17:36, pending 15:17:51, success 15:17:53 (vpn-dns-gateway/pipeline/head).
|
||||
- Jenkins vpn-dns-gateway » feature/issue-19-monitoring #1: queued 15:17:33.9, started 15:17:41.3, duration 11.825 s, finished ~15:17:53.1, SUCCESS, "Ran 2 tests ... OK". Executed on the controller (built-in node; workspace /var/jenkins_home/workspace/eway_feature_issue-19-monitoring), single executor, no agents.
|
||||
- Prometheus 30 s samples 15:12:00-15:22:00 (cpu = 100*(1-avg(rate(idle[1m]))), MiB, MiB, load1):
|
||||
15:12:00 38.5/186/652/0.79, 15:13:00 48.8/205/710/0.41, 15:14:00 8.3/224/708/0.15, 15:15:00 38.8/136/673/0.38, 15:16:00 15.0/169/695/0.14, 15:16:30 8.3/175/688/0.15, 15:17:00 39.4/104/650/0.29, **15:17:30 19.0/116/675/0.33, 15:18:00 32.1/196/691/0.41 (build window)**, 15:18:30 43.7/221/680/0.31, 15:19:00 46.4/133/652/0.84, 15:20:00 17.1/221/702/0.51, 15:21:00 35.7/114/651/0.47, 15:22:00 11.2/209/691/0.21.
|
||||
- Result: no change attributable to the 11.8 s build; it is shorter than the 30 s scrape interval and its samples fall inside the background range (8-49%). Whole-host measurements cannot attribute CPU/RAM to Jenkins.
|
||||
- Background pattern: bursts about every 2 min (CPU 35-49%, MemAvailable -80..-120 MiB). docker stats 15:23:39-15:25:47 every ~8 s: containers mostly <2% CPU; burst at 15:24:38-15:24:46 = gitea 13.7% CPU, 23->93 MiB, grafana 15.4%, 73->140 MiB, MemAvailable 118 MiB.
|
||||
- CPU by mode, 15 min to ~15:26: idle 74.3%, iowait 14.7%, system 4.5%, user 4.0%, steal 1.6%. vmstat burst: si 2189 pages/s, wa 10%. Interpretation: memory pressure causes swap-in I/O wait; CPU work itself is ~8.5%.
|
||||
- Dashboard v2 (15:26): CPU panel adds "of which I/O wait" = 100*avg(rate(node_cpu_seconds_total{mode="iowait"}[2m])).
|
||||
|
||||
## Capacity alert test (Root disk space low) 2026-10-28 (UTC; EDT = UTC-4)
|
||||
|
||||
- Before: rule inactive, instance Normal since 14:56:20. Root fs ~61% available. Final file backed up on the droplet.
|
||||
- 15:36:48 temporary change on the droplet only: threshold `lt 15` -> `lt 70` in grafana/provisioning/alerting/sre.yaml; POST /api/admin/provisioning/alerting/reload -> "Alerting config reloaded" (no restart). Git kept 15.
|
||||
- 15:36:50 Pending; polled every ~15 s; 15:41:50 Alerting/firing (pending period 5 m as configured). Notification expected ~15:42:00 (group_wait 10 s).
|
||||
- 15:42:24 restored `lt 15` from the backup; reload -> "Alerting config reloaded". 15:42:41 rule inactive, no instances; Grafana Alertmanager active alerts: [] (resolved).
|
||||
- Droplet rule file SHA-256 1614a4490202de44ec75c958ade3b79a3c207cc60e712a6be9804f3f01e49d9e = Git working copy.
|
||||
- Side note: 15:30:05 GET /api/annotations returned 500 after 3.96 s during a dashboard load (memory pressure).
|
||||
- Discord #devops-alerts (screenshots): 11:42 EDT "[FIRING:1] Root disk space low" Value A=61.343850329350225, C=1, labels device=/dev/vda1 fstype=ext4 mountpoint=/ owner=billy severity=warning, runbook_url present; then "[RESOLVED] Root disk space low" with grafana_state_reason=Updated (resolution came from the restored rule definition; at that moment free space 61.3% > 15%, so the restored condition is false). The summary text is static ("below 15% free") and did not reflect the temporary 70% threshold.
|
||||
|
||||
## Controlled incident: Jenkins outage 2026-10-28 (UTC; EDT = UTC-4)
|
||||
|
||||
- Pre-check: no Jenkins build process (python3/sh/git/durable) in gitea-jenkins-1; ci probe 1; HTTPS rule instances ci Normal, git Normal. (A first attempt aborted before injection because the check matched the ps header line.)
|
||||
- 16:05:00 INJECT `cd ~/gitea && docker compose stop jenkins`; container stopped 16:05:06.
|
||||
- Prometheus ci probe_success samples: 16:04:50 = 1; 16:05:20 = 0 (first failing probe); 0 at 16:05:50, 16:06:20, 16:06:50.
|
||||
- probe_http_status_code (ci): 200 at 16:04:20, 16:04:50; 502 (Caddy, upstream down) 16:05:20-16:09:50; 0 (no HTTP response while Jenkins was starting) at 16:10:20; 200 at 16:10:50.
|
||||
- Grafana rule HTTPS service down, instance ci: Normal until ~16:05:48; Pending observed 16:05:54; Alerting observed 16:06:52 (poll every ~6 s). Gitea instance Normal throughout.
|
||||
- 16:07 (12:07 PM EDT) Discord "[FIRING:1] HTTPS service down SRE https://ci.yebilly.me/login (https billy critical)", Value A=0, C=1, runbook_url present (screenshot).
|
||||
- Acknowledgement: Billy sent the FIRING screenshot to the operator (Claude session) before the restart; a Discord "ack" reply was posted afterward (its timestamp is later than the restart).
|
||||
- 16:09:48 RESTART `cd ~/gitea && docker compose start jenkins` (4 min 48 s after injection).
|
||||
- Jenkins log: 16:10:45.113 "Completed initialization"; 16:10:45.275 "Jenkins is fully up and running".
|
||||
- ci probe_success: 0 at 16:09:50, 16:10:20; 1 at 16:10:50 (first successful probe). Rule ci instance Alerting until ~16:11:20; Normal observed 16:11:27. Gitea instance Normal throughout.
|
||||
- (Host-side check with --resolve to 127.0.0.1 returned 403 throughout: the droplet's own loopback request arrives through docker-proxy as the probe gateway 172.30.90.1, which the allowlist denies. Not a service signal.)
|
||||
- Measured: injection -> first failing sample 20 s; injection -> firing ~1 m 52 s (16:06:52); injection -> Discord ~2 m (16:07); restart -> Jenkins fully up 57 s; restart -> first successful probe sample 62 s; restart -> rule Normal ~1 m 32-39 s; probe-observed outage 16:05:20 -> 16:10:50 (5 m 30 s). Configured worst-case detection = scrape 30 s + evaluation 30 s + pending 60 s + group_wait 10 s = 2 m 10 s; observed ~2 m.
|
||||
- 16:12 (12:12 PM EDT) Discord "[RESOLVED] HTTPS service down SRE https://ci.yebilly.me/login", Value A=1, C=0 (resolved by evaluation, no state-reason override) (screenshot). Notification receipt -> resolved message ~5 m.
|
||||
- 16:11:46 laptop: https://ci.yebilly.me/login 200 0.254 s; https://git.yebilly.me/user/login 200 0.050 s.
|
||||
|
||||
## Restart persistence 2026-10-28 (UTC)
|
||||
|
||||
- Before 16:12:05: oldest TSDB sample 14:52:16; 160 `up{job="prometheus"}` samples in 2 h; dashboard Group 1 SRE v2 (7 panels); data source Prometheus http://prometheus:9090; rules HTTPS service down + Root disk space low (inactive); contact point team-alerts.
|
||||
- 16:12:09 `docker compose restart prometheus`; answering 16:12:15. After: oldest sample still 14:52:16 (history kept on volume monitoring_prometheus_data). Raw scrapes node 16:11:36, 16:12:06, 16:12:36, 16:13:06; https 16:11:50, 16:12:20, 16:12:50: no gap > 35 s (restart fell between scrapes).
|
||||
- 16:12:56 `docker compose restart grafana`; at 16:13:44 dashboard v2 7 panels, data source, both rules, contact point all present; admin login unchanged (volume monitoring_grafana_data). A restart shows persistence, not a backup restore.
|
||||
|
||||
## SLI short window around the incident (UTC)
|
||||
|
||||
- Window [10m] 16:03:00-16:13:00, evaluation time 2026-10-28 16:13:00 UTC, scrape interval 30 s (expected ~20 samples). Queries: 100*avg_over_time(probe_success{job="https",instance="<url>"}[10m]), count_over_time(...), sum_over_time(...).
|
||||
- Gitea https://git.yebilly.me/user/login: 100% (20 received, 20 successes).
|
||||
- Jenkins https://ci.yebilly.me/login: 45% (20 received, 9 successes, 11 failures). Raw: 1 at 16:03:20-16:04:50; 0 at 16:05:20-16:10:20; 1 at 16:10:50-16:12:50. No missing samples, so no unknown time; boundary: the first sample in the window is 16:03:20.
|
||||
- (First attempt evaluated at the wrong epoch, 16:23:00, giving 100%/20 for both; rerun with date -d.)
|
||||
|
||||
## Post-recovery verification (UTC)
|
||||
|
||||
- Billy pushed b6cf080 (d3a5e6b..b6cf080) after re-authorising Git Credential Manager (stale OAuth refresh token removed).
|
||||
- Gitea status vpn-dns-gateway/pipeline/head on b6cf080: pending 16:36:27, success 16:37:08 (webhook + status integration working after the outage).
|
||||
- Jenkins feature/issue-19-monitoring #2: start 16:36:34.6, duration 33.923 s, SUCCESS, "Ran 2 tests ... OK", commit b6cf08061815acd628bf3caaa90e38c46d57a8e7 (slower than #1's 11.8 s, consistent with swap pressure after the restarts).
|
||||
- Manual PDF build (Gitea Actions, runner latex-local on Vincent's laptop) runs only on pushes to main; it is verified at merge.
|
||||
|
||||
## Improvement issues from the blameless review
|
||||
|
||||
- #20 "Add an off-droplet uptime check for git, ci, and metrics" (priority 1, owner @vsun1) and #21 "Remove swap churn on The-Ocean (memory headroom)" (priority 2, owner @bill), opened by bill 2026-10-28.
|
||||
|
||||
## Grafana accounts
|
||||
|
||||
- 2026-10-28 17:03:14 UTC Billy created Grafana user vsun1 (Vincent Sun), org role Viewer, not server admin. Org users: billy Admin, vsun1 Viewer.
|
||||
|
||||
## Grafana administrator password replaced
|
||||
|
||||
- ~17:2x UTC Billy changed the billy password in Grafana (Profile -> Change password); the new value is only in his password manager and Grafana's database.
|
||||
- 17:29:34 UTC the previous value (still in the running container's environment) returned HTTP 401 on /api/user: the initial credential is no longer valid.
|
||||
- GF_SECURITY_ADMIN_PASSWORD line removed from ~/monitoring/.env.secret (now only DISCORD_WEBHOOK_URL; mode 600 root); `docker compose config --quiet` valid. The stale value leaves the container environment at the next Grafana recreate.
|
||||
|
||||
## Audit follow-up checks 2026-10-28 (UTC)
|
||||
|
||||
- Baseline detail (first sample 04:34:10): free -b available 154066944 B (146.9 MiB), swap used 434180096 B (414.1 MiB); second sample 04:34:27 available 229351424 B (218.7 MiB). Docker 29.8.1, Compose v5.5.1, kernel 6.8.0-147-generic.
|
||||
- 14:56 target check: all five targets up, lastError none, lastScrapeDuration 0.031-0.226 s.
|
||||
- 17:30:59 CPU counters, /proc/stat (USER_HZ 100) vs node_cpu_seconds_total: user 4100.8 / 4099.5 s, system 1768.9 / 1768.0, idle 562052.6 / 562034.4, iowait 2080.2 / 2078.2, steal 1727.5 / 1726.4 (difference consistent with the <=30 s scrape age).
|
||||
- 17:3x targets: blackbox 0.004 s, https git 0.128 s, https ci 0.064 s, node 0.062 s, prometheus 0.022 s; all up, no error.
|
||||
- Container identities and mounts: prometheus uid 65534 (nobody), /prometheus = volume monitoring_prometheus_data, /etc/prometheus/prometheus.yml bind ro; grafana uid 472, /var/lib/grafana = volume monitoring_grafana_data, /etc/grafana/provisioning and /var/lib/grafana-dashboards bind ro; node-exporter uid 65534, /host bind ro; blackbox-exporter uid 0 (image default), /config/blackbox.yml bind ro -> changed to user 65534:65534 (see below).
|
||||
|
||||
## Collection-health rule and non-root Blackbox (UTC)
|
||||
|
||||
- Local smoke run: new rule "Monitoring target down" (expr `up`, < 1 for 1 m, no data -> Alerting, error -> Error) loaded healthy and went Pending for the absent node target; blackbox-exporter as uid 65534 probed successfully.
|
||||
- 17:33:23 deployed sre.yaml (third rule), compose.yaml (blackbox `user: "65534:65534"`), README (runbook, password prompt); `docker compose up -d grafana blackbox-exporter`. 17:33:57 "finished to provision alerting", no errors. blackbox id uid=65534(nobody). Old admin password no longer in the Grafana container environment. 17:34:15 all five targets up.
|
||||
|
||||
## Collection-health test: Blackbox Exporter stopped (UTC; EDT = UTC-4)
|
||||
|
||||
- Pre: up blackbox=1, prometheus=1, https=1 (x2), node=1.
|
||||
- 17:34:44 INJECT `docker compose stop blackbox-exporter`.
|
||||
- 17:34:56 first failed scrape: up blackbox=0, one https target 0; 17:35:07 both https targets 0; count(probe_success) returned no series from 17:35:07 until the restore (probe series absent, not 0).
|
||||
- 17:37:52 RESTORE `docker compose start blackbox-exporter`; 17:38:25 all five targets up; blackbox uid 65534.
|
||||
- Grafana alert state could not be read through the API (admin password now known only to Billy); notifications are evidenced by the Discord screenshots.
|
||||
- Discord #devops-alerts (screenshots), EDT: 1:36 PM "[FIRING:1] Monitoring target down" instance blackbox-exporter:9115 job blackbox, A=0; same minute "[FIRING:1] HTTPS service down" for ci and for git with grafana_state_reason=NoData, A=-1 (probe series absent -> no-data policy Alerting); 1:37 PM "[FIRING:3] Monitoring target down" (blackbox plus both https targets); RESOLVED (A=1) for HTTPS service down git and ci (1:39 PM for ci) and "[RESOLVED] Monitoring target down" for all three at 1:39 PM.
|
||||
|
||||
## Review gate on PR #22 (UTC)
|
||||
|
||||
- PR #22 feature/issue-19-monitoring -> main, opened by Billy.
|
||||
- Gitea reviews: vsun1 APPROVED 17:09:21 (head b6cf080) and 17:13:53 (head 336eaae); each dismissed as stale when a later commit arrived (branch protection dismisses stale approvals).
|
||||
- vpn-dns-gateway/pipeline/pr-main: success on 336eaae at 17:12:32; success on 249488d by 17:54:22. Merge still requires a fresh approval of the final head.
|
||||
- 17:56 live verification: deployed config files byte-identical to Git (9 files, SHA-256); running containers match documented users, memory caps, networks, no host ports except Caddy, no Docker socket, not privileged; image digests match pins; 3 alert rules in grafana.db (for 60 s / 60 s / 300 s, no data -> Alerting, error -> Error); users billy (admin), vsun1; 0 OOM events.
|
||||
@@ -0,0 +1,147 @@
|
||||
# Monitoring (Assignment 7 / Instructor Manual Chapter 5)
|
||||
|
||||
Prometheus, Grafana OSS, Node Exporter, and Blackbox Exporter on the droplet
|
||||
**The-Ocean**, beside Gitea, Jenkins, and Caddy (`deploy/`). Grafana is the only
|
||||
web entry point: `https://metrics.yebilly.me` (same allowlist as Jenkins, then
|
||||
Grafana login). No monitoring port is published on the host.
|
||||
|
||||
| Service | Image (pinned in `compose.yaml`) | Private address | Networks | Memory cap | State |
|
||||
|---|---|---|---|---|---|
|
||||
| Prometheus | `prom/prometheus:v3.15.1` | `prometheus:9090` | monitoring | 128 MiB | volume `monitoring_prometheus_data` (7 d / 500 MB) |
|
||||
| Grafana OSS | `grafana/grafana:13.2.5` | `grafana:3000` | monitoring, `gitea_web` | 192 MiB | volume `monitoring_grafana_data` |
|
||||
| Node Exporter | `quay.io/prometheus/node-exporter:v1.12.1` | `node-exporter:9100` | monitoring | 32 MiB | none (read-only host `/`) |
|
||||
| Blackbox Exporter | `quay.io/prometheus/blackbox-exporter:v0.29.1` | `blackbox-exporter:9115`, `172.30.90.10` | monitoring, `gitea_probe` | 32 MiB | none |
|
||||
|
||||
Configuration in Git: `prometheus/prometheus.yml`, `blackbox/blackbox.yml`,
|
||||
`grafana/provisioning/` (data source, dashboard provider, alert rules, contact
|
||||
point), and `grafana/dashboards/sre.json`. Provisioned items are read-only in
|
||||
the UI; change them here, copy to the droplet, and restart Grafana.
|
||||
|
||||
## Secrets (never in Git)
|
||||
|
||||
`~/monitoring/.env.secret` on the droplet, mode `600`, owner root:
|
||||
|
||||
```
|
||||
GF_SECURITY_ADMIN_PASSWORD=<from the team password manager>
|
||||
DISCORD_WEBHOOK_URL=<webhook for #devops-alerts>
|
||||
```
|
||||
|
||||
The admin password applies only when Grafana first creates its database. At
|
||||
first login, change it in Grafana (Profile → Change password), store the new
|
||||
value in the password manager, and delete the `GF_SECURITY_ADMIN_PASSWORD`
|
||||
line from `.env.secret`; on The-Ocean this was done on 28 Oct 2026.
|
||||
|
||||
## Deploy
|
||||
|
||||
Prerequisite: `deploy/` is current on the droplet and Caddy has been recreated
|
||||
once (`cd ~/gitea && docker compose up -d caddy`), which creates the
|
||||
`gitea_probe` network and the `metrics.yebilly.me` route.
|
||||
|
||||
```bash
|
||||
scp -r monitoring root@<droplet-ip>:~/monitoring # from the laptop
|
||||
cd ~/monitoring && chmod 700 .
|
||||
# scp from Windows creates 700 directories; Grafana (uid 472) must read its config.
|
||||
find grafana prometheus blackbox -type d -exec chmod 755 {} + && find grafana prometheus blackbox -type f -exec chmod 644 {} +
|
||||
install -m 600 /dev/null .env.secret && nano .env.secret # typed by a team member
|
||||
docker compose config --quiet
|
||||
docker compose pull
|
||||
docker compose run --rm --no-deps --entrypoint /bin/promtool prometheus check config /etc/prometheus/prometheus.yml
|
||||
docker compose up -d
|
||||
docker compose ps
|
||||
docker compose logs --tail=50 prometheus grafana node-exporter blackbox-exporter
|
||||
docker image inspect --format '{{.RepoDigests}}' prom/prometheus:v3.15.1 # repeat per image
|
||||
```
|
||||
|
||||
Startup order does not matter: Grafana retries the data source and Prometheus
|
||||
retries scrapes. All four services restart `unless-stopped`.
|
||||
|
||||
## Operate, update, back up, roll back
|
||||
|
||||
- Pause/resume: `docker compose stop` / `docker compose start`. **Never**
|
||||
`docker compose down -v`; it deletes both named volumes.
|
||||
- Config change: edit in Git, copy the file, then
|
||||
`docker compose restart prometheus` (or `grafana`). Validate Prometheus config
|
||||
with the `promtool` line above first.
|
||||
- Upgrade one image at a time: back up, read the release notes, change the tag
|
||||
and digest in `compose.yaml`, `docker compose pull <svc> && docker compose up -d <svc>`,
|
||||
then check targets, dashboard, and alert rules. Do not assume an older Grafana
|
||||
or Prometheus can read data written by a newer one: restore the backup instead.
|
||||
- Contact-point test (the provisioned contact point has no Test button in the UI;
|
||||
Grafana 13 removed the old test endpoint). Sends one message to `#devops-alerts`
|
||||
using the stored URL, which is never printed:
|
||||
|
||||
```bash
|
||||
GIP=$(docker inspect monitoring-grafana-1 --format '{{(index .NetworkSettings.Networks "monitoring_monitoring").IPAddress}}')
|
||||
read -rs -p 'Grafana password for billy: ' P; echo # typed, never stored
|
||||
curl -s -u "billy:$P" -H 'Content-Type: application/json' -X POST \
|
||||
-d '{"integration":{"uid":"team-alerts-discord","type":"discord","version":"v1","settings":{},"secureFields":{"url":true}}}' \
|
||||
"http://$GIP:3000/apis/notifications.alerting.grafana.app/v1beta1/namespaces/default/receivers/dGVhbS1hbGVydHM/test"
|
||||
unset P # expect {"status":"success",...}; dGVhbS1hbGVydHM is base64 of "team-alerts"
|
||||
```
|
||||
|
||||
- Backup (state not rebuildable from Git: Grafana users/passwords, alert state,
|
||||
metric history):
|
||||
|
||||
```bash
|
||||
cd ~/monitoring && docker compose stop grafana prometheus
|
||||
docker run --rm -v monitoring_grafana_data:/g:ro -v monitoring_prometheus_data:/p:ro \
|
||||
-v /root/backups:/b alpine:3.22 tar czf /b/monitoring-$(date -u +%Y%m%dT%H%M%SZ).tgz /g /p
|
||||
docker compose start grafana prometheus
|
||||
```
|
||||
|
||||
Restore (same image versions only): `docker compose stop grafana prometheus`,
|
||||
empty both volumes, then
|
||||
`docker run --rm -v monitoring_grafana_data:/g -v monitoring_prometheus_data:/p -v /root/backups:/b alpine:3.22 tar xzf /b/monitoring-<stamp>.tgz -C /`
|
||||
and `docker compose start grafana prometheus`.
|
||||
|
||||
- Remove the stack entirely: `docker compose stop && docker compose rm -f`
|
||||
(volumes kept), then revert the `metrics` block and probe allowlist entry in
|
||||
`deploy/Caddyfile` and recreate Caddy.
|
||||
|
||||
## Runbook: Monitoring target down
|
||||
|
||||
Alert `Monitoring target down` (critical, owner Billy, backup Vincent): a
|
||||
Prometheus scrape target (`up`) has failed for 1 minute, or no target data
|
||||
exists. While it fires, the dashboard and the other alerts are partly blind.
|
||||
|
||||
1. Acknowledge in `#devops-alerts` with your name and the time.
|
||||
2. The `job` label names the broken collector: `blackbox` or `https` means
|
||||
Blackbox Exporter, `node` means Node Exporter, `prometheus` means Prometheus.
|
||||
3. On the droplet: `cd ~/monitoring && docker compose ps`, then
|
||||
`docker compose logs --tail=50 <service>`.
|
||||
4. Stopped: `docker compose start <service>`. Running but failing:
|
||||
`docker compose restart <service>`. Never use `down -v`.
|
||||
5. Confirm all targets are up again (dashboard *Scrape health* panel) and that
|
||||
Discord shows the resolved message.
|
||||
|
||||
## Runbook: HTTPS service down
|
||||
|
||||
Alert `HTTPS service down` (critical, owner Billy, backup Vincent): a login
|
||||
page's `probe_success` has been 0 for 1 minute. If the probe series disappears
|
||||
instead, this rule can resolve; `Monitoring target down` reports that case.
|
||||
|
||||
1. Acknowledge in `#devops-alerts` with your name and the time.
|
||||
2. Open the `Group 1 SRE` dashboard. Is only one service down, or both?
|
||||
- Both down, and the scrape health panel also shows failures: check Caddy and the droplet first.
|
||||
- Missing data rather than 0: the monitoring stack itself is failing (`docker compose ps` in `~/monitoring`).
|
||||
3. On the droplet: `cd ~/gitea && docker compose ps`, then `docker compose logs --tail=50 <gitea|jenkins|caddy>`.
|
||||
4. If the service container is stopped: `docker compose start <service>`. If it
|
||||
is running but unhealthy: `docker compose restart <service>`. Never use
|
||||
`down -v`.
|
||||
5. Confirm the probe returns to 1 and Discord shows the resolved message. For
|
||||
Jenkins, also run a pipeline and confirm the Gitea status check.
|
||||
6. Record the timeline in the incident log or manual.
|
||||
|
||||
## Runbook: Root disk space low
|
||||
|
||||
Alert `Root disk space low` (warning, owner Billy): available space on `/`
|
||||
(`/dev/vda1`, ext4) has stayed below 15% for 5 minutes. 15% of 24.9 GB is
|
||||
about 3.7 GB: enough to act before Gitea, Jenkins, or Prometheus fail to write.
|
||||
|
||||
1. Acknowledge in `#devops-alerts`.
|
||||
2. `df -h /` and `docker system df` to find the growth.
|
||||
3. Safe first actions: `docker builder prune` (build cache), `journalctl --vacuum-size=200M`,
|
||||
remove obsolete images with `docker image prune`. Do not delete volumes.
|
||||
4. Prometheus is capped at 500 MB / 7 days; if it is the cause, lower the cap
|
||||
rather than deleting its volume.
|
||||
5. If space cannot be recovered, plan a disk resize (permanent, costs more) with the team.
|
||||
@@ -0,0 +1,14 @@
|
||||
# Success = DNS answer, valid certificate for the hostname, redirects followed,
|
||||
# and a final 2xx on the login page. TLS verification stays on.
|
||||
modules:
|
||||
http_2xx:
|
||||
prober: http
|
||||
timeout: 10s
|
||||
http:
|
||||
method: GET
|
||||
preferred_ip_protocol: ip4
|
||||
valid_status_codes: [] # empty = any 2xx
|
||||
follow_redirects: true
|
||||
fail_if_not_ssl: true
|
||||
tls_config:
|
||||
insecure_skip_verify: false
|
||||
@@ -0,0 +1,97 @@
|
||||
# Monitoring stack on The-Ocean (Assignment 7 / Instructor Manual Chapter 5).
|
||||
# Four project-published images, pinned by tag and digest (the repository ignores
|
||||
# .env files, so versions live here). No service publishes a host port:
|
||||
# Caddy reaches grafana:3000 on gitea_web; Prometheus and the exporters stay on
|
||||
# the private "monitoring" network. Pause with stop/start; never "down -v".
|
||||
name: monitoring
|
||||
|
||||
services:
|
||||
prometheus:
|
||||
image: prom/prometheus:v3.15.1@sha256:fa3302279710be2f21a8301ec17a8b4f2301fd829bd113839b3b6b02b6f191a2
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- --config.file=/etc/prometheus/prometheus.yml
|
||||
- --storage.tsdb.path=/prometheus
|
||||
- --storage.tsdb.retention.time=7d
|
||||
- --storage.tsdb.retention.size=500MB # whichever limit is hit first
|
||||
environment:
|
||||
- GOMEMLIMIT=96MiB # Go GC target below the container cap
|
||||
volumes:
|
||||
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||||
- prometheus_data:/prometheus
|
||||
networks: [monitoring]
|
||||
mem_limit: 128m
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:13.2.5@sha256:9f7aa1e1e3246aade5792d35a738049f7f32f89cd51d1956cf426a4e86268a84
|
||||
restart: unless-stopped
|
||||
# Root-only, untracked: GF_SECURITY_ADMIN_PASSWORD and DISCORD_WEBHOOK_URL (see README).
|
||||
env_file: [.env.secret]
|
||||
environment:
|
||||
GF_SERVER_ROOT_URL: https://metrics.yebilly.me/
|
||||
GF_SECURITY_ADMIN_USER: billy
|
||||
GF_SECURITY_COOKIE_SECURE: "true"
|
||||
GF_SECURITY_DISABLE_GRAVATAR: "true"
|
||||
GF_AUTH_ANONYMOUS_ENABLED: "false"
|
||||
GF_USERS_ALLOW_SIGN_UP: "false"
|
||||
GF_METRICS_ENABLED: "false" # no public /metrics through the HTTPS hostname
|
||||
# 1 GiB droplet: skip plugin downloads, news, and phone-home checks.
|
||||
GF_PLUGINS_PREINSTALL_DISABLED: "true"
|
||||
GF_NEWS_NEWS_FEED_ENABLED: "false"
|
||||
GF_ANALYTICS_REPORTING_ENABLED: "false"
|
||||
GF_ANALYTICS_CHECK_FOR_UPDATES: "false"
|
||||
GF_ANALYTICS_CHECK_FOR_PLUGIN_UPDATES: "false"
|
||||
GOMEMLIMIT: 150MiB
|
||||
volumes:
|
||||
- grafana_data:/var/lib/grafana
|
||||
- ./grafana/provisioning:/etc/grafana/provisioning:ro
|
||||
- ./grafana/dashboards:/var/lib/grafana-dashboards:ro
|
||||
networks: [monitoring, web]
|
||||
mem_limit: 192m
|
||||
|
||||
node-exporter:
|
||||
image: quay.io/prometheus/node-exporter:v1.12.1@sha256:1b4e4438faca4dd7e001dd445d161a4a2091b0fededa84093b3a8dfeae1f1be0
|
||||
restart: unless-stopped
|
||||
pid: host
|
||||
command:
|
||||
- --path.rootfs=/host
|
||||
- --path.procfs=/host/proc
|
||||
- --path.sysfs=/host/sys
|
||||
# Only what the dashboard and alerts use: CPU, memory, root disk.
|
||||
- --collector.disable-defaults
|
||||
- --collector.cpu
|
||||
- --collector.meminfo
|
||||
- --collector.filesystem
|
||||
- --collector.loadavg
|
||||
- --collector.uname
|
||||
volumes:
|
||||
- /:/host:ro,rslave # read-only host view; no Docker socket, not privileged
|
||||
networks: [monitoring]
|
||||
mem_limit: 32m
|
||||
|
||||
blackbox-exporter:
|
||||
image: quay.io/prometheus/blackbox-exporter:v0.29.1@sha256:ea1c7aa3ef3f307cd03e85f34abb604478ccb90b567fc690da0cd9776da76b13
|
||||
restart: unless-stopped
|
||||
user: "65534:65534" # image default is root; HTTP probes need no privileges
|
||||
command: ["--config.file=/config/blackbox.yml"]
|
||||
volumes:
|
||||
- ./blackbox/blackbox.yml:/config/blackbox.yml:ro
|
||||
networks:
|
||||
monitoring:
|
||||
probe:
|
||||
# The only private address allowed past the ci.yebilly.me allowlist.
|
||||
ipv4_address: 172.30.90.10
|
||||
mem_limit: 32m
|
||||
|
||||
networks:
|
||||
monitoring:
|
||||
web:
|
||||
external: true
|
||||
name: gitea_web
|
||||
probe:
|
||||
external: true
|
||||
name: gitea_probe # defined in deploy/docker-compose.yml; Caddy answers git/ci there
|
||||
|
||||
volumes:
|
||||
prometheus_data:
|
||||
grafana_data:
|
||||
@@ -0,0 +1,30 @@
|
||||
# External TCP evidence, 28 October 2026
|
||||
|
||||
Vincent ran the PowerShell loop in the Codex conversation on his external
|
||||
Wi-Fi connection, outside SSH. `ports-20261028-154000.csv` retains all 18
|
||||
connection outcomes and UTC completion timestamps from that run. Only the
|
||||
local Wi-Fi name in `Network` has been replaced by a generic description;
|
||||
the original CSV is retained under ignored `build/evidence/assignment7-port-tests/`.
|
||||
|
||||
The tests ran 19:32:40-19:40:00 UTC (15:32:40-15:40:00 EDT). TCP 443 and 80
|
||||
succeeded on both droplet addresses. TCP 3000, 3001, 8080, 9090, 9100, 9115,
|
||||
and 50000 failed on both. The 443 controls passed before the negative tests.
|
||||
These results establish reachability from the tested client network at that
|
||||
time; they do not identify which networking layer blocked a connection or
|
||||
test TLS, redirects, or application authentication.
|
||||
|
||||
`test-ports.ps1` preserves the executed loop as a reusable script, with network
|
||||
description and output location exposed as parameters. This saved script was
|
||||
syntax-checked; the historical evidence comes from Vincent's earlier run of
|
||||
the conversational loop, not a subsequent execution of this file.
|
||||
|
||||
To repeat from repository root in Windows PowerShell:
|
||||
|
||||
```powershell
|
||||
./monitoring/evidence/test-ports.ps1 -NetworkDescription 'External Wi-Fi'
|
||||
```
|
||||
|
||||
A failed HTTPS control makes that address family's remaining tests
|
||||
inconclusive and skips them. Keep the new date and results; do not replace
|
||||
the historical evidence. See Microsoft's
|
||||
[Test-NetConnection documentation](https://learn.microsoft.com/en-us/powershell/module/nettcpip/test-netconnection?view=windowsserver2025-ps).
|
||||
@@ -0,0 +1,19 @@
|
||||
TimeUTC,Network,Target,Port,ExpectedReachable,TcpTestSucceeded,Result
|
||||
2026-10-28T19:32:40.4700276Z,External Wi-Fi (Vincent laptop; local network name redacted),147.182.178.136,443,True,True,MATCH
|
||||
2026-10-28T19:32:49.7334208Z,External Wi-Fi (Vincent laptop; local network name redacted),147.182.178.136,80,True,True,MATCH
|
||||
2026-10-28T19:33:24.9527541Z,External Wi-Fi (Vincent laptop; local network name redacted),147.182.178.136,3000,False,False,MATCH
|
||||
2026-10-28T19:34:00.0160397Z,External Wi-Fi (Vincent laptop; local network name redacted),147.182.178.136,3001,False,False,MATCH
|
||||
2026-10-28T19:34:35.0118147Z,External Wi-Fi (Vincent laptop; local network name redacted),147.182.178.136,8080,False,False,MATCH
|
||||
2026-10-28T19:35:10.1101959Z,External Wi-Fi (Vincent laptop; local network name redacted),147.182.178.136,9090,False,False,MATCH
|
||||
2026-10-28T19:35:44.9897149Z,External Wi-Fi (Vincent laptop; local network name redacted),147.182.178.136,9100,False,False,MATCH
|
||||
2026-10-28T19:36:19.9643517Z,External Wi-Fi (Vincent laptop; local network name redacted),147.182.178.136,9115,False,False,MATCH
|
||||
2026-10-28T19:36:54.9233170Z,External Wi-Fi (Vincent laptop; local network name redacted),147.182.178.136,50000,False,False,MATCH
|
||||
2026-10-28T19:36:55.4230345Z,External Wi-Fi (Vincent laptop; local network name redacted),2604:a880:400:d1:0:5:22d:6001,443,True,True,MATCH
|
||||
2026-10-28T19:36:55.8361207Z,External Wi-Fi (Vincent laptop; local network name redacted),2604:a880:400:d1:0:5:22d:6001,80,True,True,MATCH
|
||||
2026-10-28T19:37:22.1944035Z,External Wi-Fi (Vincent laptop; local network name redacted),2604:a880:400:d1:0:5:22d:6001,3000,False,False,MATCH
|
||||
2026-10-28T19:37:48.6712583Z,External Wi-Fi (Vincent laptop; local network name redacted),2604:a880:400:d1:0:5:22d:6001,3001,False,False,MATCH
|
||||
2026-10-28T19:38:15.0191304Z,External Wi-Fi (Vincent laptop; local network name redacted),2604:a880:400:d1:0:5:22d:6001,8080,False,False,MATCH
|
||||
2026-10-28T19:38:41.1817674Z,External Wi-Fi (Vincent laptop; local network name redacted),2604:a880:400:d1:0:5:22d:6001,9090,False,False,MATCH
|
||||
2026-10-28T19:39:07.6837526Z,External Wi-Fi (Vincent laptop; local network name redacted),2604:a880:400:d1:0:5:22d:6001,9100,False,False,MATCH
|
||||
2026-10-28T19:39:34.1413090Z,External Wi-Fi (Vincent laptop; local network name redacted),2604:a880:400:d1:0:5:22d:6001,9115,False,False,MATCH
|
||||
2026-10-28T19:40:00.0333941Z,External Wi-Fi (Vincent laptop; local network name redacted),2604:a880:400:d1:0:5:22d:6001,50000,False,False,MATCH
|
||||
|
@@ -0,0 +1,39 @@
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$NetworkDescription,
|
||||
[string]$OutputDirectory = 'build/evidence/assignment7-port-tests'
|
||||
)
|
||||
|
||||
# Run on an external Windows client, outside the droplet's SSH session.
|
||||
# Use a generic network description; do not include a personal address or SSID.
|
||||
$targets = @('147.182.178.136', '2604:a880:400:d1:0:5:22d:6001')
|
||||
$results = @()
|
||||
foreach ($target in $targets) {
|
||||
foreach ($port in @(443, 80, 3000, 3001, 8080, 9090, 9100, 9115, 50000)) {
|
||||
Write-Host "Testing $target port $port..."
|
||||
$test = Test-NetConnection -ComputerName $target -Port $port `
|
||||
-InformationLevel Detailed -WarningAction SilentlyContinue
|
||||
$reachable = [bool]$test.TcpTestSucceeded
|
||||
$expected = $port -in @(80, 443)
|
||||
$result = [pscustomobject]@{
|
||||
TimeUTC = (Get-Date).ToUniversalTime().ToString('o')
|
||||
Network = $NetworkDescription
|
||||
Target = $target
|
||||
Port = $port
|
||||
ExpectedReachable = $expected
|
||||
TcpTestSucceeded = $reachable
|
||||
Result = if ($port -eq 443 -and !$reachable) {
|
||||
'INCONCLUSIVE: HTTPS control failed'
|
||||
} elseif ($reachable -eq $expected) { 'MATCH' } else { 'UNEXPECTED' }
|
||||
}
|
||||
$results += $result
|
||||
$result | Format-Table Target, Port, TcpTestSucceeded, Result -AutoSize
|
||||
if ($port -eq 443 -and !$reachable) {
|
||||
Write-Host 'Skipping remaining ports for this address.'
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
New-Item -ItemType Directory -Force -Path $OutputDirectory | Out-Null
|
||||
$file = Join-Path $OutputDirectory ("ports-{0}.csv" -f (Get-Date -Format 'yyyyMMdd-HHmmss'))
|
||||
$results | Export-Csv -LiteralPath $file -NoTypeInformation
|
||||
Write-Host "Results saved to $file"
|
||||
@@ -0,0 +1,578 @@
|
||||
{
|
||||
"uid": "group1-sre",
|
||||
"title": "Group 1 SRE",
|
||||
"tags": [
|
||||
"sre",
|
||||
"assignment7"
|
||||
],
|
||||
"timezone": "America/New_York",
|
||||
"refresh": "30s",
|
||||
"time": {
|
||||
"from": "now-6h",
|
||||
"to": "now"
|
||||
},
|
||||
"schemaVersion": 41,
|
||||
"version": 1,
|
||||
"editable": false,
|
||||
"graphTooltip": 1,
|
||||
"panels": [
|
||||
{
|
||||
"id": 1,
|
||||
"type": "timeseries",
|
||||
"title": "Droplet CPU utilization (%)",
|
||||
"description": "Whole-droplet CPU busy %, averaged across CPUs: 100 minus the idle-time rate over 2m. Counts every workload on the host, not one container. The I/O wait line is the part spent waiting on disk (on this 1 GiB droplet, mostly swap-in), not computation.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percent",
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"lineInterpolation": "linear",
|
||||
"thresholdsStyle": {
|
||||
"mode": "line"
|
||||
}
|
||||
},
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
},
|
||||
"min": 0,
|
||||
"max": 100
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "100 * (1 - avg(rate(node_cpu_seconds_total{job=\"node\",mode=\"idle\"}[2m])))",
|
||||
"legendFormat": "CPU busy"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "100 * avg(rate(node_cpu_seconds_total{job=\"node\",mode=\"iowait\"}[2m]))",
|
||||
"legendFormat": "of which I/O wait"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"type": "timeseries",
|
||||
"title": "Available memory (bytes)",
|
||||
"description": "MemAvailable: the kernel's estimate of memory available to start new applications without swapping (not just unused RAM).",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 0,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "bytes",
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"lineInterpolation": "linear",
|
||||
"thresholdsStyle": {
|
||||
"mode": "line"
|
||||
}
|
||||
},
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "red",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "green",
|
||||
"value": 104857600
|
||||
}
|
||||
]
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "node_memory_MemAvailable_bytes{job=\"node\"}",
|
||||
"legendFormat": "available"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"type": "timeseries",
|
||||
"title": "Root filesystem available (%)",
|
||||
"description": "Available bytes / size bytes for the host root filesystem (/dev/vda1, ext4, mounted at /). Alert fires below 15% for 5m.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 8,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percent",
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"lineInterpolation": "linear",
|
||||
"thresholdsStyle": {
|
||||
"mode": "line"
|
||||
}
|
||||
},
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "red",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "green",
|
||||
"value": 15
|
||||
}
|
||||
]
|
||||
},
|
||||
"min": 0,
|
||||
"max": 100
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "100 * node_filesystem_avail_bytes{job=\"node\",mountpoint=\"/\",fstype=\"ext4\"} / node_filesystem_size_bytes{job=\"node\",mountpoint=\"/\",fstype=\"ext4\"}",
|
||||
"legendFormat": "/ available"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"type": "timeseries",
|
||||
"title": "Gitea HTTPS availability (probe_success)",
|
||||
"description": "1 = Blackbox Exporter fetched the Gitea login page with valid TLS and a 2xx; 0 = the probe failed.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 8,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "none",
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"lineInterpolation": "stepAfter",
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"min": 0,
|
||||
"max": 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",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "probe_success{job=\"https\",instance=\"https://git.yebilly.me/user/login\"}",
|
||||
"legendFormat": "Gitea"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"type": "timeseries",
|
||||
"title": "Jenkins HTTPS availability (probe_success)",
|
||||
"description": "1 = Blackbox Exporter fetched the Jenkins login page with valid TLS and a 2xx; 0 = the probe failed.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 16,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "none",
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"lineInterpolation": "stepAfter",
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"min": 0,
|
||||
"max": 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",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "probe_success{job=\"https\",instance=\"https://ci.yebilly.me/login\"}",
|
||||
"legendFormat": "Jenkins"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"type": "timeseries",
|
||||
"title": "HTTPS probe duration (s)",
|
||||
"description": "Total time of each probe (DNS, connect, TLS, request), one line per service.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 16,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"lineInterpolation": "linear",
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "probe_duration_seconds{job=\"https\",instance=\"https://git.yebilly.me/user/login\"}",
|
||||
"legendFormat": "Gitea"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "probe_duration_seconds{job=\"https\",instance=\"https://ci.yebilly.me/login\"}",
|
||||
"legendFormat": "Jenkins"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"type": "timeseries",
|
||||
"title": "Scrape health (up)",
|
||||
"description": "Optional: 1 = Prometheus scraped the target. For the https job, up=1 can coexist with probe_success=0 (collection worked, the probed request failed).",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 24,
|
||||
"w": 24,
|
||||
"h": 6
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "none",
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"lineInterpolation": "stepAfter",
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"min": 0,
|
||||
"max": 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",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "up",
|
||||
"legendFormat": "{{job}} {{instance}}"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": {
|
||||
"type": "grafana",
|
||||
"uid": "-- Grafana --"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
# Grafana-managed alerts. Grafana expands $VAR in the contact point, which keeps the
|
||||
# webhook URL out of Git; templates use .Labels instead of $labels to avoid "$".
|
||||
apiVersion: 1
|
||||
|
||||
contactPoints:
|
||||
- orgId: 1
|
||||
name: team-alerts
|
||||
receivers:
|
||||
- uid: team-alerts-discord
|
||||
type: discord
|
||||
settings:
|
||||
url: $DISCORD_WEBHOOK_URL # from the untracked .env.secret
|
||||
disableResolveMessage: false # resolved notifications on
|
||||
|
||||
groups:
|
||||
- orgId: 1
|
||||
name: sre
|
||||
folder: SRE
|
||||
interval: 30s # matches the scrape interval
|
||||
rules:
|
||||
- uid: https-service-down
|
||||
title: HTTPS service down
|
||||
condition: C
|
||||
data:
|
||||
- refId: A
|
||||
relativeTimeRange: {from: 300, to: 0}
|
||||
datasourceUid: prometheus
|
||||
model:
|
||||
refId: A
|
||||
expr: probe_success{job="https"}
|
||||
instant: true
|
||||
- refId: C
|
||||
datasourceUid: __expr__
|
||||
model:
|
||||
refId: C
|
||||
type: threshold
|
||||
expression: A
|
||||
conditions:
|
||||
- evaluator: {type: lt, params: [1]}
|
||||
for: 1m
|
||||
# A missing series or a failed query is a monitoring failure, not health.
|
||||
noDataState: Alerting
|
||||
execErrState: Error
|
||||
labels: {severity: critical, owner: billy}
|
||||
annotations:
|
||||
summary: "{{ .Labels.instance }} HTTPS probe is failing"
|
||||
description: "probe_success has been 0 for at least 1 minute. Owner: Billy (backup: Vincent)."
|
||||
runbook_url: https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/monitoring/README.md#runbook-https-service-down
|
||||
notification_settings:
|
||||
receiver: team-alerts
|
||||
group_by: [alertname, instance]
|
||||
group_wait: 10s
|
||||
group_interval: 1m
|
||||
repeat_interval: 4h
|
||||
|
||||
- uid: root-disk-low
|
||||
title: Root disk space low
|
||||
condition: C
|
||||
data:
|
||||
- refId: A
|
||||
relativeTimeRange: {from: 300, to: 0}
|
||||
datasourceUid: prometheus
|
||||
model:
|
||||
refId: A
|
||||
expr: 100 * node_filesystem_avail_bytes{job="node",mountpoint="/",fstype="ext4"} / node_filesystem_size_bytes{job="node",mountpoint="/",fstype="ext4"}
|
||||
instant: true
|
||||
- refId: C
|
||||
datasourceUid: __expr__
|
||||
model:
|
||||
refId: C
|
||||
type: threshold
|
||||
expression: A
|
||||
conditions:
|
||||
- evaluator: {type: lt, params: [15]}
|
||||
for: 5m
|
||||
noDataState: Alerting
|
||||
execErrState: Error
|
||||
labels: {severity: warning, owner: billy}
|
||||
annotations:
|
||||
summary: "Root filesystem on The-Ocean below 15% free"
|
||||
description: "Available space on / has stayed under 15% for 5 minutes. Owner: Billy (backup: Vincent)."
|
||||
runbook_url: https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/monitoring/README.md#runbook-root-disk-space-low
|
||||
notification_settings:
|
||||
receiver: team-alerts
|
||||
group_by: [alertname]
|
||||
group_wait: 10s
|
||||
group_interval: 1m
|
||||
repeat_interval: 4h
|
||||
|
||||
# Collection health: one series per scrape target, so a stopped exporter or a
|
||||
# probe series that disappears is reported instead of silently resolving.
|
||||
- uid: monitoring-target-down
|
||||
title: Monitoring target down
|
||||
condition: C
|
||||
data:
|
||||
- refId: A
|
||||
relativeTimeRange: {from: 300, to: 0}
|
||||
datasourceUid: prometheus
|
||||
model:
|
||||
refId: A
|
||||
expr: up
|
||||
instant: true
|
||||
- refId: C
|
||||
datasourceUid: __expr__
|
||||
model:
|
||||
refId: C
|
||||
type: threshold
|
||||
expression: A
|
||||
conditions:
|
||||
- evaluator: {type: lt, params: [1]}
|
||||
for: 1m
|
||||
noDataState: Alerting # no up series at all: Prometheus has lost every target
|
||||
execErrState: Error # Prometheus itself unreachable
|
||||
labels: {severity: critical, owner: billy}
|
||||
annotations:
|
||||
summary: "{{ .Labels.job }} target {{ .Labels.instance }} is not being collected"
|
||||
description: "Prometheus could not scrape this target for 1 minute; panels and alerts that depend on it are blind. Owner: Billy (backup: Vincent)."
|
||||
runbook_url: https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/monitoring/README.md#runbook-monitoring-target-down
|
||||
notification_settings:
|
||||
receiver: team-alerts
|
||||
group_by: [alertname]
|
||||
group_wait: 10s
|
||||
group_interval: 1m
|
||||
repeat_interval: 4h
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: 1
|
||||
providers:
|
||||
- name: sre
|
||||
folder: SRE
|
||||
type: file
|
||||
allowUiUpdates: false # Git is the source of truth for the dashboard
|
||||
options:
|
||||
path: /var/lib/grafana-dashboards
|
||||
@@ -0,0 +1,11 @@
|
||||
apiVersion: 1
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
uid: prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://prometheus:9090 # service name; localhost would be the Grafana container
|
||||
isDefault: true
|
||||
editable: false
|
||||
jsonData:
|
||||
timeInterval: 30s
|
||||
@@ -0,0 +1,30 @@
|
||||
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"]
|
||||
# Multi-target pattern: each URL becomes the probe target and the instance label;
|
||||
# the scrape itself goes to Blackbox Exporter's /probe endpoint.
|
||||
- job_name: https
|
||||
metrics_path: /probe
|
||||
params:
|
||||
module: [http_2xx]
|
||||
static_configs:
|
||||
- targets:
|
||||
- https://git.yebilly.me/user/login
|
||||
- https://ci.yebilly.me/login
|
||||
relabel_configs:
|
||||
- source_labels: [__address__]
|
||||
target_label: __param_target
|
||||
- source_labels: [__param_target]
|
||||
target_label: instance
|
||||
- target_label: __address__
|
||||
replacement: blackbox-exporter:9115
|
||||
@@ -0,0 +1,4 @@
|
||||
def total_price(unit_price, quantity):
|
||||
if quantity < 1:
|
||||
raise ValueError("Quantity must be positive")
|
||||
return unit_price * quantity
|
||||
@@ -0,0 +1,11 @@
|
||||
import unittest
|
||||
from pricing import total_price
|
||||
|
||||
|
||||
class PricingTests(unittest.TestCase):
|
||||
def test_total(self):
|
||||
self.assertEqual(total_price(10, 3), 30)
|
||||
|
||||
def test_invalid_quantity(self):
|
||||
with self.assertRaises(ValueError):
|
||||
total_price(10, 0)
|
||||