# Forgejo (was: Gitea) This deploys the Forgejo git hosting software on Fly.io. ## Installation 1. Clone this repository 1. `fly launch`, follow the prompts 1. Select `n` when it asks if you want to deploy 1. Create a volume in a region of your choice: `fly volumes create data --size 50 --region ord` 1. Generate, and store securely, you secrets: ```shell fly secrets set \ "GITEA__security__SECRET_KEY=$(openssl rand -hex 16)" \ "GITEA__security__INTERNAL_TOKEN=$(openssl rand -hex 16)" ``` 1. For S3 storage you'll need to add two more secrets: ```shell fly secrets set \ "GITEA__storage__MINIO_ACCESS_KEY_ID=[redacted]" \ "GITEA__storage__MINIO_SECRET_ACCESS_KEY=[redacted]" ``` 1. Deploy, `fly deploy --remote-only` 1. Setup DNS with your registrar, you must have either CNAME or A/AAAA records set. See: https://fly.io/docs/app-guides/custom-domains-with-fly/ 1. Create certificate for Fly's automatic TLS termination. `fly certs create git.example.com` 1. Opens an SSH session to the running container. `fly ssh console` 1. In the SSH session in the container, run: `su git` and then ```shell gitea admin user create \ --username MYNAME \ --email MYEMAIL@example.com \ --admin \ --random-password \ --must-change-password ``` ## Proxy the GUI to localhost 1. Forward container port 3000 to localhost:3000 `fly proxy 3000:3000` ## Get Connected using WireGuard (VPN) 1. Create a WireGuard peer with `fly wireguard create` 1. Setup WireGuard with generated config 1. `fly ips private` to get the IP of your Daemon 1. Set the `DOCKER_HOST` env variable using that IP: ``` export DOCKER_HOST=tcp://[fdaa:0:5d2:a7b:81:0:26d4:2]:2375 ``` # Final Step 1. Delete the Docker Engine from your local system. 1. You probably want to scale your remote Daemon: `fly scale vm shared-cpu-2x` # NOTES: * https://blog.luketurner.org/posts/gitea-on-fly/