Simple DevOps Project: Deployment of 2048 Game on AWS using docker
Table of contents
Introduction
This application was deployed in the Ec2 instance of Ubuntu's Processor of T2 Micro with 8 GB of storage on it.
Setup:
Launch an EC2 instance.
Sign in to the AWS Management Console.
Go to the EC2 Dashboard.
Click on "Launch Instance."
Choose an Amazon Machine Image (AMI) with Ubuntu, such as "Ubuntu Server" or "Ubuntu LTS."
Select an instance type, configure instance details, and add storage as needed.
Configure security groups to allow SSH (port 22) and any other required access.
Review and launch the instance, and create or choose an existing key pair to connect to the instance securely.
Connect to the EC2 instance:
Once your EC2 instance is running, you can connect to it using SSH. Replace
your-key.pem
with the actual name of your key pair file andyour-instance-ip
with the public IP of your instance:ssh -i your-key.pem ubuntu@your-instance-ip
Update and Upgrade Packages:
After connecting to the instance, it's a good practice to update and upgrade the system packages to ensure you have the latest software and security updates:
sudo apt update sudo apt upgrade
We have to install Docker.
sudo apt install docker.io -y
We have given permission to docker
Then we will write a Dockerfile for our 2048 app
FROM ubuntu:22.04 RUN apt-get update RUN apt-get install -y nginx zip curl RUN echo "daemon off;">>/etc/nginx/nginx.conf RUN curl -o /var/www/html/master.zip -L https://codeload.github.com/jabir000/2048/zip/master RUN cd /var/www/html/ && unzip master.zip && mv 2048-master/* . && rm -rf 2048-master master.zip EXPOSE 80 CMD ["/usr/sbin/nginx", "-c", "/etc/nginx/nginx.conf"]
Execute the following commands in the new terminal
pwd ls docker build -t <docker image name> .
docker images
docker run -d -p 80:80 <container id>
docker ps
๐ Thank you so much for reading my blog! ๐ I hope you found it helpful and informative. If you did, please ๐ give it a like and ๐ subscribe to my newsletter for more of this type of content. ๐
I'm always looking for ways to improve my blog, so please feel free to leave me a comment or suggestion. ๐ฌ
Thanks again for your support! ๐