Prerender service based on https://prerender.io
NOTE: All commits should use https://www.conventionalcommits.org/en/v1.0.0/. TODO(acorn1010): Use https://github.com/semantic-release/semantic-release
You'll need the following dependencies before you can run this project:
- CLI tools:
- Ubuntu:
sudo apt install -y packer kubectl hcloud-cli
- Go to https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli#install-terraform and install Terraform
- Mac:
brew install terraform packer kubectl hcloud
- Ubuntu:
- Make an
ed25519
SSH key (rsa
isn't supported):
[ -f ~/.ssh/id_ed25519 ] || ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519 && chmod 400 ~/.ssh/id_ed25519*
- Set up an hcloud context:
hcloud context create <project-name>
- Add this Bash alias:
alias createkh='tmp_script=$(mktemp) && curl -sSL -o "${tmp_script}" https://raw.githubusercontent.com/kube-hetzner/terraform-hcloud-kube-hetzner/master/scripts/create.sh && chmod +x "${tmp_script}" && "${tmp_script}" && rm "${tmp_script}"'
- Run
createkh
from your repository root. PressEnter
to skip directory choice, thenyes
when creating the MicroOS snapshots.
- Hetzner for K3s cluster (CPX31)
- Terraform
- client:
- server:
- Compute: Hetzner shared cloud (cheap compute + network)
- Alternatives:
- Contabo (cheap compute)
- OVH (cheap network)
- Alternatives:
- Storage: Hetzner volumes
- Alternatives:
- Cloudflare R2 ($15 / TB, $4.50 / 1M writes, $0.36 / 1M reads)
- Wasabi ($6 / TB, no egress)
- Alternatives:
- Network: Hetzner Load Balancer
- CDN: Cloudflare Pages (it's free)
- Playwright for browser rendering
- Worker scripts for clients to interface with API:
- Compute: Hetzner shared cloud (cheap compute + network)
- shared
- A repo shared by both client and server. Safe way to allow typed APIs without leaking server code.
ts-json-schema-generator
is used for validation on the server.
- A repo shared by both client and server. Safe way to allow typed APIs without leaking server code.
- Create a Terraform user API token here and set up an
organization
andworkspace
. This is yourTF_API_TOKEN
. - Get your
SSH_PUBLIC_KEY
from your https://github.com/acorn1010.keys - Add
SSH_PUBLIC_KEY
,TF_API_TOKEN
,GCR_SECRET
,HETZNER_TOKEN
to yourGitHub Settings > Secrets and Variables > New repository secret
- Backend Service on K8 handles API requests to render pages, store the pages in our Storage solution