Configuration details:
- EC2 instance name: todaysphere-app
- Docker node.js app image name : todaysphere_app
- Docker node.js app container name: todaysphereapp
- App URL format - http://EC2_INSTANCE_PUBLIC_IP_ADDRESS:3000
Deployment link - https://todaysphere-app.onrender.com
TodaySphere Node.js App which has completely automated deployment using Jenkins, AWS EC2, Docker and GitHub CI/CD. This app accepts location as an input from the user and based on that it shows the current weather, news for that location/region, an activity of the day which the user can perform and NASA's Astronomy Picture of the Day. A one-stop solution to start a good day! 😃
For the Devops part of this project, I created an AWS EC2 instance, installed Jenkins on the server, then integrated Jenkins with this GitHub repository containing Node.js app code. Next, using Docker, I dockerized the Node.js app and automated this process on Jenkins. Finally automated the whole process using GitHub Webhooks.
App Name: Today + Atmosphere(around you) - TodaySphere 😉
- Node.js
- AWS EC2
- Jenkins
- Docker
- GitHub Webhooks (for CI/CD)
- WeatherStack
- Mapbox
- NewsAPI.org
- NASA Open APIs
- Bored API
To get started with the project, follow these steps:
- AWS account
- GitHub account
Note:
-
Make sure to enable port 8080 inbound traffic while creating the EC2 instance
-
(with default settings) Login as "ubuntu" using putty with the .ppk file
-
Inside the EC2 instance (choose OS as Ubuntu)
sudo apt update- Installing Java inside EC2 instance
sudo apt install openjdk-11-jrejava -version- Installing Jenkins on EC2 instance
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key |sudo gpg --dearmor -o /usr/share/keyrings/jenkins.gpgsudo sh -c 'echo deb [signed-by=/usr/share/keyrings/jenkins.gpg] http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/nullsudo apt updatesudo apt install jenkinssudo systemctl start jenkins.servicesudo systemctl status jenkinssudo cat /var/lib/jenkins/secrets/initialAdminPassword- After setting up Jenkins, use the following commands to integrate it with GitHub
ssh-keygencat id_rsa.pubcat id_rsa- Running the Node.js app on EC2 instance
cd /var/lib/jenkins/workspace/todaysphere-appsudo apt install nodejssudo apt install npmsudo npm installnode app.js- Installing Docker and Containerizing the Node.js app
sudo apt install docker.iosudo chmod 777 /var/run/docker.socksudo docker build . -t todaysphere_appsudo docker run -d --name todaysphereapp -p 3000:3000 todaysphere_app:latest- Jenkins Build step (execute shell)
docker build . -t todaysphere_appdocker container rm -f todaysphereappdocker run -d --name todaysphereapp -p 3000:3000 todaysphere_app:latest- Optional - To open access to ports/firewall modification (incase 8080 port does not open)
sudo ufw allow OpenSSHsudo ufw enablesudo ufw allow 8080sudo ufw status








