For AI agents: the complete documentation index is available at https://docs.hod.sh/llms.txt, the full documentation bundle is available at https://docs.hod.sh/llms-full.txt, and this page is available as Markdown at https://docs.hod.sh/self-hosting/configuration.md.

Configuration

The server reads environment variables, or a TOML file with hod-server --config FILE (or HOD_CONFIG); environment variables override the file.

Basics

VariableDefault
HOD_LISTEN0.0.0.0:8080
HOD_PUBLIC_URLThe URL forges and runners reach the server at
HOD_ORGdefault
HOD_ADMIN_TOKEN(required)32+ characters
HOD_RUNNER_TOKENBootstrap token protected runners register with (pool default): they take default-branch and tag jobs (Runner trust); 32+ characters. Changing or unsetting it revokes the old one at the next start, and it follows HOD_ORG
HOD_RUNNER_TOKEN_UNPROTECTEDBootstrap token unprotected runners register with (pool unprotected): they take every other job, such as pull requests'. Same rules; it must differ from HOD_RUNNER_TOKEN
RUST_LOGinfoLog level
HOD_LOG_FORMATjson for JSON logs

Database

VariableDefault
DATABASE_URL(required)Postgres 18+ (Database)
HOD_DATABASE_MAX_CONNECTIONS16The connection pool's size
HOD_DATABASE_STATEMENT_TIMEOUT30sPostgres cancels a statement that runs longer
HOD_DATABASE_LOCK_TIMEOUT10sA statement fails if it waits longer for a lock

Jobs, storage and caches

VariableDefault
HOD_STORAGEfile:///var/lib/hod/blobsOr s3://bucket/prefix
HOD_GIT_PROTOCOLShttpsURL schemes the server may fetch repositories with; http and file only for trusted setups and tests. Hod speaks git itself (gitoxide) over http and https; file runs git-upload-pack and ssh runs ssh, which the image doesn't have
HOD_CACHE_SCOPE_LIMIT10GSize cap per cache scope
HOD_CACHE_KEEP_DAYS7Cache entries unused for this long are deleted
HOD_JOB_FILES_LIMIT10GSize cap on a job's files: archives, in all
HOD_LOG_LIMIT100MSize cap on a job attempt's log: past it the job fails with log_limit, keeping what it printed before
HOD_JOB_TIMEOUT6hHow long a job without timeout: may run (a duration: 90m, 1d12h)
HOD_MAX_JOB_TIMEOUTThe longest any job may run, whatever its timeout:; no cap by default
HOD_RUNNER_DOWNLOADS/usr/share/hod/runners in the imageThe hod-runner builds the server hands out (Runners)

Connections and limits

VariableDefault
HOD_SHUTDOWN_TIMEOUT25sHow long a stopping server waits for requests in flight (Stopping)
HOD_MAX_CONNECTIONS4096Open connections, TLS handshakes included; past it, new connections are closed at once (Limits)
HOD_REQUEST_TIMEOUT30sHow long a request may take to answer; past it, 503 (Limits)
HOD_MAX_REQUESTS256Requests in flight for the API, the web UI and sign-in; past it, 503 with Retry-After
HOD_MAX_RUNNER_REQUESTS512The same for runners; each connected runner always holds one
HOD_MAX_WEBHOOK_REQUESTS64The same for forge webhooks
HOD_RATE_LIMIT_SIGN_IN10Sign-ins a minute per client address; past it, 429 (Rate limits). 0 for no limit, as for the three below
HOD_RATE_LIMIT_ANONYMOUS300Requests a minute per client address without credentials; the same number again for requests whose credentials fail
HOD_RATE_LIMIT_CALLER1200Requests a minute per signed-in user, across all their tokens and sessions
HOD_RATE_LIMIT_GIT120Git proxy requests a minute per job
HOD_MAX_STREAMS1024Open event, log and log-row streams on this server; past it, 429 (Stream caps). 0 for no cap, as for the two below
HOD_MAX_STREAMS_PER_USER64The same per signed-in user, across all their tokens and sessions
HOD_MAX_STREAMS_PER_ADDRESS32The same per client address, for streams opened without signing in
HOD_TRUSTED_PROXIESReverse proxies, load balancers or CDNs in front of the server, as addresses and CIDRs, comma-separated (10.0.0.5, 172.16.0.0/12). private_ranges stands for 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, ::1/128 and fc00::/7. Only from these is the client's address in HOD_CLIENT_IP_HEADER believed; without any, the client is the connection's peer
HOD_CLIENT_IP_HEADERX-Forwarded-ForThe header the trusted proxies put the client's address in. X-Forwarded-For is read from the right, past the trusted proxies; any other name (CF-Connecting-IP, X-Real-IP) must hold one address that the proxy always sets. Needs HOD_TRUSTED_PROXIES
HOD_HSTS_MAX_AGE365dHow long browsers keep to https for this host (Strict-Transport-Security), a duration such as 30d; sent only when HOD_PUBLIC_URL is https. 0 turns it off (Security headers)
HOD_OUTBOUND_ALLOWAddresses, CIDRs and host names that repository URLs not on a configured forge may reach although they aren't public, comma-separated (git.lan, 10.1.0.0/16). private_ranges stands for the same ranges as in HOD_TRUSTED_PROXIES (Outbound requests)

