how to host forgejo on fly.io
Find a file
2025-10-29 00:45:49 +01:00
Dockerfile init commit 2025-10-25 17:17:46 +02:00
fly.toml scale to 0 2025-10-29 00:45:49 +01:00
README.md Readme++ 2025-10-25 19:12:09 +02:00

host forgejo on fly.io

original guide: https://lugh.ch/forgejo-on-flyio.html#should-you-self-host-your-git-instance

Dockerfile is vanilla forgejo (the guide uses the rootless version)

setup

  • see fly.toml for all the env vars
  • in the original guide most of the FIXMEs are straightforward (don't make the two cookie names the exact same)
  • the FIXMEs below (in the admin script)
    • initial guide didn't mention ROOT_URL (which is probably of interest to most!)

create the initial user (admin)

  • fly ssh console (be fast before the scale to 0 kicks in... haha)
  • su git (git user owns the files already there)
  • forgejo admin user create --username FIXME --password FIXME --email "some@email" --admin
    • if needed (config file is not found), you can add something like --config custom/conf/app.ini (take note of the app.ini, you can find . | grep app.ini)

maintenance

ssh/scp to grab backups

  • fly ssh issue (temp ssh creds)
  • fly ssh console (use the creds)
  • su - git
forgejo dump \
  --config /var/lib/gitea/custom/conf/app.ini \
  --type tar.gz \
  --file /var/tmp/forgejo_$(date +%Y%m%d_%H%M%SZ).tar.gz

  • scp -i ~/.ssh/MY_KEY root@<APP_NAME>.internal:/var/tmp/forgejo\* . (from wherever!)
  • fly ssh rm -r /var/tmp/forgejo* remove the backup archive on the machine (dont wanna trigger an auto disk resize)