Install with Nix or a binary
Configure a native LinkJar PDS, run it with systemd or NixOS, and put HTTPS in front of it without Docker.
Use with AI
Take the context you need.
The server runs as one Rust executable. First download or build it. For Linux without Nix, use the portable static executable. On NixOS, use the module below. A foreground example is included for local checks.
You need a domain, a writable data directory, a blob store, CA certificates,
and a TLS proxy for public HTTPS. The HTTP listener binds all interfaces.
Keep port 2583 behind the host’s firewall and allow public traffic through
your TLS proxy. Never enable PDS_DEV_MODE on a public host.
Configure the server
Section titled “Configure the server”For a new installation, generate a JWT secret and admin password separately:
openssl rand --hex 32openssl rand --hex 32Generate a secp256k1 PLC rotation key on Linux:
openssl ecparam --name secp256k1 --genkey --noout --outform DER | tail --bytes=+8 | head --bytes=32 | xxd --plain --cols 32Keep these values in a secret manager or a restricted file. Reuse the original secrets when moving an existing server. The rotation key controls the accounts’ DIDs; replacing it is not an installation reset.
Create /etc/linkjar-pds/pds.env, owned by root with mode 0600, under a
root-owned directory. Create the directory before editing the file:
sudo install -d -m 0700 -o root -g root /etc/linkjar-pdssudoedit /etc/linkjar-pds/pds.envsudo chmod 0600 /etc/linkjar-pds/pds.envPut one literal NAME=value assignment on each line.
Replace the three secret placeholders:
PDS_HOSTNAME=pds.example.comPDS_JWT_SECRET=REPLACE_WITH_JWT_SECRETPDS_ADMIN_PASSWORD=REPLACE_WITH_ADMIN_PASSWORDPDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=REPLACE_WITH_ROTATION_KEYPDS_BLOBSTORE_DISK_LOCATION=/var/lib/linkjar-pds/blocksPDS_INVITE_REQUIRED=truePDS_BSKY_APP_VIEW_URL=https://api.bsky.appPDS_BSKY_APP_VIEW_DID=did:web:api.bsky.appPDS_REPORT_SERVICE_URL=https://mod.bsky.appPDS_REPORT_SERVICE_DID=did:plc:ar7c4by46qjdydhdevvrndacPDS_CRAWLERS=https://bsky.networkSystemd reads this file; the binary does not load .env files itself. Keep all
settings needed by operator commands in this runtime file. The examples below
set PDS_DATA_DIRECTORY and PDS_PORT in the service definition. Leave them
out of the file so they cannot override those settings.
For S3 storage, remove
PDS_BLOBSTORE_DISK_LOCATION and add the S3 settings and credentials.
Set up email before inviting other people.
Environment variables lists the remaining options.
NixOS service
Section titled “NixOS service”Add a pinned input to your host’s flake. Replace <reviewed-commit> with the
full commit you intend to run:
inputs.linkjar-pds.url = "github:linkjar/pds/<reviewed-commit>";Add inputs.linkjar-pds.nixosModules.default to your host’s modules list.
In a host module, enable the service and put the same package on the operator’s
command path:
{ inputs, pkgs, ... }:{ services.linkjar-pds = { enable = true; environmentFile = "/etc/linkjar-pds/pds.env"; };
environment.systemPackages = [ inputs.linkjar-pds.packages.${pkgs.stdenv.hostPlatform.system}.linkjar-pds ];}This example assumes your flake passes inputs through specialArgs to the
host modules. You can instead reference the input in the outer flake expression.
Provision the runtime file before activating the service. Your existing secret
manager can supply it at another runtime path, such as /run/secrets/linkjar-pds.env.
Use a quoted string for environmentFile; never put secrets in a Nix expression,
builtins.toFile, or a Nix path copied into the store.
The module creates the linkjar-pds user and group and mode 0700 state at
/var/lib/linkjar-pds. It checks configuration before startup, restarts after
failure, and restricts filesystem access. It supplies CA certificates and keeps
the HTTP port closed in the firewall by default. Set services.linkjar-pds.port
if you need a port other than 2583. Configure your TLS proxy separately.
Activate the reviewed host configuration with your usual nixos-rebuild
procedure. Then check the service:
sudo systemctl status linkjar-pdssudo journalctl -u linkjar-pds -n 50 --no-pagercurl --fail http://127.0.0.1:2583/xrpc/_healthThe service protects /home and /root. Keep additional key files in an
accessible runtime secret directory. Use services.linkjar-pds.environment
only for public settings; operator commands
need those settings too.
Linux binary with systemd
Section titled “Linux binary with systemd”This example uses the executable installed at /usr/local/bin/linkjar-pds
by the download guide.
Keep the host’s CA certificate package installed.
Create a dedicated account and data directory. On Debian or Ubuntu:
sudo useradd --system --user-group --home-dir /var/lib/linkjar-pds --shell /usr/sbin/nologin linkjar-pdssudo install -d -m 0700 -o linkjar-pds -g linkjar-pds /var/lib/linkjar-pdsCreate the account only once. If you use another distribution, use its system
account command. Save this unit as /etc/systemd/system/linkjar-pds.service:
[Unit]Description=LinkJar AT Protocol Personal Data ServerWants=network-online.targetAfter=network-online.target
[Service]Type=simpleUser=linkjar-pdsGroup=linkjar-pdsWorkingDirectory=/var/lib/linkjar-pdsEnvironmentFile=/etc/linkjar-pds/pds.envEnvironment=PDS_DATA_DIRECTORY=/var/lib/linkjar-pdsEnvironment=PDS_PORT=2583ExecStartPre=/usr/local/bin/linkjar-pds check-configExecStart=/usr/local/bin/linkjar-pds serveRestart=on-failureRestartSec=5TimeoutStopSec=30StateDirectory=linkjar-pdsStateDirectoryMode=0700UMask=0077NoNewPrivileges=truePrivateTmp=truePrivateDevices=trueProtectSystem=strictProtectHome=trueProtectKernelTunables=trueProtectKernelModules=trueProtectControlGroups=trueRestrictSUIDSGID=trueRestrictAddressFamilies=AF_INET AF_INET6 AF_UNIXCapabilityBoundingSet=
[Install]WantedBy=multi-user.targetAfter saving the runtime environment file and firewall rules, start it:
sudo systemctl daemon-reloadsudo systemctl enable --now linkjar-pdssudo systemctl status linkjar-pdssudo journalctl -u linkjar-pds -n 50 --no-pagercurl --fail http://127.0.0.1:2583/xrpc/_healthPublic HTTPS
Section titled “Public HTTPS”Point the TLS proxy at 127.0.0.1:2583. It must handle the server hostname,
account handle names, and long-lived WebSocket connections for the firehose.
For a native Caddy installation, adapt the repository’s Caddyfile:
{ email operator@example.com on_demand_tls { ask http://127.0.0.1:2583/tls-check }}
pds.example.com, *.pds.example.com { tls { on_demand } reverse_proxy 127.0.0.1:2583}Run Caddy as its own service with persistent certificate storage. The DNS and
ports in the DNS guide apply to this setup too. The /tls-check
guard limits certificate requests to the server and active account handles.
For a different proxy, configure equivalent hostname, TLS, and WebSocket support.
Foreground checks
Section titled “Foreground checks”On a private development host, run the binary as your own user with disposable state. Set the required settings in that shell first:
export PDS_HOSTNAME=pds.example.comexport PDS_DATA_DIRECTORY="$PWD/native-data"export PDS_BLOBSTORE_DISK_LOCATION="$PWD/native-data/blocks"export PDS_JWT_SECRET=REPLACE_WITH_JWT_SECRETexport PDS_ADMIN_PASSWORD=REPLACE_WITH_ADMIN_PASSWORDlinkjar-pds check-configlinkjar-pds serveUse the executable path from your build if it is not installed on PATH.
Stop it with Ctrl-C. This example does not configure public TLS or a rotation
key for creating accounts. Never point it at a live production data directory.
Move from Docker
Section titled “Move from Docker”Take a tested backup, stop the old server, and preserve the complete data directory and every secret. Review the authentication limits on rollback.
Copy the stopped data to /var/lib/linkjar-pds, then assign it to
linkjar-pds:linkjar-pds. Change container paths such as /app/data to host
paths in the environment. Preserve external database and blob-store settings.
Run native verification before starting.
Only one server may use the data, including copies on different hosts.
Next: verify the public setup, then create an account. Use the operator guides for updates, backups, and monitoring.
