Introduction

I spend a lot of time on Reddit in r/devops, r/homelab, and r/selfhosted, where I always see different versions of the same question:

It’s difficult to get hands-on experience in DevOps. What is a good beginner project?

I’ve posted this answer to Reddit multiple times before, but this post will have more detail.

Static site

Build a static site. That’s the answer.

meme

Why

A static site is a great beginner project because:

How

Below is my outline on the general steps to setup a static site. You don’t need to follow it exactly, but it should be more than enough to get you started.

  1. Purchase a domain
    • This can’t be done via IaC
    • I like Hover, but you can also use Cloudflare, Namecheap, AWS, etc…
    • If this is a personal site, try to get a .com TLD, not .net, .io, .ai, etc…
    • Be sure to check the renewal price in addition to the purchase price
    • Be sure to enable WHOIS privacy (unless you want telemarketing calls)
  2. Create a GitHub account and two repositories
    • One for your IaC code (Terraform and Ansible)
    • One for your static site’s code
  3. Provision a virtual private server (VPS) in the cloud using Terraform
    • Use any VPS provider that has Terraform support (DigitalOcean or AWS would be my recommendations, but you can also use Linode, OVH, Oracle Cloud, Scaleway, etc…)
    • This code should be checked into Git on GitHub
    • Bonus: Don’t hard-code your API keys anywhere in your Terraform code
    • Bonus: You can store your state locally (don’t check it into Git), but consider storing it remotely (HashiCorp offers free state storage in Terraform Cloud)
    • Bonus: Use Atlantis with your GitHub account to run Terraform via pull requests to GitHub
  4. Setup DNS using Terraform
    • After you get the IP of your VPS, you need DNS to link yourname.com to 1.2.3.4
    • You can use a separate DNS provider (like Cloudflare, NS1, or DNSimple ), but your VPS provider might also offer DNS (e.g., DigitalOcean, AWS Route53, Linode, Scaleway, etc…)
    • This code should be checked into Git on GitHub
  5. Configure the VPS using Ansible
    • After the VPS is online, you need to login, install updates, setup users, install packages, mess with configuration files, etc…
    • At the very least, you’ll need a webserver installed (e.g., Nginx or Apache) and a few configuration files for your webserver put in the correct places
    • This code should be checked into Git on GitHub
    • Bonus: Get a TLS certificate for free from Let’s Encrypt and configure your webserver to redirect from port 80 to 443
    • Bonus: Learn what idempotency means
    • Bonus: Instead of making one big playbook, try to use roles
  6. Create the static site locally on your PC
    • You’ll have to choose a static site generator (here is a good list of options)
    • I like Hugo, but the choice is yours (consider things like speed, available themes, the language the templates are written in, plugins, if you’re migrating from another data source, etc…)
    • Make sure the site builds locally on your PC and you can visit it on localhost
    • This code should be checked into Git on GitHub
  7. Deploy the site to your VPS using Setup GitHub Actions
    • You need to automate deploying your static site’s rendered code from GitHub to your VPS
    • This automation needs to happen on some sort of trigger (e.g., on each commit to Git, on a schedule, on a tag, etc…)
    • Bonus: Use GitHub Actions to lint your Terraform code with tflint and Ansible code with ansible-lint
    • Bonus: Setup a free GitHub Pages domain at yourname.github.io and push a dev/test version of your site to there
    • Bonus: Setup a dependency management solution (like Renovate or Dependabot) to automatically update dependencies

Cost

In my setup, I’m spending $66/year on my site and the surrounding infrastructure.

Product Cost (per year)
Domain name (Hover) $12
DNS (Route53) $6
VPS (DigitalOcean) $48

However, there are some cost-cutting measures that are possible:

  • DNS: Use a free provider like Cloudflare or NS1
  • Hosting: Use a static-site host like GitHub Pages or Netlify

Keep in mind that moving to a dedicated static-site host would remove the VPS from the setup above, and thus remove all reason to use Ansible in your setup (less to manage, but also less to learn).

Conclusion

The setup above is more than enough to put on a resume, but it definitely lacks a few things:

  • Database
  • API
  • Load balancing
  • Containers/K8s

However, in my mind, those things are not great for a beginner project, but for something more intermediate-level (for that kind of project, check out the The Cloud Resume Challenge or roadmap.sh).

-Logan