Memester: Creating a CI/CD Pipeline Using GitHub Actions on AWS using Amazon Lightsail and Docker for App Deployment

Carlos Cuellar
Strategio
Published in
4 min readNov 23, 2022
Memester: An App to Create and Share Memes

Have you ever wanted to share memes? If the answer is yes, then Memester is the app for you. Memester allows a user to log in, create and share memes. It also doubles as a messenger app. This was the app that our team, EC2 Read, used for a CI/CD pipeline that was created using GitHub Actions.

GitHub Actions allows for seamless integration with GitHub as it allows for the building and testing of every pull request from the repository as well as deploying to production merged pull requests. Memester’s primary language is Python, so Pytest was used to test the code. Once the code is tested Lightsail deploys the Docker container to the cloud(AWS) and Docker in turn deploys the application.

A diagram for the CI/CD pipeline

Why Use These Tools?

These tools were chosen over other tools for numerous reasons. Early in the CI/CD pipeline’s design phase, other tools were considered such as Jenkins, Travis, and Terraform. GitHub Actions was chosen over Jenkins and Travis because it requires less setup as it is already hosted on GitHub. Terraform was considered but was ultimately decided against because it is a bit more complicated than GitHub actions, requires more setup, and in the end, the outcome is very similar to GitHub actions.

AWS gives the application security which is a benefit to the application itself. Docker’s lightweight nature and scalability were reasons why it was chosen. GitHub Actions’ flexibility allows for changes to be made as necessary because of its connection to GitHub. Docker’s storage and AWS makes the application more reliable. AWS also allows for global communication using the application if the regions are used.

GitHub Actions

First of all, to use GitHub actions a .yml file must be created. The code for our .yml file is as follows;

A snippet of main.yml

Build

GitHub Actions handles the building, testing, and deployment of the app. It sets up Python, installs the necessary plugins, and automates the testing before deploying the application.

GitHub Actions building the project

Docker and Lightsail

An EC2 instance was originally going to be used for the application, but we ended up using Lightsail to deploy the application to the cloud. This was done as it made the deployment of the app more streamlined. Lightsail only needs the Docker image and it would automatically containerize Docker. This allows for easy deployment to the cloud(AWS).

A snippet of the code used for the Docker container

Amazon CloudWatch

Amazon CloudWatch is what will be used to monitor the application once it is deployed to the cloud. This will allow us to collect and track metrics. We’ll be able to see when our application was used more, when the most popular time of the year to post memes, etc. This allows the team to continuously improve the application based on the information we receive from CloudWatch.

Challenges and Improvements Made

In the beginning, it was challenging to understand the architecture that we needed to use. Due to this, we made the application more complicated than we needed to. We also underestimated the amount of time the team needed to learn all the technologies to the point where we could implement the application. It also proved to be a challenge communicating considering we’re all in different locations and even different time zones. Despite these challenges, we were able to produce an end result, that we as a team were proud of.

We ended up improving the application considerably. We started off by simplifying the application. We also decided to use Docker with Lightsail instead of using an EC2 instance as we had originally planned. The amount of testing done was also ramped up. To help deal with the communication issues we used a GitHub board which allowed everyone in the team to be on the same page in terms of what tasks needed completion.

Demo

Below is a quick demo of our app done by our own Rane Davis.

Meet the Team

EC2-Read Team

--

--

Carlos Cuellar
Strategio

My name is Carlos Cuellar and I am a Software Engineer based out of NYC. In my personal life I am a singer, gamer, anime and sports fan.