Ghost is a lightweight blogging platform. This repository contains CloudFormation scripts and other resources to deploy your own Ghost blog stack in AWS. This is NOT designed to be production ready but to host a personal blog with minimal cost using AWS free tier :-)
The stack runs 4 docker containers inside an EC2 instance.
- Ghost - blogging platform
- Traefik - reverse proxy
- Commento - commenting platform
- PostgreSQL - commento database
Docker-compose is used for the container orchestration.
Below is the high level design.
- Registered domain for the Lets Encrypt integration to work
- User account and domain verification with an SMTP provider such as mailgun
- AWS account and an IAM user with programmatic access
Once you clone the repository make sure to update the following files to reflect your details.
-
commento.env
Comment out everything but below two values for the initial deployment as smtp setup interferes with the Commento admin account registration
-
COMMENTO_ORIGIN
-
COMMENTO_POSTGRES
-
-
ghost.env - add your smtp details here
-
docker-compose.yaml
Update the following lines
certificatesresolvers.letsencrypt.acme.email={YOUR EMAIL}
traefik.http.routers.ghost.rule=Host({YOUR DOMAIN})
traefik.http.routers.commento.rule=Host(commento.{YOUR DOMAIN})
-
ghost-blog-setup.cfn.yaml
command: "sudo aws s3 cp s3://{YOUR BUCKET NAME}/blog/config/ /data/traefik/ --recursive"
-
inception.cfn.yaml
- Update
HostedZone
with your domain - Update
MyMailGunDomainKeyRecordSet
resource with your domain key
- Update
-
Makefile
- Update
REGION
,PROFILE
andBUCKET
values
- Update
- Deploy the
inception stack
- this creates the initial infrastructure in the AWS accountmake create-inception-stack STACK_NAME=inception-stack-name
- Deploy the
blog-host stack
- this deployes and configures the Ghost hostmake create-blog-host-stack STACK_NAME=host-stack-name
Check CloudFormation stacks for any errors.
- Use AWS SSM to log into the Ghost host, navigate to /data/traefik folder and bring up the stack with
docker-compose up -d
- Register your admin user with ghost on https://yourdomain.com/ghost
- Register yourself to the local commento on https://commento.yourdomain.com
- Use AWS SSM to log into the Ghost host, navigate to /data/traefik folder and bring down the stack with
docker-compose down
- Uncomment smtp setup values in
commento.env
- Uncomment
COMMENTO_FORBID_NEW_OWNERS=true
to avoid new registered users - Bring up the stack again with
docker-compose up -d
- In the Ghost host:
cd /data/traefik
- Set
BUCKET
value inbackup-all.sh
./backup-all.sh
This will backup all the content and config files into the S3.
- In the Ghost host:
cd /data/traefik
- Set
BUCKET
value inupdate-components.sh
./update-components.sh
This will pull new docker images and update the stack.
Have a look at my blog https://fewmorewords.com/ghost-on-aws
It is deployed using this stack and only costs me less than a dollar per month :-) with AWS free tier
Enjoy!