Add DevOps IT manual LaTeX source

This commit is contained in:
2026-10-08 23:35:08 -04:00
parent c6decd1f08
commit 45dfb9b7ed
44 changed files with 4740 additions and 0 deletions
+349
View File
@@ -0,0 +1,349 @@
\chapter{Jenkins/CI}
\ChapterLabel{JenkinsCI}
\section{Student Pack domain and DNS}
The team claimed a domain through the Namecheap offer in the GitHub
Student Developer Pack, which provides one \texttt{.me} domain free for
the first year, including an SSL certificate, through the GitHub
Education-linked signup flow.
\begin{description}
\item[Domain offer:] Namecheap, via GitHub Student Developer Pack
(\texttt{education.github.com/pack/offers}).
\item[Eligibility:] requires an approved GitHub Student Developer Pack
account, verified with a Stevens \texttt{.edu} email.
\item[Domain registered:] \texttt{ssw590-08}
\item[First-year cost:] \$0 (covered by the Student Pack offer).
\item[Renewal cost:] \texttt{\$14.16 I believe}
\item[Expiration / renewal date:] \texttt{10/01/2027}
\item[Tracking renewal:] the renewal date is recorded here and in the
team's Hosts table; Namecheap also sends automatic renewal-reminder
emails to the account on file. A future team member should check the
Hosts table entry and the Namecheap account directly rather than
assume the domain renews automatically without payment.
\end{description}
\textbf{Gitea hostname:} \texttt{git.ssw590-08.me} -- chosen as the
subdomain for the team's Gitea instance.
\textbf{DNS configuration:} an A record was created in Namecheap's
Advanced DNS panel for the domain:
\begin{figure}[H]
\centering
\includegraphics[width=1\linewidth]{HW4 images/Screenshot 2026-10-01 230752.png}
\caption{Namecheap's Advanced DNS panel}
\label{fig:dns}
\end{figure}
\begin{center}
\begin{tabular}{llll}
\toprule
Type & Host & Value & TTL \\
\midrule
A & git & 147.182.179.191 & Automatic \\
\bottomrule
\end{tabular}
\end{center}
\textbf{Independent lookup verification:} resolution of the hostname was
confirmed from a machine independent of the Droplet itself using
\texttt{nslookup git.git.ssw590-08.me}, returning the expected Droplet IP
address.
\begin{figure}[H]
\centering
\includegraphics[width=1\linewidth]{HW4 images/Screenshot 2026-10-01 230957.png}
\caption{nslookup}
\label{fig:domain}
\end{figure}
\textbf{HTTPS hostname link:} \texttt{https://git.ssw590-08.me/}.
\section{Pinned Gitea Deployment}
Gitea was deployed on the team's DigitalOcean Droplet using Docker
Compose, with a pinned, recorded image version rather than a floating
\texttt{latest} tag.
\begin{description}
\item[Droplet:] Droplet plan/size: RAM 512GB, Disk 10GB; Region: NYC1; OS: Ubuntu 24.04 (LTS) x64; Basic \$4/mo plan
\item[Docker installation:] Docker Engine and the Compose plugin were
installed from Docker's official APT repository (rather than the
Ubuntu-default \texttt{docker.io} package, which does not include
\texttt{docker compose}).
\item[Gitea image:] \texttt{gitea/gitea: 1.26.4 8e25c717b8f7 245MB 69.3MB U}
\item[Restart policy:] \texttt{restart: unless-stopped}, so the
container recovers automatically after a Droplet reboot.
\item[Persistent mount:] a named Docker volume (\texttt{gitea-data})
mounted to \texttt{/data} inside the container -- this is what
survives container replacement, independent of the container's own
disposable filesystem layer.
\item[Proxy connection:] Gitea now sits behind a reverse proxy
terminating HTTPS at \url{https://git.ssw590-08.me/}; the Gitea
backend (port 3000) is no longer directly reachable from the public
internet -- verified by confirming
\texttt{http://147.182.179.191:3000} is no longer publicly
accessible.
\end{description}
\textbf{Redacted Compose excerpt:}
\begin{verbatim}
services:
gitea:
image: gitea/gitea: 1.26.4 8e25c717b8f7 245MB 69.3MB U
container_name: gitea
restart: unless-stopped
environment:
- USER_UID=1000
- USER_GID=1000
# SQLite is Gitea's default database, so no DB-related env vars are
# required here.
- GITEA__server__ROOT_URL=http://[DROPLET_IP]:3000/
# reverse proxy are in place. Gitea uses this value to
# generate links, so it must match how users actually reach the site.
volumes:
- gitea-data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000" # web UI -- will move behind the reverse proxy later
- "222:22" # git-over-SSH (optional; remove if you won't use it)
volumes:
gitea-data:
# Named volume -- this is what survives "docker compose down/up" and
# is the basis of the persistence test the rubric requires.
\end{verbatim}
\textbf{Reproducing this deployment:} another team could repeat this
installation by provisioning a Droplet with Docker installed, copying
this Compose file, substituting their own hostname/IP into
\texttt{http://147.182.179.191:3000/}, and running \texttt{docker compose up -d}. No
manual configuration file editing is required beyond that substitution.
\begin{figure}[H]
\centering
\includegraphics[width=1\linewidth]{HW4 images/Screenshot 2026-10-01 233750.png}
\caption{10/01/26 docker compose ps with Gitea container running}
\label{fig:dockercompose}
\end{figure}
\section{Database and Persistence}
The team selected \textbf{SQLite} (Gitea's built-in default database)
rather than a separate PostgreSQL container. This choice was made given
the team's limited prior Docker/Linux experience -- SQLite requires no
separate database service, no database credentials to manage, and no
private network configuration between containers, while still being
explicitly named in the assignment as a reasonable choice for a small
student team.
The SQLite database file resides inside the \texttt{gitea-data} named
volume (under \texttt{/data} in the container), which is mounted outside
the container's disposable filesystem layer -- confirmed by the
persistence test below. No database service or public database port is
exposed, since SQLite requires none.
\textbf{Persistence test:}
\begin{enumerate}
\item Created a test repository and one test issue in Gitea. \\
Repository:SSW-590\; Issue: \#1 Test issue \#1.
\item Ran \texttt{docker compose down}, followed by
\texttt{docker compose up -d}, from the \texttt{\textasciitilde/gitea}
directory containing the Compose file. This destroys and recreates
the Gitea container itself while leaving the named volume untouched.
\item Refreshed the Gitea web interface and confirmed the test
repository and issue were still present and unchanged.
\end{enumerate}
\textbf{Conclusion:} the container replacement did not affect stored
data, confirming that Gitea's application data (repository metadata,
issues, and the SQLite database file) persists independently of the
container lifecycle, as intended by the named-volume configuration.
\begin{figure}[H]
\centering
\includegraphics[width=1\linewidth]{HW4 images/Screenshot 2026-10-01 222503.png}
\caption{10/01/26 Before docker compose down}
\label{fig:before}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=1\linewidth]{HW4 images/Screenshot 2026-10-01 222539.png}
\caption{10/01/26 After docker compose down}
\label{fig:after}
\end{figure}
\section{HTTPS/certificate}
A custom domain, \texttt{git.ssw590-08.me}, was configured
to provide secure access to the Gitea server hosted on
DigitalOcean. A DNS A record was created to point the
domain to the Droplet's public IP address.
Caddy was deployed as a Docker container and configured
as a reverse proxy to forward HTTPS requests to the
Gitea service on the internal Docker network. Caddy
automatically provisions and renews TLS certificates
and redirects HTTP requests to HTTPS.
The Gitea configuration was updated to use
\texttt{https://git.ssw590-08.me/} as its root URL.
The HTTPS configuration was verified by accessing the
Gitea website through a browser, checking the TLS
certificate, and testing the HTTP-to-HTTPS redirect.
\begin{figure}[H]
\centering
\includegraphics[width=1\linewidth]{HW4 images/https-proof.png}
\caption{Showcase of Gitea running on HTTPS}
\label{fig:https}
\end{figure}
There was a major blockage in setting up the HTTPS which was linked back to an issue in setting up the YML file. After reviewing and debugging the config.yml, the HTTPS was able to launch at the needed port.
\section{Firewall/exposure}
The DigitalOcean firewall was configured to allow
inbound TCP traffic on ports 80 and 443 for HTTP
and HTTPS access. Port 222 was retained for Git
SSH access, while port 22 was used for Droplet
administration.
Caddy was configured to expose ports 80 and 443
and act as the public entry point for the Gitea
web interface. The Gitea web port, 3000, was
removed from public port publishing and remained
accessible internally through the Docker network.
The firewall configuration and Docker port mappings
were verified to ensure that web traffic was routed
through Caddy rather than directly to Gitea.
\begin{figure}[H]
\centering
\includegraphics[width=1\linewidth]{HW4 images/docker-running.png}
\caption{Docker showcasing reverse proxy confirmation}
\label{fig:reverse-proxy}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=1\linewidth]{HW4 images/firewall-ports.png}
\caption{Terminal Showing exposed ports from firewall}
\label{fig:firewall}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=1\linewidth]{HW4 images/shh-verification.png}
\caption{SSH Key working for Gitea}
\label{fig:ssh}
\end{figure}
For this portion, dealing with the SSH key proved trickier than expected. Gitea and GitHub use different SSH keys and therefore cannot be used in both scenarios. A new SSH key had to be generated for Gitea and connected before firewall connection could be tested.
\section{Startup team workflow}
\begin{description}
\item[Organization:] \url{https://git.ssw590-08.me/SSW-590-08}
\item[Product repository:] \url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web}
\begin{figure}[H]
\centering
\includegraphics[width=1\linewidth]{HW4 images/Screenshot 2026-10-02 235122.png}
\caption{README.md}
\label{fig:readme}
\end{figure}
\end{description}
\begin{figure}[H]
\centering
\includegraphics[width=1\linewidth]{HW4 images/Screenshot 2026-10-02 235020.png}
\caption{Issues}
\label{fig:issues1}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=1\linewidth]{HW4 images/Screenshot 2026-10-02 235009.png}
\caption{Issues}
\label{fig:issues2}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=1\linewidth]{HW4 images/Screenshot 2026-10-02 234535.png}
\caption{Issue \#1}
\label{fig:issue-one}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=1\linewidth]{HW4 images/Screenshot 2026-10-02 233510.png}
\caption{Issue \#5}
\label{fig:issue-five}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=1\linewidth]{HW4 images/Screenshot 2026-10-02 234912.png}
\caption{Team Members}
\label{fig:team}
\end{figure}
\section{Architecture and operation}
\textbf{End-to-end request and data path:} a browser reaches
\url{https://git.ssw590-08.me/}, which resolves to the Droplet and is
received by the reverse proxy on port 443. The proxy terminates HTTPS
and forwards the request internally to the Gitea container on port
3000, which is no longer directly reachable from outside the Droplet.
Gitea reads and writes its application data, including the SQLite
database file, to the \texttt{gitea-data} named Docker volume, mounted
to \texttt{/data} inside the container. Git repository data and Gitea's
internal database share this same persistent volume; neither lives
inside the container's own disposable filesystem layer.
\textbf{Where data lives:} entirely inside the \texttt{gitea-data}
named volume on the Droplet's disk, independent of the Gitea
container's lifecycle. This was directly verified in Section 3's
persistence test: destroying and recreating the container left the
volume, and therefore all repository and database contents, untouched.
\textbf{Public vs.\ private interfaces:} the DigitalOcean Cloud
Firewall allows inbound TCP traffic on four ports: 443 (HTTPS, the
public entry point via Caddy), 80 (HTTP, used for the redirect to
HTTPS), 22 (Droplet administration/SSH), and 222 (Git-over-SSH). Caddy
is configured to expose only ports 80 and 443 and acts as the sole
public entry point for the Gitea web interface. Gitea's own web port,
3000, has been removed from Docker's public port publishing entirely
and is reachable only internally over the Docker network -- it is not
listed in the Cloud Firewall because it is not exposed to the host's
public network interface at all. This was verified by confirming that
web traffic reaches Gitea only through Caddy, not directly on port
3000, and that the firewall rules and Docker port mappings agree with
each other.
\textbf{Restart and troubleshooting:} the operational restart procedure
is: \texttt{cd \textasciitilde/gitea \&\& docker compose down \&\&
docker compose up -d}. The team has run this procedure directly (as
part of the Section 3 persistence test), confirming Gitea comes back up
with all data intact. For troubleshooting, \texttt{docker compose ps}
shows container status, and \texttt{docker compose logs gitea} surfaces
application logs if the container fails to start or behaves
unexpectedly.
\textbf{Persistence test vs.\ backup/restore -- explicitly
distinguished:} the Section 3 test confirms data survives
\emph{container replacement on the same Droplet, using the same
volume}. It does not prove data could be recovered if that volume, or
the Droplet itself, were lost -- that would require a separate copy of
the data stored elsewhere (a true backup), which has not been performed
and is not required by this assignment's base rubric (it is covered
instead by the optional extra-credit backup/restore task, not attempted
here).
\begin{figure}[H]
\centering
\includegraphics[width=0.8\linewidth]{HW4 images/gitea-architecture-diagram.png}
\caption{Architecture Diagram}
\label{fig:arch}
\end{figure}