How to create a Ghost blog with docker 🐳+ AWS ❤️
25 Jun 2019- Login to the AWS website
- Click on Services (top bar)
- Click on EC2
- Click on Launch Instance
- Search and choose Ubuntu Server (18 or up)
- Leave selected the free tear (unless you have upwards of $10000000000)
- Edit security groups (by clicking on
edit security groups) - Click Add rule -
http- leave other defaults - Click Add rule -
https-leave other defaults - Click Launch Instance
- Choose Create new pair key from the drop down selector (name it and download it)
- Open terminal
- CD into the directory where the pair key was downloaded to and do this
- Change the .pem file permissions with:
sudo chmod 600 <<MYPAIRKEYFILENAME>>.pem - Go to your AWS instances tab in the EC2 page and find the Public DNS (IPv4) of your instance
ssh [email protected]<<INSERT.Public.Dns.IPv4>> -i PairKeyName.pem- Type
yesto get into the ubuntu computer - Install docker:
sudo snap install docker - Make a start file:
vim startserver - Put this in the script👇:
#!/bin/bash; docker run -d --name website -e url=https://<<websitename>> -p 80:2386 -v /home/ubuntu/website:/var/lib/ghost/content ghost- Create a /website directory:
mkdir website - Go to
cloudflare.comand link your website to it by creating an account (or signing in) and going through the steps to link it to your URL that you used in step 21 - Make a
CNAMErecord with the name being@and the address being the public IPv4 of the aws instance that you found in step 15 (example:ec2-54-224-132-93.compute-1.amazonaws.com) - Go to your domain service (mine is google domains) and set the nameservers to be cloudflare’s (you should have already done this step while setting up cloudflare in step 23)
- Change the permissions of the
startserverscript to be able to execute:chmod +x startscript - Now run it:
./startscript - It will take a bit to complete because docker needs to pull the image off of their website, but when it does everything should be up and running
Please Note
It may take a bit for cloudflare to enable https. It will also take some time for your domain provider to change its nameservers and for that change to propagate back to cloudflare.