0.0.9 • Published 2 years ago
cdk-hugo-pipeline v0.0.9
cdk-hugo-pipeline
This is an AWS CDK Construct for deploying Hugo Static websites to AWS S3 behind SSL/Cloudfront with cdk-pipelines
with having an all-in-one infrastructure-as-code deployment on AWS, meaning
- self-contained, all resources should be on AWS
- a blog with hugo and a nice theme (in my opinion)
- using cdk and cdk-pipelines running
- a monorepo with all the code components
- a local development possibility in docker
- which includes building the code in the container with build.sh to test also locally upfront
- with a development stage on a
dev.your-domain.com
subdomain
Take a look at the blog post My blog with hugo - all on AWS in which I write about all the details and learnings.
Usage
TBD
mkdir my-blog && cd my-blog
npx projen new awscdk-app-ts
# add hugo template
git submodule add https://github.com/apvarun/blist-hugo-theme.git frontend/themes/blist
# add fix version
git submodule set-branch --branch v2.1.0 frontend/themes/blist
If you use hugo modules add them as git submodules in the themes
directory, so they
can be pulled by the same git command in the codepipeline.
If with npm test
you get the error docker exited with status 1
, then clean the docker layers and re-run the tests via docker system prune -f
.
Typescript
import { App, Stack, StackProps } from 'aws-cdk-lib';
import { HugoPipeline } from 'cdk-hugo-pipeline';
export class MyStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
new HugoPipeline(this, 'HugoPipeline', {
TBD: 'TBD',
domainName: 'your-domain.com' // Domain you already have a hosted zone for
});
}
Resources / Inspiration
- cdk-hugo-deploy: however we need to build the static site with hugo before locally
- CDK-SPA-Deploy: same as above