My Capstone Project for Udacity’s Cloud DevOps Engineer Nanodegree
Tags: node, jenkins, docker, typescript
Published: 2020-11-12 14:17:01

---
title: My Capstone Project for Udacity’s Cloud DevOps Engineer Nanodegree
published: true
date: 2020-11-12 14:10:06 UTC
tags: nodejs,jenkins,docker,typescript
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/500/1*cAB3Zkg7VhhbeF90NaO7RQ.png)

After three months of various DevOps related courses and smaller projects, I had reached the end of my Nanodegree, and it was time to build out my capstone project.

My project can be broken down into two parts: the application itself, and the infrastructure that deploys and hosts it.

#### The Application: Random Song

Random Song is a simple web app built using TypeScript, Node.js and Express. It serves as a web service that can send you a random song, using the Musixmatch API. To test out the app, simply go to the /random route, and you'll receive a random song object in JSON.

Going to the / route will return:

```
Welcome to my capstone project! To get a random song, go to the '/random' route.
```

And going to the /random route will return a random song:

```
{
  track_id: 160557034,
  track_name: 'Get Up and Fight',
  track_name_translation_list: [],
  track_rating: 26,
  commontrack_id: 86880624,
  instrumental: 0,
  explicit: 0,
  has_lyrics: 1,
  has_subtitles: 1,
  has_richsync: 1,
  num_favourite: 62,
  album_id: 30545841,
  album_name: 'Simulation Theory (Super Deluxe)',
  artist_id: 1248,
  artist_name: 'Muse',
  track_share_url: 'https://www.musixmatch.com/lyrics/Muse/Get-Up-and-Fight?utm_source=application&utm_campaign=api&utm_medium=Student+Developer%3A1409620630471',
  track_edit_url: 'https://www.musixmatch.com/lyrics/Muse/Get-Up-and-Fight/edit?utm_source=application&utm_campaign=api&utm_medium=Student+Developer%3A1409620630471',
  restricted: 0,
  updated_time: '2020-05-19T15:42:03Z',
  primary_genres: { music_genre_list: [[Object], [Object] ] }
}
```

#### The Infrastructure

After the application was built, the next task was deploying it. In this project I decided to go with a Rolling Deployment. My goal was to write out the necessary configuration files and required build commands, and then create a pipeline to automate the process of actually building the application and deploying the infrastructure. This way, it could be executed in the exact same manner every time I added new code or infrastructure to the project. I needed a server to host Jenkins, my CI/CD technology of choice for this project. After provisioning an AWS EC2 instance and installing Jenkins, it was time to start defining the tasks that I’d want Jenkins to run. After accessing my application’s code, here are the tasks that I created for Jenkins to run:

1. Install Node dependencies  
 Simply running npm install would do the trick.
2. Build the application  
 My application is written in TypeScript, so I needed to run npm run build to build out the JavaScript distribution folder.
3. Lint the code  
 Running npm run lint to make sure everything is up to tslint's standards.
4. Build the Docker image  
 Here Jenkins would build a Docker container based on the Dockerfile that I created. It was based off a simple Node image, and would copy my application code into the container and start it.
5. Upload the container to Docker Registry  
 After being containerized, my application would then be uploaded to the Docker Registry for further availability.
6. Create the Kubernetes configuration file  
 Here I needed to create a Kubernetes deployment file that would be used in the next step to actually deploy my application into a cluster. I used Kubernetes via AWS EKS.
7. Deploy application  
 With the help of my Kubernetes deployment file and my Docker container that I uploaded to the registry, I was now able to deploy my application to my AWS EKS cluster. I also ran a kubectl get pods and kubectl get services to make sure everything was running as expected.

In the end, the app is deployed to the cluster and accessible to users. Random songs for days.

Unfortunately, the app is not currently deployed due to EKS not being a cheap service for a student to continuously pay for. However, I’m planning on taking the Random Song application and turning it into something that will be more permanently hosted in a future project. As far as the infrastructure goes, these are also things that can be repurposed in future projects — Docker containers, Kubernetes clusters and Jenkins pipelines are tools that can help build any software related project.

If you’d like to see the code, you can take a look at the project’s repo on [GitHub](https://github.com/gavischneider/cloud-devops-engineer-nanodegree-capstone-project).