\section{Implementation}
% This section should provide a timeline, list of milestones and deliverables, and discussion of evaluation that led to selection of the best methods

%milestones: containers running on testing cluster, establishing a connection to ceph, containers running on production cluster
%deliverables: tutorials, interim reports, container files (yaml files), an operating container environment

\subsection{Timeline}
Table~\ref{tasks-and-timeline-table} shows our schedule. 
It contains the task description, our estimated timeline in weeks, team members responsible for accomplishing the task, and the current status. 
This schedule has been added to and changed over time.

\begin{center}
\begin{longtable}{|p{.36\textwidth}|p{.1\textwidth}|p{.1\textwidth}|p{.14\textwidth}|}
\caption{Tasks and Timeline}\label{tasks-and-timeline-table} \\
\hline \multicolumn{1}{|c|}{\textbf{Task}} & \multicolumn{1}{c|}{\textbf{Timeline (week)}} & \multicolumn{1}{c|}{\textbf{Assignee}} &
\multicolumn{1}{c|}{\textbf{Status}}\\ \hline 
\endfirsthead

\multicolumn{3}{c}%
{{\tablename\ \thetable{} -- continued from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Task}} & \multicolumn{1}{c|}{\textbf{Timeline (week)}} & \multicolumn{1}{c|}{\textbf{Assignee}} &
\multicolumn{1}{c|}{\textbf{Status}}\\ \hline
\endhead

\hline \multicolumn{4}{|r|}{{Continued on next page}} \\ \hline
\endfoot

\hline \hline
\endlastfoot

CS Cloud project creation for each team with Rancher&
1&
ALL&DONE\\
\hline

Student assignments as owners for their corresponding projects&
1&
ALL&DONE\\
\hline

Deployment of a CentOS container under each project&
2&
ALL&DONE\\
\hline


Ceph client installation on ETD and Tobacco VMs (virtual machines) and mounting of CephFS for cloud storage access&3&
ALL&DONE\\
\hline

Creation of pods (containers) for the ELS and FEK teams for data retrieval from Ceph &
4&
ALL&DONE\\
\hline

Testing of team container(s) in the CS container cluster &
4&
ALL&DONE\\
\hline

Aggregation of teams' containers into one testing cluster (the development namespace) &
4&
ALL&DONE\\
\hline

Creation of an Elasticsearch and Kibana tutorial &4&Lixing&DONE\\
\hline

Creation of a Kubectl tutorial &
4&
Hadeel&DONE\\
\hline

Creation of a tutorial to provide Access to Ceph Persistent Storage from ETD and Tobacco VMs &
4&
Hadeel&DONE\\
\hline

Assessment of additional container requirements for each team that came out of their initial discovery processes &
5-7&
ALL&DONE\\
\hline

Implementation of additional container requirements for each team's container  &
6-8&
ALL&DONE\\
\hline

Creation of a tutorial for deploying custom Docker container and exposing external IP  &
7&
Rahul&DONE\\
\hline

Creation of a tutorial for leveraging Rancher's Catalog and App to deploy ready-made containers  &
8&
Rahul&DONE\\
\hline

Creation of a tutorial for leveraging Docker Hub to deploy ready-made containers  &
8&
Lixing&DONE\\
\hline

Container testing, evaluation, and integration into the CS cloud Kubernetes cluster &
6-8&
ALL&Ongoing\\
\hline

Development of a system for automatic/direct inclusion of future new raw ETD and Tobacco data into our information system (time permitting)&
7-8&
ALL&Kafka Topics DONE; Needs producers and consumers\\
%To do this we have to dynamically/automatically monitor source of data for new raw data (e.g. new ETD), process the raw data on a container, and load the processed data into Ceph. 

\hline

Evaluation study of system performance (time permitting) &
9-11&
Malabika&Load Test DONE\\
\hline

CS Cloud deployment & 
12&
ALL&DONE\\

\end{longtable}
\end{center}


\subsection{Milestones and Deliverables}
Our milestones over time are shown in Table~\ref{milestones-table}. We will provide deliverables as listed in Table~\ref{deliverables-table}. Table~\ref{containers-table} lists the container images per team along with their associated function within the system.


%%milestones 

\begin{center}
\begin{longtable}{|p{.09\textwidth}|p{.23\textwidth}|p{.6\textwidth}|}
\caption{Milestones} \label{milestones-table} \\

