Infrastructure-as-Code for a pipeline for building and deploying Hugo websites in Amazon Web Services.
What do you need already?
- Each of your Hugo websites' source code in a separate GitHub repository. Private repositories are okay.
- A Route53 Hosted Zone for each website's domain.
What does this deploy?
For each website, in a nutshell:
- A CodePipeline pipeline for pulling website source from GitHub, building it, testing it, then publishing to S3.
- A TLS (HTTPS) certificate for the domain.
- A CloudFront distribution, with Lambda functions to handle:
- Redirecting the
www.subdomain to the root domain.
index.htmlif the client requests a directory.
- Download and unpack the latest release build.
config.ymland add your websites.
secrets.ymland add your secrets.
hugo-awsand cross your fingers. You should expect ~30 minutes per website for this initial deployment.
Each website will build and deploy automatically on commit to the
- UX testing and feedback on the deployment process.
- Email alert when a build/test/deploy fails.
Obviously, huge credit to the Hugo project. Thank you!
This project also uses the following projects:
- github.com/cariad/gocloudformationplus for managing CloudFormation stacks.
- github.com/cariad/godomaincert for managing AWS certificates.
- github.com/cariad/s3headersetter to set the HTTP headers on S3 objects.
- github.com/gjtorikian/html-proofer for validating the built websites before publishing them.
Licence, credit & sponsorship
This project is published under the MIT Licence.
You don't owe me anything in return, but as an indie freelance coder there are two things I'd appreciate: