The stack that powers my personal website and wrote about in this post.
Featuring
A scheduled Lambda function fetches a summary of latest activity from Github, Twitter, Reddit and Medium. It then generates a new static website using this webpack config and uploads the resulting build to S3.
Terraform is used to create the required resources in AWS after setting a few environment variables, including Route53 entries for your domain and emails (via Mailgun).
Install terraform from the downloads page
open https://www.terraform.io/downloads.html
Clone the repository (without history)
git clone --depth=1 [email protected]:jschr/jschr.io.git example.com
Install app dependencies
yarn install
Set environment variables
cd instructure/env-dev
mv vars.tfvars.sample vars.tfvars # rename sample file
open vars.tfvars # set env vars
Development
mv .env.sample .env # rename sample file
open .env # set env vars for development
yarn start # starts webpack dev server
open localhost:8080
Deploy infrastructure
yarn run terraform-plan # review the infrastructure changes
yarn run deploy
Deploying will take a few minutes but you'll need to wait about 15-20 minutes before the CloudFront distribution is created. By then the Lambda function should have ran to generate the website.
You can invoke the Lambda function by logging into the aws console and heading over to the Lambda management section.
Then go to Functions -> website_generator -> Test.
If it ran successfully you will see the result of the CloudFront invalidation.
You can create your own components to customize the look and feel.
Modify the props passed to your components in getProps.
You can add more data sources to make your site more dynamic.
Feel free to create an issue with any questions about deploying your own version!
You are mosly paying for CloudFront invalidations which by default happens every 15 minutes.
The first 1000 invalidations are free, afterwhich it's $0.005 per invalidation path. With the default settings thats about 2,880 invaldations per month for a total of ~$10/mo USD.
You can increase the render interval to 45 minutes if you'd prefer to stay within the free tier.