Step 1
Access AWS!!!
-
access aws
-
Set your region to Ohio
-
Find EC2, should be there.
-
Navigate to instances
-
Find NCS.cf Yeung CSP or NCS.gq Mort CSP and click connect.
-
Type in cd ~
-
Run the commands below:
First you type in: $ virtualenv -p /usr/bin/python3 webapp
Then type: $ source webapp/bin/activate
Now Type in sudo docker-compose up in your terminal
After that type in the link in your browser: something like https://localhost:PORTNUMBER.. if this works, push your changes and your good.
-
now type in docker-compose up -d --build
-
now curl your site by typing - curl localhost:PORTNUMBER
-
If it shows you a bunch of HTML, this is a good sign and now your almost done.
NGINX stuff via Azeem Khan & Jeffery F.
So it turns out Jeffery created a pretty good guide for nginx stuff, here is a link to access it: Jeffrey's guide to duckdns
make sure to create your own config file: you can type in $ sudo nano PROJECTNAME
My friend Azeem did a great job by including how your config file should look like so here it is:
-
save changes - CTRL X
-
create a link:
$ cd /etc/nginx/sites-enabled
$ ln -s /etc/nginx/sites-available/PROJECTNAME/etc/nginx/sites-enabled
then type $ sudo nginx -t
- now you have to restart so run:
sudo systemctl restart nginx
- check if it works on chrome or your preferred browser.
Step 4
Certification stuff
Certbot allows your site to be HTTPS, this is good.
Run commands below
$ cd
$ sudo snap install core; sudo snap refresh core
$ sudo snap install --classic certbot
$ sudo ln -s /snap/bin/certbot
$ sudo certbot --nginx
My friend Azeem helped me understand why we need https and a valid certificate, he taught me to run these commands.
Final Step
What if I wanted to change code or any other stuff?
-
cd to your project
-
type:
sudo docker-compose ps
- now type:
sudo docker ps
-
run: git status (to see if there are changes)
-
type in:
sudo docker-compose kill
now it should say 502 BAD GATEWAY
-
make sure to git pull
-
type in:
sudo docker-compose up -d --build
- restart:
sudo systemctl restart nginx
- cd into your project and type in curl localhost:PORTNUMBER
You can probably see changes saving
- now type in your url in browser and see if the changes saved.
If it did, good job, it worked!