Goring SSL
Goring sites currently do not use CloudFront and instead have LetsEncrypt running on the Lightsails providing SSL certificates.
Goring SSLs no longer need to be touched but I thought I'd provide the information here for posterity
Certbot
Certbot is already installed on the Lightsail and is responsible for generating SSLs. To generate them, the docker container needs to be brought down temporarily, the certbot command ran, the certificates moved and renamed and then the docker container brought back up.
Bring down the docker container
docker-compose -f docker-compose.prod.yml downRun
sudo certbot certonly --standaloneand follow instructions:- Enter
developers@wesayhowhigh.comwhen asked for email address - Agree to the first set of terms
- Say No to the second set of terms (about statistics etc)
- In the domain part make sure you include www and non-www comma separated (eg: domain.com,www.domain.com)
- Enter
Once successful It will place 2 files inside /etc/letsencrypt/live/DOMAIN/ - fullchain.pem and privkey.pem.
You'll want to move and rename them into /etc/ssl/
It's easier to do this in sudo (as you can TAB to autofill the correct directories) so type
sudo suand hit EnterCopy
fullchain.pemas site.cert -cp /etc/letsencrypt/live/DOMAIN/fullchain.pem /etc/ssl/site.certCopy
privkey.pemas site.key -cp /etc/letsencrypt/live/DOMAIN/privkey.pem /etc/ssl/site.keyBring up the docker container -
docker-compose -f docker-compose.prod.yml upVisit the website and inspect the certificate to make sure the expiry date has increased\
Certbot Automated Renewal
To enable auto-renewal on LetsEncrypt (Cerbot) Goring Sites:
Switch to sudo: sudo su
Go to the renewal-hooks directory inside the LetsEncrypt directory cd /etc/letsencrypt/renewal-hooks
You'll see 3 directories inside there; pre, deploy and post - you'll be creating a script in each of those folders and making them executable.
Create the pre.sh file first:
Type vi /pre/pre.sh to open up Vi ready for editing. Hit I to go to INSERT mode (prevents copy and pasting stripping the first few characters).
Once pasted, hit Esc then type !wq and press Enter to quit and save the file.
Pre Script
#!/bin/sh
# Bring down website to allow cert validation
docker-compose -f /home/ubuntu/docker-compose.prod.yml down
Deploy Script
#!/bin/sh
# Backup existing certificates
cp /etc/ssl/site.key /etc/ssl/site.key.backup
cp /etc/ssl/site.cert /etc/ssl/site.cert.backup
# Copy across new certificates
cp $RENEWED_LINEAGE/fullchain.pem /etc/ssl/site.cert
cp $RENEWED_LINEAGE/privkey.pem /etc/ssl/site.key
Post Script
#!/bin/sh
# Bring up website
docker-compose -f /home/ubuntu/docker-compose.prod.yml up -d
Make Files Executable Type the following commands to make the files you've just created executable:
chmod +x pre/pre.sh
chmod +x deploy/deploy.sh
chmod +x post/post.sh