Build the complete Assignment 5 manual on trusted branch pushes
Assignment 5 manual PDF / manual (push) Successful in 47s
Assignment 5 manual PDF / manual (push) Successful in 47s
This commit is contained in:
parent
fa9a32f8a9
commit
c74087a93b
@@ -0,0 +1,719 @@
|
||||
\chapter{Startup Foundation with Gitea}
|
||||
\ChapterLabel{GiteaStartupFoundation}
|
||||
\index{Gitea}
|
||||
\index{Docker!Gitea deployment}
|
||||
\index{SQLite}
|
||||
\index{persistent storage}
|
||||
\index{DNS}
|
||||
\index{HTTPS}
|
||||
\index{ACME}
|
||||
\index{Caddy}
|
||||
\index{certificate renewal}
|
||||
\index{Cloud Firewall}
|
||||
\index{Docker volume}
|
||||
\index{GitHub Student Developer Pack}
|
||||
\index{pull request}
|
||||
\index{SSH}
|
||||
\index{TLS}
|
||||
|
||||
\section{Student Pack Domain and DNS}
|
||||
On September 29, 2026, the team secured
|
||||
\href{https://myfileagent.tech}{\texttt{myfileagent.tech}} through
|
||||
\texttt{.TECH domains} using the
|
||||
\href{https://education.github.com/pack}{GitHub Student Developer Pack}. The
|
||||
team confirmed its eligible Pack account; the published offer provides one
|
||||
standard \texttt{.TECH} domain free for one year. The registrar listed renewal
|
||||
at \$29.99 per year. Nick owns the renewal task, disabled automatic renewal,
|
||||
and recorded the September 29, 2027 expiration date. These non-secret terms
|
||||
are recorded here without reproducing registrar account details.
|
||||
|
||||
The public \phantomsection\label{AcronymRef:DNS}DNS A record maps
|
||||
\texttt{myfileagent.tech} to the Droplet IPv4
|
||||
address \texttt{142.93.193.110}. An independently timed Windows lookup returned
|
||||
that address, plain \phantomsection\label{AcronymRef:HTTP}HTTP returned
|
||||
\texttt{308 Permanent Redirect} to the same hostname over
|
||||
\phantomsection\label{AcronymRef:HTTPS}HTTPS, and HTTPS returned
|
||||
\texttt{200 OK} through Caddy.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.68\textwidth]{hw4_images/domain_http_evidence.png}
|
||||
\caption{Dated independent DNS and HTTP evidence showing the public A record,
|
||||
Caddy's HTTP-to-HTTPS redirect, and a successful HTTPS response.}
|
||||
\label{fig:domain-http-evidence}
|
||||
\end{figure}
|
||||
|
||||
\FloatBarrier
|
||||
|
||||
\section{Pinned Gitea Deployment}
|
||||
On September 26, 2026, the team established a deployment of
|
||||
\phantomsection\label{GlossaryRef:gitea}Gitea. It runs on
|
||||
\texttt{ssw590-group7-droplet}. The deployment uses the official rootless
|
||||
Gitea image following the official container guidance
|
||||
\cite{GiteaDockerRootless}, and the official Caddy image from Docker Hub
|
||||
\cite{CaddyDockerImage}. The exact pinned images and recorded digests are:
|
||||
|
||||
\begin{minted}{text}
|
||||
gitea_image=docker.gitea.com/gitea:1.27.3-rootless
|
||||
gitea_digest=sha256:1c17ecaead42eb3b5391553d8708103a4beb0e86edf5b9ebc1eb269c318845f2
|
||||
caddy_image=caddy:2.11.4-alpine
|
||||
caddy_digest=sha256:6aeddd44c3078b0f9a35206472a11420648a79c184603ef95957d0a20044cb2b
|
||||
\end{minted}
|
||||
|
||||
The minimal definition consists of a versioned \texttt{compose.yaml}
|
||||
and \texttt{Caddyfile}. The Gitea and Caddy services use
|
||||
\texttt{restart: unless-stopped}; Git-over-\phantomsection\label{AcronymRef:SSH}SSH
|
||||
is disabled.
|
||||
|
||||
The non-secret deployment files are versioned in the MyFileAgent repository as
|
||||
\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/main/ops/gitea/compose.yaml}{\texttt{ops/gitea/}\allowbreak\texttt{compose.yaml}}
|
||||
and
|
||||
\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/main/ops/gitea/Caddyfile}{\texttt{ops/gitea/}\allowbreak\texttt{Caddyfile}}.
|
||||
The team verified the current public files after activation. The initial
|
||||
Compose definition and Caddyfile were recorded by these commits, with later
|
||||
commits preserving their version history:
|
||||
|
||||
\begin{minted}{text}
|
||||
compose_commit=533ddfb38aaefaa36fbd130695b2e1adf566e822
|
||||
caddyfile_commit=11ac824a326d40fdce71642cd37e2543b9eea12c
|
||||
\end{minted}
|
||||
|
||||
The
|
||||
following sanitized excerpt records the reproducible service, mount, port, and
|
||||
network choices without credentials:
|
||||
|
||||
\begin{minted}{yaml}
|
||||
name: myfileagent-gitea
|
||||
|
||||
services:
|
||||
caddy:
|
||||
image: caddy:2.11.4-alpine
|
||||
container_name: myfileagent-caddy
|
||||
restart: unless-stopped
|
||||
profiles: [https]
|
||||
ports: ["80:80", "443:443"]
|
||||
volumes:
|
||||
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
||||
- caddy-data:/data
|
||||
- caddy-config:/config
|
||||
networks: [edge, gitea-private]
|
||||
|
||||
gitea:
|
||||
image: docker.gitea.com/gitea:1.27.3-rootless
|
||||
container_name: myfileagent-gitea
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
GITEA__database__DB_TYPE: sqlite3
|
||||
GITEA__database__PATH: /var/lib/gitea/data/gitea.db
|
||||
GITEA__server__DOMAIN: "${GITEA_DOMAIN:-myfileagent.tech}"
|
||||
GITEA__server__ROOT_URL: "${GITEA_ROOT_URL:-https://myfileagent.tech/}"
|
||||
GITEA__server__DISABLE_SSH: "true"
|
||||
GITEA__service__DISABLE_REGISTRATION: "true"
|
||||
ports: ["127.0.0.1:3000:3000"]
|
||||
volumes:
|
||||
- gitea-data:/var/lib/gitea
|
||||
- gitea-config:/etc/gitea
|
||||
networks: [gitea-private]
|
||||
\end{minted}
|
||||
|
||||
From a directory containing those two files, another authorized operator can
|
||||
reproduce the current deployment with:
|
||||
|
||||
\begin{minted}{bash}
|
||||
docker compose pull
|
||||
docker compose --profile https up -d
|
||||
docker compose ps
|
||||
\end{minted}
|
||||
|
||||
Host port 3000 remains bound only to the
|
||||
\phantomsection\label{GlossaryRef:loopback}loopback interface as
|
||||
\texttt{127.0.0.1:3000}. An external connection attempt to public port 3000
|
||||
failed as expected, while a request from the Droplet to
|
||||
\texttt{http://127.0.0.1:3000/} returned HTTP 200. Public requests now terminate
|
||||
at Caddy on ports 80 and 443 and traverse the private Compose network to
|
||||
\texttt{gitea:3000}; the backend itself is never published publicly.
|
||||
|
||||
\section{Database and Persistence}
|
||||
The team selected \phantomsection\label{GlossaryRef:sqlite}SQLite because this
|
||||
is a small two-person course deployment and it avoids an unnecessary database
|
||||
service and network port. Gitea stores its database at
|
||||
\path{/var/lib/gitea/data/gitea.db}. The Docker-managed
|
||||
\phantomsection\label{GlossaryRef:dockervolume}volumes
|
||||
\texttt{myfileagent-gitea\_gitea-data} and
|
||||
\texttt{myfileagent-gitea\_gitea-config} persist application data and
|
||||
configuration outside the disposable container layer.
|
||||
|
||||
The team completed that replacement test on September 26, 2026 from
|
||||
19:52:28 to 19:53:44 UTC. The exact before and after identifiers were:
|
||||
|
||||
\begin{minted}{text}
|
||||
before_id=b0b377f252218b9495028307532d3529cd10c153dc18d3187470795b542618a8
|
||||
after_id=186dbfeaf4d21609d8fa0b98741945844c69fc4a2d35d074935508ea0b008b48
|
||||
\end{minted}
|
||||
|
||||
Before replacement, the first container served the MyFileAgent product
|
||||
repository and open Issue~\#2,
|
||||
``Implement validation that permits file operations only within the configured
|
||||
demonstration directory and rejects traversal or out-of-scope paths.'' The
|
||||
team then ran:
|
||||
|
||||
\begin{minted}{bash}
|
||||
docker compose up -d --force-recreate --no-deps gitea
|
||||
\end{minted}
|
||||
|
||||
The replacement container had the distinct after identifier shown above. The
|
||||
same repository and open issue remained available, and the command record
|
||||
reported \texttt{container\_replaced=PASS}. Both named volumes remained
|
||||
mounted at \texttt{/var/lib/gitea} and \texttt{/etc/gitea}. Therefore the
|
||||
repository, issue metadata, and configuration survived because their state was
|
||||
stored in persistent volumes rather than the replaced container layer.
|
||||
|
||||
\begin{figure}[htbp]
|
||||
\centering
|
||||
\includegraphics[width=0.9\textwidth]{gitea_persistence_evidence.png}
|
||||
\caption{Dated container-replacement evidence showing distinct before and
|
||||
after container identifiers, the surviving MyFileAgent repository and Issue
|
||||
\#2, a PASS result, and both persistent volume mounts.}
|
||||
\label{fig:gitea-persistence-evidence}
|
||||
\end{figure}
|
||||
|
||||
\FloatBarrier
|
||||
|
||||
This test verifies container-replacement persistence only; it is not a backup
|
||||
or restore test.
|
||||
|
||||
\section{HTTPS and Certificate Renewal}
|
||||
The team selected Caddy as the \phantomsection\label{GlossaryRef:reverseproxy}
|
||||
reverse proxy and public \phantomsection\label{GlossaryRef:tls}
|
||||
\phantomsection\label{AcronymRef:TLS}TLS termination
|
||||
point. Caddy accepts public HTTPS and forwards private HTTP to
|
||||
\texttt{gitea:3000} by Compose service name on the private
|
||||
\texttt{gitea-private} network. Gitea never needs to publish its backend port
|
||||
to the public interface. Caddy publishes ports 80 and 443 through the enabled
|
||||
\texttt{https} profile. Its certificate and runtime state persist in the
|
||||
\texttt{caddy-data} and \texttt{caddy-config} volumes.
|
||||
|
||||
The team compared Let's Encrypt and ZeroSSL, two publicly trusted ACME
|
||||
certificate authorities supported by automated clients. Let's Encrypt was
|
||||
selected because it provides free automated certificates without requiring a
|
||||
paid plan and is the option recommended by the assignment. The Caddyfile pins
|
||||
the Let's Encrypt production ACME directory. Caddy's
|
||||
\phantomsection\label{GlossaryRef:acme}\phantomsection\label{AcronymRef:ACME}ACME
|
||||
automation obtained the production
|
||||
certificate, manages renewal, and adds the HTTP-to-HTTPS redirect
|
||||
\cite{CaddyAutomaticHTTPS}.
|
||||
|
||||
The production proxy configuration selects the Let's Encrypt production ACME
|
||||
directory and routes by Compose service name over the private network:
|
||||
|
||||
\begin{minted}{text}
|
||||
{
|
||||
acme_ca https://acme-v02.api.letsencrypt.org/directory
|
||||
}
|
||||
|
||||
{$GITEA_HOSTNAME} {
|
||||
reverse_proxy gitea:3000
|
||||
}
|
||||
\end{minted}
|
||||
|
||||
The Compose file defaults Gitea's \texttt{DOMAIN} to
|
||||
\texttt{myfileagent.tech} and \texttt{ROOT\_URL} to
|
||||
\texttt{https://myfileagent.tech/}. The live public repository is
|
||||
available through the
|
||||
\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline}{MyFileAgent product-repository link}.
|
||||
|
||||
\paragraph{Activation and rollback.}
|
||||
After the team confirmed the A record and firewall rules, it activated the
|
||||
versioned deployment with the \texttt{https} profile:
|
||||
|
||||
\begin{minted}{bash}
|
||||
cd /home/codex/myfileagent-gitea
|
||||
docker compose --profile https config --quiet
|
||||
docker compose --profile https up -d
|
||||
\end{minted}
|
||||
|
||||
The activation preserved all four named volumes. If public access fails, the
|
||||
bounded recovery path preserves data and stops only the proxy while operators
|
||||
test the loopback service:
|
||||
|
||||
\begin{minted}{bash}
|
||||
cd /home/codex/myfileagent-gitea
|
||||
docker compose --profile https stop caddy
|
||||
docker compose up -d gitea
|
||||
curl -fsS -o /dev/null -w 'loopback_http=%{http_code}\n' \
|
||||
http://127.0.0.1:3000/
|
||||
\end{minted}
|
||||
|
||||
\paragraph{Validation and observed production result.}
|
||||
The team validated the merged Compose model and Caddyfile before activation,
|
||||
then verified the live endpoint after activation \cite{CaddyCommandLine}:
|
||||
|
||||
\begin{minted}{bash}
|
||||
cd /home/codex/myfileagent-gitea
|
||||
docker compose --profile https config --quiet
|
||||
docker exec myfileagent-caddy caddy validate \
|
||||
--config /etc/caddy/Caddyfile --adapter caddyfile
|
||||
\end{minted}
|
||||
|
||||
The production certificate has subject \texttt{CN=myfileagent.tech}, issuer
|
||||
\texttt{Let's Encrypt E1}, a September 29, 2026 start date, and a December 28,
|
||||
2026 expiration date. Figure~\ref{fig:domain-certificate-evidence} records
|
||||
those fields and its thumbprint; Figure~\ref{fig:domain-http-evidence} records
|
||||
the redirect and successful HTTPS response.
|
||||
|
||||
\begin{figure}[htbp]
|
||||
\centering
|
||||
\includegraphics[width=\textwidth]{hw4_images/domain_evidence.png}
|
||||
\caption{Production certificate evidence showing the MyFileAgent hostname,
|
||||
Let's Encrypt issuer, validity interval, and certificate thumbprint.}
|
||||
\label{fig:domain-certificate-evidence}
|
||||
\end{figure}
|
||||
|
||||
Caddy automatically obtains, stores, and renews managed certificates and
|
||||
creates the HTTP redirect \cite{CaddyAutomaticHTTPS}. Caddy does not document
|
||||
a Certbot-style \texttt{renew --dry-run} command. The team therefore tested
|
||||
the same automation path with a temporary \texttt{acme-test.myfileagent.tech}
|
||||
A record and Let's Encrypt staging directory. The first attempts occurred
|
||||
before public DNS propagation and reported that no record existed. The team
|
||||
confirmed the A record through the \texttt{1.1.1.1} and \texttt{8.8.8.8}
|
||||
resolvers, retried, and observed multiple external HTTP-01 requests, a valid
|
||||
authorization, and \texttt{certificate obtained successfully}. It then removed
|
||||
the temporary Caddy block and DNS record and reconfirmed production HTTPS 200.
|
||||
This is recorded as a successful staging automation exercise, not as a claim
|
||||
that the production certificate was forcibly renewed.
|
||||
|
||||
\begin{figure}[htbp]
|
||||
\centering
|
||||
\includegraphics[width=\textwidth]{hw4_images/caddy_renewal_test_evidence.png}
|
||||
\caption{Dated Caddy ACME staging evidence showing renewal information,
|
||||
successful certificate acquisition for the temporary test hostname, and a
|
||||
subsequent successful production HTTPS response.}
|
||||
\label{fig:caddy-renewal-test-evidence}
|
||||
\end{figure}
|
||||
|
||||
\FloatBarrier
|
||||
|
||||
\section{Firewall and External Exposure}
|
||||
\phantomsection\label{GlossaryRef:cloudfirewall}
|
||||
\paragraph{Exposure policy and temporary exceptions.}
|
||||
The host currently publishes the earlier Assignment 3 applications on ports
|
||||
5050 and 8080 while that work is graded; both returned HTTP 200 during the
|
||||
September 26 check and were not altered. At Nick's direction, these two ports
|
||||
will remain open only until Group Assignment~\#3 is graded; afterward, the team
|
||||
will remove their inbound firewall rules when the earlier services are no
|
||||
longer needed. The new Gitea backend is not public:
|
||||
the host listener is \texttt{127.0.0.1:3000}, and an external port-3000 check
|
||||
could not connect. The DigitalOcean Cloud Firewall
|
||||
\texttt{ssw590-group7-gitea-firewall} was created and attached to the
|
||||
\texttt{ssw590-group7-droplet}. The control panel reports eight total rules,
|
||||
five inbound and three outbound. It permits
|
||||
\phantomsection\label{AcronymRef:TCPAssignment4}80/TCP,
|
||||
443/TCP, and---at the team's direction---administrative SSH on 22/TCP from all
|
||||
IPv4 and IPv6 sources, and temporarily permits 5050/TCP and 8080/TCP for
|
||||
Assignment 3 grading. Because the team requires SSH access from changing
|
||||
locations, restricting SSH to a stable list of source addresses is not
|
||||
operationally feasible. The instructor cleared this exception. SSH therefore
|
||||
remains reachable from all IPv4 and IPv6 sources while the separately verified
|
||||
key-only controls prohibit password and keyboard-interactive authentication.
|
||||
|
||||
\paragraph{Defense in depth.}
|
||||
The Droplet has public IPv4 but no public IPv6 address. Outbound
|
||||
traffic remains allowed for DNS, time synchronization, image retrieval, and
|
||||
certificate services. This control must be implemented at the DigitalOcean
|
||||
boundary rather than relying only on host UFW because Docker-published ports
|
||||
can bypass expected UFW paths \cite{DigitalOceanCloudFirewalls}. The firewall
|
||||
remains necessary even with HTTPS: HTTPS authenticates and encrypts web traffic,
|
||||
but it does not close unrelated ports, restrict which services are reachable,
|
||||
or prevent an accidentally published container port from accepting connections.
|
||||
The firewall
|
||||
is attached to one Droplet, shown by the control panel as
|
||||
\texttt{ssw590-group7-droplet}, with the expected 1~GB / 25~GB / NYC1 facts.
|
||||
Its three outbound rules allow ICMP, all TCP, and all UDP to IPv4 and IPv6
|
||||
destinations. The control panel listed no overlapping firewall.
|
||||
|
||||
\paragraph{External verification.}
|
||||
From an
|
||||
external Windows client, the team obtained the final expected results on
|
||||
September 29: 22/TCP, 80/TCP, 443/TCP, 5050/TCP, and 8080/TCP were reachable;
|
||||
the Gitea backend on 3000/TCP and database port 5432/TCP were not reachable. A
|
||||
fresh key-authenticated SSH connection also succeeded after firewall creation.
|
||||
The team additionally opened an authenticated SSH local-forwarding session
|
||||
from the same external workstation and loaded
|
||||
\path{http://localhost:3000/myfileagent/myfileagent-pipeline}. This confirms that
|
||||
the private Gitea administration path remains functional even though direct
|
||||
public access to 3000/TCP is blocked.
|
||||
Figure~\ref{fig:firewall-configuration-evidence} records the applied IPv4 and
|
||||
IPv6 rule set, and Figure~\ref{fig:firewall-external-test-evidence} records the
|
||||
external port-test results.
|
||||
|
||||
\begin{table}[H]
|
||||
\centering
|
||||
\caption{Host and container port mappings after firewall creation}
|
||||
\label{tab:gitea-port-mappings}
|
||||
\small
|
||||
\begin{tabularx}{\textwidth}{L{1.9cm}L{3.4cm}Y Y}
|
||||
\toprule
|
||||
\textbf{Port} & \textbf{Listener or mapping} & \textbf{Current exposure} & \textbf{Purpose} \\
|
||||
\midrule
|
||||
22/TCP & Host OpenSSH & Public IPv4/IPv6; keys only & Administration and the verified Gitea tunnel \\
|
||||
80/TCP & Caddy \texttt{80:80} & Public through firewall & HTTP redirect and ACME validation \\
|
||||
443/TCP & Caddy \texttt{443:443} & Public through firewall & MyFileAgent HTTPS \\
|
||||
3000/TCP & \path{127.0.0.1:3000:3000} & Loopback only & Private Gitea backend and SSH tunnel \\
|
||||
5050/TCP & Earlier assignment service & Temporarily public & Assignment 3 grading \\
|
||||
5432/TCP & No listener or mapping & Not public & Unused because SQLite was selected \\
|
||||
8080/TCP & Earlier assignment service & Temporarily public & Assignment 3 grading \\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
\end{table}
|
||||
|
||||
\begin{figure}[htbp]
|
||||
\centering
|
||||
\includegraphics[width=\textwidth]{hw4_images/firewall_configuration_evidence.png}
|
||||
\caption{Sanitized DigitalOcean Cloud Firewall evidence showing inbound
|
||||
allowances for SSH, HTTP, HTTPS, and the two temporarily preserved grading
|
||||
services, plus outbound ICMP, TCP, and UDP rules for IPv4 and IPv6.}
|
||||
\label{fig:firewall-configuration-evidence}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[htbp]
|
||||
\centering
|
||||
\includegraphics[width=0.62\textwidth]{hw4_images/firewall_external_test_evidence.png}
|
||||
\caption{Dated external Windows-client evidence showing public ports 22, 80,
|
||||
443, 5050, and 8080 reachable while the loopback-only Gitea backend on 3000
|
||||
and the unused database port 5432 remain unreachable.}
|
||||
\label{fig:firewall-external-test-evidence}
|
||||
\end{figure}
|
||||
|
||||
\paragraph{SSH hardening and firewall attachment.}
|
||||
An initial attempt in the SSW590 team context was blocked by an account
|
||||
permissions warning related to the payment method. Switching to the authorized My Team
|
||||
context resolved that blocker and made the correct Droplet available for
|
||||
attachment. Before permitting public SSH from arbitrary locations, the team
|
||||
installed \path{/etc/ssh/sshd_config.d/00-ssw590-ssh-hardening.conf}. It
|
||||
disables password and keyboard-interactive authentication, permits root only
|
||||
with a key, and explicitly enables public-key authentication. The file passed
|
||||
\texttt{sshd -t}, and SSH was reloaded without terminating the active session.
|
||||
The team then confirmed a new key-authenticated session, confirmed that a
|
||||
password-only session was rejected, and recorded the following effective
|
||||
configuration at 23:27:51 UTC:
|
||||
|
||||
\begin{minted}{text}
|
||||
2026-09-26T23:27:51+00:00
|
||||
permitrootlogin without-password
|
||||
pubkeyauthentication yes
|
||||
passwordauthentication no
|
||||
kbdinteractiveauthentication no
|
||||
\end{minted}
|
||||
|
||||
OpenSSH reports \texttt{without-password} as the effective equivalent of the
|
||||
configured \texttt{prohibit-password} policy. These human-run checks established
|
||||
key-only SSH before Cloud Firewall attachment, and the final external test
|
||||
reconfirmed port 22. These controls support the instructor-cleared exception
|
||||
for administration from changing locations.
|
||||
|
||||
\clearpage
|
||||
\section{Startup Team Workflow}
|
||||
The team created the
|
||||
\href{https://myfileagent.tech/myfileagent}{\texttt{myfileagent} organization}
|
||||
and public
|
||||
\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline}{\texttt{myfileagent-pipeline} product repository}
|
||||
with an initialized
|
||||
\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/main/README.md}{\texttt{README.md}}.
|
||||
The organization contains \texttt{nkogut} and \texttt{glovely} in the Owners
|
||||
team. The supplied configuration evidence confirms that both accounts are
|
||||
active and have the team's intended site-administrator role. Both accounts
|
||||
also participate in the organization's Owners team so that either team member
|
||||
can administer the shared startup workspace.
|
||||
|
||||
The repository contains five actionable product and operations issues. Issue
|
||||
\#1 traces the MyFileAgent product-scope documentation through branch
|
||||
\texttt{issue-1-product-scope} and Pull Request~\#6: \texttt{nkogut} authored
|
||||
the merged change and the linked issue closed. Issue~\#4 traces the versioned Gitea deployment
|
||||
through branch \texttt{issue-4-gitea-deployment} and Pull Request~\#7:
|
||||
\texttt{glovely} authored the merged change and the linked issue closed. The
|
||||
remaining issues retain the product and operations backlog.
|
||||
|
||||
The team then completed reciprocal approval on two additional merged changes:
|
||||
\texttt{nkogut} authored Pull Request~\#8 and \texttt{glovely} submitted an
|
||||
\texttt{APPROVED} review; \texttt{glovely} authored Pull Request~\#9 and
|
||||
\texttt{nkogut} submitted an \texttt{APPROVED} review. The dated evidence also
|
||||
shows both intended administrator accounts. Pull Request~\#8 references closed
|
||||
operations Issue~\#4, while Pull Request~\#9 references closed product Issue~\#1.
|
||||
Figure~\ref{fig:gitea-configuration-evidence} therefore records two complete
|
||||
issue-linked, reciprocally reviewed, merged, and closed workflow traces while
|
||||
leaving unfinished Issues~\#2, \#3, and \#5 open.
|
||||
|
||||
\noindent\textit{Evidence note.} This image was captured on September 26,
|
||||
2026, before the organization and repository received their current names.
|
||||
The displayed \texttt{filepilot/filepilot-pipeline} repository is the same
|
||||
repository now available as
|
||||
\texttt{myfileagent/myfileagent-pipeline}; its issues, pull requests, reviews,
|
||||
and history were preserved.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.72\textwidth]{hw4_images/gitea_configuration_evidence.png}
|
||||
\caption{Dated Gitea configuration and workflow evidence showing both
|
||||
administrator accounts, the public MyFileAgent repository, five actionable
|
||||
issues, merged Pull Requests~\#8 and \#9 linked to closed Issues~\#4 and
|
||||
\#1, and reciprocal approved reviews.}
|
||||
\label{fig:gitea-configuration-evidence}
|
||||
\end{figure}
|
||||
|
||||
\FloatBarrier
|
||||
|
||||
\section{Architecture and Operation}
|
||||
The production request path is browser to DigitalOcean Cloud Firewall to Caddy
|
||||
on 443, then Caddy to
|
||||
\texttt{gitea:3000} over the private Compose bridge network. Gitea reads its SQLite
|
||||
file and repository data from persistent Docker volumes. There is no public
|
||||
Gitea application or database port. Caddy is configured for both the edge and
|
||||
private networks; Gitea is attached only to the private network. Public
|
||||
isolation is enforced by the loopback host binding and firewall rather than
|
||||
Docker's \texttt{internal} network flag. An initial attempt using that flag
|
||||
left the requested loopback publication unprogrammed, causing an empty browser
|
||||
response; the team corrected the network definition while preserving the
|
||||
named data volumes. An authenticated SSH local-forward remains available as an
|
||||
administrative fallback and was verified before public activation.
|
||||
|
||||
Figure~\ref{fig:gitea-architecture} adapts the assignment reference to the
|
||||
team's actual SQLite deployment. Solid arrows show the active public HTTPS
|
||||
request path, the dashed arrow shows the verified SSH-tunnel fallback,
|
||||
and the data arrow terminates in Docker-managed persistent storage rather than
|
||||
the disposable Gitea container layer.
|
||||
|
||||
\begin{figure}[htbp]
|
||||
\centering
|
||||
\begin{tikzpicture}[
|
||||
node distance=9mm and 12mm,
|
||||
component/.style={draw, rounded corners, align=center, minimum height=12mm,
|
||||
text width=2.45cm, fill=devopsLightBlue},
|
||||
private/.style={draw, rounded corners, align=center, minimum height=12mm,
|
||||
text width=2.45cm, fill=green!10},
|
||||
data/.style={draw, cylinder, shape border rotate=90, aspect=0.28,
|
||||
align=center, minimum height=15mm, text width=2.55cm, fill=gray!12},
|
||||
flow/.style={-{Latex[length=2.5mm]}, thick},
|
||||
tunnel/.style={-{Latex[length=2.5mm]}, thick, dashed}
|
||||
]
|
||||
\node[component] (browser) {Public browser\\HTTPS};
|
||||
\node[component, right=of browser] (firewall) {DigitalOcean\\Cloud Firewall};
|
||||
\node[component, right=of firewall] (caddy) {Caddy proxy\\\texttt{https} profile};
|
||||
\node[private, right=of caddy] (gitea) {Gitea\\\texttt{gitea:3000}};
|
||||
\node[data, below=of gitea] (storage) {\texttt{gitea-data}\\repositories +\\SQLite file};
|
||||
\node[component, below=of browser] (admin) {Team admin\\SSH client};
|
||||
\node[component, below=of firewall] (sshd) {Host OpenSSH\\key-only};
|
||||
|
||||
\draw[flow] (browser) -- node[above, font=\tiny]{443 / optional 80} (firewall);
|
||||
\draw[flow] (firewall) -- node[above, font=\tiny]{80, 443} (caddy);
|
||||
\draw[flow] (caddy) -- node[above, font=\tiny]{private} (gitea);
|
||||
\draw[flow] (gitea) -- node[right, font=\scriptsize]{mounted path} (storage);
|
||||
\draw[tunnel] (admin) -- node[above, font=\scriptsize]{22/TCP} (sshd);
|
||||
\draw[tunnel] (sshd) -| node[pos=0.72, below, font=\scriptsize]{\texttt{127.0.0.1:3000}} (gitea);
|
||||
\end{tikzpicture}
|
||||
\caption{MyFileAgent Gitea request, administration, and persistence paths.
|
||||
Caddy alone publishes the web edge; Gitea and its SQLite data remain private.}
|
||||
\label{fig:gitea-architecture}
|
||||
\end{figure}
|
||||
|
||||
\FloatBarrier
|
||||
|
||||
The service is operated from \path{/home/codex/myfileagent-gitea} with
|
||||
\texttt{docker compose}. Container status, recent logs, loopback HTTP response,
|
||||
volume presence, and memory availability were checked after startup. This
|
||||
startup check is not the required persistence-replacement test and is not a
|
||||
backup or restore test.
|
||||
|
||||
Routine restart and first-line troubleshooting use the versioned Compose
|
||||
project and do not delete named volumes:
|
||||
|
||||
\begin{minted}{bash}
|
||||
cd /home/codex/myfileagent-gitea
|
||||
docker compose restart gitea
|
||||
docker compose ps
|
||||
docker compose logs --tail=100 gitea
|
||||
curl -fsS -o /dev/null -w 'loopback_http=%{http_code}\n' \
|
||||
http://127.0.0.1:3000/
|
||||
docker inspect myfileagent-gitea \
|
||||
--format '{{range .Mounts}}{{println .Name "->" .Destination}}{{end}}'
|
||||
\end{minted}
|
||||
|
||||
Operators first check container state and recent logs, then the loopback HTTP
|
||||
response and expected volume mounts. If public HTTPS fails while the
|
||||
loopback check succeeds, the fault domain moves outward to the private proxy
|
||||
network, Caddy logs, certificate state, DNS, and Cloud Firewall. A routine
|
||||
restart reuses the existing volumes; the completed container-replacement test
|
||||
proved persistence across replacement. Neither operation proves recoverability
|
||||
from deletion or corruption, so neither is described as a backup/restore test.
|
||||
|
||||
\section{Manual Quality and Controls}
|
||||
This chapter distinguishes observed results from planned or optional work. The
|
||||
Hosts table records the current Droplet name, capacity, address, and non-root
|
||||
administrative account, the private SSH-forwarded fallback, and the active
|
||||
public hostname \texttt{myfileagent.tech}. The Passwords table
|
||||
records only the Bitwarden entry names \texttt{Gitea - Nick},
|
||||
\texttt{Gitea - Gowri}, and \texttt{.tech Domain} for the individual
|
||||
\texttt{nkogut} and \texttt{glovely} accounts and registrar access; it contains
|
||||
no passwords or derivation information. This Assignment 4 work uses one
|
||||
consolidated history entry and one consolidated AI-assistance entry. The
|
||||
required implementation and evidence are complete, with an instructor-cleared
|
||||
SSH source-policy exception documented above. The optional backup/restore test
|
||||
is recorded separately below and is not counted among the eight required
|
||||
rubric items. Version~1.6.1 was compiled and visually inspected after the final
|
||||
content and layout updates.
|
||||
|
||||
\clearpage
|
||||
\section{Optional Extra Credit: Verified Backup and Restore}
|
||||
\index{backup and restore}
|
||||
\index{Gitea!backup and restore}
|
||||
|
||||
\paragraph{Completion status.}
|
||||
The team completed and documented every part of the optional extra credit:
|
||||
\begin{enumerate}[label=\arabic*.,leftmargin=*,nosep]
|
||||
\item a dated backup method with its scope and temporary storage location;
|
||||
\item a sanitized archive listing and a consistent cold-backup procedure; and
|
||||
\item a pre-backup repository and issue, isolated restore, repository and
|
||||
issue usability checks, labeled original/restored screenshots, and a
|
||||
dated PASS outcome with cleanup evidence.
|
||||
\end{enumerate}
|
||||
|
||||
On September 29, 2026, the team created the public
|
||||
\href{https://myfileagent.tech/nkogut/backup-restore-proof}{\texttt{nkogut/backup-restore-proof}}
|
||||
repository with an initialized \texttt{main} branch and open Issue~\#1,
|
||||
``Verify repository and issue survive isolated restore.'' Both records existed
|
||||
before the backup and served as recovery acceptance criteria.
|
||||
|
||||
\paragraph{Backup method and consistency.}
|
||||
The team used a \phantomsection\label{GlossaryRef:coldbackup}cold backup so the
|
||||
SQLite database, repositories,
|
||||
attachments, and application files belonged to one recoverable point in time.
|
||||
It stopped only the production Gitea container, archived the
|
||||
\texttt{myfileagent-gitea\_gitea-data} and
|
||||
\texttt{myfileagent-gitea\_gitea-config} volumes, then immediately restarted
|
||||
Gitea. Caddy, the firewall, and the earlier grading services were unchanged.
|
||||
Production was stopped at 20:19:13 UTC and healthy again at 20:19:17 UTC.
|
||||
|
||||
The archive was stored temporarily at
|
||||
\path{/home/codex/myfileagent-gitea/backups/}
|
||||
\path{myfileagent-gitea-backup-20260929T201913Z.tar.gz}. It was 117~KiB and
|
||||
had SHA-256 digest
|
||||
\texttt{b58b378bf1fca318160c0df370552e80ebfe967351daf3b88256c37e59bbe716}.
|
||||
The backup command used read-only source mounts:
|
||||
|
||||
\begin{minted}{bash}
|
||||
docker compose stop gitea
|
||||
docker run --rm -u "$(id -u):$(id -g)" \
|
||||
-v myfileagent-gitea_gitea-data:/source/data:ro \
|
||||
-v myfileagent-gitea_gitea-config:/source/config:ro \
|
||||
-v /home/codex/myfileagent-gitea/backups:/backup \
|
||||
caddy:2.11.4-alpine \
|
||||
sh -c 'tar -czf /backup/myfileagent-gitea-backup-20260929T201913Z.tar.gz \
|
||||
-C /source data config'
|
||||
docker compose up -d gitea
|
||||
\end{minted}
|
||||
|
||||
The sanitized listing showed both the SQLite database and repository objects
|
||||
inside the same archive:
|
||||
|
||||
\begin{minted}{text}
|
||||
data/data/gitea.db
|
||||
data/git/repositories/nkogut/backup-restore-proof.git/HEAD
|
||||
data/git/repositories/nkogut/backup-restore-proof.git/refs/heads/main
|
||||
production_after=nkogut/backup-restore-proof state=available
|
||||
production_issue_after=#1 state=open
|
||||
backup_phase=PASS
|
||||
\end{minted}
|
||||
|
||||
\paragraph{Isolated restore and verification.}
|
||||
The archive was extracted into new volumes
|
||||
\texttt{myfileagent-restore-gitea-data} and
|
||||
\texttt{myfileagent-restore-gitea-config}. A separate container named
|
||||
\texttt{myfileagent-gitea-restore-test} used the same pinned Gitea image and
|
||||
published only \texttt{127.0.0.1:3300}; it was never added to Caddy or the
|
||||
Cloud Firewall. The production volumes were not mounted into the restore
|
||||
container.
|
||||
|
||||
\begin{minted}{bash}
|
||||
docker volume create myfileagent-restore-gitea-data
|
||||
docker volume create myfileagent-restore-gitea-config
|
||||
docker run --rm -u 0 \
|
||||
-v myfileagent-restore-gitea-data:/restore/data \
|
||||
-v myfileagent-restore-gitea-config:/restore/config \
|
||||
-v /home/codex/myfileagent-gitea/backups:/backup:ro \
|
||||
caddy:2.11.4-alpine \
|
||||
sh -c 'tar -xzf /backup/myfileagent-gitea-backup-20260929T201913Z.tar.gz \
|
||||
-C /restore && chown -R 1000:1000 /restore/data /restore/config'
|
||||
|
||||
docker run -d --name myfileagent-gitea-restore-test --restart no \
|
||||
-p 127.0.0.1:3300:3000 \
|
||||
-e GITEA__server__ROOT_URL=http://127.0.0.1:3300/ \
|
||||
-e GITEA__server__DISABLE_SSH=true \
|
||||
-v myfileagent-restore-gitea-data:/var/lib/gitea \
|
||||
-v myfileagent-restore-gitea-config:/etc/gitea \
|
||||
docker.gitea.com/gitea:1.27.3-rootless
|
||||
\end{minted}
|
||||
|
||||
The restored \phantomsection\label{AcronymRef:API}API returned the same public
|
||||
repository, default branch, and open
|
||||
issue. A Git smart-HTTP \texttt{ls-remote} request returned two refs, showing
|
||||
that the repository was usable rather than merely listed. Production remained
|
||||
healthy throughout the isolated restore test.
|
||||
|
||||
\begin{minted}{text}
|
||||
restore_ready=1
|
||||
restored_repo=nkogut/backup-restore-proof default_branch=main private=false
|
||||
restored_issue=#1 Verify repository and issue survive isolated restore state=open
|
||||
restored_git_refs=2
|
||||
restore_port=127.0.0.1:3300
|
||||
production_status=1.27.3
|
||||
restore_phase=PASS
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[htbp]
|
||||
\centering
|
||||
\begin{minipage}[t]{0.49\textwidth}
|
||||
\centering
|
||||
\textbf{Production repository}\par\smallskip
|
||||
\includegraphics[width=\linewidth,trim=0 450 0 0,clip]{hw4_images/backup_original_repository.png}
|
||||
\end{minipage}\hfill
|
||||
\begin{minipage}[t]{0.49\textwidth}
|
||||
\centering
|
||||
\textbf{Isolated restored repository}\par\smallskip
|
||||
\includegraphics[width=\linewidth,trim=0 450 0 0,clip]{hw4_images/backup_restored_repository.png}
|
||||
\end{minipage}
|
||||
\caption{The initialized proof repository in production and in the separate
|
||||
loopback-only restored Gitea instance.}
|
||||
\label{fig:gitea-backup-repository-evidence}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[htbp]
|
||||
\centering
|
||||
\begin{minipage}[t]{0.49\textwidth}
|
||||
\centering
|
||||
\textbf{Production Issue \#1}\par\smallskip
|
||||
\includegraphics[width=\linewidth,trim=0 130 0 0,clip]{hw4_images/backup_original_issue.png}
|
||||
\end{minipage}\hfill
|
||||
\begin{minipage}[t]{0.49\textwidth}
|
||||
\centering
|
||||
\textbf{Restored Issue \#1}\par\smallskip
|
||||
\includegraphics[width=\linewidth,trim=0 130 0 0,clip]{hw4_images/backup_restored_issue.png}
|
||||
\end{minipage}
|
||||
\caption{The same open issue and pre-backup description in production and
|
||||
in the isolated restored instance.}
|
||||
\label{fig:gitea-backup-issue-evidence}
|
||||
\end{figure}
|
||||
|
||||
The full sanitized command record is retained as
|
||||
\path{backup_restore_evidence.txt} in the Assignment 4 working directory. It
|
||||
contains no archive contents, credentials, private keys, or access tokens. The
|
||||
backup archive itself is not part of the submitted manual. After evidence
|
||||
capture, the team removed the temporary restore container, both restore
|
||||
volumes, and the sensitive archive at 20:25:38 UTC. Each cleanup check reported
|
||||
\texttt{PASS}, and the production proof repository remained available.
|
||||
|
||||
\begin{minted}{text}
|
||||
restore_container_removed=PASS
|
||||
restore_volumes_removed=PASS
|
||||
backup_archive_removed=PASS
|
||||
production_repo=nkogut/backup-restore-proof available
|
||||
cleanup_completed=2026-09-29T20:25:38+00:00
|
||||
\end{minted}
|
||||
Reference in New Issue
Block a user