Compare commits
@@ -0,0 +1,5 @@
|
||||
|
||||
FROM ghcr.io/xu-cheng/texlive-full@sha256:c06416ebbc69c8e90e07d1f1a6f7a3f9b334e773daa3543ce879ea533317c3a7
|
||||
|
||||
RUN apk add --no-cache nodejs npm
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
|
||||
name: Build DevOps IT Manual
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- feature/15-final-project
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-manual:
|
||||
name: Compile LaTeX PDF
|
||||
runs-on: latex-build
|
||||
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Generate build metadata
|
||||
shell: sh
|
||||
run: |
|
||||
set -eu
|
||||
SHORT_SHA="$(printf '%s' "$GITHUB_SHA" | cut -c1-7)"
|
||||
BUILD_ID="v1.7+build.${GITHUB_RUN_NUMBER}.${SHORT_SHA}"
|
||||
|
||||
cat > manual/build_metadata.tex <<EOF
|
||||
\renewcommand{\BuildIdentifier}{${BUILD_ID}}
|
||||
\renewcommand{\BuildCommit}{${GITHUB_SHA}}
|
||||
\renewcommand{\BuildRun}{${GITHUB_RUN_NUMBER}}
|
||||
\renewcommand{\BuildAttempt}{${GITHUB_RUN_ATTEMPT:-1}}
|
||||
EOF
|
||||
|
||||
- name: Compile complete manual
|
||||
shell: sh
|
||||
run: |
|
||||
set -eu
|
||||
cd manual
|
||||
|
||||
latexmk -pdf -interaction=nonstopmode \
|
||||
-halt-on-error -file-line-error itManual.tex
|
||||
|
||||
test -s itManual.pdf
|
||||
|
||||
mkdir -p dist
|
||||
cp itManual.pdf dist/SSW590-DevOps-IT-Manual.pdf
|
||||
|
||||
- name: Upload PDF artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: SSW590-DevOps-IT-Manual
|
||||
path: manual/dist/SSW590-DevOps-IT-Manual.pdf
|
||||
retention-days: 14
|
||||
if-no-files-found: error
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
.DS_Store
|
||||
.venv/
|
||||
**/.venv/
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
.pytest_cache/
|
||||
.env
|
||||
*.bak
|
||||
*.before-*
|
||||
manual_backup/
|
||||
manual/build_metadata.tex
|
||||
manual/dist/
|
||||
@@ -0,0 +1,2 @@
|
||||
# Public GPG fingerprint verified against original image
|
||||
36cec81744274634645df40b6ac249c55615c80f:pricing-service/chapter6-evidence/05-ansible-deployment/staging-before-ansible.json:generic-api-key:170
|
||||
@@ -0,0 +1,77 @@
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
timeout(time: 10, unit: 'MINUTES')
|
||||
buildDiscarder(logRotator(numToKeepStr: '5'))
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Verify Node.js') {
|
||||
steps {
|
||||
sh 'node --version'
|
||||
sh 'npm --version'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Syntax Check') {
|
||||
steps {
|
||||
dir('app') {
|
||||
sh 'npm run check'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Automated Tests') {
|
||||
steps {
|
||||
dir('app') {
|
||||
sh 'npm test'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Verify Python') {
|
||||
steps {
|
||||
sh 'python3 --version'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Staging Health Check') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
curl -fsS --max-time 10 http://startup-pricing-staging:5000/health -o /tmp/pricing-health.json
|
||||
python3 -c 'import json; data=json.load(open("/tmp/pricing-health.json")); assert data["status"] == "healthy"; assert data["version"] == "v2"; print("Staging health check PASSED")'
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Staging Pricing Smoke Test') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
curl -fsS --max-time 10 http://startup-pricing-staging:5000/pricing -o /tmp/pricing-response.json
|
||||
python3 -c 'import json; data=json.load(open("/tmp/pricing-response.json")); assert data["version"] == "v2"; actual={p["name"]:p["price"] for p in data["plans"]}; assert actual == {"Starter":5,"Basic":12,"Pro":30,"Enterprise":60}; print("Pricing smoke test PASSED")'
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
echo 'CI PASSED: Node.js tests and staging smoke tests completed.'
|
||||
}
|
||||
|
||||
failure {
|
||||
echo 'CI FAILED: Review the Jenkins console output.'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
|
||||
pipeline {
|
||||
agent { label 'chapter6-mac-agent-secure' }
|
||||
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
timeout(time: 60, unit: 'MINUTES')
|
||||
buildDiscarder(logRotator(numToKeepStr: '5'))
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Secret Security Gate') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
export PATH=/opt/homebrew/bin:$PATH
|
||||
gitleaks version
|
||||
gitleaks git . --redact=100 --exit-code 42
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Verify Node.js') {
|
||||
steps {
|
||||
sh 'node --version'
|
||||
sh 'npm --version'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Syntax Check') {
|
||||
steps {
|
||||
dir('app') {
|
||||
sh 'npm run check'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Automated Tests') {
|
||||
steps {
|
||||
dir('app') {
|
||||
sh 'npm test'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Verify Python') {
|
||||
steps {
|
||||
sh 'python3 --version'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Dependency Security Audit') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
export PATH=/opt/homebrew/bin:$PATH
|
||||
export UV_CACHE_DIR="$WORKSPACE/.uv-cache"
|
||||
uv tool run --from pip-audit==2.10.1 pip-audit --disable-pip -r pricing-service/requirements-production.lock.txt > pip-audit-report.txt 2>&1 || {
|
||||
cat pip-audit-report.txt
|
||||
exit 1
|
||||
}
|
||||
cat pip-audit-report.txt
|
||||
'''
|
||||
}
|
||||
post {
|
||||
always {
|
||||
archiveArtifacts artifacts: 'pip-audit-report.txt', allowEmptyArchive: false
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Container Security Gate') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
export PATH=/opt/homebrew/bin:$PATH
|
||||
trivy image --platform linux/amd64 --scanners vuln --severity HIGH,CRITICAL --exit-code 1 --format table --output trivy-report.txt git.nageshwaran.dev/ssw590-startup/startup-pricing@sha256:14d520f6fbe60c9cc5e661551a03e944de3a2ad777a64c316ec397ee765db22d
|
||||
'''
|
||||
}
|
||||
post {
|
||||
always {
|
||||
archiveArtifacts artifacts: 'trivy-report.txt', allowEmptyArchive: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Staging Verification and Smoke Tests') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
date -u
|
||||
|
||||
ssh -o BatchMode=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o ConnectTimeout=10 -i "$HOME/.ssh/chapter6_deploy" chapter6deploy@git.nageshwaran.dev verify-staging > staging-verification.txt
|
||||
|
||||
cat staging-verification.txt
|
||||
|
||||
python3 -c 'import json; lines=open("staging-verification.txt").read().splitlines(); data=[json.loads(x) for x in lines if x.startswith("{")]; assert len(data)==2; assert data[0]["status"]=="healthy"; assert data[0]["version"]=="v2"; assert data[1]["version"]=="v2"; assert {p["name"]:p["price"] for p in data[1]["plans"]}=={"Starter":5,"Basic":12,"Pro":30,"Enterprise":60}; print("SUCCESS: All staging smoke tests passed")'
|
||||
'''
|
||||
}
|
||||
post {
|
||||
always {
|
||||
archiveArtifacts artifacts: 'staging-verification.txt', allowEmptyArchive: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Production Approval') {
|
||||
steps {
|
||||
timeout(time: 30, unit: 'MINUTES') {
|
||||
script {
|
||||
def approver = input(
|
||||
message: 'Approve Chapter 6 production promotion?',
|
||||
ok: 'Approve Production',
|
||||
submitter: 'chapter6-approver',
|
||||
submitterParameter: 'APPROVED_BY'
|
||||
)
|
||||
if (approver != 'chapter6-approver') {
|
||||
error('Production approval requires the designated approver')
|
||||
}
|
||||
echo "Production approved by: ${approver}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Server Authorization') {
|
||||
steps {
|
||||
timeout(time: 10, unit: 'MINUTES') {
|
||||
input message: 'Administrator: confirm server-side authorization is ready',
|
||||
ok: 'Authorization Ready',
|
||||
submitter: 'chapter6-approver'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Production Promotion') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
date -u > production-promotion.txt
|
||||
|
||||
ssh -o BatchMode=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o ConnectTimeout=10 -i "$HOME/.ssh/chapter6_deploy" chapter6deploy@git.nageshwaran.dev promote-production >> production-promotion.txt 2>&1 || {
|
||||
cat production-promotion.txt
|
||||
exit 1
|
||||
}
|
||||
|
||||
cat production-promotion.txt
|
||||
date -u
|
||||
'''
|
||||
}
|
||||
post {
|
||||
always {
|
||||
archiveArtifacts artifacts: 'production-promotion.txt', allowEmptyArchive: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Production HTTPS Verification') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
date -u > production-verification.txt
|
||||
curl -fsS --max-time 10 https://pricing.nageshwaran.dev/health > production-health.json
|
||||
curl -fsS --max-time 10 https://pricing.nageshwaran.dev/pricing > production-pricing.json
|
||||
|
||||
python3 -c 'import json; h=json.load(open("production-health.json")); p=json.load(open("production-pricing.json")); assert h["status"]=="healthy" and h["version"]=="v2"; assert p["version"]=="v2"; assert {x["name"]:x["price"] for x in p["plans"]}=={"Starter":5,"Basic":12,"Pro":30,"Enterprise":60}'
|
||||
|
||||
cat production-health.json production-pricing.json >> production-verification.txt
|
||||
echo "SUCCESS: Production HTTPS smoke tests passed" >> production-verification.txt
|
||||
cat production-verification.txt
|
||||
'''
|
||||
}
|
||||
post {
|
||||
always {
|
||||
archiveArtifacts artifacts: 'production-verification.txt,production-health.json,production-pricing.json', allowEmptyArchive: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
echo 'DELIVERY PASSED: Security gates, approval, production promotion and HTTPS verification completed.'
|
||||
}
|
||||
|
||||
failure {
|
||||
echo 'CI FAILED: Review the Jenkins console output.'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
skipDefaultCheckout(true)
|
||||
timeout(time: 10, unit: 'MINUTES')
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '5',
|
||||
artifactNumToKeepStr: '3'
|
||||
))
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
sh 'git log -1 --oneline'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Verify Build Tools') {
|
||||
steps {
|
||||
sh '''
|
||||
node --version
|
||||
npm --version
|
||||
python3 --version
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('JavaScript Validation') {
|
||||
steps {
|
||||
dir('app') {
|
||||
sh 'npm run check'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('JavaScript Unit Tests') {
|
||||
steps {
|
||||
dir('app') {
|
||||
sh 'npm test'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Python Validation') {
|
||||
steps {
|
||||
dir('pricing-service') {
|
||||
sh '''
|
||||
python3 -m py_compile app.py test_app.py
|
||||
echo "Python syntax validation PASSED"
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Python Unit Tests') {
|
||||
steps {
|
||||
dir('pricing-service') {
|
||||
sh '''
|
||||
set -eu
|
||||
export PYTHONPATH=/var/jenkins_home/final-project-python-deps
|
||||
export PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
python3 -m unittest -v test_app
|
||||
|
||||
echo "Python unit tests PASSED"
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Versioned Package') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
|
||||
VERSION="1.0.${BUILD_NUMBER}"
|
||||
|
||||
rm -rf dist
|
||||
mkdir -p dist
|
||||
printf '%s\\n' "$VERSION" > dist/VERSION
|
||||
git rev-parse HEAD > dist/COMMIT
|
||||
|
||||
python3 -m zipfile -c \
|
||||
"dist/startup-product-${VERSION}.zip" \
|
||||
app/package.json \
|
||||
app/src \
|
||||
app/test \
|
||||
pricing-service/app.py \
|
||||
pricing-service/test_app.py \
|
||||
pricing-service/requirements.txt \
|
||||
pricing-service/Dockerfile \
|
||||
dist/VERSION \
|
||||
dist/COMMIT
|
||||
|
||||
echo "Package version: $VERSION"
|
||||
ls -lh dist/
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Verify Package Integrity') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
|
||||
python3 -m zipfile -t \
|
||||
"dist/startup-product-1.0.${BUILD_NUMBER}.zip"
|
||||
|
||||
echo "Package integrity PASSED"
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Archive Artifacts') {
|
||||
steps {
|
||||
archiveArtifacts(
|
||||
artifacts: 'dist/*',
|
||||
fingerprint: true,
|
||||
onlyIfSuccessful: true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
echo 'FINAL PROJECT BASELINE BUILD PASSED'
|
||||
}
|
||||
|
||||
failure {
|
||||
echo 'FINAL PROJECT BASELINE BUILD FAILED'
|
||||
}
|
||||
|
||||
always {
|
||||
echo "Build number: ${env.BUILD_NUMBER}"
|
||||
echo "Build URL: ${env.BUILD_URL}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "startup-product",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "node --test",
|
||||
"check": "node --check src/health.js"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
function getHealthStatus(databaseConnected) {
|
||||
return {
|
||||
status: databaseConnected ? "healthy" : "unhealthy",
|
||||
database: databaseConnected ? "connected" : "disconnected"
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = { getHealthStatus };
|
||||
@@ -0,0 +1,24 @@
|
||||
const test = require("node:test");
|
||||
const assert = require("node:assert/strict");
|
||||
const { getHealthStatus } = require("../src/health");
|
||||
|
||||
test("reports healthy when database is connected", () => {
|
||||
assert.deepEqual(getHealthStatus(true), {
|
||||
status: "healthy",
|
||||
database: "connected"
|
||||
});
|
||||
});
|
||||
|
||||
test("reports unhealthy when database is disconnected", () => {
|
||||
assert.deepEqual(getHealthStatus(false), {
|
||||
status: "unhealthy",
|
||||
database: "disconnected"
|
||||
});
|
||||
});
|
||||
|
||||
test("reports unhealthy when database status is missing", () => {
|
||||
assert.deepEqual(getHealthStatus(), {
|
||||
status: "unhealthy",
|
||||
database: "disconnected"
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
Jenkins webhook automatic build test
|
||||
@@ -0,0 +1,3 @@
|
||||
git.nageshwaran.dev {
|
||||
reverse_proxy gitea:3000
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
services:
|
||||
gitea:
|
||||
image: docker.gitea.com/gitea:1.27.3-rootless
|
||||
container_name: gitea
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- GITEA__database__DB_TYPE=sqlite3
|
||||
- GITEA__server__ROOT_URL=https://git.nageshwaran.dev/
|
||||
- GITEA__server__HTTP_PORT=3000
|
||||
volumes:
|
||||
- ./data:/var/lib/gitea
|
||||
- ./config:/etc/gitea
|
||||
networks:
|
||||
- gitea_internal
|
||||
|
||||
caddy:
|
||||
image: caddy:2.10.2-alpine
|
||||
container_name: caddy
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
||||
- ./caddy_data:/data
|
||||
- ./caddy_config:/config
|
||||
networks:
|
||||
- gitea_internal
|
||||
|
||||
networks:
|
||||
gitea_internal:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,21 @@
|
||||
# Application Health Check
|
||||
|
||||
## Purpose
|
||||
|
||||
The health-check endpoint provides a simple way to verify that the startup application is responding.
|
||||
|
||||
## Expected Behavior
|
||||
|
||||
A successful health check should return an HTTP 200 response and indicate that the application is available.
|
||||
|
||||
## Operational Use
|
||||
|
||||
The endpoint can be used by the startup team to perform basic service availability checks during development and deployment.
|
||||
|
||||
## Verification
|
||||
|
||||
The team should verify the endpoint after deployment and after service restarts.
|
||||
|
||||
## Future Development
|
||||
|
||||
The health check can be extended to include dependency and database availability checks when those components are introduced.
|
||||
@@ -0,0 +1,24 @@
|
||||
# Startup Product
|
||||
|
||||
## Product Overview
|
||||
|
||||
The SSW590 Startup product is a self-hosted application managed through the team's Gitea development workflow.
|
||||
|
||||
## Purpose
|
||||
|
||||
The product repository provides a central place for the startup team to develop, document, review, and maintain the application.
|
||||
|
||||
## Main Goals
|
||||
|
||||
- Provide a clear product entry point.
|
||||
- Maintain development documentation.
|
||||
- Support collaborative Git-based development.
|
||||
- Use an organized issue and pull-request workflow.
|
||||
|
||||
## Call to Action
|
||||
|
||||
Review the product requirements, create an issue for new work, implement the change on a feature branch, and submit a pull request for review.
|
||||
|
||||
## Future Development
|
||||
|
||||
The landing page and product documentation can be extended as application features are added.
|
||||
@@ -0,0 +1,12 @@
|
||||
*.aux
|
||||
*.log
|
||||
*.out
|
||||
*.toc
|
||||
*.idx
|
||||
*.ilg
|
||||
*.ind
|
||||
*.fdb_latexmk
|
||||
*.fls
|
||||
*.synctex.gz
|
||||
build_metadata.tex
|
||||
main.pdf
|
||||
@@ -0,0 +1 @@
|
||||
SSW590 DevOps IT Manual LaTeX project. Build from manual/: latexmk -pdf -interaction=nonstopmode -halt-on-error -file-line-error main.tex. build_metadata.tex is generated by CI and must not be committed. This is a source scaffold; the instructor requires real Gitea Actions run evidence and the final PDF downloaded from the successful workflow.
|
||||
@@ -0,0 +1,15 @@
|
||||
\chapter{Operational Registers}\label{ch:registers}
|
||||
\section{Hosts Table}
|
||||
\begin{longtable}{p{.24\linewidth}p{.23\linewidth}p{.28\linewidth}p{.16\linewidth}}\toprule Host or service & Role & Exposure & Owner\\\midrule
|
||||
\url{git.nageshwaran.dev} & Public Gitea endpoint & HTTPS 443; HTTP 80 redirects & NM\\
|
||||
DigitalOcean Droplet & Ubuntu 24.04 Docker host; IPv4 143.244.173.110 & SSH 22 restricted to approved IPv4 /32 & NM\\
|
||||
Gitea container & Repository and Actions service & Private container port 3000 & NM\\
|
||||
Caddy container & TLS proxy & Public TCP 80/443 & NM\\
|
||||
Gitea Actions runner & Pending installation & No public management port planned & Team\\\bottomrule\end{longtable}
|
||||
\section{Passwords Table (hints only)}
|
||||
\begin{longtable}{p{.25\linewidth}p{.20\linewidth}p{.46\linewidth}}\toprule Service & Owner & Secret-handling hint\\\midrule
|
||||
Droplet SSH & NM & Key-based login; private key remains on owner device.\\
|
||||
Gitea accounts & NM / SP & Individual credentials held outside the repository.\\
|
||||
Caddy ACME & NM & Account material persists in restricted Caddy data directory.\\
|
||||
Runner registration & Team & Token must be kept outside repository, logs, and PDF; location to document after setup.\\\bottomrule\end{longtable}
|
||||
\noindent\textbf{Controls:} The runner row is a planned addition, not evidence that a runner has been registered.\index{secrets}
|
||||
@@ -0,0 +1,17 @@
|
||||
\chapter{Startup Foundation with Gitea}\label{ch:gitea}
|
||||
\section{Student Pack Domain and DNS}
|
||||
The team uses the domain \texttt{nageshwaran.dev} and subdomain \url{https://git.nageshwaran.dev}. A DNS A record maps the subdomain to \texttt{143.244.173.110}. The domain was obtained through a GitHub Student Developer Pack offer at Name.com. Registration and renewal terms should be rechecked against the registrar account before final submission.
|
||||
\section{Pinned Gitea Deployment}
|
||||
The Ubuntu 24.04 Droplet uses Docker Compose. Gitea runs with \texttt{docker.gitea.com/gitea:1.27.3-rootless}; Caddy uses \texttt{caddy:2.10.2-alpine}. Gitea's port 3000 is not published on the host. Caddy publishes TCP 80/443 and proxies to \texttt{gitea:3000} on the private Docker network.
|
||||
\section{Database and Persistence}
|
||||
The deployed Gitea instance uses SQLite. Host bind mounts preserve repository and application data across container recreation. The previously documented test confirmed that the \texttt{persistence-test} repository directory survived replacement; separate issue persistence verification remains outstanding.
|
||||
\section{HTTPS and Certificate Renewal}
|
||||
Caddy terminates HTTPS and redirects HTTP requests to HTTPS. Earlier evidence recorded an HTTP 308 redirect, HTTPS 200 response, and a Let's Encrypt certificate issued September 30, 2026, expiring December 29, 2026. Automatic renewal scheduling was observed; an actual renewal or dry-run test was not recorded.\index{HTTPS}
|
||||
\section{Firewall and External Exposure}
|
||||
The DigitalOcean Cloud Firewall allows public HTTP/HTTPS and restricts SSH to an approved IPv4 source. External testing previously showed port 3000 unreachable. The approved SSH source address may change and must be maintained in the Cloud Firewall.
|
||||
\section{Startup Team Workflow}
|
||||
The organization \texttt{SSW590-Startup} has repository \texttt{startup-product} and two members. Five issues were created; pull requests \#6 and \#7 were peer reviewed and merged. The repository is at \url{https://git.nageshwaran.dev/SSW590-Startup/startup-product}.
|
||||
\section{Architecture and Operation}
|
||||
\begin{center}\fbox{\begin{minipage}{.83\linewidth}\centering Git clients (HTTPS 443) $\longrightarrow$ Caddy TLS proxy $\longrightarrow$ Gitea (private 3000)\\[.5em]Gitea $\longrightarrow$ persistent SQLite and Git repositories\\[.5em]Gitea Actions $\longleftrightarrow$ external runner (planned)\end{minipage}}\end{center}
|
||||
\section{Manual Quality and Controls}
|
||||
The current chapter summarizes the existing Version 1.2 manual. The full evidence screenshots remain in the previously submitted manual PDF; they have not been silently recreated in this source project. Before final submission, insert dated, labeled evidence figures and confirm the deployed public root URL configuration.\index{Gitea}
|
||||
@@ -0,0 +1,380 @@
|
||||
|
||||
\chapter{Automated LaTeX Manual Builds with Gitea Actions}
|
||||
\label{ch:actions}
|
||||
|
||||
\noindent\textbf{Evidence status:}
|
||||
The self-hosted Gitea Actions runner has been registered,
|
||||
configured, and successfully used to compile and publish
|
||||
the LaTeX manual as a downloadable workflow artifact.
|
||||
Additional source-change and failure-repair demonstrations
|
||||
are still pending.
|
||||
|
||||
\section{Source and Trigger}
|
||||
|
||||
The source-of-truth repository for this project is:
|
||||
|
||||
\begin{center}
|
||||
\url{https://git.nageshwaran.dev/SSW590-Startup/startup-product}
|
||||
\end{center}
|
||||
|
||||
The main LaTeX document is located at
|
||||
\texttt{manual/main.tex}. Chapter files are maintained
|
||||
in the \texttt{manual/chapters/} directory.
|
||||
|
||||
The automated workflow is defined in:
|
||||
|
||||
\begin{center}
|
||||
\texttt{.gitea/workflows/manual-build.yml}
|
||||
\end{center}
|
||||
|
||||
The workflow is configured to execute when changes are
|
||||
pushed to the \texttt{main} branch. It also supports
|
||||
manual execution using \texttt{workflow\_dispatch}.
|
||||
|
||||
This ensures that the documentation can be rebuilt
|
||||
automatically from the repository's source files.
|
||||
|
||||
\section{Runner Setup}
|
||||
|
||||
A self-hosted Gitea Actions runner was installed and
|
||||
registered on a macOS computer rather than on the
|
||||
DigitalOcean Droplet.
|
||||
|
||||
The runner was configured as follows:
|
||||
|
||||
\begin{itemize}
|
||||
\item Runner name: \texttt{macbook-latex-runner}
|
||||
\item Runner version: \texttt{v5.0.0}
|
||||
\item Runner label: \texttt{latex-build}
|
||||
\item Host operating system: macOS on Apple Silicon
|
||||
\item Container engine: Docker through Colima
|
||||
\item Execution environment: Linux AMD64 Docker container
|
||||
\end{itemize}
|
||||
|
||||
The DigitalOcean Droplet continues to host the Gitea
|
||||
server, while the MacBook performs the computationally
|
||||
intensive LaTeX compilation.
|
||||
|
||||
This separation reduces resource usage on the
|
||||
memory-constrained Droplet.
|
||||
|
||||
The runner uses a custom Docker image named:
|
||||
|
||||
\begin{center}
|
||||
\texttt{ssw590-texlive-node:1.0}
|
||||
\end{center}
|
||||
|
||||
This image contains Node.js, npm, TeX Live, and latexmk.
|
||||
|
||||
The runner configuration includes:
|
||||
|
||||
\begin{verbatim}
|
||||
runner:
|
||||
labels:
|
||||
- "latex-build:docker://ssw590-texlive-node:1.0"
|
||||
|
||||
container:
|
||||
docker_host: "-"
|
||||
options: "--platform linux/amd64"
|
||||
\end{verbatim}
|
||||
|
||||
The Docker host setting prevents the macOS Colima socket
|
||||
from being mounted into the job container.
|
||||
|
||||
The runner successfully connected to Gitea and executed
|
||||
the automated manual build.
|
||||
|
||||
\section{Reproducible Compilation}
|
||||
|
||||
The automated build uses a custom Docker image derived
|
||||
from the following pinned TeX Live image:
|
||||
|
||||
\begin{verbatim}
|
||||
ghcr.io/xu-cheng/texlive-full@
|
||||
sha256:c06416ebbc69c8e90e07d1f1a6f7a3f9b334e773daa3543ce879ea533317c3a7
|
||||
\end{verbatim}
|
||||
|
||||
The custom image installs Node.js and npm using Alpine
|
||||
Linux's \texttt{apk} package manager.
|
||||
|
||||
The installed tool versions were verified as:
|
||||
|
||||
\begin{itemize}
|
||||
\item Node.js: \texttt{v24.18.1}
|
||||
\item npm: \texttt{11.12.1}
|
||||
\item latexmk: \texttt{4.88}
|
||||
\end{itemize}
|
||||
|
||||
The LaTeX document is compiled using:
|
||||
|
||||
\begin{verbatim}
|
||||
latexmk -pdf -interaction=nonstopmode \
|
||||
-halt-on-error -file-line-error main.tex
|
||||
\end{verbatim}
|
||||
|
||||
The workflow checks that the generated PDF exists
|
||||
and is nonempty before uploading it.
|
||||
|
||||
The base TeX Live image is pinned by digest. The custom
|
||||
image is built locally and identified by its local tag;
|
||||
its final image digest has not yet been recorded.
|
||||
|
||||
\subsection{Automated Build Verification}
|
||||
|
||||
The self-hosted Gitea Actions runner successfully executed
|
||||
the automated LaTeX compilation workflow.
|
||||
|
||||
The successful workflow completed the following steps:
|
||||
|
||||
\begin{enumerate}
|
||||
\item Started the Docker job container.
|
||||
\item Checked out the source repository.
|
||||
\item Generated build metadata.
|
||||
\item Compiled the LaTeX document.
|
||||
\item Uploaded the generated PDF artifact.
|
||||
\end{enumerate}
|
||||
|
||||
The verified successful execution completed in
|
||||
approximately 20 seconds and produced one downloadable
|
||||
PDF artifact.
|
||||
|
||||
This successful execution was a rerun of an existing
|
||||
workflow, so separate push-triggered demonstrations
|
||||
are documented in the following testing section.
|
||||
|
||||
\section{PDF Version Traceability}
|
||||
|
||||
The human-maintained document version is
|
||||
\texttt{\ManualVersion}.
|
||||
|
||||
The automated workflow generates a build identifier
|
||||
using the workflow run number and the triggering
|
||||
Git commit's abbreviated SHA.
|
||||
|
||||
The identifier follows this format:
|
||||
|
||||
\begin{verbatim}
|
||||
v1.3+build.<run-number>.<short-commit-sha>
|
||||
\end{verbatim}
|
||||
|
||||
The workflow writes this information to a generated
|
||||
\texttt{build\_metadata.tex} file before compiling
|
||||
the document.
|
||||
|
||||
The current PDF contains the following metadata:
|
||||
|
||||
\noindent\textbf{Build identifier:}
|
||||
\BuildIdentifier
|
||||
|
||||
\noindent\textbf{Triggering commit:}
|
||||
\BuildCommit
|
||||
|
||||
\noindent\textbf{Workflow run number:}
|
||||
\BuildRun
|
||||
|
||||
\noindent\textbf{Workflow attempt:}
|
||||
\BuildAttempt
|
||||
|
||||
\medskip
|
||||
|
||||
This metadata allows a generated PDF to be traced
|
||||
back to the corresponding repository commit and
|
||||
workflow execution.
|
||||
|
||||
The generated metadata file is not intended to be
|
||||
committed to the source repository.
|
||||
|
||||
\section{Downloadable Artifact}
|
||||
|
||||
After successful compilation, the workflow copies
|
||||
the generated PDF to the distribution directory.
|
||||
|
||||
The resulting file is named:
|
||||
|
||||
\begin{center}
|
||||
\texttt{SSW590-DevOps-IT-Manual.pdf}
|
||||
\end{center}
|
||||
|
||||
The workflow uploads this file using
|
||||
\texttt{actions/upload-artifact@v4}.
|
||||
|
||||
The artifact is published under the name:
|
||||
|
||||
\begin{center}
|
||||
\texttt{SSW590-DevOps-IT-Manual}
|
||||
\end{center}
|
||||
|
||||
The workflow specifies an artifact retention period
|
||||
of 14 days.
|
||||
|
||||
The upload action is configured to fail if the
|
||||
expected PDF file does not exist.
|
||||
|
||||
The verified successful workflow published one
|
||||
downloadable artifact through the Gitea Actions
|
||||
interface.
|
||||
|
||||
\subsection{Push-Triggered Build Validation}
|
||||
|
||||
A source-code change was committed and pushed to the
|
||||
main branch to verify automatic workflow execution.
|
||||
|
||||
The first successful push-triggered build used commit
|
||||
\texttt{7be302d} and Gitea Actions run number 3.
|
||||
|
||||
The workflow completed successfully in 21 seconds
|
||||
and published one downloadable PDF artifact.
|
||||
|
||||
This confirms that a repository push automatically
|
||||
triggers the LaTeX compilation and artifact upload
|
||||
process without requiring manual workflow execution.
|
||||
|
||||
\section{Change, Failure, and Repair}
|
||||
|
||||
The automated workflow must be tested using
|
||||
source changes and a controlled compilation failure.
|
||||
|
||||
The following table records the current status
|
||||
of these demonstrations.
|
||||
|
||||
\begin{longtable}{
|
||||
p{.19\linewidth}
|
||||
p{.24\linewidth}
|
||||
p{.24\linewidth}
|
||||
p{.23\linewidth}
|
||||
}
|
||||
\toprule
|
||||
Test & Commit & Run / PDF & Result \\
|
||||
\midrule
|
||||
\endfirsthead
|
||||
|
||||
\toprule
|
||||
Test & Commit & Run / PDF & Result \\
|
||||
\midrule
|
||||
\endhead
|
||||
|
||||
Successful push 1
|
||||
& PENDING
|
||||
& PENDING
|
||||
& Not yet tested \\
|
||||
|
||||
Successful push 2
|
||||
& PENDING
|
||||
& PENDING
|
||||
& Not yet tested \\
|
||||
|
||||
Controlled TeX failure
|
||||
& PENDING
|
||||
& PENDING
|
||||
& Not yet tested \\
|
||||
|
||||
Repair push
|
||||
& PENDING
|
||||
& PENDING
|
||||
& Not yet tested \\
|
||||
|
||||
\bottomrule
|
||||
\end{longtable}
|
||||
|
||||
The first two tests will verify that modifying
|
||||
LaTeX source files and pushing commits to
|
||||
\texttt{main} automatically triggers successful builds.
|
||||
|
||||
The failure test will introduce a deliberate
|
||||
LaTeX syntax error and verify that the workflow
|
||||
reports a compilation failure.
|
||||
|
||||
The repair test will remove the syntax error
|
||||
and confirm that the next workflow execution
|
||||
successfully generates a new PDF artifact.
|
||||
|
||||
Each test must be supported by the corresponding
|
||||
commit identifier, workflow run, and screenshot.
|
||||
|
||||
\section{Runner and Secret Boundary}
|
||||
|
||||
The Gitea Actions runner executes repository-defined
|
||||
workflow commands inside Docker containers.
|
||||
|
||||
Therefore, workflow modification permissions must
|
||||
be restricted to trusted repository maintainers.
|
||||
|
||||
The runner registration file is stored locally
|
||||
and protected using restrictive file permissions.
|
||||
|
||||
Registration tokens, credentials, and private keys
|
||||
must never be committed to the repository or
|
||||
included in screenshots.
|
||||
|
||||
The workflow does not require privileged Docker
|
||||
execution or access to the host Docker socket
|
||||
from inside the job container.
|
||||
|
||||
The runner uses the following configuration:
|
||||
|
||||
\begin{verbatim}
|
||||
container:
|
||||
docker_host: "-"
|
||||
privileged: false
|
||||
\end{verbatim}
|
||||
|
||||
This reduces unnecessary container access to
|
||||
the host Docker environment.
|
||||
|
||||
Because the runner operates on a personal computer,
|
||||
untrusted pull requests and workflow changes should
|
||||
not be executed without review.
|
||||
|
||||
\section{Manual Quality and Controls}
|
||||
|
||||
The automated documentation workflow improves
|
||||
repeatability by generating a PDF from version-controlled
|
||||
LaTeX source files.
|
||||
|
||||
The implementation provides:
|
||||
|
||||
\begin{itemize}
|
||||
\item Version-controlled documentation source.
|
||||
\item Automated workflow execution.
|
||||
\item A self-hosted Gitea Actions runner.
|
||||
\item A Docker-based LaTeX build environment.
|
||||
\item PDF build metadata and commit traceability.
|
||||
\item Downloadable PDF artifacts.
|
||||
\item Automated failure reporting.
|
||||
\end{itemize}
|
||||
|
||||
\subsection{Troubleshooting}
|
||||
|
||||
The following issues were encountered during setup:
|
||||
|
||||
\begin{enumerate}
|
||||
\item The runner initially attempted to mount
|
||||
the macOS Colima Docker socket into a Linux
|
||||
container. This was addressed using
|
||||
\texttt{docker\_host: "-"}.
|
||||
|
||||
\item The original TeX Live container did not
|
||||
contain Node.js, preventing
|
||||
\texttt{actions/checkout@v4} from executing.
|
||||
|
||||
\item A custom Docker image was created with
|
||||
Node.js, npm, TeX Live, and latexmk.
|
||||
|
||||
\item The first Dockerfile used
|
||||
\texttt{apt-get}, which was unavailable because
|
||||
the TeX Live image uses Alpine Linux.
|
||||
|
||||
\item The Dockerfile was corrected to use
|
||||
\texttt{apk add --no-cache nodejs npm}.
|
||||
|
||||
\item The runner configuration was updated
|
||||
to use the custom Docker image.
|
||||
\end{enumerate}
|
||||
|
||||
Following these corrections, the automated
|
||||
workflow completed successfully and produced
|
||||
a downloadable PDF artifact.
|
||||
|
||||
The final submission will incorporate screenshots,
|
||||
completed testing results, and updated document
|
||||
version history.
|
||||
@@ -0,0 +1,824 @@
|
||||
\chapter{Continuous Integration with Jenkins}
|
||||
\label{chap:jenkins-ci}
|
||||
|
||||
\section{Overview}
|
||||
This chapter documents the Jenkins continuous integration system deployed
|
||||
for the SSW590 startup product. Jenkins integrates with Gitea to
|
||||
automatically validate source code changes.
|
||||
|
||||
\section{Jenkins Deployment and Persistence}
|
||||
|
||||
Jenkins was deployed as a Docker container on the team's
|
||||
DigitalOcean Droplet running Ubuntu 24.04. The deployment uses
|
||||
the custom image \texttt{jenkins-node:2.580.1}, which provides
|
||||
the Jenkins automation server and the Node.js tooling required
|
||||
for the startup product's continuous integration pipeline.
|
||||
|
||||
The Docker Compose project is located at
|
||||
\texttt{/opt/jenkins}. The Jenkins container uses the
|
||||
\texttt{jenkins\_jenkins\_internal} bridge network.
|
||||
|
||||
\subsection{Persistent Storage}
|
||||
|
||||
Jenkins configuration, installed plugins, job definitions,
|
||||
credentials, and build history are stored in the persistent
|
||||
host directory \texttt{/opt/jenkins/jenkins\_home}, mounted
|
||||
inside the container at \texttt{/var/jenkins\_home}.
|
||||
|
||||
This bind mount separates Jenkins application data from the
|
||||
container's writable layer so that the data remains available
|
||||
when the container is replaced, provided the host directory
|
||||
is preserved.
|
||||
|
||||
\subsection{Resource Limits}
|
||||
|
||||
The Droplet has limited system resources. Docker Compose
|
||||
therefore restricts Jenkins to 384 MiB of container memory
|
||||
and 768 MiB of combined memory and swap.
|
||||
|
||||
The Java virtual machine is configured with an initial heap
|
||||
of 64 MiB, a maximum heap of 192 MiB, a maximum metaspace
|
||||
of 128 MiB, and the serial garbage collector.
|
||||
|
||||
These limits reduce resource consumption but do not
|
||||
guarantee that every build will succeed under memory pressure.
|
||||
|
||||
\subsection{Network Exposure and Restart Policy}
|
||||
|
||||
The Jenkins HTTP service listens on container port 8080,
|
||||
published only to \texttt{127.0.0.1:8080} on the Droplet.
|
||||
This prevents direct access to Jenkins through the Droplet's
|
||||
public IP address on port 8080.
|
||||
|
||||
The container uses the restart policy \texttt{no}.
|
||||
Consequently, an administrator must explicitly start Jenkins
|
||||
after a container stop or host restart.
|
||||
|
||||
\subsection{Deployment Verification}
|
||||
|
||||
The deployment was verified using the following commands
|
||||
on the DigitalOcean Droplet:
|
||||
|
||||
\begin{verbatim}
|
||||
cd /opt/jenkins
|
||||
docker compose config
|
||||
docker ps --filter name=jenkins
|
||||
\end{verbatim}
|
||||
|
||||
The Docker inspection confirmed that the container was
|
||||
running with image \texttt{jenkins-node:2.580.1},
|
||||
persistent storage, the private bridge network, and
|
||||
localhost-only HTTP port publishing.
|
||||
|
||||
\section{HTTPS and Reverse Proxy Configuration}
|
||||
|
||||
The Jenkins continuous integration service is published through
|
||||
the hostname \url{https://ci.nageshwaran.dev}. The deployment
|
||||
uses Caddy as its reverse proxy, alongside the existing Gitea
|
||||
service at \url{https://git.nageshwaran.dev}.
|
||||
|
||||
\subsection{Caddy Reverse Proxy Rules}
|
||||
|
||||
The reverse proxy configuration is stored in
|
||||
\texttt{/opt/gitea/Caddyfile} on the DigitalOcean Droplet.
|
||||
|
||||
The verified configuration contains the following routes:
|
||||
|
||||
\begin{verbatim}
|
||||
git.nageshwaran.dev {
|
||||
reverse_proxy gitea:3000
|
||||
}
|
||||
|
||||
ci.nageshwaran.dev {
|
||||
reverse_proxy jenkins:8080
|
||||
}
|
||||
\end{verbatim}
|
||||
|
||||
Caddy routes requests according to their requested hostname.
|
||||
Traffic for the Gitea hostname is forwarded to container port
|
||||
3000, while requests for the Jenkins hostname are forwarded
|
||||
to container port 8080.
|
||||
|
||||
\subsection{Network Isolation}
|
||||
|
||||
The Jenkins Docker Compose configuration publishes port 8080
|
||||
only on the Droplet loopback interface, using
|
||||
\texttt{127.0.0.1:8080:8080}.
|
||||
|
||||
Caddy forwards traffic to the Jenkins service by its Docker
|
||||
service name, \texttt{jenkins}, on port 8080. This separates
|
||||
the public HTTPS entry point from the Jenkins application
|
||||
listener.
|
||||
|
||||
The internal Jenkins port does not need to be published
|
||||
directly on the Droplet's public network interface.
|
||||
|
||||
\subsection{HTTPS Operations}
|
||||
|
||||
The Caddy configuration uses hostname-based site blocks,
|
||||
allowing Caddy to manage HTTPS for the configured domains
|
||||
when DNS, certificate issuance, and network connectivity
|
||||
are correctly configured.
|
||||
|
||||
The verified configuration establishes the reverse proxy
|
||||
routes. Certificate renewal and external firewall behavior
|
||||
should be verified separately rather than inferred from
|
||||
the Caddyfile alone.
|
||||
|
||||
\section{Gitea Integration and Webhooks}
|
||||
|
||||
\subsection{Repository and Jenkins Server}
|
||||
|
||||
The startup product source code is hosted on the team's
|
||||
self-managed Gitea instance at
|
||||
\url{https://git.nageshwaran.dev}.
|
||||
|
||||
The repository belongs to the organization
|
||||
\texttt{SSW590-Startup} and is named
|
||||
\texttt{startup-product}.
|
||||
|
||||
Jenkins is accessible through
|
||||
\url{https://ci.nageshwaran.dev}.
|
||||
|
||||
The Jenkins Gitea integration was configured with a
|
||||
Gitea server entry named \texttt{SSW590-Gitea}.
|
||||
An API credential identified as
|
||||
\texttt{ssw590-gitea-token} is stored in the
|
||||
Jenkins credential store rather than in the
|
||||
version-controlled application source.
|
||||
|
||||
\subsection{Multibranch Pipeline}
|
||||
|
||||
The Jenkins multibranch pipeline is identified by
|
||||
\texttt{startup-product-gitea-ci}.
|
||||
|
||||
The pipeline discovers repository branches and pull
|
||||
requests and executes the version-controlled
|
||||
\texttt{Jenkinsfile} associated with each build.
|
||||
|
||||
The pipeline provides continuous integration checks
|
||||
for changes proposed to the protected main branch.
|
||||
|
||||
\subsection{Webhook-Triggered Builds}
|
||||
|
||||
Gitea webhooks notify Jenkins when relevant repository
|
||||
events occur, including updates to pull requests.
|
||||
|
||||
This integration was tested during pull request
|
||||
\#8, titled ``Add Jenkins CI pipeline and automated
|
||||
Node.js tests.''
|
||||
|
||||
Jenkins executed builds after changes were pushed
|
||||
to the pull request, and their results were reported
|
||||
back to Gitea as commit status checks.
|
||||
|
||||
A deliberately failing test produced a failed
|
||||
status. After the test was corrected, Jenkins
|
||||
reported a successful status, allowing the reviewed
|
||||
pull request to proceed through the merge workflow.
|
||||
|
||||
\subsection{Integration Verification}
|
||||
|
||||
The integration was verified through Jenkins build
|
||||
results, Gitea pull request status checks, and
|
||||
the successful Jenkins build of the main branch
|
||||
following the merge.
|
||||
|
||||
The final main-branch build completed successfully
|
||||
with two passing automated tests and zero failures.
|
||||
|
||||
\section{Version-Controlled Jenkins Pipeline}
|
||||
|
||||
The continuous integration pipeline is defined in a
|
||||
\texttt{Jenkinsfile} stored at the root of the
|
||||
\texttt{startup-product} repository.
|
||||
|
||||
Using a version-controlled Jenkinsfile ensures that
|
||||
pipeline changes are reviewed and tracked alongside
|
||||
the application source code.
|
||||
|
||||
\subsection{Pipeline Execution Controls}
|
||||
|
||||
The pipeline uses the Jenkins declarative pipeline
|
||||
syntax with \texttt{agent any}.
|
||||
|
||||
The following execution controls are configured:
|
||||
|
||||
\begin{itemize}
|
||||
\item Concurrent builds are disabled using
|
||||
\texttt{disableConcurrentBuilds()}.
|
||||
\item A five-minute timeout prevents indefinitely
|
||||
running builds.
|
||||
\item Build history is limited to the five most recent
|
||||
builds using \texttt{buildDiscarder}.
|
||||
\end{itemize}
|
||||
|
||||
\subsection{Pipeline Stages}
|
||||
|
||||
The Jenkinsfile defines four sequential stages:
|
||||
|
||||
\begin{enumerate}
|
||||
\item \textbf{Checkout:} Retrieves the repository
|
||||
revision associated with the Jenkins build using
|
||||
\texttt{checkout scm}.
|
||||
|
||||
\item \textbf{Verify Node.js:} Executes
|
||||
\texttt{node --version} and \texttt{npm --version}
|
||||
to verify that the required tools are available.
|
||||
|
||||
\item \textbf{Syntax Check:} Changes into the
|
||||
\texttt{app} directory and executes
|
||||
\texttt{npm run check}.
|
||||
|
||||
\item \textbf{Automated Tests:} Executes
|
||||
\texttt{npm test} from the \texttt{app} directory.
|
||||
\end{enumerate}
|
||||
|
||||
\subsection{Node.js Project Scripts}
|
||||
|
||||
The application defines its validation commands in
|
||||
\texttt{app/package.json}:
|
||||
|
||||
\begin{verbatim}
|
||||
"scripts": {
|
||||
"test": "node --test",
|
||||
"check": "node --check src/health.js"
|
||||
}
|
||||
\end{verbatim}
|
||||
|
||||
The syntax-check command uses Node.js to validate
|
||||
the JavaScript syntax of \texttt{src/health.js}.
|
||||
|
||||
The test command uses the built-in Node.js test runner
|
||||
to execute the project's automated tests.
|
||||
|
||||
\subsection{Build Result Reporting}
|
||||
|
||||
The Jenkinsfile includes post-build handlers for
|
||||
successful and failed executions.
|
||||
|
||||
On success, Jenkins prints:
|
||||
|
||||
\begin{verbatim}
|
||||
CI PASSED: All checks completed successfully.
|
||||
\end{verbatim}
|
||||
|
||||
On failure, Jenkins prints:
|
||||
|
||||
\begin{verbatim}
|
||||
CI FAILED: Review the Jenkins console output.
|
||||
\end{verbatim}
|
||||
|
||||
These messages supplement the Jenkins build status
|
||||
and console output.
|
||||
|
||||
\section{Automated Tests and CI Verification}
|
||||
|
||||
\subsection{Application Health-Check Function}
|
||||
|
||||
The startup product includes a health-check function
|
||||
in \texttt{app/src/health.js}.
|
||||
|
||||
The function \texttt{getHealthStatus} accepts a Boolean
|
||||
parameter representing database connectivity and returns
|
||||
an object containing the application status and database
|
||||
connection state.
|
||||
|
||||
When database connectivity is true, the function returns
|
||||
\texttt{healthy} and \texttt{connected}. When connectivity
|
||||
is false, it returns \texttt{unhealthy} and
|
||||
\texttt{disconnected}.
|
||||
|
||||
\subsection{Automated Unit Tests}
|
||||
|
||||
The test file \texttt{app/test/health.test.js} uses
|
||||
the built-in Node.js test runner and strict assertions.
|
||||
|
||||
Two automated test cases are implemented:
|
||||
|
||||
\begin{enumerate}
|
||||
\item \textbf{Connected database:} Calling
|
||||
\texttt{getHealthStatus(true)} must return an object
|
||||
with status \texttt{healthy} and database state
|
||||
\texttt{connected}.
|
||||
|
||||
\item \textbf{Disconnected database:} Calling
|
||||
\texttt{getHealthStatus(false)} must return an object
|
||||
with status \texttt{unhealthy} and database state
|
||||
\texttt{disconnected}.
|
||||
\end{enumerate}
|
||||
|
||||
These tests validate the application's response to
|
||||
simulated database connectivity states. They do not
|
||||
establish connectivity to a live database server.
|
||||
|
||||
\subsection{Jenkins Test Execution}
|
||||
|
||||
The automated test stage runs the following command
|
||||
inside the application directory:
|
||||
|
||||
\begin{verbatim}
|
||||
npm test
|
||||
\end{verbatim}
|
||||
|
||||
The command invokes the Node.js test runner through
|
||||
the project's \texttt{package.json} configuration.
|
||||
|
||||
During the verified successful Jenkins main-branch
|
||||
build, both automated tests passed with zero failures.
|
||||
|
||||
The successful build also completed the Node.js
|
||||
verification and JavaScript syntax-check stages.
|
||||
|
||||
\subsection{Continuous Integration Result}
|
||||
|
||||
The Jenkins multibranch pipeline reported a successful
|
||||
main-branch build after pull request \#8 was reviewed
|
||||
and merged.
|
||||
|
||||
The verified Jenkins main-branch build was build
|
||||
number \#1, which completed in approximately
|
||||
33 seconds with two passing tests and zero failures.
|
||||
|
||||
The build console is available at:
|
||||
|
||||
\begin{quote}
|
||||
\url{https://ci.nageshwaran.dev/job/startup-product-gitea-ci/job/main/1/console}
|
||||
\end{quote}
|
||||
|
||||
\section{Failed Build and Successful Recovery}
|
||||
|
||||
\subsection{Controlled Failure Experiment}
|
||||
|
||||
To demonstrate that the continuous integration pipeline
|
||||
detects incorrect application behavior, the team
|
||||
deliberately introduced an incorrect expected result
|
||||
into an automated health-check test.
|
||||
|
||||
The change was pushed to the feature branch
|
||||
\texttt{feature/jenkins-ci}, associated with Gitea
|
||||
pull request \#8.
|
||||
|
||||
The failing commit was identified by the abbreviated
|
||||
Git SHA \texttt{e1d9007}.
|
||||
|
||||
The Gitea webhook triggered Jenkins to execute the
|
||||
pipeline against the updated pull request.
|
||||
|
||||
Jenkins pull-request build \#2 failed because the
|
||||
automated test assertion did not match the application's
|
||||
actual result.
|
||||
|
||||
The failed Jenkins status was reported to Gitea,
|
||||
demonstrating that the CI integration detected the
|
||||
deliberately introduced defect.
|
||||
|
||||
\subsection{Corrective Commit}
|
||||
|
||||
The team corrected the failing test expectation and
|
||||
pushed the repaired implementation to the same
|
||||
feature branch.
|
||||
|
||||
The corrective commit was identified by the
|
||||
abbreviated Git SHA \texttt{e00142a}.
|
||||
|
||||
The subsequent Jenkins pull-request build \#3
|
||||
completed successfully.
|
||||
|
||||
The pipeline executed the syntax check and automated
|
||||
tests, and Jenkins reported a successful result
|
||||
back to Gitea.
|
||||
|
||||
\subsection{Failure and Recovery Results}
|
||||
|
||||
The observed results are summarized below:
|
||||
|
||||
\begin{center}
|
||||
\begin{tabular}{llll}
|
||||
\toprule
|
||||
Revision & Jenkins Build & Result & Purpose \\
|
||||
\midrule
|
||||
\texttt{e1d9007} & PR-8 \#2 & FAILURE & Deliberate defect \\
|
||||
\texttt{e00142a} & PR-8 \#3 & SUCCESS & Corrected test \\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
This controlled failure-and-recovery experiment
|
||||
demonstrates that the Jenkins pipeline does not
|
||||
simply execute automatically; it can identify
|
||||
an incorrect test expectation and confirm that
|
||||
the correction restores the passing status.
|
||||
|
||||
\section{Branch Protection and Required Status Checks}
|
||||
|
||||
\subsection{Protected Main Branch}
|
||||
|
||||
The Gitea repository was configured with branch
|
||||
protection for \texttt{main}.
|
||||
|
||||
The purpose of this protection is to ensure that
|
||||
changes are validated by the Jenkins continuous
|
||||
integration pipeline before being merged into
|
||||
the main development branch.
|
||||
|
||||
\subsection{Required Jenkins Status Check}
|
||||
|
||||
The required CI status check was configured as:
|
||||
|
||||
\begin{verbatim}
|
||||
startup-product-gitea-ci/pipeline/pr-main
|
||||
\end{verbatim}
|
||||
|
||||
This status check connects Jenkins build results
|
||||
to the Gitea pull request merge workflow.
|
||||
|
||||
A failing Jenkins build prevents the required
|
||||
status check from being satisfied.
|
||||
|
||||
\subsection{Verification Using Pull Request 8}
|
||||
|
||||
During pull request \#8, the deliberately failing
|
||||
test caused Jenkins PR build \#2 to report
|
||||
\texttt{FAILURE}.
|
||||
|
||||
Gitea displayed the unsuccessful status, and
|
||||
the pull request could not satisfy the required
|
||||
CI check.
|
||||
|
||||
After the corrective commit was pushed, Jenkins
|
||||
PR build \#3 reported \texttt{SUCCESS}.
|
||||
|
||||
The required status check became successful,
|
||||
allowing the pull request to proceed through
|
||||
the review and merge workflow.
|
||||
|
||||
This verifies that the required CI status check
|
||||
was enforced during the demonstrated workflow.
|
||||
|
||||
\section{Pull Request Review and Merge}
|
||||
|
||||
\subsection{Pull Request Creation}
|
||||
|
||||
The Jenkins CI implementation was developed on the
|
||||
feature branch \texttt{feature/jenkins-ci}.
|
||||
|
||||
The changes were submitted to Gitea through
|
||||
pull request \#8, titled:
|
||||
|
||||
\begin{quote}
|
||||
Add Jenkins CI pipeline and automated Node.js tests
|
||||
\end{quote}
|
||||
|
||||
The pull request proposed merging the feature branch
|
||||
into the protected \texttt{main} branch.
|
||||
|
||||
The changes included the version-controlled
|
||||
Jenkinsfile, Node.js project configuration,
|
||||
application health-check implementation, and
|
||||
automated tests.
|
||||
|
||||
\subsection{Continuous Integration Validation}
|
||||
|
||||
Jenkins automatically validated changes associated
|
||||
with pull request \#8.
|
||||
|
||||
An intentionally incorrect test expectation caused
|
||||
Jenkins pull-request build \#2 to fail.
|
||||
|
||||
After the corrective commit was pushed, Jenkins
|
||||
pull-request build \#3 completed successfully.
|
||||
|
||||
Gitea displayed the successful required status check:
|
||||
|
||||
\begin{verbatim}
|
||||
startup-product-gitea-ci/pipeline/pr-main
|
||||
\end{verbatim}
|
||||
|
||||
\subsection{Reviewer Approval}
|
||||
|
||||
The pull request was reviewed by the team member
|
||||
using the Gitea account \texttt{shiv}.
|
||||
|
||||
The reviewer inspected the five changed files
|
||||
and submitted an approval through Gitea's
|
||||
pull request review interface.
|
||||
|
||||
The approval was recorded before the pull
|
||||
request was merged.
|
||||
|
||||
\subsection{Merge into Main}
|
||||
|
||||
After Jenkins reported a successful required
|
||||
status check and the reviewer approved the
|
||||
changes, pull request \#8 was merged into
|
||||
the \texttt{main} branch.
|
||||
|
||||
The resulting merge commit was:
|
||||
|
||||
\begin{verbatim}
|
||||
b2cdc5cad4d522a36160f738c0befbb6d86cbda0
|
||||
\end{verbatim}
|
||||
|
||||
\subsection{Post-Merge Verification}
|
||||
|
||||
After the merge, the Jenkins multibranch
|
||||
pipeline detected the updated \texttt{main}
|
||||
branch and executed a new build.
|
||||
|
||||
Jenkins main-branch build \#1 completed
|
||||
successfully in approximately 33 seconds.
|
||||
|
||||
The console output confirmed:
|
||||
|
||||
\begin{itemize}
|
||||
\item Node.js and npm verification completed.
|
||||
\item JavaScript syntax checking succeeded.
|
||||
\item Both automated health tests passed.
|
||||
\item Zero automated test failures were reported.
|
||||
\item The final pipeline result was \texttt{SUCCESS}.
|
||||
\end{itemize}
|
||||
|
||||
This confirms that the merged source code
|
||||
passed the automated Jenkins validation
|
||||
on the main branch.
|
||||
|
||||
\section{Security, Credentials, and Trust Boundaries}
|
||||
|
||||
\subsection{Credential Management}
|
||||
|
||||
Jenkins integrates with the self-hosted Gitea server
|
||||
using an API credential stored in the Jenkins
|
||||
credential store.
|
||||
|
||||
The credential identifier is:
|
||||
|
||||
\begin{verbatim}
|
||||
ssw590-gitea-token
|
||||
\end{verbatim}
|
||||
|
||||
The API token value is not included in the
|
||||
Jenkinsfile, application source code, or this manual.
|
||||
|
||||
Credentials should be rotated if exposed, and
|
||||
replacement values must be updated in Jenkins.
|
||||
|
||||
\subsection{Public and Private Network Boundaries}
|
||||
|
||||
The public Jenkins endpoint is:
|
||||
|
||||
\begin{verbatim}
|
||||
https://ci.nageshwaran.dev
|
||||
\end{verbatim}
|
||||
|
||||
Caddy routes HTTPS requests to the Jenkins container
|
||||
using the internal Docker service address
|
||||
\texttt{jenkins:8080}.
|
||||
|
||||
Jenkins publishes its application port only on
|
||||
the Droplet's loopback interface:
|
||||
|
||||
\begin{verbatim}
|
||||
127.0.0.1:8080:8080
|
||||
\end{verbatim}
|
||||
|
||||
This avoids publishing the Jenkins application
|
||||
port directly on the Droplet's public interface.
|
||||
|
||||
\subsection{Repository and Pipeline Trust}
|
||||
|
||||
The Jenkinsfile is stored in the Gitea repository
|
||||
and executed by Jenkins during continuous
|
||||
integration builds.
|
||||
|
||||
Changes to the Jenkinsfile can affect the commands
|
||||
executed by the Jenkins build agent.
|
||||
|
||||
Therefore, repository write access, pull request
|
||||
review, and branch protection are important
|
||||
security controls.
|
||||
|
||||
The demonstrated workflow used a protected
|
||||
main branch, a required Jenkins status check,
|
||||
and a separate reviewer approval before merging
|
||||
pull request \#8.
|
||||
|
||||
\subsection{Resource and Operational Boundaries}
|
||||
|
||||
The Jenkins container uses a 384 MiB memory limit
|
||||
and a maximum Java heap of 192 MiB.
|
||||
|
||||
These resource limits help control consumption
|
||||
on the small DigitalOcean Droplet.
|
||||
|
||||
The container restart policy is \texttt{no},
|
||||
so Jenkins requires an explicit start after
|
||||
a container stop or host restart.
|
||||
|
||||
The persistent Jenkins home directory is stored at:
|
||||
|
||||
\begin{verbatim}
|
||||
/opt/jenkins/jenkins_home
|
||||
\end{verbatim}
|
||||
|
||||
Administrators must protect this directory because
|
||||
it contains Jenkins configuration and sensitive
|
||||
application state.
|
||||
|
||||
\subsection{Security Limitations}
|
||||
|
||||
The verified configuration demonstrates localhost-only
|
||||
port publishing, Docker network separation,
|
||||
credential-store usage, and branch protection.
|
||||
|
||||
These controls do not by themselves prove complete
|
||||
host hardening or eliminate risks from untrusted
|
||||
pipeline code.
|
||||
|
||||
API token rotation, firewall verification, software
|
||||
updates, and access-control reviews remain important
|
||||
operational responsibilities.
|
||||
|
||||
\section{Screenshot Evidence}
|
||||
|
||||
The following figures record the observed Jenkins and Gitea CI workflow.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.92\linewidth]{img/jenkins_dashboard.png}
|
||||
\caption{Jenkins dashboard showing the configured CI jobs.}
|
||||
\label{fig:jenkins-dashboard}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.92\linewidth]{img/jenkins_failed_build.png}
|
||||
\caption{Jenkins PR 8 build 2: one automated test failed and Jenkins reported FAILURE to Gitea.}
|
||||
\label{fig:jenkins-failed}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.92\linewidth]{img/jenkins_successful_build.png}
|
||||
\caption{Jenkins PR 8 build 3: both automated tests passed and Jenkins reported SUCCESS.}
|
||||
\label{fig:jenkins-recovery}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.92\linewidth]{img/gitea_pr8_merged.png}
|
||||
\caption{Gitea pull request 8 merged from the Jenkins feature branch into main.}
|
||||
\label{fig:gitea-pr8-merged}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.92\linewidth]{img/gitea_pr8_approval.png}
|
||||
\caption{Gitea reviewer approval and merge activity for pull request 8.}
|
||||
\label{fig:gitea-pr8-approval}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.92\linewidth]{img/jenkins_main_success.png}
|
||||
\caption{Post-merge Jenkins main branch build 1: two tests passed with zero failures.}
|
||||
\label{fig:jenkins-main-success}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.92\linewidth]{img/gitea_branch_protection.png}
|
||||
\caption{Gitea repository branch protection rule for main.}
|
||||
\label{fig:gitea-branch-protection}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.92\linewidth]{img/gitea_required_ci_check.png}
|
||||
\caption{Gitea branch protection requiring the Jenkins pr-main status check.}
|
||||
\label{fig:gitea-required-check}
|
||||
\end{figure}
|
||||
|
||||
\section{Operations and Verification Evidence}
|
||||
|
||||
\subsection{Routine Jenkins Operations}
|
||||
|
||||
Jenkins is managed through Docker Compose on the
|
||||
DigitalOcean Droplet. The Compose project is located
|
||||
at \texttt{/opt/jenkins}.
|
||||
|
||||
The following commands provide routine operational
|
||||
control and inspection:
|
||||
|
||||
\begin{verbatim}
|
||||
cd /opt/jenkins
|
||||
|
||||
# Inspect container status
|
||||
docker compose ps
|
||||
|
||||
# Start Jenkins
|
||||
docker compose up -d
|
||||
|
||||
# Stop Jenkins
|
||||
docker compose stop
|
||||
|
||||
# Inspect recent logs
|
||||
docker compose logs --tail=100 jenkins
|
||||
|
||||
# Verify effective configuration
|
||||
docker compose config
|
||||
\end{verbatim}
|
||||
|
||||
The commands above are documented operational procedures;
|
||||
they are not all claimed as separately executed tests.
|
||||
|
||||
\subsection{Persistence and Recovery}
|
||||
|
||||
The Jenkins home directory is stored on the host at
|
||||
\texttt{/opt/jenkins/jenkins\_home}.
|
||||
|
||||
This bind mount preserves Jenkins application data
|
||||
independently of the container writable layer.
|
||||
|
||||
Before container replacement or configuration changes,
|
||||
administrators should back up the Jenkins home directory
|
||||
and the Docker Compose configuration.
|
||||
|
||||
Because the restart policy is \texttt{no}, Jenkins
|
||||
must be explicitly started after a host restart.
|
||||
|
||||
\subsection{Troubleshooting Procedure}
|
||||
|
||||
If Jenkins becomes unavailable, the administrator
|
||||
should first inspect the container state and logs:
|
||||
|
||||
\begin{verbatim}
|
||||
cd /opt/jenkins
|
||||
docker compose ps
|
||||
docker compose logs --tail=100 jenkins
|
||||
\end{verbatim}
|
||||
|
||||
If the container is running but the public Jenkins
|
||||
hostname is unavailable, the administrator should
|
||||
inspect Caddy, DNS, HTTPS certificate status, and
|
||||
Docker network connectivity.
|
||||
|
||||
If a pipeline fails, the Jenkins console output
|
||||
should be inspected to identify the failing stage.
|
||||
|
||||
The controlled failure experiment in pull request
|
||||
\#8 demonstrates this diagnostic workflow.
|
||||
|
||||
\subsection{Verified Continuous Integration Evidence}
|
||||
|
||||
The following results were observed during the
|
||||
Jenkins and Gitea integration exercise:
|
||||
|
||||
\begin{enumerate}
|
||||
\item Jenkins ran using the custom Docker image
|
||||
\texttt{jenkins-node:2.580.1}.
|
||||
|
||||
\item Docker Compose confirmed persistent storage,
|
||||
resource limits, and localhost-only port publishing.
|
||||
|
||||
\item Caddy routed the Jenkins hostname to
|
||||
\texttt{jenkins:8080}.
|
||||
|
||||
\item Gitea webhook events triggered Jenkins
|
||||
pull-request builds.
|
||||
|
||||
\item Pull request \#8 produced a deliberately
|
||||
failed Jenkins build \#2.
|
||||
|
||||
\item A corrective commit produced successful
|
||||
Jenkins pull-request build \#3.
|
||||
|
||||
\item Gitea displayed the required Jenkins
|
||||
status check as successful.
|
||||
|
||||
\item Reviewer \texttt{shiv} approved the pull
|
||||
request before it was merged.
|
||||
|
||||
\item The merged main branch passed Jenkins
|
||||
build \#1 with two passing automated tests
|
||||
and zero failures.
|
||||
\end{enumerate}
|
||||
|
||||
\subsection{Evidence and Submission Controls}
|
||||
|
||||
Screenshots of the actual Docker deployment,
|
||||
Jenkins pipeline stages, failed and successful
|
||||
builds, Gitea required status check, reviewer
|
||||
approval, and merged pull request should be
|
||||
included in the final manual.
|
||||
|
||||
Each screenshot must correspond to an actual
|
||||
observed result and include an explanatory caption.
|
||||
|
||||
Sensitive credentials, API tokens, private keys,
|
||||
and passwords must not appear in the submitted PDF.
|
||||
|
||||
The final compiled manual should be checked for
|
||||
correct chapter ordering, figure references,
|
||||
document history, and successful LaTeX compilation.
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
\chapter{Introduction to SRE: Monitoring and Reliability}
|
||||
\label{chap:sre}
|
||||
\section{Purpose, Scope, and Deployment}
|
||||
This chapter documents operational monitoring for the team's existing DigitalOcean Ubuntu 24.04 Droplet, Gitea source control, and Jenkins CI service. The monitoring stack uses Docker Compose with Prometheus v3.5.0, Grafana OSS v12.1.1, Blackbox Exporter v0.27.0, and Node Exporter v1.9.1. Caddy exposes Grafana over HTTPS at \url{https://monitor.nageshwaran.dev}. Exporter and Prometheus endpoints are addressed internally on the monitoring Docker network rather than deliberately exposed as public service ports. Persistent Docker storage is configured for monitoring services. The deployment was designed for a resource-constrained Droplet (approximately 512 MB RAM, 1 GB swap, and 10 GB nominal disk).
|
||||
|
||||
\section{Architecture and Monitoring Pipeline}
|
||||
\begin{center}\small
|
||||
\fbox{\begin{minipage}{0.91\linewidth}\centering
|
||||
Gitea HTTPS / Jenkins HTTPS $\longrightarrow$ Blackbox Exporter\\[5pt]
|
||||
Droplet CPU / RAM / filesystem $\longrightarrow$ Node Exporter\\[5pt]
|
||||
Exporters $\longrightarrow$ Prometheus (30-second scrape)\\[5pt]
|
||||
Prometheus $\longrightarrow$ Grafana dashboards and alert evaluation\\[5pt]
|
||||
Grafana Alertmanager $\longrightarrow$ Discord contact point
|
||||
\end{minipage}}
|
||||
\end{center}
|
||||
The monitored service URLs are \url{https://git.nageshwaran.dev} and \url{https://ci.nageshwaran.dev/login}. The blackbox HTTP module performs HTTPS checks, follows redirects, and validates successful responses. Prometheus uses the \texttt{https-probes} job, plus \texttt{node-exporter} and \texttt{prometheus} scrape jobs. The evaluation interval is 30 seconds.
|
||||
|
||||
\section{Grafana Dashboard and Metrics Evidence}
|
||||
The \emph{SSW590 - SRE Monitoring Dashboard} contains six time-series panels: CPU usage, available RAM, available root filesystem percentage, Jenkins HTTPS availability, Gitea HTTPS availability, and combined HTTPS response time. The screenshots below show a six-hour window with recorded metrics rather than empty placeholder panels.
|
||||
\begin{figure}[H]\centering\includegraphics[width=\linewidth]{img/grafana_https_availability_latency.png}\caption{HTTPS response-time series and Jenkins availability. Brief Jenkins availability drops reflect controlled incident testing.}\label{fig:sre-latency}\end{figure}
|
||||
\begin{figure}[H]\centering\includegraphics[width=\linewidth]{img/grafana_gitea_disk.png}\caption{Gitea HTTPS availability and root filesystem free-space percentage, approximately 18\% during the test.}\label{fig:sre-disk}\end{figure}
|
||||
\begin{figure}[H]\centering\includegraphics[width=\linewidth]{img/grafana_ram_cpu.png}\caption{Available RAM in bytes and Droplet CPU utilization percentage.}\label{fig:sre-host}\end{figure}
|
||||
\begin{lstlisting}[caption={Representative Prometheus queries used by the dashboard}]
|
||||
probe_success{job="https-probes"}
|
||||
probe_duration_seconds{job="https-probes"}
|
||||
node_memory_MemAvailable_bytes
|
||||
100 * (1 - avg(rate(node_cpu_seconds_total{mode="idle"}[5m])))
|
||||
100 * node_filesystem_avail_bytes{mountpoint="/",fstype!~"tmpfs|overlay"}
|
||||
/ node_filesystem_size_bytes{mountpoint="/",fstype!~"tmpfs|overlay"}
|
||||
\end{lstlisting}
|
||||
|
||||
\section{Service Level Indicators, Objectives, and Error Budget}
|
||||
The service level indicator (SLI) is the fraction of successful HTTPS probes, independently calculated for Jenkins and Gitea. The proposed service level objective (SLO) is at least 99.9\% successful probes over a rolling 30-day period. The corresponding downtime budget is $30\times24\times60\times(1-0.999)=43.2$ minutes per 30 days. This is a \emph{target}, not a claim that 30 days of observations have been collected.
|
||||
\begin{lstlisting}[caption={Rolling one-hour availability percentage per service}]
|
||||
100 * avg_over_time(probe_success{job="https-probes"}[1h])
|
||||
\end{lstlisting}
|
||||
The captured instantaneous results of this rolling-window query showed 100\% for Jenkins and 100\% for Gitea. The historical graph also shows Jenkins' one-hour rolling SLI temporarily falling to approximately 91\% during earlier outage testing before returning to 100\%; Gitea stayed at 100\% in the captured view. A 100\% latest one-hour result does not establish compliance over 30 days. An hour with 99.9\% SLO has a theoretical downtime allowance of 3.6 seconds; a controlled multi-minute outage exceeds that hour's proportional budget. Probe-based SLI approximates availability at the scrape interval and is not exact user-request uptime.
|
||||
\begin{figure}[H]\centering\includegraphics[width=\linewidth]{img/sli_slo_availability.png}\caption{Prometheus rolling one-hour HTTPS availability SLI query and two observed 100\% results, with earlier Jenkins degradation visible in the history.}\label{fig:sre-sli}\end{figure}
|
||||
|
||||
\section{Alert Rules and Discord Notification Routing}
|
||||
Two Grafana-managed rules are grouped under \texttt{SSW590 - SRE Monitoring / SSW590-SRE-Alerts}, evaluated every 30 seconds. Both route to the \texttt{SSW590 Discord Alerts} contact point. The HTTPS service-down rule evaluates \texttt{probe\_success} and fires after a sustained failure of at least one minute. The disk rule evaluates available root filesystem percentage and fires if it stays below 15\% for five minutes. Both have zero keep-firing duration. Discord contact-point delivery was independently verified during the incident exercises.
|
||||
\begin{center}\small\begin{tabularx}{\linewidth}{@{}L{3.0cm}Y L{2cm}L{2cm}@{}}\toprule Rule & Condition & Pending & Recovery delay\\\midrule
|
||||
HTTPS Service Down & HTTPS probe failure for Jenkins or Gitea & 1 minute & 0 seconds\\
|
||||
Low Disk Space & Root filesystem available $<15\%$ & 5 minutes & 0 seconds\\\bottomrule\end{tabularx}\end{center}
|
||||
|
||||
\section{Controlled Jenkins Outage and Recovery}
|
||||
A controlled Jenkins outage was conducted by stopping the Jenkins container, while the monitoring stack and Gitea remained operational. Blackbox Exporter detected the HTTPS probe failure; Grafana transitioned the HTTPS service alert through Pending and Firing, and a Discord \textbf{FIRING} message was delivered. Jenkins was restarted with \texttt{docker start jenkins}; the container was subsequently running, and a local request to \texttt{/login} returned HTTP 200. Grafana then returned to Normal and Discord delivered a \textbf{RESOLVED} message. The Jenkins dashboard plot shows probe drops, while Gitea continued responding. This verifies detection and recovery signaling, not automatic self-healing. A post-recovery Jenkins pipeline run was also verified: the job checked out the configured Gitea branch, passed the JavaScript syntax check and both automated tests, reported zero failures, and ended with \texttt{Finished: SUCCESS}. No Jenkins build was executed during the outage, so outage-time build behavior is not claimed.
|
||||
|
||||
\section{Safe Disk Alert Simulation}
|
||||
The actual root filesystem had approximately 18\% available capacity. To test alerting without consuming scarce disk space, the rule's threshold was temporarily raised from 15\% to 25\%, leaving the five-minute pending period unchanged. The rule became Pending, then Firing. Discord received the \textbf{FIRING} notification at approximately 10:59 PM on October 30, 2026, reporting about 17.98\% free space on \texttt{/dev/vda1}. The threshold was restored to the required 15\%; Discord subsequently delivered a \textbf{RESOLVED} notification at 11:19 PM, with the annotation \texttt{grafana\_state\_reason = Updated}. The recovery was therefore a controlled rule-configuration reset, not a claim that disk usage had been reduced. No large test files were written.
|
||||
|
||||
\section{Operations, Risk, and Follow-Up}
|
||||
Operators should inspect Grafana alerts and Prometheus targets, check \texttt{docker ps}, examine container logs and Caddy routing, and verify service health after recovery. For low disk capacity, inspect \texttt{df -h} and \texttt{docker system df} before considering safe cleanup; do not blindly delete volumes, application data, or audit evidence. The small Droplet has limited headroom, and Grafana/Prometheus retention and resource usage require attention. Rotate the Discord webhook if it has been disclosed outside its intended secret store.
|
||||
|
||||
\section{Evidence Coverage and Outstanding Validation}
|
||||
\begin{center}\small\begin{tabularx}{\linewidth}{@{}Y L{2.5cm}@{}}\toprule Requirement & Evidence status\\\midrule
|
||||
Dashboard: CPU, RAM, disk, uptime, latency & Verified (Figures \ref{fig:sre-latency}--\ref{fig:sre-host})\\
|
||||
HTTPS alert with Discord firing and resolved & Verified in incident account\\
|
||||
Disk alert with Discord firing and resolved & Verified in notification text\\
|
||||
One-hour SLI and proposed 99.9\% SLO & Verified / calculated\\
|
||||
Grafana/Prometheus restart and historical data & Verified (restart and dashboard screenshots)\\
|
||||
Jenkins post-recovery CI build & Verified (successful build; outage-time build not tested)\\
|
||||
Two reliability-improvement Gitea issues & Verified (issues \#10 and \#11)\\\bottomrule\end{tabularx}\end{center}
|
||||
The Discord screenshots are included below. The monitoring restart test was performed by restarting Grafana and Prometheus individually; both containers returned to the running state, the dashboard remained accessible, and historical time-series data remained visible. Docker volumes \texttt{monitoring\_grafana\_data} and \texttt{monitoring\_prometheus\_data} were present. This is a practical restart/persistence check, not a full Droplet reboot test. Jenkins build evidence is post-recovery only; no build was run during the outage.
|
||||
|
||||
|
||||
\section{Additional Operational Verification Evidence}
|
||||
The following captured evidence supplements the dashboard and SLI figures above. It records the Discord delivery of both alert transitions, the restart/persistence check, the successful post-recovery CI build, and the two follow-up reliability issues.
|
||||
\begin{figure}[H]\centering\includegraphics[width=0.96\linewidth]{img/sre_evidence/evidence_19.png}\caption{Discord: HTTPS service-down alert in FIRING state.}\end{figure}
|
||||
\begin{figure}[H]\centering\includegraphics[width=0.96\linewidth]{img/sre_evidence/evidence_20.png}\caption{Discord: HTTPS service-down alert RESOLVED after Jenkins recovery.}\end{figure}
|
||||
\begin{figure}[H]\centering\includegraphics[width=0.96\linewidth]{img/sre_evidence/evidence_21.png}\caption{Discord: low-disk-space alert FIRING during the safe threshold simulation.}\end{figure}
|
||||
\begin{figure}[H]\centering\includegraphics[width=0.96\linewidth]{img/sre_evidence/evidence_22.png}\caption{Discord: low-disk-space alert RESOLVED after restoring the 15\% threshold. The notification reports the state reason as Updated.}\end{figure}
|
||||
\begin{figure}[H]\centering\includegraphics[width=0.96\linewidth]{img/sre_evidence/evidence_17.png}\caption{Monitoring stack restart and container status verification.}\end{figure}
|
||||
\begin{figure}[H]\centering\includegraphics[width=0.96\linewidth]{img/sre_evidence/evidence_18.png}\caption{Grafana dashboard after the monitoring restart, with historical metrics still visible.}\end{figure}
|
||||
\begin{figure}[H]\centering\includegraphics[width=0.96\linewidth]{img/sre_evidence/evidence_13.png}\caption{Jenkins post-recovery pipeline execution evidence.}\end{figure}
|
||||
\begin{figure}[H]\centering\includegraphics[width=0.96\linewidth]{img/sre_evidence/evidence_15.png}\caption{Jenkins post-recovery build details and successful completion.}\end{figure}
|
||||
\begin{figure}[H]\centering\includegraphics[width=0.96\linewidth]{img/sre_evidence/evidence_16.png}\caption{Gitea reliability follow-up issues, including issue numbers 10 and 11.}\end{figure}
|
||||
@@ -0,0 +1,239 @@
|
||||
\chapter{Secure Delivery and Rollback}
|
||||
\label{chap:secure-delivery}
|
||||
\newcommand{\sixrepo}{https://git.nageshwaran.dev/SSW590-Startup/startup-product}
|
||||
\newcommand{\sixfile}[1]{\href{https://git.nageshwaran.dev/SSW590-Startup/startup-product/src/commit/a96c888/#1}{\nolinkurl{#1}}}
|
||||
\section{Scope and architecture}
|
||||
This revision records the November 24--26, 2026 secure delivery exercise for the Startup Pricing Service. Staging and production are separate containers on the existing DigitalOcean host. They share the host failure domain; this is not high availability. Gitea, Jenkins, Caddy and the existing monitoring stack remain in service.
|
||||
\begin{figure}[H]\centering
|
||||
\begin{tikzpicture}[node distance=8mm, every node/.style={font=\small}, b/.style={draw,rounded corners,align=center,minimum height=9mm}]
|
||||
\node[b](git){Gitea\\source and registry};
|
||||
\node[b,right=of git](ci){Jenkins\\Mac agent};
|
||||
\node[b,right=of ci](gate){Security gates\\human approval};
|
||||
\node[b,below=of ci](stage){Staging\\Gunicorn :5000};
|
||||
\node[b,right=of stage](prod){Production\\Gunicorn :5000};
|
||||
\node[b,below=of stage](proxy){Caddy HTTPS};
|
||||
\node[b,right=of proxy](mon){Blackbox /\\Prometheus / Grafana};
|
||||
\draw[->](git)--(ci);\draw[->](ci)--(gate);\draw[->](ci)--(stage);\draw[->](gate)--(prod);\draw[->](proxy)--(stage);\draw[->](proxy)--(prod);\draw[->](mon)--(proxy);
|
||||
\end{tikzpicture}
|
||||
\caption{Logical delivery and observation paths; both application environments share one Droplet.}
|
||||
\end{figure}
|
||||
\section{Release integrity and locked inputs}
|
||||
The registry repository is \nolinkurl{git.nageshwaran.dev/}\allowbreak\nolinkurl{ssw590-startup/startup-pricing}. Deployments select immutable registry references rather than mutable tags or local image identifiers alone.
|
||||
\begin{description}
|
||||
\item[V1 index digest]\leavevmode\par\nobreak {\footnotesize\nolinkurl{sha256:d0d0a2c2052b01a33ce12fd2b278e906552ea9797b5b918f44e5065f444d3027}}
|
||||
\item[V1 amd64 manifest]\leavevmode\par\nobreak {\footnotesize\nolinkurl{sha256:be7e0a6d6bb82b78e68616ecb905c3232e59715490143e36d0bb71172da31a7c}}
|
||||
\item[V2 index digest]\leavevmode\par\nobreak {\footnotesize\nolinkurl{sha256:14d520f6fbe60c9cc5e661551a03e944de3a2ad777a64c316ec397ee765db22d}}
|
||||
\item[V2 amd64 manifest]\leavevmode\par\nobreak {\footnotesize\nolinkurl{sha256:158f8cd88eef9af7d057b8810651ae60b010ea3c598e8f04694926f0cac8ab5f}}
|
||||
\item[Hardened V2 base]\leavevmode\par\nobreak {\footnotesize\nolinkurl{python:3.13-alpine@sha256:9ef1a599f863231c3d91e941389bfdc4a2d6070557243d54df1a4e57015b960e}}
|
||||
\end{description}
|
||||
Both releases were pulled by immutable reference. Index and platform manifest digests identify different registry objects. The hardened V2 uses hash-locked Python dependencies, including Flask 3.1.3 and Gunicorn 23.0.0. The production lock file is \href{https://git.nageshwaran.dev/SSW590-Startup/startup-product/src/commit/a96c888/pricing-service/requirements-production.lock.txt}{production dependency lock file}. Historical image-to-source commit provenance is not established; the recovery release records are reconstructed, not original reviewed release attestations.
|
||||
\begin{center}\small\begin{tabularx}{\linewidth}{lYY}\toprule
|
||||
& V1 & Hardened V2\\\midrule
|
||||
Business response & Basic 10, Pro 25, Enterprise 50; total 85 & Starter 5, Basic 12, Pro 30, Enterprise 60; total 107\\
|
||||
Health & Healthy; no version field & Healthy; version v2\\
|
||||
Source commit & Unverified & Unverified\\
|
||||
Recovery configuration & Reconstructed V1 record & Reconstructed V2 record; healthy staging Compose template\\
|
||||
Delivery evidence & Live rollback journal & Jenkins delivery build 7; live restoration journal\\\bottomrule\end{tabularx}\end{center}
|
||||
The observed totals are 85 and 107, not the course reference totals of 30 and 36. The application does not expose a source commit in its health response. These are outstanding rubric gaps, not verified equivalence.
|
||||
\section{Container hardening and Ansible deployment}
|
||||
The application runs as non-root \texttt{appuser}, with a read-only root filesystem, all capabilities dropped, no-new-privileges, 64 MiB memory, 128 MiB memory plus swap, half a CPU, 64 processes and a 16 MiB restricted temporary filesystem. Staging uses one Gunicorn worker; production uses two. Host mappings are loopback-only (5062 staging and 5061 production); Caddy provides HTTPS. Jenkins reaches staging through its internal Docker network.
|
||||
\par Configuration and automation: \href{https://git.nageshwaran.dev/SSW590-Startup/startup-product/src/commit/a96c888/pricing-service/recovery/staging/compose.yml}{\nolinkurl{compose.yml}}, \href{https://git.nageshwaran.dev/SSW590-Startup/startup-product/src/commit/a96c888/pricing-service/ansible/staging-recovery.yml}{\nolinkurl{staging-recovery.yml}}, and \href{https://git.nageshwaran.dev/SSW590-Startup/startup-product/src/commit/a96c888/pricing-service/ansible/production-recovery-transaction.yml}{production recovery transaction}. The healthy staging Compose configuration checks the application on port 5000. The recovery transaction uses a shared production lock to exclude competing promotion operations.
|
||||
\par The November 26 guarded unchanged staging run reported ok=9, changed=0, failed=0, skipped=8. Replacement was explicitly disabled for that run; it demonstrates verification without mutation, not unrestricted deployment idempotence. Production HTTPS remained healthy.
|
||||
\section{Jenkins delivery and security gates}
|
||||
The dedicated \href{https://ci.nageshwaran.dev/job/startup-product-chapter6-delivery/7/}{delivery build 7} completed successfully on November 26. Gitleaks reported no leaks, pip-audit reported no known vulnerabilities, and Trivy reported zero HIGH or CRITICAL findings for the configured scan of hardened V2. This does not establish absence of all vulnerabilities. Earlier image scans motivated the hardened rebuild. A narrowly scoped Gitleaks exception identifies a public Python signing fingerprint, not a secret.
|
||||
\par Production approval was recorded as \texttt{chapter6-approver}. The developer was denied approval in build 6, which was subsequently aborted. The restricted deployment account uses a forced-command SSH gateway and narrowly scoped sudo helpers. A root-managed, time-limited, single-use authorization file is consumed before promotion. The authorization file is not cryptographically bound to a Jenkins build; privileged administrators and races within its validity window remain trust considerations.
|
||||
\par Build 7 verified staging, promoted the immutable V2 release, retained the previous production container and independently verified production HTTPS. The promotion log recorded start at 06:18:42 UTC and completion at 06:19:01 UTC, with Jenkins HTTPS verification by 06:19:06. A transient 502 was observed; continuous downtime was not measured for this promotion.
|
||||
\par The separate \href{https://ci.nageshwaran.dev/job/chapter6-synthetic-secret-test/3/}{synthetic-secret build 3} detected a generated test token, exited 42, skipped the delivery sentinel and finished FAILURE. This was an isolated negative-test job, not a negative run of the full production pipeline.
|
||||
\par \href{https://git.nageshwaran.dev/SSW590-Startup/startup-product/pulls/13}{PR 13} had a successful Jenkins build 8 before the final recovery evidence commit. Final-head CI, independent review and merge must be verified separately.
|
||||
\section{Production rollback and restoration}
|
||||
On November 26 an authorized Ansible transaction ran on the host under systemd, independently of the initiating SSH connection. It acquired the promotion lock, verified V2, preserved the original container, deployed cached V1, verified its HTTPS health and business response, then restored the original V2 container and verified its identity and response. Emergency restoration was exercised in simulation before the live drill.
|
||||
\begin{center}\small\begin{tabularx}{\linewidth}{lY}\toprule UTC & Observed event\\\midrule
|
||||
07:50:37.935 & Lock acquired\\
|
||||
07:50:42.066 & V2 verified\\
|
||||
07:50:44.469 & Rollback decision\\
|
||||
07:50:44.475 & Rollback started\\
|
||||
07:50:58.351 & V1 recovery verified\\
|
||||
07:51:08.370 & V2 restoration started\\
|
||||
07:51:25.439 & Original V2 recovered\\
|
||||
07:51:25.446 & Lock released\\\bottomrule\end{tabularx}\end{center}
|
||||
Rollback took 13.877 seconds from recorded start to verification; restoration took 17.069 seconds. Independent HTTPS sampling recorded 21 failed probes among 45 drill-window samples. The two failure timestamp spans were 9.264 and 10.036 seconds; surrounding healthy-probe brackets were 11.272 and 14.121 seconds. These are sampled estimates, not exact continuous downtime. The original V2 container was restored and the transaction reported success. Host crash or forced process termination can still require manual recovery.
|
||||
\section{Staging configuration failure and recovery}
|
||||
A separate authorized drill used \href{https://git.nageshwaran.dev/SSW590-Startup/startup-product/src/commit/a96c888/pricing-service/recovery/staging/compose.failure.yml}{\nolinkurl{compose.failure.yml}} to override Gunicorn's bind port to 8001 while leaving the health check on 5000. No Docker daemon or proxy failure was induced. Compose wait returned 1 with an unhealthy container; the Ansible deployment gate failed with exit 2. Production health assertions passed before and after the operation.
|
||||
\begin{center}\small\begin{tabularx}{\linewidth}{lY}\toprule UTC & Observed event\\\midrule
|
||||
08:22:39 & Failure exercise started\\
|
||||
08:23:01.334 & First failed staging probe\\
|
||||
08:23:29.391 & Compose failure returned\\
|
||||
08:24:21 & Restoration exercise started\\
|
||||
08:24:34.262 & Healthy Compose deployment started\\
|
||||
08:24:50.900 & First subsequent healthy staging probe\\
|
||||
08:24:55.937 & Compose healthy, exit 0\\
|
||||
08:25:02 & HTTPS health and pricing verification complete\\\bottomrule\end{tabularx}\end{center}
|
||||
Restoration used the healthy template without the failure override. Ansible reported ok=12, changed=1, failed=0. Staging returned healthy V2 and all four expected plans; production returned healthy V2. Staging recorded 88 failed probes in 111 drill-window samples, a failure timestamp span of 108.437 seconds and first-failure-to-recovery interval of 109.566 seconds. Production recorded zero failures in 111 samples (100 percent sampled availability). These are not continuous availability guarantees. The Ansible gate rejection is verified; a Jenkins rejection during the staging outage is not evidenced.
|
||||
\section{Monitoring and operational runbooks}
|
||||
The existing Prometheus, Grafana and Blackbox stack monitors HTTPS availability and latency alongside host metrics. Production health is \url{https://pricing.nageshwaran.dev/health}; staging health is \url{https://staging-pricing.nageshwaran.dev/health}. PricingServiceDown uses probe failure for one minute; PricingServiceHighLatency uses duration above two seconds for two minutes. Configuration validation and rule loading were observed; alert firing during the drills is not established. The independent CSV probes provide the recovery measurements above.
|
||||
\begin{description}
|
||||
\item[Release] Developer opens a PR; reviewer checks source, locked inputs and tests. Require passing security gates, immutable registry identity and staging health/business checks. Authorized approver reviews the exact release before promotion. Verify production and retain evidence.
|
||||
\item[Failure] Stop promotion on any failed scan, health check or identity mismatch. Record UTC time, build, digest and configuration; inspect scoped container logs and monitoring. Do not bypass gates or restart unrelated services.
|
||||
\item[Rollback] Obtain authorization, confirm cached immutable release and matching configuration, verify capacity and acquire the shared lock through the recovery transaction. Verify health and business output after rollback and restoration. Escalate if emergency restoration fails.
|
||||
\item[State compatibility] The observed pricing exercise does not demonstrate database or payment rollback. For future persistent state use expand-and-contract migrations, backward-compatible schemas and tested backups; do not reverse a destructive migration blindly or replay payments without idempotency controls.
|
||||
\item[Cleanup] Preserve previous releases, logs, configuration backups and persistent service volumes. Inspect disk and memory before any operation. Remove only explicitly reviewed obsolete artifacts after backup and authorization; never use blanket prune or volume deletion on this shared host.
|
||||
\end{description}
|
||||
\section{Evidence and remaining limitations}
|
||||
Recovery evidence is committed in \href{https://git.nageshwaran.dev/SSW590-Startup/startup-product/commit/a96c888}{commit a96c888}. The following paths identify the original evidence; raw logs and reports must be reviewed for sensitive content before publication.
|
||||
\begin{itemize}
|
||||
\item \href{https://git.nageshwaran.dev/SSW590-Startup/startup-product/src/commit/a96c888/pricing-service/chapter6-evidence/06-rollback-recovery/production-recovery-final-20261126-075316.log}{\nolinkurl{production-recovery-final-20261126-075316.log}}
|
||||
\item \href{https://git.nageshwaran.dev/SSW590-Startup/startup-product/src/commit/a96c888/pricing-service/chapter6-evidence/06-rollback-recovery/production-downtime-analysis-20261126-075411.log}{\nolinkurl{production-downtime-analysis-20261126-075411.log}}
|
||||
\item \href{https://git.nageshwaran.dev/SSW590-Startup/startup-product/src/commit/a96c888/pricing-service/chapter6-evidence/06-rollback-recovery/staging-failure-20261126-082239.log}{\nolinkurl{staging-failure-20261126-082239.log}}
|
||||
\item \href{https://git.nageshwaran.dev/SSW590-Startup/startup-product/src/commit/a96c888/pricing-service/chapter6-evidence/06-rollback-recovery/staging-restoration-20261126-082421.log}{\nolinkurl{staging-restoration-20261126-082421.log}}
|
||||
\item \href{https://git.nageshwaran.dev/SSW590-Startup/startup-product/src/commit/a96c888/pricing-service/chapter6-evidence/06-rollback-recovery/staging-downtime-analysis-20261126-082556.log}{\nolinkurl{staging-downtime-analysis-20261126-082556.log}}
|
||||
\end{itemize}
|
||||
Additional local evidence directories contain registry, Jenkins, dependency and monitoring reports; publication and grader access must be confirmed. Outstanding items include historical source provenance, reference pricing totals, Jenkins staging-outage rejection, independent final PR approval, and final-head CI verification. No credit is claimed for unobserved tests. ChatGPT assisted with recovery planning, evidence interpretation and drafting on November 26, 2026; the team is responsible for checking the report against actual execution records.
|
||||
|
||||
\clearpage
|
||||
\section{Selected screenshot evidence}
|
||||
These original captures supplement the execution records. Build 5 is historical gate evidence; build 7 records actual production delivery. Historical PR 12 is not the final PR 13 review.
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.65\textheight,keepaspectratio]{img/chapter6-selected/build5-gitleaks.png}
|
||||
\caption{Delivery build 5: Gitleaks scanned 23 commits and reported no leaks.}
|
||||
\end{figure}
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.65\textheight,keepaspectratio]{img/chapter6-selected/build5-pip-audit.png}
|
||||
\caption{Delivery build 5: dependency audit reported no known vulnerabilities.}
|
||||
\end{figure}
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.65\textheight,keepaspectratio]{img/chapter6-selected/build5-trivy.png}
|
||||
\caption{Delivery build 5: Trivy scan of the immutable V2 image, configured for HIGH and CRITICAL severity.}
|
||||
\end{figure}
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.65\textheight,keepaspectratio]{img/chapter6-selected/build5-smoke.png}
|
||||
\caption{Delivery build 5: staging digest verification and smoke tests before approval.}
|
||||
\end{figure}
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.65\textheight,keepaspectratio]{img/chapter6-selected/restricted-ssh.png}
|
||||
\caption{Restricted deployment account: authorized verification succeeded and an unauthorized command was denied.}
|
||||
\end{figure}
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.65\textheight,keepaspectratio]{img/chapter6-selected/build6-denied.png}
|
||||
\caption{Delivery build 6: unauthorized production approval rejection.}
|
||||
\end{figure}
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.65\textheight,keepaspectratio]{img/chapter6-selected/step240-build7-designated-human-approval.png}
|
||||
\caption{Delivery build 7: designated human approval.}
|
||||
\end{figure}
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.65\textheight,keepaspectratio]{img/chapter6-selected/step241-build7-fullscreen-production-success.png}
|
||||
\caption{Delivery build 7: successful production delivery.}
|
||||
\end{figure}
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.65\textheight,keepaspectratio]{img/chapter6-selected/prometheus-alert-rules-validation-20261123.png}
|
||||
\caption{Production monitoring: Prometheus alert configuration validation.}
|
||||
\end{figure}
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.65\textheight,keepaspectratio]{img/chapter6-selected/step295A-unchanged-staging-check.png}
|
||||
\caption{November 26 unchanged staging dry run: replacement not required, health and pricing checks passed, changed=0.}
|
||||
\end{figure}
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.65\textheight,keepaspectratio]{img/chapter6-selected/grafana-pricing-availability.png}
|
||||
\caption{November 23 Grafana dashboard: pricing HTTPS probe returned 1 (healthy), alongside Jenkins, Gitea and host metrics. This predates the recovery drills.}
|
||||
\end{figure}
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.65\textheight,keepaspectratio]{img/chapter6-selected/historical-pr12.png}
|
||||
\caption{Historical PR 12 reviewer approval and merge into main; not evidence of final PR 13 approval.}
|
||||
\end{figure}
|
||||
|
||||
\clearpage
|
||||
\section{Recovery and security execution evidence}
|
||||
The following selected output is transcribed from the recorded execution results, not new screenshots or simulated tests. The complete recovery logs are linked in Section 6.8. All recovery timestamps are UTC on November 26, 2026.
|
||||
\subsection*{Production rollback and restoration}
|
||||
Selected transaction events, presented as a compact transcription of the journal timeline:
|
||||
\begin{lstlisting}
|
||||
07:50:37.934593 PRODUCTION_LOCK_ACQUIRED
|
||||
07:50:44.468507 ROLLBACK_DECISION
|
||||
07:50:44.474884 ROLLBACK_STARTED
|
||||
07:50:58.351494 ROLLBACK_RECOVERED
|
||||
07:51:08.369626 RESTORATION_STARTED
|
||||
07:51:25.438908 RESTORATION_RECOVERED
|
||||
07:51:25.444577 RECOVERY_TRANSACTION_SUCCESS
|
||||
07:51:25.445828 PRODUCTION_LOCK_RELEASED
|
||||
\end{lstlisting}
|
||||
The production recovery journal reported successful restoration of the original V2 container. V1 returned the three expected plans (total 85); restored V2 returned four plans (total 107). See the full \href{https://git.nageshwaran.dev/SSW590-Startup/startup-product/src/commit/a96c888/pricing-service/chapter6-evidence/06-rollback-recovery/production-recovery-final-20261126-075316.log}{production recovery record}. Independent probes recorded two interruption spans, as described in Section 6.5.
|
||||
\subsection*{Staging configuration failure}
|
||||
Selected lines from the recorded Ansible failure output:
|
||||
\begin{lstlisting}
|
||||
container startup-pricing-staging is unhealthy
|
||||
Compose deployment failed; delivery blocked
|
||||
ANSIBLE_EXIT_CODE=2
|
||||
Health=unhealthy Command=["gunicorn","--workers","1",
|
||||
"--bind","0.0.0.0:8001","app:app"]
|
||||
=== PRODUCTION HEALTH ===
|
||||
{"status":"healthy","version":"v2"}
|
||||
\end{lstlisting}
|
||||
The Compose return code was 1. Ansible rejected the deployment. The Jenkins outage-specific failure was not captured; this is an Ansible gate result, not a Jenkins failure result.
|
||||
\clearpage\subsection*{Healthy restoration and HTTPS verification}
|
||||
Selected output from the recorded restoration run (08:24:21--08:25:02):
|
||||
\begin{lstlisting}
|
||||
Container startup-pricing-staging Healthy
|
||||
PLAY RECAP
|
||||
digitalocean : ok=12 changed=1 unreachable=0 failed=0
|
||||
=== STAGING HTTPS HEALTH ===
|
||||
{"status":"healthy","version":"v2"}
|
||||
=== STAGING HTTPS PRICING ===
|
||||
{"plans":[{"name":"Starter","price":5},
|
||||
{"name":"Basic","price":12},{"name":"Pro","price":30},
|
||||
{"name":"Enterprise","price":60}],
|
||||
"service":"Startup Pricing Service","version":"v2"}
|
||||
=== PRODUCTION HTTPS HEALTH ===
|
||||
{"status":"healthy","version":"v2"}
|
||||
\end{lstlisting}
|
||||
Public endpoints: \href{https://staging-pricing.nageshwaran.dev/health}{staging health}, \href{https://staging-pricing.nageshwaran.dev/pricing}{staging pricing}, \href{https://pricing.nageshwaran.dev/health}{production health}, and \href{https://pricing.nageshwaran.dev/pricing}{production pricing}.
|
||||
\subsection*{Independent availability measurements}
|
||||
Selected output from the saved staging downtime analysis:
|
||||
\begin{lstlisting}
|
||||
=== STAGING ===
|
||||
Drill window samples: 111
|
||||
Failed samples: 88
|
||||
Sampled availability: 20.72 %
|
||||
Failure timestamp span: 108.436741 seconds
|
||||
First failure to recovery: 109.565538 seconds
|
||||
=== PRODUCTION ===
|
||||
Drill window samples: 111
|
||||
Failed samples: 0
|
||||
Sampled availability: 100.0 %
|
||||
\end{lstlisting}
|
||||
The observation window is the staging drill only; these are sampled estimates, not long-term SLO compliance or exact continuous downtime.
|
||||
\subsection*{Synthetic-secret negative test}
|
||||
Recorded result summary (not raw console output): Jenkins \href{https://ci.nageshwaran.dev/job/chapter6-synthetic-secret-test/3/}{synthetic-secret build 3} detected a generated test token (rule \texttt{github-pat}); Gitleaks returned 42, the delivery sentinel was skipped, and the build finished FAILURE. This separate test job does not demonstrate a full production-pipeline negative run. The test token is deliberately not reproduced. The archived console and reports remain in the local evidence directory, \nolinkurl{04-jenkins-ci/synthetic-secret-build-3/}. See also \href{https://ci.nageshwaran.dev/job/startup-product-chapter6-delivery/7/consoleText}{delivery build 7 console} and \href{https://ci.nageshwaran.dev/job/startup-product-chapter6-delivery/7/artifact/}{build 7 artifacts} for the passing scan and promotion evidence. Access to these links must be confirmed by the team.
|
||||
|
||||
\clearpage
|
||||
\section{Additional visual execution evidence}
|
||||
The following authentic screenshots supplement the saved log transcriptions. The availability screenshot documents the production rollback drill, not the staging drill. Staging downtime is supported by the saved analysis in Section 6.6. The synthetic-secret test was an isolated Jenkins job.
|
||||
\clearpage
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.80\textheight,keepaspectratio]{img/chapter6-selected/staging-restoration.png}
|
||||
\caption{Saved Ansible restoration output: Compose healthy, zero failed tasks, staging and production HTTPS healthy at 08:25:02 UTC.}
|
||||
\end{figure}
|
||||
\clearpage
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.80\textheight,keepaspectratio]{img/chapter6-selected/live-https.png}
|
||||
\caption{Live HTTPS verification at 08:59:26 UTC on November 26, 2026: both environments returned healthy V2 and matching pricing plans.}
|
||||
\end{figure}
|
||||
\clearpage
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.80\textheight,keepaspectratio]{img/chapter6-selected/production-downtime.png}
|
||||
\caption{Saved production rollback availability analysis: two observed interruption groups; sampled estimates rather than exact continuous downtime.}
|
||||
\end{figure}
|
||||
\clearpage
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.80\textheight,keepaspectratio]{img/chapter6-selected/synthetic-secret-start.png}
|
||||
\caption{Jenkins synthetic-secret test build 3: recorded job execution and environment validation.}
|
||||
\end{figure}
|
||||
\clearpage
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.80\textheight,keepaspectratio]{img/chapter6-selected/synthetic-secret-blocked.png}
|
||||
\caption{Jenkins synthetic-secret test build 3: delivery sentinel skipped, exit code 42, final result FAILURE.}
|
||||
\end{figure}
|
||||
\clearpage
|
||||
\begin{figure}[H]\centering
|
||||
\includegraphics[width=\linewidth,height=0.80\textheight,keepaspectratio]{img/chapter6-selected/synthetic-secret-report.png}
|
||||
\caption{Redacted archived report for synthetic-secret build 3: one github-pat finding, exit code 42, delivery sentinel skipped. The generated token is omitted.}
|
||||
\end{figure}
|
||||
@@ -0,0 +1,158 @@
|
||||
\chapter{Customer Support and Incident Management}
|
||||
\label{chap:customer-support}
|
||||
|
||||
\section{Purpose and Scope}
|
||||
|
||||
This chapter documents the customer support workflow
|
||||
implemented using Zammad and its integration with
|
||||
the existing Gitea engineering workflow.
|
||||
|
||||
A simulated pricing API incident was used to
|
||||
demonstrate ticket management, engineering escalation,
|
||||
technical investigation, access control, customer
|
||||
communication, and incident closure.
|
||||
|
||||
\section{Support Platform}
|
||||
|
||||
Zammad was deployed using Docker Compose.
|
||||
Deployment, configuration, and runtime verification
|
||||
logs are maintained in the local dos-support
|
||||
evidence directory.
|
||||
|
||||
\section{Customer Support Incident}
|
||||
|
||||
The simulated incident was recorded as Zammad
|
||||
ticket 60002, titled Pricing API returns an error.
|
||||
The ticket was assigned to the Student Agent
|
||||
with high priority.
|
||||
|
||||
An engineering investigation was created in Gitea
|
||||
as issue 14, referencing the corresponding
|
||||
customer support ticket.
|
||||
|
||||
\section{Technical Investigation}
|
||||
|
||||
The recorded engineering investigation reported:
|
||||
|
||||
\begin{itemize}
|
||||
\item Production HTTPS health: Healthy, V2.
|
||||
\item Staging HTTPS health: Healthy, V2.
|
||||
\item Production pricing endpoint successfully verified.
|
||||
\item Starter pricing: \$5.
|
||||
\item Basic pricing: \$12.
|
||||
\item Pro pricing: \$30.
|
||||
\item Enterprise pricing: \$60.
|
||||
\item The reported error could not be reproduced.
|
||||
\item No corrective deployment or infrastructure
|
||||
changes were required.
|
||||
\end{itemize}
|
||||
|
||||
\section{Public and Internal Message Visibility}
|
||||
|
||||
The ticket contained three public articles and
|
||||
two internal notes. Article visibility was corrected
|
||||
and verified using both customer and agent views.
|
||||
|
||||
The following figures document the correction
|
||||
and role-specific visibility verification.
|
||||
|
||||
\newcommand{\supportfigure}[3]{%
|
||||
\begin{figure}[!htbp]
|
||||
\centering
|
||||
\includegraphics[
|
||||
width=\linewidth,
|
||||
height=0.72\textheight,
|
||||
keepaspectratio
|
||||
]{img/chapter7-evidence/#1}
|
||||
\caption{#2}
|
||||
\label{fig:#3}
|
||||
\end{figure}
|
||||
\clearpage
|
||||
}
|
||||
|
||||
\supportfigure
|
||||
{06-visibility-correction-20261126.png}
|
||||
{Backend article visibility correction and successful
|
||||
verification with evidence checksum.}
|
||||
{support-visibility-correction}
|
||||
|
||||
\supportfigure
|
||||
{07-customer-visibility-verification-20261126.png}
|
||||
{Customer view showing three public messages
|
||||
without the two internal notes.}
|
||||
{support-customer-view}
|
||||
|
||||
\supportfigure
|
||||
{08-agent-visibility-verification-20261126.png}
|
||||
{Agent view showing internal investigation notes
|
||||
and public customer communication.}
|
||||
{support-agent-view}
|
||||
|
||||
\section{Incident Resolution and Closure}
|
||||
|
||||
The investigation findings were communicated
|
||||
to the customer through Zammad. The incident
|
||||
was classified as unable to reproduce rather
|
||||
than a repaired software defect.
|
||||
|
||||
The Zammad ticket and corresponding Gitea
|
||||
engineering issue were subsequently closed.
|
||||
|
||||
\supportfigure
|
||||
{09-ticket-closure-20261126.png}
|
||||
{Zammad ticket 60002 showing closed status.}
|
||||
{support-ticket-closure}
|
||||
|
||||
\supportfigure
|
||||
{10-engineering-issue-open-20261126.png}
|
||||
{Gitea engineering issue 14 referencing
|
||||
Zammad ticket 60002.}
|
||||
{support-engineering-issue}
|
||||
|
||||
\supportfigure
|
||||
{11-engineering-investigation-results-20261126.png}
|
||||
{Documented engineering investigation results
|
||||
for production and staging environments.}
|
||||
{support-investigation}
|
||||
|
||||
\supportfigure
|
||||
{12a-engineering-final-resolution-20261126.png}
|
||||
{Final engineering resolution documenting
|
||||
the unable-to-reproduce outcome.}
|
||||
{support-final-resolution}
|
||||
|
||||
\supportfigure
|
||||
{12b-engineering-issue-closure-20261126.png}
|
||||
{Closed Gitea engineering issue 14.}
|
||||
{support-engineering-closure}
|
||||
|
||||
\section{Evidence Management}
|
||||
|
||||
The local evidence directory contains six
|
||||
timestamped log files covering deployment
|
||||
preparation, configuration, Zammad deployment,
|
||||
runtime verification, engineering investigation,
|
||||
and article visibility correction.
|
||||
|
||||
\supportfigure
|
||||
{13-local-evidence-inventory-20261126.png}
|
||||
{Local terminal evidence inventory showing
|
||||
the six supporting log files.}
|
||||
{support-evidence-inventory}
|
||||
|
||||
The screenshots demonstrate the recorded support
|
||||
workflow. The original logs provide additional
|
||||
technical evidence and should be retained with
|
||||
the submission materials.
|
||||
|
||||
\section{Conclusion}
|
||||
|
||||
The simulated incident demonstrates the
|
||||
customer support lifecycle from ticket
|
||||
investigation and engineering escalation
|
||||
through customer communication and closure.
|
||||
|
||||
Customer-facing communication was separated
|
||||
from internal engineering notes, and both
|
||||
support and engineering records were closed
|
||||
without unnecessary infrastructure changes.
|
||||
|
After Width: | Height: | Size: 211 KiB |
|
After Width: | Height: | Size: 362 KiB |
|
After Width: | Height: | Size: 785 KiB |
|
After Width: | Height: | Size: 446 KiB |
|
After Width: | Height: | Size: 734 KiB |
|
After Width: | Height: | Size: 173 KiB |
|
After Width: | Height: | Size: 428 KiB |
|
After Width: | Height: | Size: 421 KiB |
|
After Width: | Height: | Size: 2.8 MiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 3.2 MiB |
|
After Width: | Height: | Size: 3.0 MiB |
|
After Width: | Height: | Size: 965 KiB |
|
After Width: | Height: | Size: 387 KiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 343 KiB |
|
After Width: | Height: | Size: 812 KiB |
|
After Width: | Height: | Size: 568 KiB |
|
After Width: | Height: | Size: 3.1 MiB |
|
After Width: | Height: | Size: 229 KiB |
|
After Width: | Height: | Size: 820 KiB |
|
After Width: | Height: | Size: 793 KiB |
|
After Width: | Height: | Size: 289 KiB |
|
After Width: | Height: | Size: 257 KiB |
|
After Width: | Height: | Size: 268 KiB |
|
After Width: | Height: | Size: 287 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 559 KiB |
|
After Width: | Height: | Size: 306 KiB |
|
After Width: | Height: | Size: 651 KiB |
|
After Width: | Height: | Size: 655 KiB |
|
After Width: | Height: | Size: 650 KiB |
|
After Width: | Height: | Size: 467 KiB |
|
After Width: | Height: | Size: 374 KiB |
|
After Width: | Height: | Size: 531 KiB |
|
After Width: | Height: | Size: 537 KiB |
|
After Width: | Height: | Size: 613 KiB |
|
After Width: | Height: | Size: 118 KiB |
|
After Width: | Height: | Size: 518 KiB |
|
After Width: | Height: | Size: 559 KiB |
|
After Width: | Height: | Size: 763 KiB |
|
After Width: | Height: | Size: 393 KiB |
|
After Width: | Height: | Size: 588 KiB |
|
After Width: | Height: | Size: 503 KiB |
|
After Width: | Height: | Size: 513 KiB |
|
After Width: | Height: | Size: 566 KiB |
|
After Width: | Height: | Size: 595 KiB |
|
After Width: | Height: | Size: 406 KiB |
|
After Width: | Height: | Size: 398 KiB |
|
After Width: | Height: | Size: 241 KiB |
|
After Width: | Height: | Size: 1001 KiB |
|
After Width: | Height: | Size: 427 KiB |
|
After Width: | Height: | Size: 499 KiB |
|
After Width: | Height: | Size: 372 KiB |
|
After Width: | Height: | Size: 459 KiB |
|
After Width: | Height: | Size: 272 KiB |
|
After Width: | Height: | Size: 382 KiB |
|
After Width: | Height: | Size: 436 KiB |
|
After Width: | Height: | Size: 392 KiB |
|
After Width: | Height: | Size: 204 KiB |
|
After Width: | Height: | Size: 185 KiB |
|
After Width: | Height: | Size: 172 KiB |
|
After Width: | Height: | Size: 147 KiB |
|
After Width: | Height: | Size: 410 KiB |
|
After Width: | Height: | Size: 465 KiB |
|
After Width: | Height: | Size: 233 KiB |
|
After Width: | Height: | Size: 817 KiB |
|
After Width: | Height: | Size: 350 KiB |
|
After Width: | Height: | Size: 238 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 283 KiB |
|
After Width: | Height: | Size: 71 KiB |