Deploying to NixOS
Celler provides a NixOS module that allows you to deploy the Celler Server on a NixOS machine.
Prerequisites
- A machine running NixOS
- (Optional) A dedicated bucket on S3 or a S3-compatible storage service
- You can either set up Garage or use a hosted service like Backblaze B2 and Cloudflare R2.
- (Optional) A PostgreSQL database
Generating the Credentials File
The RS256 JWT secret can be generated with the openssl utility:
$ nix shell nixpkgs#openssl
$ openssl genrsa -out private-key.pem 4096
$ openssl rsa -in private-key.pem -pubout -out public-key.pem
Keep the private-key.pem file in a secure location. You need it to sign tokens using celler admin make-token.
The public key will be part of the server configuration.
Importing the Module
You can import the module in one of two ways:
- Ad-hoc: Import the
nixos/cellerd.nixfrom the repository. - Flakes: Add
github:celler-cache/celleras an input, then importceller.nixosModules.cellerd.
Configuration
{
services.cellerd = {
enable = true;
# Replace with absolute path to your environment file
environmentFile = "/etc/cellerd.env";
settings = {
listen = "[::]:8080";
jwt = {
rs256-public-key-file = ./public-key.pem;
};
# Chunking is off by default. To enable it, see the Chunking page.
};
};
}
settings accepts all options from the server configuration reference.
Unless you configure them, the module uses SQLite and local storage in /var/lib/cellerd.
After the new configuration is deployed, the Celler Server will be accessible on port 8080. It’s highly recommended to place it behind a reverse proxy like NGINX to provide HTTPS.