Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Deploying to NixOS

Celler provides a NixOS module that allows you to deploy the Celler Server on a NixOS machine.

Prerequisites

  1. A machine running NixOS
  2. (Optional) A dedicated bucket on S3 or a S3-compatible storage service
  3. (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.nix from the repository.
  • Flakes: Add github:celler-cache/celler as an input, then import celler.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.