diff --git a/manual/HW9 images/agent-view.png b/manual/HW9 images/agent-view.png new file mode 100644 index 0000000..9cc2020 Binary files /dev/null and b/manual/HW9 images/agent-view.png differ diff --git a/manual/HW9 images/backup-logs.png b/manual/HW9 images/backup-logs.png new file mode 100644 index 0000000..122220c Binary files /dev/null and b/manual/HW9 images/backup-logs.png differ diff --git a/manual/HW9 images/backup.png b/manual/HW9 images/backup.png new file mode 100644 index 0000000..486a2d1 Binary files /dev/null and b/manual/HW9 images/backup.png differ diff --git a/manual/HW9 images/baseline.png b/manual/HW9 images/baseline.png new file mode 100644 index 0000000..6a058f9 Binary files /dev/null and b/manual/HW9 images/baseline.png differ diff --git a/manual/HW9 images/compose-ps.png b/manual/HW9 images/compose-ps.png new file mode 100644 index 0000000..0a0df24 Binary files /dev/null and b/manual/HW9 images/compose-ps.png differ diff --git a/manual/HW9 images/customer-tickets.png b/manual/HW9 images/customer-tickets.png new file mode 100644 index 0000000..489772e Binary files /dev/null and b/manual/HW9 images/customer-tickets.png differ diff --git a/manual/HW9 images/customer-view.png b/manual/HW9 images/customer-view.png new file mode 100644 index 0000000..522adaf Binary files /dev/null and b/manual/HW9 images/customer-view.png differ diff --git a/manual/HW9 images/docker-stats-after.png b/manual/HW9 images/docker-stats-after.png new file mode 100644 index 0000000..3acb246 Binary files /dev/null and b/manual/HW9 images/docker-stats-after.png differ diff --git a/manual/HW9 images/exposure.png b/manual/HW9 images/exposure.png new file mode 100644 index 0000000..1b709e2 Binary files /dev/null and b/manual/HW9 images/exposure.png differ diff --git a/manual/HW9 images/issue-ticket-link.png b/manual/HW9 images/issue-ticket-link.png new file mode 100644 index 0000000..ab14c02 Binary files /dev/null and b/manual/HW9 images/issue-ticket-link.png differ diff --git a/manual/HW9 images/outage-log.png b/manual/HW9 images/outage-log.png new file mode 100644 index 0000000..2cd46e6 Binary files /dev/null and b/manual/HW9 images/outage-log.png differ diff --git a/manual/HW9 images/recheck-app.png b/manual/HW9 images/recheck-app.png new file mode 100644 index 0000000..48b184b Binary files /dev/null and b/manual/HW9 images/recheck-app.png differ diff --git a/manual/HW9 images/recheck-gitea.png b/manual/HW9 images/recheck-gitea.png new file mode 100644 index 0000000..8930b3e Binary files /dev/null and b/manual/HW9 images/recheck-gitea.png differ diff --git a/manual/HW9 images/recheck-grafana-dashboard.png b/manual/HW9 images/recheck-grafana-dashboard.png new file mode 100644 index 0000000..1035cc3 Binary files /dev/null and b/manual/HW9 images/recheck-grafana-dashboard.png differ diff --git a/manual/HW9 images/recheck-jenkins.png b/manual/HW9 images/recheck-jenkins.png new file mode 100644 index 0000000..5485e08 Binary files /dev/null and b/manual/HW9 images/recheck-jenkins.png differ diff --git a/manual/HW9 images/restart.png b/manual/HW9 images/restart.png new file mode 100644 index 0000000..6a5d23e Binary files /dev/null and b/manual/HW9 images/restart.png differ diff --git a/manual/HW9 images/self-registration.png b/manual/HW9 images/self-registration.png new file mode 100644 index 0000000..9f3734d Binary files /dev/null and b/manual/HW9 images/self-registration.png differ diff --git a/manual/HW9 images/ta-test.png b/manual/HW9 images/ta-test.png new file mode 100644 index 0000000..082bc9e Binary files /dev/null and b/manual/HW9 images/ta-test.png differ diff --git a/manual/HW9 images/ticket-issue-link.png b/manual/HW9 images/ticket-issue-link.png new file mode 100644 index 0000000..47502e4 Binary files /dev/null and b/manual/HW9 images/ticket-issue-link.png differ diff --git a/manual/HW9 images/tickets-overview.png b/manual/HW9 images/tickets-overview.png new file mode 100644 index 0000000..56cacd2 Binary files /dev/null and b/manual/HW9 images/tickets-overview.png differ diff --git a/manual/HW9 images/zammad-architecture.png b/manual/HW9 images/zammad-architecture.png new file mode 100644 index 0000000..f0c0fa6 Binary files /dev/null and b/manual/HW9 images/zammad-architecture.png differ diff --git a/manual/devopsAssignment.tex b/manual/devopsAssignment.tex index 1bc6706..3aa0074 100644 --- a/manual/devopsAssignment.tex +++ b/manual/devopsAssignment.tex @@ -41,10 +41,10 @@ \newcommand{\CourseName}{DevOps} \newcommand{\Instructor}{Samah Keshiro and Kayla Holmes} \newcommand{\Organization}{Stevens Institute of Technology} -\newcommand{\DocumentDate}{November 13, 2026} +\newcommand{\DocumentDate}{November 29, 2026} \newcommand{\DueDate}{[Due Date and Time]} -\newcommand{\VERSION}{Version 1.7} -\newcommand{\AssignmentNumber}{7} +\newcommand{\VERSION}{Version 1.8 (draft)} +\newcommand{\AssignmentNumber}{8} \newcolumntype{Y}{>{\raggedright\arraybackslash}X} \newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} @@ -138,6 +138,7 @@ \include{devopsCI} \include{devopsSRE} \include{devopsSecureDelivery} +\include{devopsZammad} \printglossaries diff --git a/manual/devopsReferences.bib b/manual/devopsReferences.bib index 18496b6..44bc7c8 100644 --- a/manual/devopsReferences.bib +++ b/manual/devopsReferences.bib @@ -167,3 +167,39 @@ url = {https://www.jenkins.io/doc/pipeline/steps/pipeline-input-step/}, note = {Accessed: Nov. 13, 2026} } + +@misc{ZammadCompose, + author = {{Zammad GmbH}}, + title = {{zammad-docker-compose: Zammad Docker Compose deployment}}, + howpublished = {GitHub repository}, + year = {2026}, + url = {https://github.com/zammad/zammad-docker-compose}, + note = {Accessed: Nov. 29, 2026} +} + +@misc{ZammadDocker, + author = {{Zammad GmbH}}, + title = {{Install with Docker Compose}}, + howpublished = {Zammad System Documentation}, + year = {2026}, + url = {https://docs.zammad.org/en/latest/install/docker-compose.html}, + note = {Accessed: Nov. 29, 2026} +} + +@misc{ZammadHardware, + author = {{Zammad GmbH}}, + title = {{Hardware Requirements}}, + howpublished = {Zammad System Documentation}, + year = {2026}, + url = {https://docs.zammad.org/en/latest/prerequisites/hardware.html}, + note = {Accessed: Nov. 29, 2026} +} + +@misc{ZammadRoles, + author = {{Zammad GmbH}}, + title = {{Roles}}, + howpublished = {Zammad Admin Documentation}, + year = {2026}, + url = {https://admin-docs.zammad.org/en/latest/manage/roles/index.html}, + note = {Accessed: Nov. 29, 2026} +} diff --git a/manual/devopsZammad.tex b/manual/devopsZammad.tex new file mode 100644 index 0000000..4d83568 --- /dev/null +++ b/manual/devopsZammad.tex @@ -0,0 +1,498 @@ +\chapter{Support Ticket Management with Zammad} +\ChapterLabel{SupportDesk} +\index{Zammad} +\index{help desk} +\sloppy + +% Red marker for values still to be filled in from the team's own outputs. +\providecommand{\FillIn}[1]{\textcolor{devopsRed}{\textbf{[TO FILL: #1]}}} +% Figure helper: shows a labelled box until the screenshot file exists. +\providecommand{\zfig}[4]{% + \begin{figure}[H]\centering + \IfFileExists{HW9 images/#1}{\includegraphics[width=#2\linewidth]{HW9 images/#1}}% + {\fbox{\parbox{0.8\linewidth}{\centering\vspace{1em}\textit{[Screenshot needed: HW9 images/#1]}\vspace{1em}}}} + \caption{#3}\label{#4}\end{figure}} + +This chapter gives the startup's customers and operations team a shared place to +report problems, assign responsibility, and record the resolution. The official +Zammad Docker Compose stack~\cite{ZammadCompose,ZammadDocker} is deployed +unchanged as its own Compose project, three synthetic tickets are worked through +triage and resolution, one ticket is linked to an engineering issue in Gitea, and +the web service is stopped and restarted to show that tickets persist. + +\textbf{Local deployment.} Zammad recommends at least two CPU cores and 6~GB of +RAM, plus 4~GB more when Elasticsearch runs on the same host~\cite{ZammadHardware}. +The team's Droplet was already short of memory after Chapter~\ref{Chapter:SecureDelivery}. +As the instructor permitted for this final assignment, Zammad was therefore deployed +with Docker on a team member's laptop instead of the Droplet. For a local +deployment the instructor waived integration with the Droplet's HTTPS proxy, +firewall, and monitoring, so Steps~5, 6, and~9 of the assignment are replaced by +the local checks in Sections~\ref{sec:z-exposure} and~\ref{sec:z-recovery}. A +video submitted in Canvas shows the running installation and every workflow, +because the TA cannot reach a local installation. + +\textbf{Division of work.} \texttt{kholmes} deployed and operated Zammad on her +laptop (Sections~\ref{sec:z-baseline}--\ref{sec:z-workflow} +and~\ref{sec:z-recovery}) and recorded the video. \texttt{samahk13} created the +Gitea issue and its links (Section~\ref{sec:z-gitea}), rechecked the existing +services (Section~\ref{sec:z-retest}), and wrote this chapter. + +\section{Deployment Architecture} +\label{sec:z-architecture} + +\zfig{zammad-architecture.png}{0.95}{Local Zammad deployment. Blue boxes are +Zammad containers, gray boxes are named volumes. Only \texttt{zammad-nginx} is +published, and only on the laptop's loopback address; every other service is +reachable only on the Compose project's private network.}{fig:z-architecture} + +\begin{itemize} + \item \textbf{Entry point:} \texttt{zammad-nginx} is published on + \texttt{127.0.0.1:8080}, so only a browser on the same laptop can reach it. + There is no TLS: traffic never leaves the machine, and the HTTPS proxy was + waived for local installs. Zammad is configured for plain HTTP + (\texttt{ZAMMAD\_HTTP\_TYPE=http}, \texttt{NGINX\_SERVER\_SCHEME=http}), which + must match the scheme the browser uses or login fails with a CSRF error. + \item \textbf{Private services:} PostgreSQL, Elasticsearch, Redis, Memcached, + the Rails server, WebSocket server, scheduler, and backup service are on the + project network only, with no published ports. + \item \textbf{Earlier services:} Gitea, Jenkins, Caddy, monitoring, and the + Chapter~\ref{Chapter:SecureDelivery} application stay on the Droplet, + unchanged. The only link is a manual one: a ticket holds a Gitea issue URL, + and the issue holds the ticket number. +\end{itemize} + +\section{Capacity Baseline} +\label{sec:z-baseline} + +Both team laptops have 8~GB of RAM. The Windows laptop had only about 0.9~GB +free with normal applications open, so the macOS laptop was used. + +\begin{tabularx}{\linewidth}{L{4.2cm}Y} +\toprule +\textbf{Item} & \textbf{Value}\\ \midrule +Host & MacBook Pro, Apple silicon (\texttt{arm64}), 8 CPU cores\\ +Memory & 8~GB total (\texttt{hw.memsize} 8{,}589{,}934{,}592 bytes); 49--50\% free before start-up\\ +Docker Desktop memory limit & 5.78~GiB (the container limit shown by \texttt{docker stats})\\ +Docker / Compose & Docker Desktop 4.91.0, Engine 29.8.0 (\texttt{linux/arm64}); Compose v5.5.1\\ +Disk free & 24~GiB available on \texttt{/}\\ +\bottomrule +\end{tabularx} + +\zfig{baseline.png}{0.75}{Capacity baseline on the laptop before Zammad was +started. The only running container was the team's existing Gitea Actions LaTeX +runner (37~MiB).}{fig:z-baseline} + +\section{Official Compose Stack} +\label{sec:z-deploy} + +\subsection{Obtaining a Fixed Revision} +The official repository was cloned into its own directory and checked out +detached, so the exact revision is recorded~\cite{ZammadCompose}: +\begin{minted}[breaklines,breakanywhere]{bash} +mkdir -p ~/dos-support && cd ~/dos-support +git clone https://github.com/zammad/zammad-docker-compose.git +cd zammad-docker-compose +git switch --detach +git rev-parse HEAD +cp .env.dist .env && chmod 600 .env +\end{minted} + +Recorded commit: \texttt{67141451b6239190f7a616231bff20b8b0ccbd8a}. The image versions are the ones fixed +by that commit and were not changed: + +\begin{tabularx}{\linewidth}{L{4.4cm}Y} +\toprule +\textbf{Service} & \textbf{Image}\\ \midrule +Zammad (nginx, railsserver, websocket, scheduler, init, backup) & \texttt{ghcr.io/zammad/zammad:7.3.0-0011}\\ +Elasticsearch & \texttt{elasticsearch:9.5.7}\\ +PostgreSQL & \texttt{postgres:17.12-alpine}\\ +Redis & \texttt{redis:8.12-alpine}\\ +Memcached & \texttt{memcached:1.6.45-alpine}\\ +\bottomrule +\end{tabularx} + +\subsection{Configuration} +The real \texttt{.env} stays on the laptop with mode 600. A sanitized copy, +\href{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/src/branch/main/support/zammad.env.example}{\texttt{support/zammad.env.example}}, +is kept in Gitea: + +\begin{minted}[breaklines,breakanywhere]{bash} +COMPOSE_PROJECT_NAME=dos-support +COMPOSE_FILE=docker-compose.yml:scenarios/apply-resource-limits.yml + +# Local only: loopback port, plain HTTP +NGINX_EXPOSE_PORT=127.0.0.1:8080 +ZAMMAD_FQDN=localhost:8080 +ZAMMAD_HTTP_TYPE=http +NGINX_SERVER_SCHEME=http + +# Unique generated values (openssl rand -hex 24); never committed +POSTGRES_PASS= +ELASTICSEARCH_PASS= + +# Low-memory settings for an 8 GB laptop +ELASTICSEARCH_JAVA_OPTS=-Xms512m -Xmx512m +ZAMMAD_ELASTICSEARCH_RESOURCES_LIMITS_MEMORY=1G +ZAMMAD_RAILSSERVER_RESOURCES_LIMITS_MEMORY=1G +ZAMMAD_SCHEDULER_RESOURCES_LIMITS_MEMORY=1G +ZAMMAD_INIT_RESOURCES_LIMITS_MEMORY=1G + +# First backup at start-up instead of only at 03:00; local time zone +BACKUP_ON_START=true +TZ=America/New_York +\end{minted} + +\textbf{Deviations from the assignment's Droplet configuration.} The +external-network scenario is not loaded, because there is no proxy to join; the +host-proxy alternative's loopback port is used instead. The +\texttt{apply-resource-limits.yml} scenario and a 512~MB Elasticsearch heap are +loaded because the laptop has 8~GB in total. Both scenario files are part of the +official repository, and no image was built or replaced. + +\subsection{Validation and Start-up} +Elasticsearch needs \texttt{vm.max\_map\_count=262144}~\cite{ZammadDocker}. On +macOS the setting belongs to Docker Desktop's Linux VM, not to macOS, so it was +applied there: +\begin{minted}[breaklines,breakanywhere]{bash} +docker run --rm --privileged alpine sysctl -w vm.max_map_count=262144 +docker compose config --quiet +docker compose config --services +docker compose pull +docker compose up -d +docker compose ps -a +docker compose logs --tail=50 zammad-init zammad-railsserver zammad-nginx +\end{minted} +This setting lasts until Docker Desktop restarts and has to be applied again +after that. + +\textbf{Start-up result.} The first start took about 15 minutes: the containers +were created 24 minutes before Figure~\ref{fig:z-ps} was taken and +\texttt{zammad-init} exited 9 minutes before it, with exit code 0. No container +restarted or was stopped for running out of memory, so no setting had to be +changed after the first start. + +\zfig{compose-ps.png}{1.0}{\texttt{docker compose ps -a} in project +\texttt{dos-support}: every service up (PostgreSQL, Redis, Memcached, and the Rails +server healthy), \texttt{zammad-init} exited with code 0, and only nginx published, +on \texttt{127.0.0.1:8080}.}{fig:z-ps} + +\zfig{docker-stats-after.png}{1.0}{\texttt{docker stats -{}-no-stream} after +start-up: memory used by each Zammad container against its limit.}{fig:z-stats} + +\textbf{Before and after.} Before start-up, only the 37~MiB runner was running +and macOS reported 49--50\% of memory free. After start-up, the nine Zammad +containers used about 1.93~GiB together. Elasticsearch used 897~MiB, 88\% of its +1~GiB limit, and is the container closest to its cap; the Rails server (293~MiB) +and scheduler (333~MiB) stayed near a third of theirs. The 1~GiB caps were enough +for the stack to start and stay up. + +\section{Network Exposure} +\label{sec:z-exposure} + +Only \texttt{zammad-nginx} may be published, and only on loopback. +\begin{minted}[breaklines,breakanywhere]{bash} +docker compose ps --format "table {{.Service}}\t{{.Ports}}" +lsof -nP -iTCP -sTCP:LISTEN | grep -E ':(8080|5432|9200|6379|11211)' +\end{minted} +Only nginx has a host binding, \texttt{127.0.0.1:8080->8080/tcp}. PostgreSQL +(5432), Elasticsearch (9200, 9300), Redis (6379), and Memcached (11211) list their +ports as container ports only, and \texttt{lsof} finds a single listening socket +among the checked ports: \texttt{127.0.0.1:8080}, owned by Docker Desktop. + +\zfig{exposure.png}{1.0}{Published ports: only \texttt{127.0.0.1:8080}; no +database, search, cache, or Redis port listens on the laptop.}{fig:z-exposure} + +The control that enforces this is the Compose file itself: no internal service +declares a \texttt{ports} entry, and \texttt{NGINX\_EXPOSE\_PORT} binds nginx to +the loopback address. A loopback binding is not reachable from the local network +whatever the macOS firewall setting is. The Droplet's cloud firewall and Caddy +are not involved, and no rule was added to either. + +\section{Support Workflow and TA Access} +\label{sec:z-workflow} + +\subsection{Accounts and Roles} +Self-registration was turned off, and every account was created directly by the +administrator with an initial password set administratively, since no email +channel is configured~\cite{ZammadRoles}. + +\begin{tabularx}{\linewidth}{L{3.2cm}L{2.4cm}Y} +\toprule +\textbf{Account} & \textbf{Role} & \textbf{Group access}\\ \midrule +Admin Admin & Admin & Startup Support, Users\\ +Test Agent (student agent) & Agent & Startup Support\\ +TA User & Agent (not Admin) & Startup Support\\ +Customer User (synthetic) & Customer & none: own tickets only\\ +Secondary Customer (synthetic) & Customer & none: own tickets only\\ +\bottomrule +\end{tabularx} + +\medskip +All names and email addresses are synthetic. No password appears in this manual +or in Gitea; the TA login is given in the Canvas submission. + +\subsection{Example Tickets} +\begin{tabularx}{\linewidth}{L{1.3cm}L{3.0cm}L{1.2cm}L{1.5cm}L{2.4cm}Y} +\toprule +\textbf{Ticket} & \textbf{Title} & \textbf{State} & \textbf{Priority} & \textbf{Owner} & \textbf{Customer}\\ \midrule +\#63002 & OpenUnassigned & open & normal & none & Secondary Customer\\ +\#63003 & OpenAssigned (investigating) & open & high & Test Agent & Secondary Customer\\ +\#63005 & ResolvedTicket & closed & low & Admin Admin & Customer User\\ +\#63004 & ClosedTicket & closed & normal & Admin Admin & Secondary Customer\\ +\#63006 & TestingWorkflow (TA test) & closed & normal & TA User & Customer User\\ +\bottomrule +\end{tabularx} + +\zfig{tickets-overview.png}{1.0}{Ticket overview: the four example tickets and +the TA's test ticket \#63006, with their states, priorities, and +owners.}{fig:z-tickets} + +\subsection{Internal Note, Customer Reply, and Visibility} +In ticket \#63002, the agent added an internal note (``This will be an internal +note, the customer cannot view'') and then a public reply through the web +interface. Logged in as Secondary Customer in a separate private window, the +customer saw the public reply but not the internal note, and the customer's +ticket list showed only that customer's own tickets, \#63002, \#63003, and +\#63004; \#63005 and \#63006 belong to Customer User and were not listed. +Self-registration is off (Figure~\ref{fig:z-selfreg}), so a customer account +exists only if the administrator creates it. + +\zfig{self-registration.png}{1.0}{Demo video, 0:56 --- Security settings: new +user accounts (self-registration) set to \emph{no}.}{fig:z-selfreg} + +\zfig{agent-view.png}{1.0}{Demo video, 2:32 --- agent view of ticket \#63002: +the internal note is marked internal, and a public reply is being +added.}{fig:z-agent-view} + +\zfig{customer-tickets.png}{1.0}{Demo video, 2:45 --- Secondary Customer's +\emph{My Tickets}: only \#63002, \#63003, and \#63004.}{fig:z-customer-tickets} + +\zfig{customer-view.png}{1.0}{Demo video, 4:48 --- ticket \#63002 in the +customer's session: the public reply is shown and the internal note is +not.}{fig:z-customer-view} + +\subsection{TA Account Test} +In a separate private window, the TA account created test ticket \#63006 +``TestingWorkflow'' for Customer User, replied to it (``This is my reply''), set +an owner, and closed it, all without administrator rights; the Admin settings +were not available to it. + +\zfig{ta-test.png}{1.0}{Demo video, 3:48 --- TA session: replying to test +ticket \#63006 and choosing its owner; no Admin menu.}{fig:z-ta} + +\subsection{TA Checklist} +\begin{enumerate} + \item \textbf{Evidence:} the video in the Canvas submission. The installation + is on a team laptop and is not reachable remotely. + \item \textbf{URL (local):} \texttt{http://localhost:8080}. + \item \textbf{Account:} TA User, role Agent, group Startup Support + with full access. The password is in the Canvas submission text, not here. + \item \textbf{Example tickets:} open \#63002, investigating \#63003, closed + \#63004 and \#63005; Gitea-linked ticket \#63003; TA test ticket \#63006. + \item \textbf{Test steps:} New Ticket $\rightarrow$ customer, group Startup + Support, title, text $\rightarrow$ Create; reply in the article box with + visibility Public $\rightarrow$ Update; set Owner $\rightarrow$ Update; set + State to closed $\rightarrow$ Update. +\end{enumerate} + +\section{Link to Engineering in Gitea} +\label{sec:z-gitea} + +Ticket\#63003 reports a problem that needs a software change, so it was linked +to Gitea issue +\href{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/issues/30}{\#30}: +\begin{itemize} + \item \textbf{Report:} the synthetic customer Secondary Customer wrote on the + ticket: ``when I typed `abc' as the quantity, the page showed a confusing + technical error.'' \texttt{GET /price?quantity=abc} returns HTTP 400 with + Python's internal text \texttt{invalid literal for int() with base 10: 'abc'}. + \item \textbf{Issue \#30:} ``Ticket\#63003: Non-numeric quantity returns a + technical error message.'' Its description quotes the ticket. Acceptance + criterion: \texttt{GET /price?quantity=abc} returns HTTP 400 with the message + \texttt{quantity must be a whole number between 1 and 1000}, and a unit test + covers it. + \item \textbf{Ticket:} an internal note on Ticket\#63003 holds the clickable + issue URL, so agents can follow the engineering work. + \item \textbf{Fix:} in \texttt{pricing/app.py}, every rejected quantity now + returns one fixed message, \texttt{QUANTITY\_ERROR}, instead of + \texttt{str(error)}, so Python's internal text never reaches the customer. + A new unit test, \texttt{test\_non\_numeric\_quantity\_message}, requests + \texttt{/price?quantity=abc} and checks for HTTP 400 and the exact message; + the existing \texttt{test\_invalid\_quantity} still covers 0, $-1$, 1001, + \texttt{abc}, and 1.5. +\begin{minted}[breaklines]{python} +QUANTITY_ERROR = "quantity must be a whole number between 1 and 1000" +... + except ValueError: + return jsonify(error=QUANTITY_ERROR), 400 +\end{minted} + \item \textbf{Release:} commit \FillIn{short hash} (``Pricing: clear message + for non-numeric quantity (fixes \#30)'') ran through Jenkins run + \FillIn{\#N v1.0.N}: all four unit tests passed, the security gate passed, + and the release was approved and deployed. + \item \textbf{Verification and closure:} after the deploy, + \texttt{GET /price?quantity=abc} returned HTTP 400 with + \texttt{quantity must be a whole number between 1 and 1000}. Issue \#30 was + closed by the commit, and Ticket\#63003 got a public reply telling the + customer the fix was live and was then set to closed. +\end{itemize} + +\zfig{ticket-issue-link.png}{1.0}{Ticket\#63003 +with the customer's report and the internal note linking Gitea issue +\#30.}{fig:z-ticket-link} + +\zfig{issue-ticket-link.png}{1.0}{December 2, 2026 --- Gitea issue \#30 +referencing Ticket\#63003, with its acceptance criterion.}{fig:z-issue-link} + +The link is manual, as the assignment requires. No webhook, API automation, or +alert-to-ticket integration was configured. + +\section{Restart, Persistence, and Backup} +\label{sec:z-recovery} + +\subsection{Controlled Web-Service Outage} +Ticket \#63002, with its internal note and public reply, was the reference +ticket. Because the Droplet's +Prometheus cannot reach a local installation, the destination was checked once +per second from the laptop instead of by the Blackbox probe: +\begin{minted}[breaklines,breakanywhere]{bash} +while true; do echo "$(date +%T) $(curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/)"; sleep 1; done | tee ~/zammad-outage.log +docker compose stop zammad-nginx # announced test window +docker compose start zammad-nginx +docker compose ps -a +\end{minted} + +\begin{tabularx}{\linewidth}{L{3.4cm}Y} +\toprule +\textbf{Time (min:s)} & \textbf{Observation}\\ \midrule +before \texttt{:21:35} & \texttt{docker compose stop zammad-nginx}; checks return 200 until then\\ +\texttt{:21:35} & First failed request (curl status \texttt{000}, connection refused)\\ +\texttt{:22:05} & Last failed request; \texttt{docker compose start zammad-nginx} run\\ +\texttt{:22:06} & First successful request (HTTP 200) again\\ +\bottomrule +\end{tabularx} + +\medskip +The hour is cut off in the recording, so only minutes and seconds are shown. +There were 31 failed checks, an outage of about 31 seconds, and +\texttt{docker compose ps} showed every service healthy again, with nginx ``Up +less than a second'' (Figure~\ref{fig:z-restart}). After logging back in, +ticket \#63002 and its whole conversation were still there +(Figure~\ref{fig:z-customer-view}, taken after the restart). This is a web-service restart test, not a database +restore test: only nginx was stopped, and no volume was touched. + +\zfig{restart.png}{1.0}{Demo video, 3:56 --- \texttt{docker compose stop} and +\texttt{start zammad-nginx}, then every service healthy.}{fig:z-restart} + +\zfig{outage-log.png}{0.9}{Demo video, 4:26 --- per-second log: failed checks +(\texttt{000}) while nginx was stopped, then HTTP 200 again.}{fig:z-outage} + +\subsection{Storage and Backup} +\begin{tabularx}{\linewidth}{L{6.0cm}Y} +\toprule +\textbf{Named volume (project \texttt{dos-support})} & \textbf{Contents}\\ \midrule +\texttt{dos-support\_postgresql-data} & Tickets, users, settings (database)\\ +\texttt{dos-support\_elasticsearch-data} & Search index (can be rebuilt from the database)\\ +\texttt{dos-support\_redis-data} & Sessions and job queue\\ +\texttt{dos-support\_zammad-storage} & Attachments and application storage\\ +\texttt{dos-support\_zammad-backup} & Backup archives written by \texttt{zammad-backup}\\ +\bottomrule +\end{tabularx} + +\medskip +Memcached is a disposable cache and has no volume. Volumes survive container +replacement, but they are on the same laptop, so they are not an off-machine +backup. + +\begin{minted}[breaklines,breakanywhere]{bash} +docker volume ls | grep dos-support +docker compose logs --tail=20 zammad-backup +docker compose exec zammad-backup ls -lh /var/tmp/zammad +\end{minted} +All five named volumes exist, including \texttt{dos-support\_zammad-backup} +(Figure~\ref{fig:z-backup}). The \texttt{zammad-backup} service is running its +schedule: its log shows it waited for PostgreSQL and the init container, started +its backup loop, and is sleeping until the next scheduled run +(Figure~\ref{fig:z-backup-logs}). The backup directory was still empty +(\texttt{total 0}) when it was checked, because the first scheduled run had not +happened yet. So this lab shows that backups are configured and scheduled, not +that an archive has been written; the check is to run the \texttt{ls} command +again after the next scheduled time. + +\zfig{backup.png}{1.0}{Demo video, 4:26 --- the five named volumes of project +\texttt{dos-support}.}{fig:z-backup} + +\zfig{backup-logs.png}{1.0}{\texttt{zammad-backup} log (waiting, then sleeping +until the next run) and the still-empty backup directory.}{fig:z-backup-logs} + +\textbf{Restore.} An operator would follow the backup and restore guide for the +same Zammad release~\cite{ZammadDocker}: stop the stack without removing volumes, +place the chosen backup in the \texttt{zammad-backup} volume as that guide +describes, start the stack so the backup is restored, and then check that a known +ticket and its attachments are present. No restore was performed in this lab. + +\section{Earlier Services Retested} +\label{sec:z-retest} + +The Droplet was not changed by this assignment. On November 29 and December 2, 2026, each +earlier service was checked again: + +\begin{tabularx}{\linewidth}{L{4.0cm}Y} +\toprule +\textbf{Service} & \textbf{Result}\\ \midrule +Gitea (\url{https://git.ssw590-08.me}) & Dashboard loads; repository and recent activity shown (Figure~\ref{fig:z-gitea})\\ +Jenkins (\url{https://ci.ssw590-08.me}) & \texttt{Scrap-Web} job listed; last success 14 seconds earlier, no failure; built-in node and delivery agent connected; Jenkins 2.580.1 (Figure~\ref{fig:z-jenkins})\\ +Grafana (\url{https://metrics.ssw590-08.me}) & Reliability dashboard current on December 2 (last 6 hours): Gitea and Jenkins UP throughout, all six scrape targets UP including the production probe, CPU about 20\% apart from one build spike (Figure~\ref{fig:z-grafana})\\ +Chapter~\ref{Chapter:SecureDelivery} application (\url{https://app.ssw590-08.me}) & Version \texttt{v2}, commit \texttt{d678772}; \texttt{/price?quantity=3} returns 36 (Figure~\ref{fig:z-app})\\ +\bottomrule +\end{tabularx} + +\zfig{recheck-gitea.png}{0.85}{November 29, 2026 --- Gitea dashboard.}{fig:z-gitea} +\zfig{recheck-jenkins.png}{0.85}{November 29, 2026 --- Jenkins: \texttt{Scrap-Web} last success, no failure.}{fig:z-jenkins} +\zfig{recheck-grafana-dashboard.png}{0.85}{December 2, 2026, 10:30 AM--4:30 PM +EST --- Grafana reliability dashboard: host panels, HTTPS probe durations, Gitea +and Jenkins UP, and every scrape target UP.}{fig:z-grafana} +\zfig{recheck-app.png}{0.85}{November 29, 2026 --- production pricing application: +v2 and a total of 36.}{fig:z-app} + +\section{Operations Runbook} +\label{sec:z-runbook} +All commands run from \texttt{\textasciitilde/dos-support/zammad-docker-compose}, +so the same \texttt{.env} and scenario files are loaded. + +\begin{enumerate} + \item \textbf{Start:} open Docker Desktop; run + \texttt{docker run -{}-rm -{}-privileged alpine sysctl -w vm.max\_map\_count=262144}; + then \texttt{docker compose up -d}; wait until \texttt{docker compose ps -a} + shows all services healthy and \texttt{zammad-init} exited with code 0. + \item \textbf{Check:} open \texttt{http://localhost:8080} and log in as an agent. + \item \textbf{Restart the web service:} \texttt{docker compose restart + zammad-nginx}. + \item \textbf{Investigate:} \texttt{docker compose logs -{}-tail=50 + zammad-railsserver zammad-nginx}; \texttt{docker stats -{}-no-stream} for + memory pressure. + \item \textbf{Stop without losing data:} \texttt{docker compose stop} + (or \texttt{docker compose down} without \texttt{-v}). + \item \textbf{Never} run \texttt{docker compose down -v} or remove the + \texttt{dos-support\_*} volumes. + \item \textbf{After grading:} disable the TA account in Admin $\rightarrow$ + Users, then stop the stack. The laptop has no recurring cost. +\end{enumerate} + +\section{Limitations} +\label{sec:z-limits} +\begin{itemize} + \item Zammad runs on a laptop, not the Droplet: there is no public hostname, + TLS certificate, Caddy route, cloud-firewall check, or Prometheus/Grafana + panel for it. These were waived for local installs; no Droplet test is + claimed. + \item The laptop has 8~GB of RAM, below Zammad's recommendation, so the stack + runs with official memory-limit settings and a 512~MB Elasticsearch heap. + It is suitable for this lab, not for production load. + \item The service is only available while the laptop and Docker Desktop are + running, and the backups are on the same laptop. + \item No email channel is configured, so passwords were set administratively + and notifications are not sent. +\end{itemize} + +\fussy diff --git a/pricing/app.py b/pricing/app.py index a6dd3f0..b36fe2c 100644 --- a/pricing/app.py +++ b/pricing/app.py @@ -7,9 +7,12 @@ UNIT_PRICE = 12 COMMIT = os.environ.get("APP_COMMIT", "development") +QUANTITY_ERROR = "quantity must be a whole number between 1 and 1000" + + def total_price(quantity): if quantity < 1 or quantity > 1000: - raise ValueError("quantity must be between 1 and 1000") + raise ValueError(QUANTITY_ERROR) return UNIT_PRICE * quantity @@ -28,6 +31,6 @@ def price(): try: quantity = int(request.args.get("quantity", "1")) total = total_price(quantity) - except ValueError as error: - return jsonify(error=str(error)), 400 + except ValueError: + return jsonify(error=QUANTITY_ERROR), 400 return jsonify(quantity=quantity, total=total, currency="USD") diff --git a/pricing/test_app.py b/pricing/test_app.py index 669294b..c686b05 100644 --- a/pricing/test_app.py +++ b/pricing/test_app.py @@ -16,6 +16,13 @@ class PricingTests(unittest.TestCase): for value in ["0", "-1", "1001", "abc", "1.5"]: self.assertEqual(self.client.get("/price?quantity=" + value).status_code, 400) + def test_non_numeric_quantity_message(self): + # Ticket#63003 / issue #30: no Python internals in the error + response = self.client.get("/price?quantity=abc") + self.assertEqual(response.status_code, 400) + self.assertEqual(response.json["error"], + "quantity must be a whole number between 1 and 1000") + def test_release_identity(self): self.assertEqual(self.client.get("/").json["version"], "v2") self.assertEqual(self.client.get("/health").json["status"], "ok")