152 lines
6.6 KiB
TeX
152 lines
6.6 KiB
TeX
\chapter{Digital Ocean Docker Deployment}
|
|
\ChapterLabel{CloudDockerDeployment}
|
|
\index{Docker}\index{Amazon EC2}\index{JavaScript!classes}
|
|
|
|
\section{Scope and Platform}
|
|
This chapter records Victor's deployment of the group Color Buttons website.
|
|
The assignment's chapter title is retained; Amazon EC2 replaces the DigitalOcean
|
|
Droplet in this group's implementation. Payton handles the separate TeX Live
|
|
compiler and its chapter. UML diagrams are omitted under the instructor's
|
|
clarification that deployment diagrams are encouraged but optional.
|
|
|
|
The website is available at \url{http://54.221.175.174} while the instance is
|
|
running. This is an HTTP demonstration site without TLS. Its automatically
|
|
assigned address can change after the instance is stopped and started.
|
|
|
|
\section{AWS Configuration}
|
|
Victor created the paid AWS account for the group and configured a monthly
|
|
budget alert. No credits were reported. IAM Identity Center provides separate
|
|
Victor and Payton identities in the developers group, assigned an EC2 permission
|
|
set using \texttt{AmazonEC2FullAccess}. Root remains the
|
|
owner's administrative identity; a separate administrator role was not created
|
|
and MFA setup was deferred. The budget is an alert, not a spending cap.
|
|
|
|
\begin{tabularx}{\linewidth}{L{4cm}Y}
|
|
\toprule \textbf{Setting} & \textbf{Recorded configuration}\\ \midrule
|
|
Instance name & \texttt{ssw590-group-web}\\
|
|
Region & N. Virginia (\texttt{us-east-1})\\
|
|
Instance type & \texttt{t3.micro}\\
|
|
Operating system & Ubuntu 26.04 LTS, amd64\\
|
|
Networking & Default VPC, public IPv4 enabled\\
|
|
Inbound SSH & TCP 22 restricted to Victor's detected IP\\
|
|
Inbound website & TCP 80 from \texttt{0.0.0.0/0}\\
|
|
Storage & Launch configuration used an 8 GiB gp3 root volume with encryption and delete-on-termination selected\\
|
|
Metadata & IMDSv2 required, confirmed in instance summary\\
|
|
Application port & Container TCP 3000 published as host TCP 80\\
|
|
\bottomrule
|
|
\end{tabularx}
|
|
|
|
\section{Class-Based Website}
|
|
The original two click handlers were reorganized into a
|
|
\texttt{ColorButtonsApp} class. Its constructor retains the background and
|
|
status elements; \texttt{setColor} changes both; \texttt{connectButton} binds
|
|
click events; and \texttt{initialize} connects Blue and Red. Express serves the
|
|
static public directory. Both outcomes were verified locally and on AWS.
|
|
|
|
\subsection{Application Sources}
|
|
\paragraph{Browser class: public/app.js}
|
|
\inputminted{javascript}{docker/color-buttons/public/app.js}
|
|
\paragraph{Page: public/index.html}
|
|
\inputminted{html}{docker/color-buttons/public/index.html}
|
|
\paragraph{Web server: server.js}
|
|
\inputminted{javascript}{docker/color-buttons/server.js}
|
|
\paragraph{Dependencies: package.json}
|
|
\inputminted{json}{docker/color-buttons/package.json}
|
|
\paragraph{Dockerfile}
|
|
\inputminted{docker}{docker/color-buttons/Dockerfile}
|
|
\paragraph{.dockerignore}
|
|
\inputminted{text}{docker/color-buttons/.dockerignore}
|
|
|
|
\section{Deployment Procedure}
|
|
The commands below reproduce the recorded setup and successful configuration.
|
|
The local folder remained under \path{HW1/HW3/Group-Project} for this assignment;
|
|
relocating it to the course root is deferred. The private SSH key is stored
|
|
outside the project and is excluded from the report and repository.
|
|
|
|
\subsection{Connect and Install Docker}
|
|
From Windows Git Bash:
|
|
\begin{minted}{bash}
|
|
ssh -i "$HOME/Documents/_SIT/_Fall2026/SSW 590 - DevOps/ssw590-victor.pem" ubuntu@54.221.175.174
|
|
\end{minted}
|
|
On the EC2 host:
|
|
\begin{minted}{bash}
|
|
cat /etc/os-release
|
|
uname -m
|
|
sudo apt update
|
|
sudo apt install -y ca-certificates curl
|
|
sudo install -m 0755 -d /etc/apt/keyrings
|
|
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
|
sudo chmod 0644 /etc/apt/keyrings/docker.asc
|
|
sudo tee /etc/apt/sources.list.d/docker.sources > /dev/null <<EOF
|
|
Types: deb
|
|
URIs: https://download.docker.com/linux/ubuntu
|
|
Suites: resolute
|
|
Components: stable
|
|
Architectures: amd64
|
|
Signed-By: /etc/apt/keyrings/docker.asc
|
|
EOF
|
|
sudo apt update
|
|
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
|
sudo systemctl enable --now docker
|
|
sudo systemctl is-active docker
|
|
sudo docker version
|
|
sudo docker run --rm hello-world
|
|
\end{minted}
|
|
Victor reported successful installation after resolving the repository-key error.
|
|
The procedure follows \url{https://docs.docker.com/engine/install/ubuntu/}.
|
|
|
|
\subsection{Transfer, Build, and Run}
|
|
In a separate local Git Bash terminal, copy the application:
|
|
\begin{minted}{bash}
|
|
scp -i "$HOME/Documents/_SIT/_Fall2026/SSW 590 - DevOps/ssw590-victor.pem" -r "$HOME/Documents/_SIT/_Fall2026/SSW 590 - DevOps/HW1/HW3/Group-Project/color-buttons" ubuntu@54.221.175.174:
|
|
\end{minted}
|
|
On EC2:
|
|
\begin{minted}{bash}
|
|
cd ~/color-buttons
|
|
sudo docker build -t ssw590-group-buttons .
|
|
sudo docker run -d --name ssw590-group-buttons --restart unless-stopped -p 80:3000 ssw590-group-buttons
|
|
sudo docker ps --filter name=ssw590-group-buttons
|
|
sudo docker logs ssw590-group-buttons
|
|
curl -I http://127.0.0.1
|
|
\end{minted}
|
|
The create command assumes the container name is unused. The restart policy
|
|
allows the running service to resume after a host restart. The application binds
|
|
to all container interfaces, and the AWS security group permits public HTTP.
|
|
|
|
\section{Verification Evidence}
|
|
The terminal screenshot shows container \texttt{70ed56f7fae8} running, the
|
|
\texttt{80->3000/tcp} mapping, the server startup message, and
|
|
\texttt{HTTP/1.1 200 OK}. Public-browser screenshots record the initial white
|
|
state and the Blue and Red outcomes. These figures are supplied execution
|
|
evidence, not generated illustrations.
|
|
|
|
\begin{figure}[H]
|
|
\centering
|
|
\includegraphics[width=\linewidth]{figures/aws-container.png}
|
|
\caption{EC2 container status, startup logs, and successful local HTTP check.}
|
|
\label{fig:aws-container}
|
|
\end{figure}
|
|
|
|
\begin{figure}[p]
|
|
\centering
|
|
\includegraphics[width=\linewidth]{figures/aws-buttons-blue.png}
|
|
\caption{Public AWS website after clicking Blue.}
|
|
\label{fig:aws-blue}
|
|
|
|
\vspace{1em}
|
|
|
|
\includegraphics[width=\linewidth]{figures/aws-buttons-red.png}
|
|
\caption{Public AWS website after clicking Red.}
|
|
\label{fig:aws-red}
|
|
\end{figure}
|
|
|
|
\section{Ownership and Continued Operation}
|
|
Victor owns the AWS account and billing responsibility; both authors share the
|
|
course project. Compute, storage, and public IPv4 usage are chargeable under
|
|
this account. The instance is retained for the working assignment link and
|
|
future labs. Closing SSH does not stop the detached container. Stopping the EC2
|
|
instance takes the website offline and preserves its disk, which remains
|
|
billable; restarting can change the public address. No completed shutdown or
|
|
termination is claimed. Future cleanup and any folder relocation will be
|
|
recorded separately.
|