Simple node.js app that servers "hello world"
Great for testing simple deployments to the cloud
#AWS CI/ID Deployment
EC2 Terminal Github Action Runner
- In AWS create EC2 instance
- Connect using SSH client
- Setup git git Actions -> Runner Script on SSH Client terminal
- Use Linux x64
- on Run ./config.sh -> enter Runner group name = default, then runner name, also label same as name better, then _work just press enter
- finally then run ./run.sh
- check the runner status (idle)
- Setup Docker Username, token in Github -> secrets and variable -> Actions
EC2 Terminal Docker installation
- run "sudo apt update"
- run "sudo apt install -y docker.io"
- run "sudo systemctl start docker"
- run "docker --version" -> version should look like "Docker version 27.5.1, build 27.5.1-0ubuntu3~24.04.2" NOT "Docker version 28.3.3, build 980b856"
- create .yml file in .github/workflow/ write the code same as in current directory
- in .yml script should replace below things
- shadhirshaz/node-hello -> [dockerhub-repo-name]
- 3000 -> [your-port]
- node-hello-container -> [your-branch]-container
- deploy.yml file we can add multiple ports to run docker image [-p 80:3000]
- "permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.47/containers/json": dial unix /var/run/docker.sock: connect: permission denied"
i. run sudo su
ii. chmod 666 /var/run/docker.sock
iii. retry failed job
- "permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.51/images/create?fromImage=docker.io%2Fshadhirshaz%2Fnode-hello&tag=latest": dial unix /var/run/docker.sock: connect: permission denied"
i. run sudo su
ii. chmod 777 /var/run/docker.sock
SSL Certificate connect prograss with custom domain
- create elastic ip and associate with current instance
- add DNS records in cloudflare(DNS managenemt), A Record, Proxy status should be "DNS Only"