Project
CompletedBuilding a new website
My first post is about how this personal website came to be.

Part 1: Start at the beginning, where else?
I’ve tinkered with site building on and off over the years mainly for fun and out of curiosity, but have never really needed a website. I still remember somewhat fondly building pages with raw HTML back in the 90s. Then I remember using Macromedia’s Dreamweaver to build dynamic and static sites. Then came the likes of WordPress (WP) and Drupal, but that was pretty much it.
Except now I wanted a site to play with.
So I used Google to find the quickest way to deploy the simplest kind of website, and that rabbit hole led me to static site generators (SSG). Among the most popular were Hugo, 11ty, Gatsby, Jekyll, and Astro.
I had never tried an SSG site before so this was new to me. If you don’t know what SSG is, read What is a static site generator? to learn more. I’ll wait.
I wanted to learn something new, something different, which is why hosting static files intrigued me, but I still hasn’t grasped how it all worked. Just bits here and bits there.
I worked out that my site needed to:
- use markdown
- be fast
- be scalable
- use version control
- use a suitable host
Putting the JAM in JAMstack
New word alert “JAMstack”!
Jamstack is an architectural approach that decouples the web experience layer from data and business logic, improving flexibility, scalability, performance, and maintainability. Jamstack removes the need for business logic to dictate the web experience. It enables a composable architecture for the web where custom logic and 3rd party services are consumed through APIs.
The first time I read that I didn’t quite get it. From what I understood, a lot of SSGs used the JAMstack framework. This was all new, and like anything new it was bewildering, shiny, different, and had its own learning curve and language.
So putting these pieces together, what does a website look like? There’s no hard and fast rule which determines how this can be put together because as a technology it can be assembled in many ways targeting different platforms.
Part 2: My Architecture
As I worked my way through documentation, YouTube videos, and local installs on my local server it started to become clearer.
In my mind building this site can be thought of as two distinct parts:
- infrastructure (infra)
- website application
Infrastructure
Since I was opting to use static files with no client-side or server rendering, the files would be built then need to be hosted and delivered when a user requests it. They don’t want to wait more than a few seconds at the most, they want it now with minimal latency, wherever they happened to be in the world.
There are many deployment options on offer which will take care of the underlying infra for you, thus removing this element. For example you can host static pages on Cloudflare, GitLab Pages, GitHub Pages, Static.app, Netlify, or Vercel. They work with Git so you can version control your files, and on merge configured runners will typically take care of the rest, pushing content to your preferred host. These platforms all vary on price too.
Alternatively you can use a cloud provider such as AWS or GCP to host static files in a bucket, but you would need to build out this infra yourself. And since this was a static site learning exercise, this is the route I took.
In terms of how the content flows from creating markdown using Visual Studio Code, to the published page, this is what I came up with:
![]()
The underlying infra making all of this happen is built using Terraform (IaC) and kept in its own repo.
If you’d like a little more detail on the infra buildout, this is what it looks like:
A static site on GCS, fronted by a global HTTPS load balancer with Cloud CDN, deployed by Cloud Build on every push to the site’s source repo (private). This repo owns the GCP networking, storage, and IAM — and now deploys itself too: infra changes plan on every pull request and apply on merge to main via GitHub Actions, authenticated to GCP with no long-lived key.
Diagram reads left→right within each row: the bucket is the origin, content is delivered to the browser through Cloud CDN and the load balancer, and a separate http-redirect-map / http-redirect-proxy / http-forwarding-rule chain answers port 80 on the same static IP and 301s to HTTPS.
GitHub Actions (my website repo) exchanges a short-lived OIDC token with the Workload Identity Pool — no stored key — to impersonate terraform-ci, which runs terraform apply against every resource in the dashed boundary, including its own WIF pool/provider and the cloud-build-sa block. apply only runs after a human approves the production environment gate; IAM-role detail is listed on each service account rather than drawn as individual arrows to keep the chain legible.
What’s outside this repo?
The Cloud Build trigger itself — there’s no google_cloudbuild_trigger resource here. The GitHub connection and “build on push to main” wiring for the site is configured directly in Cloud Build, not Terraform.
The production environment’s required-reviewer rule — a GitHub repo setting (Settings → Environments), not a google_* resource, so it’s the one piece of the infra pipeline’s safety gate Terraform can’t express even though it guards every apply.
DNS — the A record pointing elliotx.com at lb-static-ip lives with the domain registrar, not GCP.
The site itself — source, Astro config, and cloudbuild.yaml live in a separate, private GitHub repo.
Repo → resources
| File | Resources | Purpose |
|---|---|---|
provider.tf | backend “gcs”, google / google-beta providers | state in a dedicated GCS bucket; project ‹gcp-project›, region us-west1 |
storage.tf | google_storage_bucket, iam_member | public static-site bucket |
main.tf | address, ssl cert, backend bucket, 2× url_map, 2× proxy, 2× forwarding_rule | Cloud CDN + LB, HTTP→HTTPS redirect |
iam.tf | service_account, 2Ă— iam_member | permissions for the Cloud Build deploy step |
ci.tf | WIF pool + provider, terraform-ci SA, 6× project_iam_member, project_service | lets GitHub Actions authenticate keylessly and manage this repo’s own resources |
.github/workflows/terraform.yml | plan (pull_request) + apply (push → main) jobs | runs terraform via WIF; apply gated by the production environment |
output.tf | load_balancer_ip, terraform_ci_service_account_email, terraform_ci_workload_identity_provider | exposes values needed to wire up the workflow |
Keeping infra and website static files separate was a personal choice, there are no best practice rules that state you can’t keep it all together in a monorepo if you choose, it’s just down to what works best for you/team, or application. Sometimes one repo makes it easier to see everything in one place and make changes as needed, and sometimes you may just want to decouple them using polyrepos to clarify the way things are built, especially when using modules.
My choice for two repos works because I did do a lot of experimentation with a few SSGs. The result of this meant I kept b0rking the directories and files, so it made sense to keep these separated, which made it easier to manage. Plus I intend to expand the infra in this particular project beyond this application so in my mind keeping it separate makes it simpler to work with.
Website application
I did initially start playing with Hugo and 11ty as I felt my way around the SSGs, but settled on Astro. The documentation and examples I learned from seemed more up to date and my progress was quicker with Astro, so I stuck with it. I did mess up my various SSGs installs so started from scratch many times, which was great as I could better learn how things were connected.
The Astro look and feel was courtesy of many other themes I explored, so I did pick and choose bits from one, bits from another, and managed to cobble things together with a fair bit of trial and error.
All posts are written in markdown using Visual Studio Code, any editor will do however, I’m used to VS Code as this is what I use at work. Once I’ve previewed the markdown and I’m happy with the post, I’ll create a PR and merge to main. All content is stored in a GitHub repo.
Because I’m using the Google Cloud Platform (GCP) I setup Cloud Build with GitHub to build the markdown files. Once merged Cloud Build will build the files and push to a Google Cloud Storage (GCS) bucket. Use Terraform infra repo to provision the Cloud Build service account (SA).
Creating and merging PRs and watching Cloud Build work is quite satisfying the first dozen times or so. Don’t forget to point your domain if you’re using one to the load balancer (LB) IP address. Once fully propagated you should see the files being served up on your domain.
With every thing in place the website has fared well. It has low latency and publishing new content is quick. But then I only have one post so far! Whether or not I’ll continue remains to be seen. I could decide to tear it all down with lessons learned.
What did I learn from this?
- I learned about JAMstack and the sheer variety of static site generators in the world.
- There are many static file hosts that can host files cheaper than using a cloud provider and will provide underlying infra and support for you.
- Make the choice for mono or polyrepo at the earliest stage and understand why you make the choice you do.
- Static site generators are not all built the same way and some mask complexity from the outset, so take time to read documentation and make your own notes along the way, it will save you from a lot of head scratching.
- I’m clearly influenced by the technology I use everyday at work such as GCP, Terraform, buckets, Cloud Build, and GitHub to name but a few things, but I shouldn’t feel married to the tech stack. There’s a wealth of alternatives to getting a static site up and running.
- Keep on top of your costs and billing. It’s easy to let this run away from you. I think (FinOps) should play a part in the running of your site.
- Keep yourself portable by ensuring your content is free to move at a moments notice if you want to change platforms.