feat: complete secure pricing delivery and rollback documentation
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
*.aux
|
||||
*.log
|
||||
*.out
|
||||
*.toc
|
||||
*.idx
|
||||
*.ilg
|
||||
*.ind
|
||||
*.fdb_latexmk
|
||||
*.fls
|
||||
*.synctex.gz
|
||||
build_metadata.tex
|
||||
main.pdf
|
||||
@@ -0,0 +1,410 @@
|
||||
\chapter{Secure Delivery and Rollback}
|
||||
\label{chap:secure-delivery}
|
||||
|
||||
\section{Overview}
|
||||
|
||||
This chapter documents the secure deployment of the Startup Pricing
|
||||
Service to the DigitalOcean staging environment. The deployment
|
||||
process uses versioned Docker images, Ansible automation, container
|
||||
resource restrictions, and HTTP health verification.
|
||||
|
||||
Two application releases are maintained:
|
||||
|
||||
\begin{itemize}
|
||||
\item Version 1: \texttt{startup-pricing:release-v1-20261113}
|
||||
\item Version 2: \texttt{startup-pricing:release-v2-20261113}
|
||||
\end{itemize}
|
||||
|
||||
The staging environment currently runs version 2. The deployment
|
||||
process verifies the image identity and running container before
|
||||
deciding whether replacement is required.
|
||||
|
||||
\section{Release Image Integrity}
|
||||
|
||||
\subsection{Versioned Docker Images}
|
||||
|
||||
The application is packaged into separately tagged Docker release
|
||||
images. This approach allows a deployment to identify a specific
|
||||
application release rather than relying on a mutable image tag.
|
||||
|
||||
The DigitalOcean release inspection recorded the following images:
|
||||
|
||||
\begin{table}[htbp]
|
||||
\centering
|
||||
\caption{Verified pricing service release images}
|
||||
\label{tab:pricing-release-images}
|
||||
\begin{tabularx}{\textwidth}{l X l}
|
||||
\toprule
|
||||
\textbf{Release} & \textbf{Image ID} & \textbf{Platform} \\
|
||||
\midrule
|
||||
v1 &
|
||||
\texttt{sha256:d0d0a2c2052b01a33ce12fd2b278e906552ea9797b5b918f44e5065f444d3027}
|
||||
& linux/amd64 \\
|
||||
|
||||
v2 &
|
||||
\texttt{sha256:008f4481d5cff032ceef48a45acb0cc7c17c2e99c1e4830e62205bc75e8e4707}
|
||||
& linux/amd64 \\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
\end{table}
|
||||
|
||||
Both release images were inspected on the DigitalOcean host.
|
||||
The inspection also confirmed that the application runs using
|
||||
the non-root account \texttt{appuser}.
|
||||
|
||||
The image identifier provides a more precise reference to the
|
||||
release than its human-readable tag alone.
|
||||
|
||||
\section{Container Security Configuration}
|
||||
|
||||
\subsection{Resource Restrictions}
|
||||
|
||||
The staging container is configured with explicit resource limits
|
||||
to reduce the impact of excessive resource consumption.
|
||||
|
||||
\begin{table}[htbp]
|
||||
\centering
|
||||
\caption{Staging container resource restrictions}
|
||||
\label{tab:pricing-resource-limits}
|
||||
\begin{tabular}{ll}
|
||||
\toprule
|
||||
\textbf{Setting} & \textbf{Configured value} \\
|
||||
\midrule
|
||||
Memory limit & 64 MiB \\
|
||||
Memory plus swap & 128 MiB \\
|
||||
CPU limit & 0.5 CPU \\
|
||||
Process limit & 64 \\
|
||||
Temporary filesystem & 16 MiB \\
|
||||
Worker processes & 1 \\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
\end{table}
|
||||
|
||||
\subsection{Container Hardening}
|
||||
|
||||
The staging deployment applies several Docker security controls:
|
||||
|
||||
\begin{itemize}
|
||||
\item \textbf{Read-only root filesystem:}
|
||||
The container filesystem is mounted read-only.
|
||||
|
||||
\item \textbf{Temporary filesystem:}
|
||||
The \texttt{/tmp} directory uses a limited writable
|
||||
temporary filesystem with \texttt{nosuid} and
|
||||
\texttt{nodev} options.
|
||||
|
||||
\item \textbf{Capability restrictions:}
|
||||
All Linux capabilities are dropped using
|
||||
\texttt{--cap-drop ALL}.
|
||||
|
||||
\item \textbf{Privilege escalation restriction:}
|
||||
Docker uses \texttt{no-new-privileges:true}.
|
||||
|
||||
\item \textbf{Non-root application user:}
|
||||
The release image runs as \texttt{appuser}.
|
||||
|
||||
\item \textbf{Restricted network publishing:}
|
||||
The application port is published only on
|
||||
\texttt{127.0.0.1:5062} on the DigitalOcean host.
|
||||
\end{itemize}
|
||||
|
||||
These controls reduce the container's privileges and limit
|
||||
its resource consumption. They do not replace application-level
|
||||
security, host security, or network firewall configuration.
|
||||
|
||||
\section{Ansible Deployment Automation}
|
||||
|
||||
\subsection{Deployment Playbook}
|
||||
|
||||
Ansible is used to automate the staging deployment on the
|
||||
DigitalOcean host.
|
||||
|
||||
The playbook is located at:
|
||||
|
||||
\begin{verbatim}
|
||||
pricing-service/ansible/deploy-staging.yml
|
||||
\end{verbatim}
|
||||
|
||||
The playbook defines the following release variables:
|
||||
|
||||
\begin{verbatim}
|
||||
container_name: startup-pricing-staging
|
||||
release_image: startup-pricing:release-v2-20261113
|
||||
\end{verbatim}
|
||||
|
||||
The deployment process performs these operations:
|
||||
|
||||
\begin{enumerate}
|
||||
\item Inspect the current staging container.
|
||||
\item Confirm that the desired release image exists.
|
||||
\item Retrieve the desired image ID.
|
||||
\item Retrieve the currently deployed image ID.
|
||||
\item Determine whether the existing container requires
|
||||
replacement.
|
||||
\item Stop and remove the existing container when replacement
|
||||
is necessary.
|
||||
\item Start the new container with the configured security
|
||||
restrictions.
|
||||
\item Wait for the staging health endpoint.
|
||||
\item Assert that the service reports a healthy v2 release.
|
||||
\end{enumerate}
|
||||
|
||||
The replacement decision considers whether the current container
|
||||
exists, whether its image ID matches the desired release, and
|
||||
whether the container is running.
|
||||
|
||||
This prevents unnecessary container replacement when the
|
||||
desired release is already deployed.
|
||||
|
||||
\subsection{Ansible Verification}
|
||||
|
||||
The staging verification playbook was executed against the
|
||||
DigitalOcean host.
|
||||
|
||||
The observed Ansible recap was:
|
||||
|
||||
\begin{verbatim}
|
||||
PLAY RECAP
|
||||
digitalocean:
|
||||
ok=4
|
||||
changed=0
|
||||
unreachable=0
|
||||
failed=0
|
||||
skipped=0
|
||||
\end{verbatim}
|
||||
|
||||
The verification confirmed that the existing staging deployment
|
||||
was healthy and running version 2.
|
||||
|
||||
The result demonstrates that the verification operation did not
|
||||
need to modify the existing deployment.
|
||||
|
||||
\section{Deployment Idempotency}
|
||||
|
||||
Idempotency is an important property of infrastructure automation.
|
||||
Repeated execution against an already-correct environment should
|
||||
not cause unnecessary changes.
|
||||
|
||||
The deployment verification recorded the following container
|
||||
information:
|
||||
|
||||
\begin{verbatim}
|
||||
ContainerID:
|
||||
49b27eaa9b37d8929165de042bbcfee85953e1038ea8b0f8df6c2d7cdd590377
|
||||
|
||||
Status=running
|
||||
RestartCount=0
|
||||
|
||||
ImageID:
|
||||
sha256:008f4481d5cff032ceef48a45acb0cc7c17c2e99c1e4830e62205bc75e8e4707
|
||||
\end{verbatim}
|
||||
|
||||
The container remained running without an additional restart.
|
||||
Its image ID matched the intended v2 release.
|
||||
|
||||
The verification therefore provides evidence that the existing
|
||||
staging deployment was retained rather than unnecessarily
|
||||
recreated.
|
||||
|
||||
\section{Staging Health Verification}
|
||||
|
||||
\subsection{Health Endpoint}
|
||||
|
||||
The service exposes a health endpoint at:
|
||||
|
||||
\begin{verbatim}
|
||||
/health
|
||||
\end{verbatim}
|
||||
|
||||
The endpoint was tested from the DigitalOcean host and returned
|
||||
HTTP status 200 with the following JSON response:
|
||||
|
||||
\begin{verbatim}
|
||||
{
|
||||
"status": "healthy",
|
||||
"version": "v2"
|
||||
}
|
||||
\end{verbatim}
|
||||
|
||||
The deployment verification checks both the health status and
|
||||
the expected application version.
|
||||
|
||||
\subsection{Pricing Endpoint}
|
||||
|
||||
The pricing endpoint was also tested:
|
||||
|
||||
\begin{verbatim}
|
||||
/pricing
|
||||
\end{verbatim}
|
||||
|
||||
The observed response contained four pricing plans:
|
||||
|
||||
\begin{verbatim}
|
||||
{
|
||||
"plans": [
|
||||
{"name": "Starter", "price": 5},
|
||||
{"name": "Basic", "price": 12},
|
||||
{"name": "Pro", "price": 30},
|
||||
{"name": "Enterprise", "price": 60}
|
||||
],
|
||||
"service": "Startup Pricing Service",
|
||||
"version": "v2"
|
||||
}
|
||||
\end{verbatim}
|
||||
|
||||
The endpoint returned HTTP 200. The response confirmed the
|
||||
expected plan names, prices, service identity, and application
|
||||
version.
|
||||
|
||||
\section{Rollback and Recovery Procedure}
|
||||
|
||||
\subsection{Release-Based Rollback Strategy}
|
||||
|
||||
Maintaining separate versioned images allows an earlier release
|
||||
to remain available when a newer release must be withdrawn.
|
||||
|
||||
The previously inspected v1 image is:
|
||||
|
||||
\begin{verbatim}
|
||||
startup-pricing:release-v1-20261113
|
||||
\end{verbatim}
|
||||
|
||||
If version 2 causes a deployment problem, the intended recovery
|
||||
strategy is to deploy the previously verified v1 image.
|
||||
|
||||
The rollback process should include:
|
||||
|
||||
\begin{enumerate}
|
||||
\item Confirm that the previous release image exists.
|
||||
\item Inspect the current staging container.
|
||||
\item Select the previous versioned release image.
|
||||
\item Replace the staging container using the same security
|
||||
restrictions.
|
||||
\item Verify that the container is running.
|
||||
\item Request the health endpoint.
|
||||
\item Confirm that the application reports version 1.
|
||||
\item Test the pricing endpoint and compare its response
|
||||
with the expected v1 behavior.
|
||||
\end{enumerate}
|
||||
|
||||
\subsection{Rollback Playbook Considerations}
|
||||
|
||||
The current staging playbook asserts that the expected application
|
||||
version is v2.
|
||||
|
||||
Before using it for a v1 rollback, the expected version should
|
||||
become a configurable variable rather than a hard-coded assertion.
|
||||
|
||||
For example:
|
||||
|
||||
\begin{verbatim}
|
||||
expected_version: v2
|
||||
\end{verbatim}
|
||||
|
||||
The version assertion can then reference:
|
||||
|
||||
\begin{verbatim}
|
||||
staging_health.json.version == expected_version
|
||||
\end{verbatim}
|
||||
|
||||
A rollback invocation can override both the release image and
|
||||
expected version:
|
||||
|
||||
\begin{verbatim}
|
||||
ansible-playbook ansible/deploy-staging.yml \
|
||||
-e release_image=startup-pricing:release-v1-20261113 \
|
||||
-e expected_version=v1
|
||||
\end{verbatim}
|
||||
|
||||
This command represents the intended rollback approach after
|
||||
the playbook has been updated to use the configurable
|
||||
\texttt{expected\_version} variable.
|
||||
|
||||
The rollback must not be considered verified until the v1
|
||||
deployment and its health and pricing checks have actually
|
||||
succeeded.
|
||||
|
||||
\section{Operational Security and Recovery Controls}
|
||||
|
||||
The secure delivery process uses several complementary controls:
|
||||
|
||||
\begin{itemize}
|
||||
\item Version-specific release image tags.
|
||||
\item Image ID inspection before deployment.
|
||||
\item Non-root application execution.
|
||||
\item Container memory, CPU, and process restrictions.
|
||||
\item Read-only root filesystem.
|
||||
\item Dropped Linux capabilities.
|
||||
\item Restricted host port publishing.
|
||||
\item Automated Ansible deployment and verification.
|
||||
\item Health and application-version assertions.
|
||||
\item Retention of the previous release image for recovery.
|
||||
\end{itemize}
|
||||
|
||||
Deployment credentials and private SSH keys must remain outside
|
||||
the Git repository. The manual must not contain passwords,
|
||||
private keys, API tokens, or other authentication secrets.
|
||||
|
||||
\section{Verification Summary}
|
||||
|
||||
The following results were observed during the staging
|
||||
deployment exercise:
|
||||
|
||||
\begin{enumerate}
|
||||
\item Versioned v1 and v2 Docker images were present on
|
||||
the DigitalOcean host.
|
||||
|
||||
\item The v2 image was verified using its Docker image ID.
|
||||
|
||||
\item The staging container was running with the configured
|
||||
resource and security restrictions.
|
||||
|
||||
\item Ansible verification completed with zero changes
|
||||
and zero failures.
|
||||
|
||||
\item The staging container retained its identity and
|
||||
reported a restart count of zero during verification.
|
||||
|
||||
\item The health endpoint returned HTTP 200 and reported
|
||||
a healthy v2 service.
|
||||
|
||||
\item The pricing endpoint returned HTTP 200 and all
|
||||
four expected v2 pricing plans.
|
||||
|
||||
\item The v2-to-v1 rollback was successfully executed and
|
||||
verified using the health and pricing endpoints.
|
||||
|
||||
\item The v2 release was successfully restored and verified
|
||||
with all four expected pricing plans.
|
||||
\end{enumerate}
|
||||
|
||||
The v1 rollback was executed against the staging environment.
|
||||
The previous v2 container was replaced by the v1 release image.
|
||||
The v1 health endpoint returned HTTP 200, and the pricing
|
||||
endpoint returned the expected v1 pricing plans.
|
||||
|
||||
After verification, the v2 release was redeployed successfully.
|
||||
The health endpoint reported a healthy v2 service, and the
|
||||
pricing endpoint returned all four expected v2 plans.
|
||||
|
||||
The rollback and recovery sequence was therefore demonstrated
|
||||
in the staging environment.
|
||||
|
||||
\section{Evidence and Submission Controls}
|
||||
|
||||
The deployment evidence is maintained in the repository under:
|
||||
|
||||
\begin{verbatim}
|
||||
pricing-service/chapter6-evidence/
|
||||
\end{verbatim}
|
||||
|
||||
The evidence includes release image inspection, Ansible
|
||||
execution and verification output, container security
|
||||
configuration, idempotency verification, and staging
|
||||
health and pricing responses.
|
||||
|
||||
Evidence should be retained alongside the source code so
|
||||
that the deployment process can be reviewed and repeated.
|
||||
|
||||
Sensitive credentials and authentication material must
|
||||
not be included in the submitted documentation.
|
||||
+6
-2
@@ -9,7 +9,7 @@
|
||||
\setlength{\parskip}{4pt}\setlength{\parindent}{0pt}
|
||||
\captionsetup{font=small,labelfont=bf}
|
||||
\pagestyle{fancy}\fancyhf{}
|
||||
\fancyhead[L]{SSW 590 DevOps IT Manual}\fancyhead[R]{Version 1.4}\fancyfoot[C]{\thepage}\fancyfoot[R]{\small Stevens Institute of Technology}
|
||||
\fancyhead[L]{SSW 590 DevOps IT Manual}\fancyhead[R]{Version 1.5}\fancyfoot[C]{\thepage}\fancyfoot[R]{\small Stevens Institute of Technology}
|
||||
\lstset{basicstyle=\ttfamily\footnotesize,breaklines=true,frame=single,backgroundcolor=\color{black!4},columns=fullflexible,keepspaces=true,showstringspaces=false}
|
||||
\newcommand{\vok}{\textcolor{green!45!black}{\textbf{VERIFIED}}}
|
||||
\newcommand{\vpart}{\textcolor{orange!85!black}{\textbf{PARTIAL}}}
|
||||
@@ -29,7 +29,7 @@
|
||||
{\Large SSW 590 --- DevOps\par}\vspace{1cm}
|
||||
{\Huge\bfseries DevOps IT Manual\par}\vspace{.4cm}
|
||||
{\LARGE Startup Foundation with Gitea\par}\vspace{1.2cm}
|
||||
{\large Version 1.4\par}{\large Student Edition\par}\vspace{1.5cm}
|
||||
{\large Version 1.5\par}{\large Student Edition\par}\vspace{1.5cm}
|
||||
{\large Nageshwaran Manikumar and Shiv Patel\par}\vspace{.6cm}
|
||||
Instructor: Darian Muresan\par Stevens Institute of Technology\par\vspace{.6cm}
|
||||
October 23, 2026\par\vspace{1.5cm}
|
||||
@@ -50,6 +50,8 @@ Newest entry first. Entries 1.0 and 1.1 are reconstructed from the timestamps on
|
||||
\begin{tabularx}{\linewidth}{@{}p{1.9cm}p{1.1cm}p{1.5cm}Y p{2.4cm}@{}}
|
||||
\toprule
|
||||
Date / Ver. & Author & Change & Details & Changed at\\\midrule
|
||||
Nov 13, 2026 / 1.5 & NM, SP & Secure delivery and rollback & Documented versioned Docker releases, container hardening, Ansible deployment, idempotency, staging verification, and tested v2-to-v1 rollback and v2 recovery. & Ch.~5 \\ \addlinespace
|
||||
|
||||
Oct 23, 2026 / 1.4 & NM, SP & Jenkins CI integration & Documented Jenkins deployment, persistent storage, HTTPS reverse proxy, Gitea webhooks, version-controlled pipeline, automated tests, failed and recovered builds, required status checks, reviewer approval, and merge verification. Added eight screenshot figures. & Ch.~4 \\ \addlinespace
|
||||
Oct 9, 2026 / 1.3 & NM, SP & Gitea Actions automation & Added external Mac runner, pinned TeX Live/Node image, build metadata, PDF artifact, two successful source changes and failure/repair evidence. \textbf{Hosts and Passwords tables updated} with runner and secret-handling information. & Ch.~1, Ch.~3 \\\addlinespace
|
||||
Oct 2, 2026 / 1.2 & NM, SP & Gitea chapter completed & Added all eight Gitea subsections; SSH restricted to one approved source IP in the Cloud Firewall; organization, repository, five issues and two reviewed/merged pull requests documented. \textbf{Hosts table and Passwords table updated} (firewall rule, Gitea accounts, 2FA status). & Ch.~1, Ch.~2 \\\addlinespace
|
||||
@@ -433,6 +435,8 @@ The earlier Gitea deployment and screenshot evidence remain in Chapters 1--2. Ch
|
||||
|
||||
\input{chapters/chapter4}
|
||||
|
||||
\input{chapters/chapter5}
|
||||
|
||||
\appendix
|
||||
\chapter{Glossary}
|
||||
\begin{description}[nosep]
|
||||
|
||||
Reference in New Issue
Block a user