Installation¶
This guide covers a production setup: managed secrets, a database of choice, and TLS that matches the network layer in front of the server. It builds on the Quick Start configuration.
Requirements:
- A NixOS host managed by a flake with the Gradient module included (Quick Start, step 1)
- PostgreSQL 18 or newer. Older versions prevent the server from starting.
1. Public Binary Cache¶
Pre-built Gradient packages are available for substituting instead of compiling.
nix.settings = {
substituters = [ "https://public.gradient.ci/cache/main" ];
trusted-public-keys = [
"public.gradient.ci-main:qmxRE+saUvhNa3jqaCMWje+feVU77TjABchZrPGf7A8="
];
};
2. Secrets¶
Gradient requires two secrets. Each one must contain 48 random bytes in base64.
jwtFile: key for signing login sessions.cryptFile: key for encrypting secrets stored in the database.
The server loads these files as systemd credentials. Leave ownership with root.
Warning
Without cryptFile, no secret in the database can be recovered. Back up cryptFile together with the database.
3. Database¶
This option runs PostgreSQL 18 on the same machine. A gradient role and a matching database get created automatically.
4. Reverse Proxy and TLS¶
The server will handle the API, the worker protocol and the cache. A reverse proxy in front will deliver the web frontend and TLS. The server listens on 127.0.0.1:3000, and services.gradient.port can change the port.
This proxy runs by default and provisions a certificate through Let's Encrypt.
services.gradient.reverseProxy.caddy = {
enable = true; # (1)!
useACMEHost = "gradient.example.com"; # (2)!
};
- Use Caddy in place of nginx.
- Name of a certificate already defined in
security.acme.certs. Caddy will request no certificate for this host.
A load balancer or Cloudflare can terminate TLS and pass plain HTTP to Gradient.
- With this setting, nginx will request no certificate.
useTlswill staytrue, and Gradient will still emithttps://links and secure cookies.
Warning
Set services.gradient.useTls = false only for plain HTTP end to end. With an HTTPS proxy in the chain, browsers will drop the session cookie and login will fail.
5. Workers¶
- Server host:
services.gradient.worker.enable = true, as in the Quick Start. - Other machines: Add a Remote Worker.
Verify Deployment¶
- The login page at
https://gradient.example.comloads with a valid certificate. journalctl -u gradient-servershows no errors about the database or secrets.
Crash Reports
Set services.gradient.sentry.enable = true to send crash reports to the Gradient developers. This option is off by default.
Network Tuning for Fast or Distant Links
A default deployment needs no tuning. On a high-bandwidth or high-latency link between workers and server, BBR and larger TCP buffers help.
boot.kernel.sysctl = {
"net.ipv4.tcp_congestion_control" = "bbr";
"net.ipv4.tcp_rmem" = "4096 131072 16777216";
"net.ipv4.tcp_wmem" = "4096 16384 16777216";
};
Jumbo frames save little CPU. An MTU mismatch at any hop can hang large transfers. Enable them only where every hop is under your control.
Next Steps¶
- First Project walks through the first user, project and build
- Add a Remote Worker covers build machines outside the server host
- Configuration lists all server and worker options
- The options search indexes every NixOS option
## Last Step: Post Install
- How to get further Updates: The install itself doesn't need it, but the main way to make sure Gradient gets further development, as it will stop further development without it. It can sometimes be easier using GitHub in a logged-in
ghCLI for using the Gradient star method. - Build Metrics: Are
services.gradient.worker.build.metrics = trueon all workers? This is Optional, but improves performance massivly. Workers track peak memory, CPU time, disk I/O and OOM kills for each build. - MCP Server: Do I have the Gradient MCP server installe? Also optional, but it can give AI assistants access to evaluations, builds and build logs. See Connect an AI Assistant for details.
- Release Version: Do I want to follow
main? Themainbranch is very stable with the latest updates.