This very ForgeJo instance! https://code.openneo.net/
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-17 15:33:49 -08:00
files Move the Forgejo Actions runner to its own machine (#5) 2026-11-16 21:36:11 -08:00
ansible.cfg Enable pipelining optimization in ansible.cfg 2024-09-06 10:51:56 -07:00
inventory.cfg Move the Forgejo Actions runner to its own machine (#5) 2026-11-16 21:36:11 -08:00
LICENSE Add license file 2024-01-14 23:59:18 -08:00
README.md Reboot automatically when the kernel crashes 2026-11-17 15:31:24 -08:00
remove-colocated-runner.yml Move the Forgejo Actions runner to its own machine (#5) 2026-11-16 21:36:11 -08:00
setup-actions.yml Keep Docker job networks inside the range that can reach the cache (#6) 2026-11-17 12:39:03 -08:00
setup-all.yml Add a Forgejo Actions runner, to run CI for impress (#1) 2026-11-08 19:32:14 -08:00
setup-forgejo.yml Move the Forgejo Actions runner to its own machine (#5) 2026-11-16 21:36:11 -08:00
setup-machine.yml Move the Forgejo Actions runner to its own machine (#5) 2026-11-16 21:36:11 -08:00
setup-security.yml Reboot automatically when the kernel crashes 2026-11-17 15:31:24 -08:00

OpenNeo Code

This is the deployment code we use to set up and manage code.openneo.net, a self-hosted copy of Forgejo! It's a very GitHub-like service, but we control the data. (Microsoft's recent approach to AI has me feeling real anxious about continuing to develop on there!)

We like to use Ansible playbooks to keep track of how we set up our servers, here's how we've structured them! (We don't use very fancy Ansible features, we just use them as idempotent command-line scripts!)

There are two machines, listed in inventory.cfg: code.openneo.net runs Forgejo itself, and runner.openneo.net runs CI jobs. CI gets its own machine so it can't slow Forgejo down, and so jobs (which run in Docker) are kept away from Forgejo's data and secrets.

  • setup-machine.yml: Sets up the hostname config, user accounts with their SSH keys for login, and a swap file for some headroom. (Both machines.)
  • setup-security.yml: Sets up firewall rules, automatic system updates, and an automatic reboot if the kernel crashes. (This is a standard playbook I use for all my servers!) (Both machines.)
  • setup-forgejo.yml: Sets up the Forgejo server itself, as a systemd service running Forgejo's official Linux binary. This is mostly a 1:1 port of Forgejo's "Installation from binary" guide!
  • setup-actions.yml: Sets up a Forgejo Actions runner on the runner machine, to run CI jobs for OpenNeo/impress in Docker containers, one at a time. (It registers the runner by running a command on the Forgejo machine, so it talks to both.)

You can run them individually, or all at once, with ansible-playbook:

ansible-playbook setup-all.yml

Add --limit runner or --limit forgejo to set up just one machine.

Setting up a new machine

Ansible logs in as you, with your SSH key, and uses sudo. So a brand-new machine needs your user account first. Create it with your SSH key authorized for root, then log in as root and run:

adduser matchu
usermod -aG sudo matchu
cp -r ~/.ssh /home/matchu/
chown -R matchu:matchu /home/matchu/.ssh

Give it the same password as on the other machine: setup-actions.yml uses sudo on both machines in one run, and Ansible only asks for one password. (setup-security.yml turns off root login and password login over SSH, and checks that nothing overrides that, so after the first run, you'll log in as yourself.)

The runner machine also has a Linode Cloud Firewall, set up by hand in Linode's dashboard (it's not in these playbooks): inbound traffic is dropped except SSH on port 22, and outbound traffic is allowed. It filters traffic before it reaches the machine, so it still applies to ports Docker publishes, which bypass ufw. (The runner doesn't need any inbound ports for CI: it polls Forgejo for jobs, and job containers reach its cache proxy without leaving the machine.)

If you're interested in setting up your own Forgejo service, this could be useful as a starting point, there's not much custom here! Just a couple things to note:

  • setup-machine.yml contains my own username and my own SSH public keys—you'll want to replace those! (Public SSH keys aren't secret, don't worry, I'm fine!)
  • files/app.ini includes some custom config you'll need to replace, like our domain name. (We also opt to use Forgejo's built-in HTTPS support, via Let's Encrypt!)
  • You'll need to create your own copy of the secret token files in files/secrets, and the runner secret in files/runner-secret. See the README in each for more details!
  • We used the latest version of Forgejo available at the time we deployed, but it's possible you're reading this later. It's worth checking out Forgejo's own self-hosting instructions, and making sure you download the latest version.
  • This code is distributed under the GPLv3 license; see the LICENSE file for more details.

Hope this helps!