Sitemap
ankita bhadani

ankita bhadani

project: 1

2 min readDec 18, 2023

Good evening connections, Hope you all are doing good !

Today, I have deployed full fledge NODE_ ToDo App using | Docker | Jenkins | EC2 | GITHUB | WEBHOOKS |

Tried my best to list the whole workaround in short & simple steps :-

1. Create an EC2 instance ( Here i have used Ubuntu linux )

2. Clone your GIT Repo & install all the package’s as per the Readme file ( Here it’s node.js, NPM libs )

3. Install the latest Java runtime package & install Jenkins.

4. Install Docker

5. Configure Jenkins & make a pipeline by giving the below mentioned steps :

$ GIT project URL, GIT Repo & specify the branch

Get ankita bhadani’s stories in your inbox

Join Medium for free to get updates from this writer.

$ Git SSH key file for Jenkins ( Generate the same via “ssh-Keygen” on EC2 ) & put it into the credentials

$ Enable GitHub hook trigger for GITScm polling via build trigger’s tab

$ Write build steps in execute shell box ( Docker Build & Run command mentioning the open port & app name )

$ Generate the SSH keys from EC2 to connect Git from Jenkins

** Make sure that both Jenkins & Docker service were having the sudo privilege’s to avoid failure **

5. Open port 8080 & 8000 for jenkins & docker from EC2 security groups >Edit Inbound Rules

** Make sure to edit route tables & Internet gateway or NAT if you have deployed the EC2 instance under a VPC __subnet **

6. Try to run the app from native EC2 & Docker so that our pipeline won’t suffer any failure ahead.

  • * Make sure to kill or remove any running containers before building the pipeline on Jenkins to avoid failure **

This application is basically java script & node js application.
Activity:-
1. Instance connect to terminal.
2. install docker
3. check — docker — version
4. mkdir projects
5. cd projects/
6. git clone <application url>
7. ls
8. cd node-todo-cicd/
9. rm Dockerfile
10. vim Dockerfile
FROM node:12.2.0-alpine
WORKDIR app
COPY . /app
RUN npm install
EXPOSE 8000
CMD [“node”,”app.js”]
11. docker build . -t node-todo
12. docker ps
13. docker run -d — name node-todo-ctr -p 8000:8000 node-todo:latest
14. add inbound rule on your instance port- 8000
7. paste <public ip>:8000 show my application
When we deploy node-todo-cicd on my server than my challenges face so, point no.
“10”, “11”, “13” is very important to all DevOps aspirants who learn docker.

--

--