Skip to main content
Version: Alpha

Install the portable core

This guide installs Golf’s portable core (Golf, Forgejo and PostgreSQL) on one machine with Docker Compose. For a cluster, follow Install Golf on Kubernetes.

Prerequisites​

  • Git, Python 3 and curl
  • Docker Engine with BuildKit and the Compose v2 plugin (docker compose)
  • An amd64 or arm64 host with network access to pull base images and Go/npm packages

./scripts/init-env.sh runs Python 3 to generate .env; no OpenSSL step is needed. Container builds supply the application toolchains. Development outside containers uses the product's pinned Go version (go.mod, currently 1.27.1) and Node 24.

Install with one command​

git clone https://github.com/mjtechguy/gitgolf.git golf && cd golf
./scripts/install.sh # or: make install

The installer:

  1. checks prerequisites and that ports 8080, 3001 and 2222 are free, with a fix-it hint for each failure
  2. writes a private .env with generated secrets (never overwriting an existing one)
  3. builds and starts the stack and waits for /readyz
  4. creates your first administrator: a Forgejo admin, a scoped Forgejo token and a Golf account mapped to it
  5. prints the addresses and where it saved your generated password (a mode-0600 file under .tmp/local-account/; move it to a password manager and delete the file)

It asks for an admin username and email. For a non-interactive run, pass --username NAME --email ADDRESS --yes. Re-running is safe: an existing account is left as is. Other options:

OptionUse
--dry-runRun the read-only checks and print the plan
--prompt-passwordType the Golf password instead of generating one
--project NAME --http-port P --forge-port P --ssh-port PRun beside another stack (applies when .env is first created)
--uninstallStop and remove containers; keeps volumes and .env

Then sign in at http://localhost:8080 with the username and generated password. The rest of this page describes the same steps by hand.

Start the stack by hand​

git clone https://github.com/mjtechguy/gitgolf.git golf && cd golf
./scripts/init-env.sh
docker compose up -d --build
curl --fail --retry 30 --retry-delay 2 --retry-connrefused http://localhost:8080/readyz

Run init-env.sh before the first docker compose command: Compose refuses to start without the generated .env. The script writes a mode-0600 .env once and leaves an existing file unchanged. The Compose project is named golf-forgejo.

Readiness returns 503 until Golf's database and Forgejo respond; the retry flags wait for that. When it succeeds, open:

ServiceAddress
Golfhttp://localhost:8080
Forgejohttp://localhost:3001
Forgejo SSHlocalhost:2222

All ports bind to loopback only. Use localhost consistently; writes require the exact configured origin. If you change a port in .env, Compose derives the matching Golf and Forgejo origins from it.

Enroll an account by hand​

Registration is disabled, so you create each account deliberately.

  1. Replace the example identity and create a user through Forgejo's supported command:

    docker compose exec forgejo forgejo --config /var/lib/gitea/custom/conf/app.ini admin user create \
    --username golf-owner --email owner@example.com --admin \
    --random-password --must-change-password=false

    The /var/lib/gitea path is the pinned rootless Forgejo image's layout; do not rename it.

  2. Store the printed native password securely, sign into Forgejo and create a per-user token under Settings → Applications. Sign-in and browsing need read:user and read:repository; creating repositories additionally needs write:user and write:repository. Add read:issue for issues and read:organization for organizations. Scopes never grant repository access the user does not already have.

  3. Through your editor or secret manager, create an ignored mode-0600 file such as .tmp/local-account/enrollment.json (.tmp/ is git-ignored):

    {
    "username": "golf-owner",
    "email": "owner@example.com",
    "password": "REPLACE_WITH_A_UNIQUE_GOLF_PASSWORD",
    "forge_token": "REPLACE_WITH_THIS_USERS_SCOPED_FORGEJO_TOKEN",
    "is_instance_admin": true
    }

    username, password, forge_token and is_instance_admin are required; email is optional. Any other field is rejected. The username is 3–64 lowercase letters, digits, ., _ or -, starting with a letter or digit. The Golf password needs at least 15 characters and is separate from the Forgejo password. Set is_instance_admin to true only for the deliberately enrolled operator and false for everyone else.

  4. Enroll the account. Golf verifies the token against Forgejo before saving it:

    docker compose exec -T golf golf local-account create < .tmp/local-account/enrollment.json
  5. Sign into Golf with its own email-or-username/password.

warning

Never put real credentials in shell arguments or examples.

Read authentication before adding OAuth or machine credentials.

Retain your data​

docker compose logs --tail=80 golf forgejo
docker compose stop # stop containers; keep everything
docker compose start # resume the same containers
# Removes containers/network while retaining named volumes:
docker compose down
docker compose up -d # recreate after down, reusing the volumes

Run these from the checkout so Compose finds compose.yaml and .env. After changing .env, apply it with docker compose up -d; start reuses the old container configuration.

danger

Do not routinely add --volumes: that destroys data.

Preserve private .env, key material, both PostgreSQL databases and Forgejo volumes together. Changing environment passwords does not rotate an existing database role.

Add execution deliberately​

Starting Golf does not enable jobs. Docker workers, private object storage and agent services use separate Compose files, enrollment and policy. Follow the product pipeline profile.

Kubernetes​

Follow Install Golf on Kubernetes for the complete workflow, from building the image through enrollment, ingress, external databases, rollouts and recovery limits.

The Golf chart deploys the shared interface/API and Forgejo with separate PostgreSQL ownership. API replicas have native spread/disruption controls; the forge/database remain single-writer unless separately replaced by qualified external services.

Recovery and migration limits​

warning

The historical backup tool qualifies a bounded Forgejo fixture, not a current Forgejo restore. Do not swap Forgejo over retained Forgejo databases or treat volumes as backups.

Read deployment profiles, recovery and status.