Self-Hosted Git Forge, Infrastructure as Code
Why It Exists
A reproducible, single-command provisioning of a self-hosted Git forge (Forgejo) on cheap cloud infrastructure, used to give agents and internal projects their own private source-control host without relying on third-party SaaS.
What We Built
A Terraform module targeting Hetzner Cloud that generates an ED25519 SSH key pair, opens a firewall for SSH/HTTP, attaches a 20 GB data volume, and boots an Ubuntu 24.04 server. A cloud-init template installs Docker and brings up Forgejo via Docker Compose, wiring the public domain, SSH domain/port and root URL through templated variables so the instance is reachable at a stable hostname.
Technologies & Approach
Pure infrastructure-as-code: the hcloud and tls Terraform providers declare the server, key, firewall and volume; cloud-init handles in-VM bootstrap (Docker engine, compose plugin, volume mount, container start). State and a generated key are kept locally for direct admin access.
Outcome / Impact
Proves the ability to stand up production-style, persistent self-hosted services from declarative code, networking, storage, secrets and container runtime all provisioned automatically and tear-down-able on demand.
Capabilities Demonstrated
- Declarative cloud provisioning with Terraform on Hetzner
- Secure-by-default networking (scoped firewall) and persistent volumes
- cloud-init driven container bootstrap (Docker Compose + Forgejo)
- Repeatable, disposable self-hosted infrastructure