Skip to main content
Environment variables let you configure Primo for different deployment environments. These are particularly useful for Docker deployments and automated setup.
Legacy PALA_* variable names are still accepted as fallbacks, but new deployments should use the PRIMO_* names documented below.

Initial Setup Variables

These variables only take effect on first startup when initializing a new instance:

PRIMO_SUPERUSER_EMAIL

Creates an initial superuser account (admin) with full access.
  • Type: String (email address)
  • Required: No
  • Default: None
  • When to use: Automated deployments, skipping manual setup
Example:

PRIMO_SUPERUSER_PASSWORD

Password for the initial superuser account.
  • Type: String
  • Required: Only if PRIMO_SUPERUSER_EMAIL is set
  • Default: None
  • Minimum: 8 characters
Example:
If both PRIMO_SUPERUSER_EMAIL and PRIMO_SUPERUSER_PASSWORD are set, the setup screen will be skipped and you’ll go straight to the sign-in page.

PRIMO_USER_EMAIL

Creates an initial regular user account.
  • Type: String (email address)
  • Required: No
  • Default: None
  • When to use: Pre-populate with a content editor account
Example:

PRIMO_USER_PASSWORD

Password for the initial regular user account.
  • Type: String
  • Required: Only if PRIMO_USER_EMAIL is set
  • Default: None
  • Minimum: 8 characters
Example:

PRIMO_APP_URL

Sets the base URL for the application. Used for generating links in emails and backend processes.
  • Type: String (URL)
  • Required: No
  • Default: Auto-detected from request
  • When to use: Email notifications, API callbacks
Example:

Custom Domain Variables

These control how sites get a public address: an automatic subdomain on creation, and connecting a site’s own custom domain.

PRIMO_BASE_DOMAIN

A wildcard base domain under which new sites get an automatic, live subdomain (<site-slug>.<base-domain>) the moment they’re created. Without it, new sites start unassigned (editable but not publicly served) until a domain is connected.
  • Type: String (domain)
  • Required: No
  • Default: Empty (new sites start unassigned)
  • When to use: Multi-site instances where every site should be reachable immediately without manual DNS.
Setting this variable only tells Primo which subdomains to assign. For those subdomains to actually resolve and serve over HTTPS, you must separately point a wildcard DNS record (*.<base-domain>) at this server and provision a matching wildcard TLS certificate. Primo does not create the DNS record or the certificate.
Example:

PRIMO_DOMAIN_PROVIDER

Selects how connecting a site’s own custom domain works. manual (the default) shows the DNS records to add and leaves routing/TLS to your reverse proxy; railway attaches the domain through Railway’s API and reports certificate status back to the editor.
  • Type: String (manual | railway)
  • Required: No
  • Default: manual
  • When to use: Set to railway when the instance runs on Railway and you want custom domains attached automatically.
Example:

PRIMO_RAILWAY_TOKEN

A Railway project access token scoped to the same environment as Primo, used only when PRIMO_DOMAIN_PROVIDER is railway. Create it in the Railway dashboard under the project’s Settings → Tokens (environment-scoped within the project; use the least-privileged token). A token for a different environment causes domain provisioning to fail. The project/environment/service IDs Railway injects automatically (RAILWAY_PROJECT_ID, etc.) supply the rest.
  • Type: String (token)
  • Required: Only when PRIMO_DOMAIN_PROVIDER=railway
  • Default: Empty
Example:

Common Configurations

Development Setup

The setup screen will guide you through creating your first account.

Production with Manual Setup

Access the setup screen to create your admin account manually.

Production with Automated Setup

No setup screen - go straight to sign-in.

Docker Compose Example

Use .env files or secrets management to avoid hardcoding passwords in docker-compose.yml

Railway Template

Railway automatically handles environment variables through their UI:
  1. Deploy using the Railway button
  2. Set environment variables in Railway dashboard
  3. Railway restarts the service automatically

Security Best Practices

Use environment variables, secrets management, or encrypted files. Never hardcode passwords in docker-compose.yml or other config files.
Generate random passwords with at least 16 characters:
Change initial passwords after setup, especially for production environments.
For production deployments, use:
  • Railway: Built-in secrets
  • Docker Swarm: Docker secrets
  • Kubernetes: Kubernetes secrets
  • Vault: HashiCorp Vault
Environment variables contain sensitive information. Restrict access to deployment configurations.

Troubleshooting

Setup screen appears even with PRIMO_SUPERUSER_EMAIL set

Cause: Environment variables not loaded, or database already initialized Solution:
  1. Check environment variables are correctly set
  2. Verify Docker/Railway configuration
  3. If database exists, delete /app/pb_data volume and restart

Can’t sign in after setting environment variables

Cause: Wrong password, or user wasn’t created Solution:
  1. Check logs for errors during startup
  2. Verify password meets minimum requirements (8 characters)
  3. Check that both EMAIL and PASSWORD variables are set

Variables not taking effect

Cause: Variables only work on first startup Solution: Environment variables for user creation only work when the database is first initialized. To reset:
  1. Stop the container
  2. Delete the volume: docker volume rm primo-data
  3. Restart with new environment variables
Deleting the volume deletes all your data. Only do this for fresh installs or if you have backups.

Next Steps

Deployment Guide

Learn how to deploy Primo to production

Troubleshooting

Solve common deployment issues