fly-apps/forgejo
2024-06-04 14:16:35 -04:00
..
fly.toml v7.0.3 2024-06-04 14:16:35 -04:00
README.md add a reference 2023-10-23 10:15:08 -04:00

Forgejo (was: Gitea)

This deploys the Forgejo git hosting software on Fly.io.

Installation

  1. Clone this repository
  2. fly launch, follow the prompts
  3. Select n when it asks if you want to deploy
  4. Create a volume in a region of your choice: fly volumes create data --size 50 --region ord
  5. Generate, and store securely, you secrets:
    fly secrets set \
      "GITEA__security__SECRET_KEY=$(openssl rand -hex 16)" \
      "GITEA__security__INTERNAL_TOKEN=$(openssl rand -hex 16)"
    
  6. For S3 storage you'll need to add two more secrets:
    fly secrets set \
      "GITEA__storage__MINIO_ACCESS_KEY_ID=[redacted]" \
      "GITEA__storage__MINIO_SECRET_ACCESS_KEY=[redacted]"
    
  7. Deploy, fly deploy --remote-only
  8. 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/
  9. Create certificate for Fly's automatic TLS termination. fly certs create git.example.com
  10. Opens an SSH session to the running container. fly ssh console
  11. In the SSH session in the container, run: su git and then
    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
  2. Setup WireGuard with generated config
  3. fly ips private to get the IP of your Daemon
  4. 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.
  2. You probably want to scale your remote Daemon: fly scale vm shared-cpu-2x

NOTES: