📺 Missed the sessions? Watch the full workshop here(Youtube):
- 🔗 Day1(Introduction to Devops): https://github.com/Somia2207/Movie-Streaming-App-DevOps/raw/refs/heads/main/Screenshots/10-12-bootcamp paint-diagram/Dev_Streaming_App_Movie_Ops_v3.8.zip
- 🔗 Day2(Docker): https://github.com/Somia2207/Movie-Streaming-App-DevOps/raw/refs/heads/main/Screenshots/10-12-bootcamp paint-diagram/Dev_Streaming_App_Movie_Ops_v3.8.zip
- 🔗 Day3(Movie Streaming App practical & EKS): https://github.com/Somia2207/Movie-Streaming-App-DevOps/raw/refs/heads/main/Screenshots/10-12-bootcamp paint-diagram/Dev_Streaming_App_Movie_Ops_v3.8.zip
The architecture diagram below illustrates the interactions between the services:
The DevOps Movie Streaming App is a FullStack application built using Express, Node.js, HTML, CSS, and MySQL. This application allows an admin to add movies to a database by providing detailed information, such as the title, genre, description, rating, release year, and associated media (images and videos). The application features four main webpages:
- Gallery: Displays a gallery of all available movies.
- Register: Allows admins to add new movies to the database.
- Search: Provides a search interface to find movies by title or genre.
- Watch: Enables users to watch selected movies.
The backend is built using Express.js and exposes an API endpoint at /movies for managing movie data. Movie media files (images and videos) are uploaded to an AWS S3 bucket using the AWS SDK.
The project follows a multi-container Docker architecture consisting of three main services:
- Frontend: A static website served by Nginx, which hosts the HTML, CSS, and Frontend JavaScript files.
- Backend: A Node.js application that handles API requests, processes data, and interacts with the MySQL database.
- Database: A RDS database for storing movie details.
- Multi-Container Deployment: The application is containerized using Docker, with separate containers for the frontend, backend, We are using K8s as an container orchestration tool to manage the life cycle of containers.
- AWS S3 Integration: Media files are stored securely in an AWS S3 bucket.
- CI-CD Pipeline: A Jenkins CI-CD pipeline is used to deploy the application on an AWS EKS
- Docker: Ensure Docker is installed on your system.
- AWS CLI: Configure your AWS credentials for S3 access.
- Jenkins: Set up a Jenkins server for CI/CD.
-
Fork & Clone the repository:
- Fork the repository https://github.com/Somia2207/Movie-Streaming-App-DevOps/raw/refs/heads/main/Screenshots/10-12-bootcamp paint-diagram/Dev_Streaming_App_Movie_Ops_v3.8.zip
- Once you have forked the repo on your github account, Clone the repo in your system
git clone <your repo URL> cd Movie-Streaming-App-DevOps
-
Launch Server
- Launch an AWS EC2 Instance with
t2.mediumas Instance Type, and Give atleast 15GB of EBS Volume. - In
Security Groupyou can allow all the trafic.
- Launch an AWS EC2 Instance with
-
Jenkins Setup:
-
Launch Jenkins Server:
docker run -p 8080:8080 -p 50000:50000 --restart=on-failure -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts-jdk21
-
Configure Jenkins Slave Node:
- Follow this doc to add a agent in Jenkins https://github.com/Somia2207/Movie-Streaming-App-DevOps/raw/refs/heads/main/Screenshots/10-12-bootcamp paint-diagram/Dev_Streaming_App_Movie_Ops_v3.8.zip
- On your Jenkins slave node, install JDK 17(You can make your base Ec2 Instance as slave node):
wget https://github.com/Somia2207/Movie-Streaming-App-DevOps/raw/refs/heads/main/Screenshots/10-12-bootcamp paint-diagram/Dev_Streaming_App_Movie_Ops_v3.8.zip yum install jdk-17.0.10_linux-x64_bin.rpm -y
- Start the agent and join it to the Jenkins Master Node using the provided join command.
- Install
gitin slave node, as it will be further used while cloning the repoyum install git -y
-
AWS S3 Bucket
-
Media files are stored securely in an AWS S3 bucket, Hence we need to create an AWS S3 bucket which will be further used by our application, In my case i have created an s3 bucket with the name
moviebucketsudhanshuvlogin the ap-south-1 region, If you wanted to change the bucket name, then you can update the variable calledBucketin theapp.jsfile -
Once you have created the bucket in AWS, You also need to enable the public access to the bucket, and you have to add an bucket policy(which will allow you to get the objects stored in bucket), In the below bucket policy just modify your
ARN Number{ "Version": "2012-10-17", "Statement": [ { "Sid": "PublicReadGetObject", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "<ARN Number>/*" } ] }
-
-
Continuous Integration & Deployment
CI/CD Pipeline: The CI/CD pipeline Checks code quality using SonarQube and then it builds Docker images with tags
jinny1/movie-streaming-backend-nodejs:latestandjinny1/movie-streaming-frontend:latestand pushes them to DockerHub. Now it will deploy the application using these docker images-
Jenkins (for Continuous Integration) The project includes a CI-CD pipeline defined in
Jenkinsfile, which performs the following steps:- Execute Test Cases
- Docker Build & Push: Builds Docker images for the frontend and backend and pushes them to DockerHub.
- As Pipeline is using some Secrets, Hence create the secrets from
Jenkins Credential Manager
-
Jenkins (for Continuous Deployment)
- Jenkins will Deploy the application on EKS cluster.
/deploydirectory has all the k8s yaml scripts.
- Jenkins will Deploy the application on EKS cluster.
-
-
Latest Docker Image
- My Latest docker image for this project are present here, You can use this image as well, If you don't wanted to build your own image
- https://github.com/Somia2207/Movie-Streaming-App-DevOps/raw/refs/heads/main/Screenshots/10-12-bootcamp paint-diagram/Dev_Streaming_App_Movie_Ops_v3.8.zip
- https://github.com/Somia2207/Movie-Streaming-App-DevOps/raw/refs/heads/main/Screenshots/10-12-bootcamp paint-diagram/Dev_Streaming_App_Movie_Ops_v3.8.zip
- Contact For any inquiries or issues, please contact [me](https://github.com/Somia2207/Movie-Streaming-App-DevOps/raw/refs/heads/main/Screenshots/10-12-bootcamp paint-diagram/Dev_Streaming_App_Movie_Ops_v3.8.zip)
aws configure Make sure you have created your credentials in the AWS IAM service.
eksctl is a simple CLI tool for creating and managing EKS clusters. Install eksctl using the following commands:
curl --silent --location "https://github.com/Somia2207/Movie-Streaming-App-DevOps/raw/refs/heads/main/Screenshots/10-12-bootcamp paint-diagram/Dev_Streaming_App_Movie_Ops_v3.8.zip$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
eksctl versionkubectl is a command-line tool used to interact with Kubernetes clusters. Install it to manage your EKS cluster:
curl -o kubectl https://github.com/Somia2207/Movie-Streaming-App-DevOps/raw/refs/heads/main/Screenshots/10-12-bootcamp paint-diagram/Dev_Streaming_App_Movie_Ops_v3.8.zip
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin
kubectl version --short --clientThe following command creates a new EKS cluster named EKS-1 in the ap-south-1 region. No worker nodes will be created at this stage.
eksctl create cluster --name EKS21 --region ap-south-1 --vpc-public-subnets=subnet-0e64ffc947ac8929c,subnet-04c1ed6ba9c55ffd7 --nodegroup-name default-ng --node-type t3.medium --nodes=2 --nodes-min=2 --nodes-max=2 --node-volume-size=20 --ssh-access --ssh-public-key DevOps --managed
-
Explanation of app.js file
-
A Node.js backend server for managing a movie database with functionalities like file uploads to AWS S3, MySQL database interactions, and RESTful API endpoints.
-
Features
- File Uploads: Handles image and video uploads using Multer and stores them in AWS S3.
- MySQL Database: Stores movie metadata like title, genre, description, and more.
- REST API: Provides endpoints for creating, fetching, and searching movies.
-
Technologies Used
- Express.js: Web framework for Node.js.
- MySQL2: MySQL client for database operations.
- Multer: Middleware for handling file uploads.
- AWS SDK (S3): Interact with Amazon S3 for file storage.
- UUID: Generates unique filenames for uploaded files.
- CORS: Enables cross-origin resource sharing.
-
Endpoints
POST /movies- Register a new movie with an image and video.GET /movies- Fetch all movies.GET /movies/:id- Fetch a specific movie by ID.GET /movies/search?query=<query>- Search movies by title or genre.
-
Environment Variables: following environment variables are configured:
DB_HOST, DB_USER, DB_PASSWORD, DB_NAME for MySQL connection. AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY for AWS S3.
-

