Let’s pull the docker image
Course: CI/CD - chapter 8
Ref - https://github.com/appleboy/ssh-action
- Create an ec2 server
- Download its keypair file
- Allow http/https traffic
- Ubuntu base image
- Download docker on the machine
- https://docs.docker.com/engine/install/ubuntu/
- sudo docker run hello-world
- Update workflow to pull the latest image on the ec2 machine
$1b- Point userapp.your_domain.com to the IP of the server
- Add nginx reverse proxy to forward requests from userapp.your_domain.com to port on which the app is running
server { server_name userapp.100xdevs.com;
location / { proxy_pass http://localhost:3005; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade;
# Basic Authentication auth_basic "Restricted Content"; auth_basic_user_file /etc/nginx/.htpasswd; }
listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/userapp.100xdevs.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/userapp.100xdevs.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}- Install certbot and Refresh certificate
sudo certbot --nginxTake home assignments
Section titled “Take home assignments”- Get a DB on
neon.tech/RDS/Aeivenand add a DB migration step to the DB - Pass in the DB credentials while starting the docker image
- Start the docker image so that it restarts if it goes down (similar to pm2)