TLS, secrets and sign-in

VariableDefault
HOD_TLS_CERT, HOD_TLS_KEYPEM files to serve https; reloaded on SIGHUP (TLS)
HOD_SECRETS_KEY_FILEThe key stored secrets are encrypted with; without it, none can be stored (Secrets)
HOD_SECRETS_OLD_KEY_FILESOld keys, comma-separated, until hod-server rotate-key has moved off them
HOD_OIDC_ISSUER_URLHOD_PUBLIC_URLWhere clouds fetch the OIDC discovery document and JWKS (OIDC identity)
HOD_AUTH_SERVER_ADMINSServer admins by identity, comma-separated (github:<id>, <provider>:<subject>); sign-in providers are [[auth.providers]] in the file (Users and roles)

Forges

VariableDefault
HOD_FORGEJO_*Forgejo
HOD_GITLAB_*GitLab
HOD_GITHUB_*GitHub

Limits

The server protects itself without a proxy in front. Besides the settings above, these limits are fixed:

TLS handshake10 s
A new connection's first request30 s to send its head
An idle connectionHTTP/1: 30 s after the last response; HTTP/2: 60 s with no request open
A client that stops readingits connection closes after 60 s without progress
A request body that goes quiet30 s between chunks, on every route
Request bodiesAPI: 5 MiB; runner messages: 4 MiB; blob uploads: the size they were signed for
HTTP/2100 concurrent streams, 16 KiB of headers; pinged every 30 s

What a client sees:

  • A closed connection, when the server has too many connections, or when the client is too slow to send a request or read a response.
  • 429 Too Many Requests, past a rate limit, with Retry-After and the problem code rate_limited; past a stream cap, with Retry-After: 5 and the code too_many_streams.
  • 503 Service Unavailable with an RFC 9457 problem document (API reference). Its code is overloaded, with Retry-After: 1, when too many requests are in flight. It is timeout when a request took longer than HOD_REQUEST_TIMEOUT. Event streams, downloads, blob uploads, the git proxy and runners are not cut off by it. A request that times out may still have made its change, as when a connection drops.

The server raises its open-file limit to the system's maximum. If that is still too low for HOD_MAX_CONNECTIONS, it serves fewer connections and logs a warning: raise the limit (ulimit -n, or nofile in Docker or systemd).

Rate limits

Each limit is a number of requests a minute, and all of them may come at once: a client that used them all gets one more every 60/N seconds.

LimitCounted perCounts
HOD_RATE_LIMIT_SIGN_INclient addressstarting a sign-in, signing a browser in, hod login's code exchange
HOD_RATE_LIMIT_ANONYMOUSclient addressthe web UI's pages, OIDC discovery, and API requests without credentials. Requests whose credentials fail count in a second bucket of the same size; once it runs out, every request with credentials from that address waits, as they are refused before they are checked
HOD_RATE_LIMIT_CALLERuserAPI requests with good credentials; the admin token counts as one user
HOD_RATE_LIMIT_GITjobgit proxy requests with the job's token

