Skip to content

Source content for my personal website, including a custom static site generator.

License

Notifications You must be signed in to change notification settings

Nadock/rileychase.net

Repository files navigation

rileychase.net

Simple static site generator and content that powers rileychase.net.

Deploy website Python 3.12 Ruff

Info For People That Aren't Me

rileychase.net is generated by a custom static site generator tool. You can find the source code for that tool under :/site_generator.

This tool was not designed to solve anyone's problems but my own, so it isn't published anywhere like PyPi. I'd suggest you consider a more established static site generator for your project. If this hasn't scared you away and you want to give it a shot, I'd recommend forking the repo and deleting all the site contents.

The rest of this README contains notes and instructions for me to run my local environment, etc. If you're trying to run the site_generator yourself it's probably worth a read.

Development Environment Setup

To work on the site content or the site_generator you will need a working install of Python 3.12 and Pipenv.

  1. Clone the repo
  2. Setup a Pipenv venv with pipenv install --dev
  3. Make sure you're using the Pipenv venv with pipenv shell

Additionally, I'd recommend you install the task CLI as the included :/Taskfile.yaml file contains many helpful development shortcut commands. (Think a Makefile that sucks way less)

Site Generator Usage

The site generator has three commands; build, live, and validate. Their use and purpose are described below.

build

Builds the entire site once and writes it to the output directory. Exits 0 if the build succeeded or non-zero if it failed.

live

Builds the entire site, then runs a simple Python web server at (by default) http://localhost:8000. The site_generator then watches the source files for changes, and when a change is detected the site will be rebuilt.

validate

Validate the site pages contents for valid content and front matter information. This only checks semantics, it won't stop you from putting something silly, like a spelling mistake etc, in a field.

CI/CD

PR Checks

The following tools run on every PR and must succeed before a branch can be merged to main.

  • ruff & mypy are run to validate code quality.
  • Unit tests are run with pytest.
  • The site_generator validate command is run to check page front matter.
  • Markdown content is validated by markdownlint — install Node.js dependencies for this tool.
  • AWS CloudFormation is linted with cfn-lint.

All of these checks can be run locally with task ci.

Temporary cfn-lint Workaround

Currently cfn-lint is incompatible with Pydantic v2 (via a dependency of theirs). Until that is resolved, we can't install cfn-lint and Pydantic in the same Pipenv environment. To work around this for now, please install cfn-lint manually in a separate Python environment or rely on the pull request checks to run the Cloudformation linting.

Deploys

On every merge to main, if the site contents was modified, the site will be built and uploaded to AWS S3. Then an invalidation is run on the CloudFront Distribution that hosts the site so the new content appears to users.

Infrastructure

S3 and CloudFront

The CloudFormation template :/aws/website_cfn.yml contains the S3 & CloudFront combo that actually serves the site contents.

To deploy updates to this template run task aws:website:deploy. Note: Changes to the CloudFront Distribution can take a long time to complete. This workflow relies on the .env values DOMAIN_NAME, and CERTIFICATE_ARN.

GitHub Actions

An IAM Role for GitHub Actions to use in CI/CD is maintain in the :/aws/gha_role_cfn.yml CloudFormation template. This used OIDC to authenticate with AWS STS.

To deploy updates to this template run task aws:gh-actions:deploy. This workflow relies on the .env values BUCKET_NAME and DISTRIBUTION_ID.

ACM Certificate

The CloudFormation template :/aws/acm_cert_cfn.yml contains the ACM Certificate used by CloudFront to serve our site contents at rileychase.net.

To deploy updates to this template run task aws:acm:deploy. This workflow relies on the .env values DOMAIN_NAME and HOSTED_ZONE_ID.

About

Source content for my personal website, including a custom static site generator.

Resources

License

Stars

Watchers

Forks