Introduction
Everything Cloudzilla needs at runtime is the binary itself and a PostgreSQL database. Git transport (smart HTTP and SSH) is implemented in pure Go via go-git, full-text search runs on Postgres tsvector, and the UI is server-rendered HTML over the wire. That means a deployment is two moving parts you already know how to operate.
In a hurry? Skip to Installation: Docker, a CZ_DATABASE_DSN, and one migrate command get you a forge on port 8080.
What you'll need
- A Linux host (amd64 or arm64), or Docker on any platform.
- PostgreSQL 14+, managed or self-run. It's the only runtime dependency. The bundled Compose stack runs PostgreSQL 18.
- Two open ports: one for HTTP (default
8080) and one for SSH Git access (default2222).
Installation
Pick whichever fits your stack. Each ships the same server binary plus a small bundled admin CLI (cz-admin) that runs database migrations. Docker is the quickest way to a running instance.
Docker
Pull the alpha image and point it at a database. The schema isn't applied automatically: run cz-admin migrate once (it's bundled in the image), and the database only needs to exist and be reachable.
$ docker run -d --name cloudzilla \ -p 8080:8080 -p 2222:2222 \ -v cloudzilla_data:/data \ -e CZ_DATABASE_DSN=postgres://cz:secret@your-postgres-host:5432/cloudzilla?sslmode=disable \ -e CZ_SERVER_BASE_URL=https://git.example.com \ -e CZ_AUTH_JWT_SECRET=replace-with-a-long-random-string \ ghcr.io/mkappworks-dev/cloudzilla-app:v0.7.0
$ docker exec -it cloudzilla /app/cz-admin migrateThen open http://localhost:8080; the first visit redirects to /setup.
Docker Compose
If you want Postgres alongside it, this is the whole stack. After it's up, apply migrations once with docker compose exec cloudzilla /app/cz-admin migrate:
services: cloudzilla: image: ghcr.io/mkappworks-dev/cloudzilla-app:v0.7.0 ports: ["8080:8080", "2222:2222"] volumes: ["cloudzilla_data:/data"] environment: CZ_DATABASE_DSN: postgres://cz:secret@db:5432/cloudzilla?sslmode=disable CZ_SERVER_BASE_URL: https://git.example.com CZ_AUTH_JWT_SECRET: replace-with-a-long-random-string CZ_AUTH_COOKIE_SECURE: "true" CZ_SECURITY_SECRET_KEY: replace-with-at-least-32-random-bytes depends_on: [db] db: image: postgres:18-alpine environment: POSTGRES_USER: cz POSTGRES_PASSWORD: secret POSTGRES_DB: cloudzilla volumes: ["czdata:/var/lib/postgresql"] volumes: czdata: cloudzilla_data:
From source
There's no release artifact for this yet. Build it with make build, which embeds templates and compiled CSS into two static binaries (the server and the admin CLI). No Node.js or runtime to install.
$ git clone https://github.com/mkappworks-dev/cloudzilla-app.git $ cd cloudzilla-app $ make build # produces dist/cloudzilla (server) and dist/cz-admin (admin) $ export CZ_DATABASE_DSN=postgres://localhost/cloudzilla?sslmode=disable $ export CZ_AUTH_JWT_SECRET=replace-with-a-long-random-string $ ./dist/cz-admin migrate # apply migrations once $ ./dist/cloudzilla # start the server on :8080
First run
Once you've run cz-admin migrate against an empty database, the server waits for you to create the first account.
- Run migrations. Apply the schema once with
cz-admin migrate(see Installation). It's safe to re-run, since applied migrations are skipped. - Open the instance. Visit
http://localhost:8080. The first request redirects to/setup. - Create the superadmin. The first account created at
/setupbecomes the instance owner, with full admin rights including user and org management. - Add an SSH key. Under Settings → SSH keys, paste your public key so you can push over SSH. See Git access.
- Create a repository and push your first commit. That's a working forge.
To invite more users when open registration is off, the superadmin manages invites and the allow_registration setting from Admin → Settings.
Configuration
Cloudzilla reads a config.yaml file, environment variables, or both. Env vars (all prefixed CZ_) override the file, so containerized deployments can skip the file entirely. Dots in a config key map to underscores: auth.jwt_secret → CZ_AUTH_JWT_SECRET. The essentials:
| Variable | Description | Default |
|---|---|---|
CZ_DATABASE_DSN | PostgreSQL connection string. required | none |
CZ_SERVER_BASE_URL | Public URL of the instance. Used in clone URLs, webhooks, and OAuth callbacks. | http://localhost:8080 |
CZ_SERVER_PORT | Port the web server binds to. | 8080 |
CZ_GIT_SSH_PORT | Port the built-in Git SSH server binds to. | 2222 |
CZ_GIT_REPOS_ROOT | Filesystem path for bare Git repository storage. | ./git-repos |
CZ_AUTH_JWT_SECRET | Signing secret for JWT session cookies. set in prod | dev default |
CZ_AUTH_COOKIE_SECURE | Set the Secure flag on cookies. Turn it on when serving over HTTPS. | false |
CZ_SECURITY_SECRET_KEY | Encrypts credentials the server must read back later, such as pull-mirror tokens. At least 32 bytes. set in prod | none |
CZ_SERVER_TRUSTED_PROXIES | Reverse-proxy IPs / CIDRs whose X-Forwarded-For is believed. Needed for per-IP rate limits behind a proxy. | none |
CZ_STORAGE_BACKEND | Where uploads such as avatars live: local or s3 (set the CZ_STORAGE_S3_* variables for any S3-compatible bucket). | local |
CZ_RATE_LIMIT_ENABLED | Rate-limit pages, API, Git-over-HTTP, archives, and search per user and per IP. Budgets are tunable via CZ_RATE_LIMIT_*. | true |
CZ_QUOTA_USER_REPOS · CZ_QUOTA_ORG_REPOS | Live repositories each user / organization may own. Over the limit, create, fork, import and transfer are refused with 403. | 0 (unlimited) |
CZ_QUOTA_USER_STORAGE_BYTES · CZ_QUOTA_ORG_STORAGE_BYTES | Disk, in bytes, each user's / organization's repositories and wikis may use together. Pushes are capped at the space left. | 0 (unlimited) |
CZ_METRICS_LISTEN_ADDR | Address of a separate listener serving Prometheus /metrics. Off when empty. | none |
Always set CZ_AUTH_JWT_SECRET and CZ_SECURITY_SECRET_KEY to long, fixed random strings in production. The built-in JWT default is a known dev placeholder, and leaving it in place lets anyone forge session tokens.
Email & OAuth (optional)
Both are off until configured. Set CZ_SMTP_HOST (plus CZ_SMTP_PORT, CZ_SMTP_USERNAME, CZ_SMTP_PASSWORD, CZ_SMTP_FROM, CZ_SMTP_TLS) to enable email notifications, email-verified sign-up, and password reset by email. For Google sign-in, set CZ_OAUTH_GOOGLE_CLIENT_ID, CZ_OAUTH_GOOGLE_CLIENT_SECRET, and CZ_OAUTH_GOOGLE_REDIRECT_URL (must match the URI registered in the Google console).
All variables
The table above covers what most installs set. Everything else, from timeouts to rate-limit budgets and S3 storage, is listed here with its default.
Show all 59 variables
| Variable | Description | Default |
|---|---|---|
CZ_SERVER_PORT | HTTP listen port. | 8080 |
CZ_SERVER_HOST | HTTP listen address. | 0.0.0.0 |
CZ_SERVER_BASE_URL | Public base URL (used for CORS, OAuth, emails, noreply commit addresses). | http://localhost:8080 |
CZ_SERVER_READ_TIMEOUT | HTTP read timeout. | 15s |
CZ_SERVER_WRITE_TIMEOUT | HTTP write timeout. | 15s |
CZ_SERVER_TRUSTED_PROXIES | Comma-separated reverse-proxy IPs/CIDRs whose X-Forwarded-For is believed. | none |
CZ_DATABASE_DSN | PostgreSQL connection string. | local dev DSN |
CZ_DATABASE_MAX_OPEN_CONNS | Max open DB connections. | 10 |
CZ_DATABASE_MAX_IDLE_CONNS | Max idle DB connections. | 5 |
CZ_AUTH_JWT_SECRET | JWT signing secret: change in production. | dev placeholder |
CZ_AUTH_JWT_EXPIRY | JWT token lifetime. | 24h |
CZ_AUTH_COOKIE_NAME | httpOnly cookie name. | cz_token |
CZ_AUTH_COOKIE_SECURE | Set Secure flag on cookies (enable for HTTPS). | false |
CZ_GIT_REPOS_ROOT | Bare git repo storage path. | ./git-repos |
CZ_GIT_SSH_PORT | SSH server port for git operations. | 2222 |
CZ_GIT_SSH_HOST_KEY | SSH host key file (auto-generated if missing). | ./cloudzilla_host_key |
CZ_OAUTH_GOOGLE_CLIENT_ID | Google OAuth client ID (empty = disabled). | none |
CZ_OAUTH_GOOGLE_CLIENT_SECRET | Google OAuth client secret. | none |
CZ_OAUTH_GOOGLE_REDIRECT_URL | OAuth redirect URI (must match Google Console). | http://localhost:8080/auth/google/callback |
CZ_SMTP_HOST | SMTP server host (empty = email disabled). Also enables email-verified signup, email verification and password reset emails. | none |
CZ_SMTP_PORT | SMTP server port. | 587 |
CZ_SMTP_USERNAME | SMTP username. | none |
CZ_SMTP_PASSWORD | SMTP password. | none |
CZ_SMTP_FROM | From address for outgoing email. | noreply@localhost |
CZ_SMTP_TLS | Use TLS for SMTP connection. | false |
CZ_IMPORT_ALLOW_LOCAL_NETWORKS | Let repository imports reach loopback, private and link-local addresses. | false |
CZ_IMPORT_TIMEOUT | Time limit for one repository import. | 30m |
CZ_WEBHOOK_ALLOW_LOCAL_NETWORKS | Let webhooks be created for and delivered to loopback, private and link-local addresses. | false |
CZ_RATE_LIMIT_ENABLED | Rate-limit every request that isn't a static asset. | true |
CZ_RATE_LIMIT_WINDOW | Length of the window each budget covers. | 1h |
CZ_RATE_LIMIT_CORE_AUTHENTICATED | Pages and /api/* per signed-in bucket. | 5000 |
CZ_RATE_LIMIT_CORE_ANONYMOUS | Pages and /api/* per client IP. | 1000 |
CZ_RATE_LIMIT_GIT_AUTHENTICATED | Git-over-HTTP requests per signed-in bucket. | 1000 |
CZ_RATE_LIMIT_GIT_ANONYMOUS | Git-over-HTTP requests per client IP. | 200 |
CZ_RATE_LIMIT_ARCHIVE_AUTHENTICATED | Archive downloads per signed-in bucket. | 100 |
CZ_RATE_LIMIT_ARCHIVE_ANONYMOUS | Archive downloads per client IP. | 20 |
CZ_RATE_LIMIT_SEARCH_AUTHENTICATED | Searches per signed-in bucket. | 600 |
CZ_RATE_LIMIT_SEARCH_ANONYMOUS | Searches per client IP. | 60 |
CZ_QUOTA_USER_REPOS | Live repositories each user may own. 0 is unlimited. | 0 |
CZ_QUOTA_USER_STORAGE_BYTES | Disk, in bytes, each user's repositories and wikis may use together. | 0 |
CZ_QUOTA_ORG_REPOS | Live repositories each organization may own. | 0 |
CZ_QUOTA_ORG_STORAGE_BYTES | Disk, in bytes, each organization's repositories and wikis may use together. | 0 |
CZ_STORAGE_BACKEND | Where uploaded files such as avatars go: local or s3. | local |
CZ_STORAGE_LOCAL_ROOT | Directory for the local backend. | ./storage |
CZ_STORAGE_S3_ENDPOINT | Endpoint URL of an S3-compatible server (R2, B2, Garage, versitygw). | AWS |
CZ_STORAGE_S3_REGION | Bucket region (auto for R2). | us-east-1 |
CZ_STORAGE_S3_BUCKET | Bucket name; required for s3. | none |
CZ_STORAGE_S3_ACCESS_KEY_ID | Static key; empty uses the AWS default credential chain. | none |
CZ_STORAGE_S3_SECRET_ACCESS_KEY | Static secret; set with access_key_id or not at all. | none |
CZ_STORAGE_S3_PATH_STYLE | Path-style URLs, needed by most self-hosted S3 servers. | false |
CZ_STORAGE_S3_PREFIX | Key prefix, so several instances can share a bucket. | none |
CZ_MIRROR_ENABLED | Sync pull mirrors and offer mirror options. When off, existing mirrors stay read-only. | true |
CZ_MIRROR_ALLOW_LOCAL_NETWORKS | Let pull mirrors reach loopback, private and link-local addresses. | false |
CZ_MIRROR_MIN_INTERVAL | Shortest sync interval a mirror may use. | 10m |
CZ_MIRROR_DEFAULT_INTERVAL | Sync interval for new mirrors (at most 720h). | 8h |
CZ_MIRROR_MAX_CONCURRENT | Syncs running at once on each server instance. | 3 |
CZ_MIRROR_TIMEOUT | Time limit for one sync. | 30m |
CZ_SECURITY_SECRET_KEY | Key that encrypts stored credentials, such as mirror tokens. At least 32 bytes. | none |
CZ_METRICS_LISTEN_ADDR | Address of a second listener that serves only GET /metrics, e.g. 127.0.0.1:9090. Empty turns it off. | none |
Git access
Cloudzilla speaks both smart HTTP and SSH out of the box, both implemented in pure Go. There is no system git binary involved on the server side.
Over SSH
Add your public key under Settings → SSH keys, then clone using the instance's SSH port (default 2222):
$ git clone ssh://git@git.example.com:2222/acme/forge.git # 2222 is the default SSH git port (CZ_GIT_SSH_PORT)
The server's SSH host key is generated on first boot (CZ_GIT_SSH_HOST_KEY, persisted in the data volume). Keep it stable across restarts: replacing it makes clients report REMOTE HOST IDENTIFICATION HAS CHANGED.
Over HTTPS
Use a personal access token as the password. Generate one under Settings → Tokens. Tokens can be scoped read-only or read/write per repository.
$ git clone https://git.example.com/acme/forge.git # username: your handle · password: a personal access token
Protected branches
A branch protection rule can also require a pull request. A matching branch can then change only by merging a PR: direct pushes, force pushes, deletes and browser edits are refused, with no admin bypass. It's off by default, so existing rules behave as before.
Reverse proxy & TLS
For production, terminate TLS at a reverse proxy and forward HTTP traffic to Cloudzilla. SSH stays a direct TCP passthrough on its own port. A minimal Caddy config:
git.example.com {
reverse_proxy localhost:8080
}Set CZ_SERVER_BASE_URL to the public HTTPS URL so generated clone links, webhooks, and OAuth callbacks point at the proxy rather than the internal port. Behind TLS, also set CZ_AUTH_COOKIE_SECURE=true so session cookies carry the Secure flag.
Health & metrics
Two unauthenticated probe endpoints answer on the main HTTP port, ahead of all middleware: no log line, no cookie, no rate limit.
/healthz: liveness,200 okwhenever the process serves HTTP. The Docker image'sHEALTHCHECKuses it./readyz: readiness,200when the database, applied migrations, and repository storage all check out, otherwise503. Use it for load-balancer and Kubernetes readiness probes.
For Prometheus, set CZ_METRICS_LISTEN_ADDR (for example 127.0.0.1:9090) to start a second listener that serves only GET /metrics.
The metrics port has no authentication. Bind it to loopback or a private network only Prometheus can reach. Don't publish it and don't proxy it.
Command-line client
cz is a remote client for a Cloudzilla host: repositories, issues and pull requests from your terminal, plus a raw cz api command. It talks to the HTTP API only, so it runs on any machine that can reach the server, not just the host. It's separate from cz-admin, the operator tool that runs on the server.
Each release attaches a standalone cz archive per platform, with a checksum. The server archive and Docker image don't include it.
$ cz auth login --host https://git.example.com $ cz repo list $ cz issue create $ cz pr list
cz auth login uses the device flow: it prints a one-time code and a URL, you sign in and approve in a browser (2FA works), and cz stores the token it's issued in your OS keychain. For CI, set CZ_HOST and CZ_TOKEN instead, or pipe a token with --with-token.
Single sign-on
A superadmin turns on LDAP or SAML 2.0 at /admin/sso. There are no environment variables for it: the settings are stored in the database, and saving them or switching a provider on asks for the superadmin's password (and 2FA code), because whoever controls the directory can sign in as its users.
| Provider | Required | Optional |
|---|---|---|
| LDAP | Host, bind DN template | Port (389), base DN, TLS |
| SAML 2.0 | Entity ID, IdP sign-in URL, ACS URL, IdP certificate | none |
LDAP
Cloudzilla binds as the DN built from the template and the username, for example uid=%s,ou=people,dc=example,dc=com. There is no search step, so the template alone decides who signs in. The directory returns no email, so a new account gets <username>@ldap.local.
SAML
Sign-in starts from Cloudzilla (SP-initiated). Register https://git.example.com/auth/saml/callback as the ACS URL in your identity provider, or give it the metadata at /auth/saml/metadata. Paste the IdP's signing certificate as base64 without the PEM header. Assertions must be signed with SHA-256 or better; encrypted assertions and IdP-initiated sign-in aren't supported yet.
Accounts
The first sign-in creates an account when registration is open. An existing account with the same email is not linked automatically, since only the identity provider vouches for that address. Users with 2FA still enter their code, and suspended accounts can't sign in.
Webhooks
Add webhooks under a repository's Settings → Webhooks. Cloudzilla sends a POST for push, issues and pull_request events, and with a secret set, signs each one with X-Hub-Signature-256 the way GitHub does, so existing receivers verify it unchanged.
A delivery that fails or gets a non-2xx answer is retried after 1 minute, 5 minutes, 30 minutes and 2 hours. Every delivery is kept with its response code, and can be sent again from the same page.
Webhooks can't reach loopback, private or CGNAT addresses (a Tailscale 100.x address, for example). For receivers on your own network, set CZ_WEBHOOK_ALLOW_LOCAL_NETWORKS=true.
Import & mirrors
The Import button on the dashboard (/repos/import) copies a Git repository from another host over HTTP or HTTPS: every branch and tag, with HEAD on the source's default branch. Issues, pull requests, wikis, releases and LFS objects aren't imported. Put credentials in the username and token fields, never in the URL; they're used for that one clone and not stored.
Pull mirrors
Tick Keep this repository in sync to make the copy a read-only pull mirror. It fetches on an interval (10 minutes to a week, 8 hours by default) and follows force pushes and deleted branches, and pushes from the upstream fire the mirror's push webhooks. A mirror's token is stored encrypted, so it needs CZ_SECURITY_SECRET_KEY.
Sources on private networks are refused by default. Set CZ_IMPORT_ALLOW_LOCAL_NETWORKS or CZ_MIRROR_ALLOW_LOCAL_NETWORKS to true to import or mirror from a server on your own network.
Backups
cz-admin backup writes everything an instance needs to one tar archive: the database, every repository, the local storage root, and the SSH host key. It needs pg_dump on the host, at least as new as your server's PostgreSQL (the Docker image bundles it).
Output goes to a temporary file and is renamed on success, so a failed run leaves no partial archive. Use --output - to stream to stdout.
$ cz-admin backup --output /backups/cloudzilla-$(date +%F).tar $ cz-admin backup --output - | zstd > cloudzilla.tar.zst
The archive holds secrets, including the SSH host key. Store it encrypted.
Restore
cz-admin restore rebuilds an empty instance: it refuses a database that already has tables, a non-empty repository root, an unknown archive version, or an unsafe tar entry, all checked before anything is written. It then restores the database, extracts the repositories, writes the host key, applies any newer migrations, and prints a report of repositories missing a directory or a row. Sign-ins survive only if CZ_AUTH_JWT_SECRET is unchanged.
$ cz-admin restore --input /backups/cloudzilla.tar $ zstd -dc cloudzilla.tar.zst | cz-admin restore --input -
Upgrading
Upgrades are a binary (or image tag) swap, followed by a migration run. The server doesn't migrate on its own, so run the bundled CLI after pulling the new version.
- Back up first with
cz-admin backup(see Backups). - Pull the new tag (e.g. bump
v0.6.0→v0.7.0). - Run migrations with the new
cz-admin migrate, then restart the container or service. - Watch the logs. The instance reports that it's serving once it's up.
Postgres 17 → 18 (since v0.5.0). The Compose stack now runs postgres:18-alpine, which can't open a volume created by 17. pg_dump -Fc first, remove only the Postgres volume (not down -v), start the new stack, and pg_restore.
cloudzilla-cli is now cz-admin (since v0.7.0). Update scripts, cron jobs, and docker compose exec calls. Audit-log rows written after the rename name the actor cz-admin; older rows keep cloudzilla-cli.
healthz and readyz are now reserved owner names, and migration 082 refuses to run while two accounts have emails that differ only by case. Fix any such accounts, then run cz-admin migrate again.
Cloudzilla is in alpha, so read the changelog before upgrading. Breaking changes are called out there per release.