Health checks, the web UI's static files, blob transfers, runners and forge webhooks aren't limited. An IPv6 client counts by its /64.

The counts are kept in memory on each server: with several servers behind a load balancer, a client may get up to the limit times the number of servers.

Behind a reverse proxy, set HOD_TRUSTED_PROXIES. Without it every client's address is the proxy's, and all anonymous visitors share one limit.

hod sends a read that got 429 or 503 once more by itself when Retry-After is 10 seconds or less.

Stream caps

Event, log and log-row streams (the web UI's live updates and log view, hod logs -f) stay open for as long as the client keeps them. The caps limit how many are open at once: per signed-in user (the admin token counts as one user), per client address for anonymous viewers of public projects, and on the whole server. A browser tab holds one or two; hod logs -f holds one per running job.

Past a cap, a new stream gets 429 with Retry-After: 5, and streams already open are left alone. The web UI and hod try again by themselves. Like rate limits, the counts are kept on each server, and an IPv6 client counts by its /64. Behind a reverse proxy, set HOD_TRUSTED_PROXIES: without it, all anonymous viewers share the proxy's address, and so one cap of 32 streams.

Outbound requests

Any org member can trigger a run of any repository URL, and the server fetches the pipeline file from it. So that nobody can use the server to reach the network behind it, a repository URL that isn't under a configured forge's URL (Forgejo, GitLab, GitHub):

  • must resolve to public addresses only: not loopback, private (RFC 1918, fc00::/7), link-local, CGNAT (100.64.0.0/10) or other special-purpose ranges, in any form, IPv4-mapped IPv6 and NAT64 included. The addresses checked are the ones connected to, so a name that resolves differently the second time gains nothing;
  • follows no redirects.

A refused URL gets one fixed message, <host> resolves to an address Hod doesn't fetch from (private, loopback or link-local); see HOD_OUTBOUND_ALLOW, whatever the address was.

To fetch from a git server on your own network that isn't a configured forge, allow it with HOD_OUTBOUND_ALLOW (outbound_allow = [...] in the file): by name (git.lan, matched exactly, and then any address it resolves to), by address or CIDR (10.1.0.0/16), or private_ranges for all of loopback and the private ranges. Cloud metadata services are never fetched from, whatever the setting says: 169.254.169.254, fd00:ec2::254, 100.100.100.200 and 192.0.0.192.

With HTTPS_PROXY (or HTTP_PROXY, ALL_PROXY) set, the server only sees the proxy's address, so the proxy decides what can be reached: restrict it there. The proxy's own name is allowed, even when it resolves to a private address.

file:// URLs, which only HOD_GIT_PROTOCOLS=file allows, read repositories on the server's own disk and aren't checked: don't allow file on a server members you don't trust can reach.

Repositories on configured forges, forge APIs, sign-in providers and component registries are set by the admin and aren't checked.

Security headers

Every response carries:

  • X-Content-Type-Options: nosniff
  • Referrer-Policy: same-origin: Hod's URLs, which name orgs, projects and branches, aren't sent to other sites
  • Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Resource-Policy: same-origin
  • Content-Security-Policy: default-src 'none'; frame-ancestors 'none' and X-Frame-Options: DENY; the web UI's pages and the sign-in pages have stricter policies of their own, which still forbid framing
  • Strict-Transport-Security: max-age=31536000 when HOD_PUBLIC_URL is https, whether the server or a proxy in front ends TLS. It covers only this host: no includeSubDomains, no preload

API responses (/api/) also carry Cache-Control: no-store, so neither the browser nor a shared cache keeps them: some show a secret once.

API responses that set their own caching keep it: the OIDC discovery document and JWKS, and hod-runner downloads (public, max-age=300).

Blob downloads from the server's own storage are application/octet-stream, with Content-Disposition: attachment, Content-Security-Policy: sandbox and Cache-Control: private, no-store, so a browser saves them and never runs them as a page. With s3:// storage, runners fetch blobs from the bucket, and the bucket's settings apply.

If a reverse proxy in front adds its own Strict-Transport-Security, set HOD_HSTS_MAX_AGE=0, or drop it from the proxy: two HSTS headers on one response are an error some scanners flag, and browsers use only the first.