Personal website to display some data products and to impose my will on the internet via blog.
Run two independent apps that do not communicate with each other for debugging and dev. Requires: Python 3.5 and npm.
cd backend
set FLASK_APP=run.py
(export FLASK_APP=run.py
)pip install -e .
flask run
cd frontend
npm install
npm run serve
The full app can be run through docker but tends to slow down my computer a lot.
cd website
echo "VUE_APP_ROOT_API=http://localhost > frontend/.env.production
docker-compose -f docker-compose-http.yml up --build
-
Set Up AWS EC2 instance:
- Ubuntu 18.04 Image
- t2.small (~$0.0023 / hour or ~$16 / month)
- t2.micro works if you download the
minified
branch ofcard-classifier
, otherwise you will get aKilled
error during install ofmaster
on t2.micro (I assumetensorflow
is the culprit). This is ~1/2 the price of t2.small.
- t2.micro works if you download the
- Optional: Check Spot Requests to lower costs. But be warned that Amazon is on bullshit and your instance will disappear without explanation.
- Enable Auto-assign Public IP
- 10-12 GB EBS (Costs ~$0.10 GB / month)
- Security Group
Website
:- SSH on 22
- HTTP on 80
- HTTPS on 443
-
Set up project
- SSH into instance
- Go to server root (EC2 defaults login as
ubuntu
so justcd ../../
after ssh-ing in) sudo git clone https://github.com/spwhite1337/website.git
cd website
source initialization.sh
- Get AWS Keys from S3 Bucket
s3://scott-p-white/personal/keys
- Get AWS Keys from S3 Bucket
-
Update DNS records in GoDaddy account
-
Update hard-coded domain name in the
nginx
folder andletsencrypt
folder of this repo. The rest of the docs assumescottpwhite.com
.nginx.conf
letsencrypt-staging.sh
letsencrypt-prod.sh
(Also change the email in this script)
cd website
sudo sh -c "echo 'VUE_APP_ROOT_API=http://scottpwhite.com' > frontend/.env.production"
sudo docker-compose -f docker-compose-http.yml up --build
SSL Certification can be accomplished with a free process from Let's Encrypt to enable transfer of data over HTTPS.
Generate an SSL certificate with Let's Encrypt / Certbot on a test site served over the domain. (Reference)
-
Stop and prune any running containers (e.g.
sudo docker system prune -a
) -
cd website/letsencrypt
-
sudo docker-compose up -d
-
Go to
http://scottpwhite.com
andhttp://www.scottpwhite.com
to verify site is working over http -
Test the certification process with:
-
Generate the certificates and save them to docker-volumes (rate limits are currently at 50 certificates per domain per week. Should be plenty but best not waste them.):
-
Shut down initial certification container with:
sudo docker-compose down
This is a security key I don't totally understand but was recommended by the internet. We'll add it as well.
- Clear all containers / networks with:
sudo docker system prune -a
cd website
sudo sh -c "echo 'VUE_APP_ROOT_API=https://scottpwhite.com' > frontend/.env.production"
sudo docker-compose -f docker-compose-https.yml up --build
Set up a cron job to automatically renew SSL certificates in the docker environment (This still needs to be verified):
0 0 1 * * cd website/letsencrypt && echo 'Y' | source cert_renewal.sh >> cron.txt