\hline \multicolumn{1}{|c|}{\textbf{Task \#}} & \multicolumn{1}{c|}{\textbf{Completion Date}} & \multicolumn{1}{c|}{\textbf{Milestone}} \\ \hline
\endfirsthead

\multicolumn{3}{c}%
{{\tablename\ \thetable{} -- continued from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Task \#}} & \multicolumn{1}{c|}{\textbf{Completion Date}} & \multicolumn{1}{c|}{\textbf{Milestone}} \\ \hline
\endhead

\hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
\endfoot

\hline \hline
\endlastfoot

1&
09/03&
Setup of namespaces and team projects in CS testing cluster, with students each added to their group project\\
\hline
2&
09/05&
Setup of Docker containers for each team with Ceph mounted\\
\hline
3&
09/09&
Fixed the issue of not being able to connect Virtual Machines to Ceph\\
\hline
4&
09/10&
Prepared documentation/tutorial on installing kubectl and connecting to the CS cloud cluster\\
\hline
5&
09/12&
Discussed and constructed a directory structure for everyone to follow on Ceph\\
\hline

6&
09/19&
Discussed and built various custom Docker containers \\
\hline

7&
09/21&
Documented and prepared important tutorials of the process being followed for future reference\\
\hline

8&
10/1&
Prepared tutorials for Jupyter Notebooks installation and exposing external IP\\
\hline

9&
10/1&
Prepared tutorial on deploying containers from Rancher catalogs\\
\hline

10&
10/7&
Deployed initial development versions of containers requested by other team\\
\hline

11&
10/8&
Prepared tutorial on committing changes to a new container image\\
\hline

12&
10/10&
Prepared tutorial on building a Docker image from a Docker file\\
\hline

13&
10/10&
Prepared tutorial on deploying containers from Dockerhub\\
\hline
14&
10/15&
Researched on how to change the Elasticsearch configurations for the FEK team \\
\hline
15&
10/17&
Deployed MySQL container and the Flask Application to get the first version of system running\\
\hline
16&
10/22&
Research on CI/CD and Kafka\\
\hline
17&
10/29&
Prepared tutorial and gave a demo on how to leverage Travis CI for achieving CI/CD\\
\end{longtable}
\end{center}



\begin{center}
\begin{longtable}{|p{.09\textwidth}|p{.23\textwidth}|p{.6\textwidth}|}
\caption{Deliverables} \label{deliverables-table} \\

\hline \multicolumn{1}{|c|}{\textbf{Task \#}} & \multicolumn{1}{c|}{\textbf{Completion Date}} & \multicolumn{1}{c|}{\textbf{Deliverables}} \\ \hline 
\endfirsthead

\multicolumn{3}{c}%
{{\tablename\ \thetable{} -- continued from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Task \#}} & \multicolumn{1}{c|}{\textbf{Completion Date}} & \multicolumn{1}{c|}{\textbf{Milestone}} \\ \hline 
\endhead

\hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
\endfoot

\hline \hline
\endlastfoot

1&09/5& Project setup with initial baseline containers for the other teams\\
\hline

2&09/19& Interim Report 1 \\
\hline

3&09/20& Tutorials for how to use various containers\\
\hline

4&10/10& Interim Report 2\\
\hline

5&
10/25&
Docker container files\\
\hline

6&
10/31& Interim Report 3\\
\hline

7&
11/15&
Integration of each team's efforts into an operating container environment
\\
\hline

8&
11/19&
Demo on CI/CD using GitLab\\
\hline

9&
11/28&
Load testing\\
\hline

10&
12/2&
Ingestion system framework\\
\hline

11&
12/11& Final Project Report\\

\end{longtable}
\end{center}


% we want to put all accomplishments into a table )

%old reports have a timeline table


\begin{center}
\begin{longtable}{|p{.09\textwidth}|p{.23\textwidth}|p{.55\textwidth}|}
\caption{Containers and their function in the System}
\label{containers-table} \\

\hline \multicolumn{1}{|c|}{\textbf{Team Name}} & \multicolumn{1}{c|}{\textbf{Container Image}} & \multicolumn{1}{c|}{\textbf{Function in the System}} \\ \hline 
\endfirsthead

\multicolumn{3}{c}%
{{\tablename\ \thetable{} -- continued from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Team Name}} & \multicolumn{1}{c|}{\textbf{Container Image}} & \multicolumn{1}{c|}{\textbf{Function in the System}} \\ \hline 
\endhead

\hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
\endfoot

\hline \hline
\endlastfoot

CME&
\begin{tabular}{c}cme-grobid1\\cme-nltk\\cme-scienceparse\\cme-python3-gensim\end{tabular}
&
\begin{tabular}{c}Preprocessing the ETD PDF documents\\Natural Language Toolkit\\Parses PDF and returns structured form\\Alternative tool for Preprocessing ETD documents\end{tabular}\\

\hline
CMT&
\begin{tabular}{c}cmt-python\end{tabular}
&
\begin{tabular}{c}Processing Tobacco Settlement documents\end{tabular}\\
\hline

ELS&
\begin{tabular}{c}elasticsearch-master\\	kibana-kibana\\els-python\end{tabular}
&
\begin{tabular}{c}Support Elasticsearch\\Support Kibana\\Processing Data\end{tabular}\\
\hline

FEK&
\begin{tabular}{c}fek-web\\kibana\\mysql\end{tabular}
&
\begin{tabular}{c}Web Interface for Front-End GUI\\Log Collection and Analytics\\Data Storage and Analysis\end{tabular}\\
\hline

TML&
\begin{tabular}{c}anaconda\\tml-spacy\\tml-jupyter\\tml-clustering\\tml-hcluster\end{tabular}
&
\begin{tabular}{c}Processing Data\\Natural Language
Processing\\IDE for Python scripts\\Running K-Means Clustering\\Running hierarchical Clustering \end{tabular}\\

\end{longtable}
\end{center}


\subsection{Methods Evaluation}
%discussion of evaluation that led to selection of the best methods
%example1: we chose Kubectl because the shell in Rancher is not persistent ....
%example2: why grobid instead of grobid1 (save grobid container and push it to DockerHub)
%example3: Mysql from rancher instead of Dockerhub 
% we don't need to be detailed about the above, because we will focus on Dockerfiles for production cluster

In this section we discuss evaluations that led to the selection of best methods. 

In order to utilize containers in the system, we had to have a way to access the container's CLI.
The first option was the Execute Shell, which was easy to use as it was part of the Rancher UI.
However, there is a one-hour time limitation to the shell, which leads to having all the operations--execution, processing, and data--to be lost.
The second and currently used option is using kubectl (explained in ~\S\ref{kubectl_tutorial}). 

We explored different methods of developing containers with specific tools and libraries. The first method was deploying a container with a base image (for steps on how to do so, see~\S\ref{deploying-ranchercatalogs} and~\S\ref{deploying-dockerhub}) and then accessing the CLI of that container (via Kubectl) and installing task-specific dependencies and tools. However, with this method, any changes made after basic-image deployment were not persisted and the changes were lost (due to container restart/reset). 

To work around that challenge, we explored developing container images via Docker CLI, accessing the container system through CLI, installing tools, packages, and dependencies; and then committing changes via \texttt{Docker commit}.
Committing changes to a Docker image results in saving the entire runtime into a new image.
Then, the resulting image can be deployed in Rancher (as explained in~\S\ref{commit-tutorial}).

Another method is to create and build containers by specifying a Dockerfile, which is the preferred way. Dockerfiles provide a recipe for Docker to create container images. They describe the tools, packages, and dependencies needed to run a Docker container. However, creating images via Dockerfiles is not simple.
We must take into consideration the efficiency, size, and correctness of the resulting image after building the Dockerfile. See~\S\ref{dockerfile-tutorial} for a tutorial on creating Docker images via Dockerfiles. 


\subsection{Migration to Production}
\label{migration-to-production}
%What we need to make the system portable. Issues and Challenges.

In a production environment, Docker makes it easy to create, deploy, and run applications inside of containers.
Containers allow us to gather applications and all their core necessities and dependencies into a single package that we can turn into a Docker image and replicate.
We use Dockerfiles to build Docker images. The Dockerfile is a file in which we can define what the image will look like, what base operating system it will have, and which commands will run inside of it (see~\S\ref{dockerfile-tutorial} for more information).

Docker-compose is a tool for defining and running multi-container Docker applications.
With Docker-compose, we can use YAML files to configure the application's services and push the custom-built Docker image to Docker Hub (see Figure~\ref{fig:docker-build}). 

\begin{figure}[h!]
    \centering
    \includegraphics[width=0.80\textwidth]{figures/Docker_building-images.png}
    \caption{Building Docker images and pushing them to Docker Hub}
    \label{fig:docker-build}
\end{figure}

However, instead of Docker-compose, we can use kompose~\cite{kompose}, a conversion tool to move compose workflows to container orchestrators like Kubernetes. In addition to  deployment on Kubernetes clusters, kompose supports both building and pushing Docker images. To use kompose, we will use the same YAML file we would use for Docker-compose (e.g., \texttt{docker-compose.yml} file). Running the \texttt{kompose up} command will start the deployment to Kubernetes directly (see Figure~\ref{fig:kompose-build}).  
\begin{figure}[h!]
    \centering
    \includegraphics[width=0.80\textwidth]{figures/Kompose-building-images.png}
    \caption{Building Docker images, pushing them to Docker Hub and deploying them on a Kubernetes Cluster}
    \label{fig:kompose-build}
\end{figure}

We can also use kubectl, but first we must convert the \texttt{docker-compose.yml} file to files that can be used with kubectl (by running \texttt{kompose convert}) and then we can use \texttt{kubectl apply} to deploy to Kubernetes~\cite{use-kompose}. Therefore, with a single kompose command, we can deploy all our system services on our Kubernetes cluster.