Skip to content

An documentation site boilerplate using Gatsby, Docz, Mermaid and deploy to S3 with authentication through CloudFront (Lambda@Edge).

Notifications You must be signed in to change notification settings

renanbatel/gatsby-docz-mermaid

Repository files navigation

Gatsby Docz with Mermaid

Setup

$ yarn # npm i

Start developing

$ yarn dev # npm run dev

Build

$ yarn build # npm run build

Serve built app

$ yarn serve # npm run serve

Deploying with Pulumi to S3 with authentication

  • Install Pulumi.
  • Install AWS CLI and configure your credentials.
  • Configure the Pulumi.prod.yml file.
    • aws:region
      The AWS region to create the resources.
    • site:dir
      The site files directory, (in case of this project, the site files are built in public folder).
    • site:name
      The site name for creating the resources (it needs to be in slug format).
    • site:log-requests
      Set to true if you want to save the CloudFront request logs (it will create a S3 Bucket for it).
  • Build your site files.
  • Compress the lambda function.
$ yarn lambda:build # npm run lambda:build
  • Deploy
$ yarn deploy # npm run deploy
  • Choose Yes and wait for the resources creation, it will take a while so be patience.
  • When the process is finished you need to link the Auth Lambda Function with your CloudFront distribution manually (deploy to Lambda@Edge), because there's a Bug in AWS that doesn't permit to do such thing through its API, you can read more about in this thread.

This deploy setup was made based on this article.

About

An documentation site boilerplate using Gatsby, Docz, Mermaid and deploy to S3 with authentication through CloudFront (Lambda@Edge).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published