Self-hosting
Everything you need to install, configure, upgrade and back up PixB with Docker Compose.
Requirements
-
Docker with the Compose plugin (
docker compose, notdocker-compose). -
An x86-64 (
linux/amd64) machine: the published images are built for that platform only. -
A free host port: PixB uses
3010unless you setPIXB_PORT. - Network access to
ghcr.ioto pull the images. - About 850 MB of images to download, and about 200 MiB of memory when idle (more with real use).
- Disk space for your files, plus the 128 MiB of free space that uploads keep as a margin.
Install
On the machine that will run PixB:
mkdir pixb && cd pixb
curl -fLO \
https://github.com/Vulptik/pixb/releases/latest/download/compose.production.yml
curl -fL -o .env \
https://github.com/Vulptik/pixb/releases/latest/download/env.example
docker compose -f compose.production.yml pull
docker compose -f compose.production.yml run --rm --no-deps init-config
docker compose -f compose.production.yml up -d --wait app
init-config creates the instance keys once and never overwrites them.
up --wait returns when the app reports healthy (about 20 seconds on a
fresh install).
PUBLIC_URL defaults to http://localhost:3010, fine for a
local trial. Otherwise set it to the address people will use (with the port, if
you changed PIXB_PORT) before running up.
Then check that it works and open
http://127.0.0.1:3010/setup to create the first administrator. On a
server you can't reach from your own computer, read
Access from other machines first.
Keep /setup private until you have created the
administrator:
whoever reaches it first creates that account.
Build from source
Clone the release you want and build with the build override, which names the
images pixb:local and pixb-postgres:local:
git clone --branch v1.1.2 https://github.com/Vulptik/pixb.git
cd pixb
cp .env.example .env
The build needs PUBLIC_URL, so set it in .env first,
along with PIXB_IMAGE=pixb:local and
PIXB_DATABASE_IMAGE=pixb-postgres:local. Then build:
docker compose -f compose.production.yml -f compose.build.yml build
Run init-config and start the app as above, without the
pull.
Config builder
Type your values to get the .env lines and commands. Nothing leaves
your browser.
The compose file comes from the PixB release on GitHub; with a version set, you
get that release’s file. Put both files in the same empty folder. If your
browser renames the download, rename it to .env.
Install on TrueNAS
PixB is in the TrueNAS Community catalog: open Apps, find PixB and install it, or see its catalog page. The install form asks for:
-
Public URL (required): the address you use to open PixB. On
your home network, use your NAS's IP address and WebUI port (for example,
http://192.168.1.20:30641). If you use a domain, enter its HTTPS address (for example,https://pixb.example.com). Don't add/setuphere. - Database Password and the Postgres image choice: leave the defaults unless you know why you need to change them.
- WebUI Port:
30641by default. - User ID and Group ID:
568by default.
Open /setup on that address to create the first administrator, as in
the Docker install. The rest of this page (configuration, reverse proxy, backups)
is written for Docker Compose; on TrueNAS use the app’s own storage and backup
tools.
Check that it works
Ask the app if it can reach its database.
curl http://127.0.0.1:3010/api/health
A healthy install answers:
{"status":"ok","db":"up","latency_ms":2}
If the database is unreachable, you get HTTP 500 and
{"status":"error","db":"down"}. Read the logs:
docker compose -f compose.production.yml logs app db
Next steps
- Add people under Settings → Users (administrators only).
- Upload from the Library in the web app.
- For scripts, create an API key under Settings → API keys, then follow the API quick start.
- Optional: under Settings → Instance → Advanced you can set a custom address and a maximum upload size, and under Settings → Instance you can set up email for password resets.
-
Take a first backup and check it with
verify.
Access from other machines
By default the app listens on 127.0.0.1:3010. Only the server itself
can reach it.
On a NAS or VPS, pick one: an SSH tunnel, listening on the network, or a reverse proxy with HTTPS (see Reverse proxy).
SSH tunnel (simplest, private)
ssh -L 3010:127.0.0.1:3010 you@your-server
Keep PUBLIC_URL=http://localhost:3010 and open that address on your
laptop.
Listen on the network
Set PIXB_BIND_ADDRESS in .env to the server's LAN
address, and PUBLIC_URL to the matching address.
PIXB_BIND_ADDRESS=192.168.1.20
PUBLIC_URL=http://192.168.1.20:3010
Recreate the app with
docker compose -f compose.production.yml up -d --wait app.
The app then listens only on that address: http://127.0.0.1:3010 and
SSH tunnels to it stop working, so use the LAN address for checks too.
This serves plain HTTP. Do not expose it to the internet. Browsers only allow
passkeys on HTTPS (or on localhost).
Reverse proxy and HTTPS
Keep the default 127.0.0.1 binding and run the proxy on the same
host.
Set PUBLIC_URL to the HTTPS address, for example
https://files.example.com.
Links always use PUBLIC_URL. PixB reads
X-Forwarded-Host and X-Forwarded-Proto for sign-in
cookies and passkeys, and the visitor address from
X-Forwarded-For for rate limits, so the proxy must
overwrite them, and nothing else should reach the app directly.
Use HTTPS. Browsers only allow passkeys on secure origins, and passkeys are tied to the domain.
The web app uploads in 10 MiB parts, but API clients send a whole file in one request. Don’t cap the request body size in the proxy (PixB enforces its own limit: see Maximum upload size in Account and instance) and allow a generous read timeout.
Adapt these examples to your setup.
Caddy example
files.example.com {
reverse_proxy 127.0.0.1:3010
}
Caddy sets the forwarded headers itself, replacing any a visitor sends, and gets the HTTPS certificate for you.
nginx example
client_max_body_size 0 turns off nginx’s own limit, which would
otherwise reject large API uploads with 413. The timeout is an
example value; adjust it to your setup.
server {
listen 443 ssl;
server_name files.example.com;
# ssl_certificate ... ; ssl_certificate_key ... ;
client_max_body_size 0;
proxy_read_timeout 300s;
location / {
proxy_pass http://127.0.0.1:3010;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_http_version 1.1;
}
}
Traefik example
Traefik reaches PixB on 127.0.0.1:3010, so run it on the host, or in
Docker with network_mode: host. Two files: the static configuration
sets the entrypoints, the certificate and the longer read timeout (60 seconds by
default), and the dynamic one routes your domain to PixB. The email, domain and
paths are examples to adapt.
entryPoints:
web:
address: ':80'
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: ':443'
transport:
respondingTimeouts:
readTimeout: 300s
certificatesResolvers:
letsencrypt:
acme:
email: you@example.com
storage: /letsencrypt/acme.json
httpChallenge:
entryPoint: web
providers:
file:
filename: /etc/traefik/pixb.yml
http:
routers:
pixb:
rule: Host(`files.example.com`)
entryPoints: [websecure]
service: pixb
tls:
certResolver: letsencrypt
services:
pixb:
loadBalancer:
servers:
- url: http://127.0.0.1:3010
Traefik has no request body limit, so large API uploads pass. It replaces the
X-Forwarded-* headers a visitor sends, as long as you leave
forwardedHeaders.trustedIPs unset. Set it only when another proxy
sits in front of Traefik.
Configuration
| Setting | What it does |
|---|---|
PUBLIC_URL |
The address people use. A plain origin: no path, query or credentials; hosting under a subpath isn’t supported. |
PIXB_BIND_ADDRESS |
Host address the app listens on (default 127.0.0.1). |
PIXB_PORT |
Host port (default 3010). |
PIXB_VERSION |
App image version. Defaults to the release the Compose file came from. |
PIXB_DATABASE_VERSION |
Database image version. Change it only when release notes say so. |
PIXB_IMAGE, PIXB_DATABASE_IMAGE |
Replace the image names entirely, for example with your own builds. |
Administrators can override the public address under Settings → Instance → Advanced.
Email (SMTP)
Email is optional. PixB only uses it to send password-reset links; without it, use the administrator recovery. Administrators set it up under Settings → Instance → Password recovery email:
| Field | Notes |
|---|---|
| SMTP host | Your mail server. |
| Port | 587 if left empty. |
| SMTP username | If your server needs one. |
| SMTP password | Leave blank to keep the saved password. |
| Sender address | The address reset mail comes from. |
| Use TLS | Turn on if your server expects a TLS connection from the start. |
Reset links use your PUBLIC_URL (or the saved custom address), never
the address a request arrived on.
Your data
Everything lives in four volumes. Back them up together:
| Volume | Contents |
|---|---|
config |
Signing and encryption keys |
database-secret |
The database password |
files |
Originals, avatars, previews, resumable uploads |
database |
PostgreSQL 18 data |
If you use host folders instead of named volumes, give the app and database users access: see Permission errors on host folders. Never delete volumes or regenerate secrets to fix an error: PixB refuses to start with keys from another installation, and new keys can’t read existing data.
Upgrade
- Read the release notes for every version you’re skipping.
- Take a backup.
-
Set
PIXB_VERSIONin.envto the new version, then:docker compose -f compose.production.yml pull app docker compose -f compose.production.yml up -d --no-deps --pull never --wait app
If you built from source, pull fails
on the local images: check out the new tag in your clone (git fetch --tags && git checkout vX.Y.Z), rebuild, then run only the up command.
The new version applies its database migrations on start. Check existing files, a new upload and your share links before letting people back in. PixB never downgrades a database, so going back means restoring the backup you took. If a migration fails or the schema isn’t recognized, PixB stops without changing anything: keep your data as it is, read the logs, and go back to the previous image or restore your backup.
Backup
The backup tool lives in the repository: run it from a checkout of the release you’re running, with Node 26.13 or later. It pauses the app while it copies (the database stays online) and restarts it afterwards.
node scripts/backup.mjs backup pixb-production /private/backups/pixb-backup
node scripts/backup.mjs verify /private/backups/pixb-backup
pixb-production is the Compose project name from
compose.production.yml; if you started with -p, use that
name. verify checks the checksums only and does not replace a restore
drill, so try a restore from time to time.
A backup holds a database dump, all files and secrets, the Compose file, and a manifest with checksums and the exact image IDs. It isn’t encrypted, so keep it somewhere private, with a copy off the host. Images are recorded, not included: save them too, or you can’t restore on a new machine.
docker image save --output /private/pixb-images.tar APP_IMAGE_ID DATABASE_IMAGE_ID
The tool never overwrites an existing folder. A folder marked
.incomplete is a failed backup.
Schedule backups
Clone the release you run (the same tag as PIXB_VERSION); it needs
only Node built-ins, so no npm install. Each backup needs a new
folder, so name it with the date. An example weekly cron entry for a
user who can run Docker, to adapt:
git clone --depth 1 --branch v1.1.2 https://github.com/Vulptik/pixb.git /opt/pixb-release
0 3 * * 0 cd /opt/pixb-release && node scripts/backup.mjs backup pixb-production /private/backups/pixb-$(date +\%F)
Old backups are never removed for you, so delete the ones you no longer need, and keep a copy off the host.
Restore
A restore never touches the original installation. It creates a new, separate one
from the backup, with the exact recorded images (load them first with
docker image load):
node scripts/backup.mjs restore /private/backups/pixb-backup \
https://files.example.com /private/restores/pixb
The restored app listens on a free local port, which the tool prints, and is
managed with the compose.restore.yml it writes. Settings, share links
and passkeys come back as they were, so review them before exposing a copy.
Switching traffic and removing the old installation are up to you.
Recover the administrator password
This resets the first administrator’s password; their authenticator app and passkeys stay.
- Make sure only you can reach PixB.
-
Arm recovery:
docker compose -f compose.production.yml exec app node docker/db-check.js arm-recovery. -
Add
RECOVERY_MODE=trueto.envand recreate the app:docker compose -f compose.production.yml up -d --no-deps --pull never --wait app. - Open
/recoverand set the new password. It works once. -
Remove the
RECOVERY_MODEline and recreate the app the same way.
Troubleshooting
"Set the client-facing PixB address"
Compose stops with
required variable PUBLIC_URL is missing a value: Set the client-facing PixB
address
when PUBLIC_URL is empty or missing. Set it in .env,
next to compose.production.yml, and run the command again.
PUBLIC_URL must be a plain http or https address
Use a plain origin such as https://files.example.com: no path, query,
fragment or credentials. A value with no scheme is treated as
https://.
With a bad value the container keeps restarting, and
docker compose -f compose.production.yml logs app shows
PUBLIC_URL must be a plain http or https address…. Fix the value in
.env and recreate the app.
Port already in use
Docker cannot bind port 3010 because something else uses it. Set
another PIXB_PORT and update the port in PUBLIC_URL.
Permission errors on host folders
With Docker Compose the app runs as UID and GID 1001 (on TrueNAS, the user and group you set, 568 by default). If you replaced a named volume with a host folder, give that user access. The same applies to a database folder, which belongs to PostgreSQL (UID and GID 999):
sudo chown -R 1001:1001 /path/to/folder
sudo chown -R 999:999 /path/to/database-folder
Refuses to start: secrets don’t match
The log says
Persistent secrets do not match this database. Restore its matching config;
startup is refused.
The config volume does not match the data. Restore the original
config and database-secret volumes from a backup.
Never delete volumes or regenerate secrets to fix this. New keys cannot read existing data.
Uploads fail with 507 or 503
Uploads keep a 128 MiB free-space margin. 507 storageFull means the
disk is full; 503 storageUnavailable means the storage mount or its
permissions broke. Fix the cause and retry: resumable uploads carry on from where
they stopped. A failed preview never removes the original.
Stop and uninstall
Stop PixB and keep everything:
docker compose -f compose.production.yml stop
Start it again:
docker compose -f compose.production.yml up -d --wait app
down removes the containers and network but keeps the four volumes,
so up brings the same installation back:
docker compose -f compose.production.yml down
Add -v only to delete everything.
down -v removes the volumes: your files, database and keys are gone
for good. Take a backup first.
To remove PixB completely after a backup, run down -v, remove the
images (docker image rm ghcr.io/vulptik/pixb:VERSION
ghcr.io/vulptik/pixb-postgres:VERSION) and delete the folder that holds compose.production.yml and
.env.
Housekeeping
PixB cleans up expired sessions and abandoned uploads every hour and recounts storage every day; no cron job needed. It logs orphaned files but never deletes them on its own.
To list orphaned files, run
docker compose -f compose.production.yml exec app node
docker/maintenance.js. Add --delete-orphan PATH (a relativePath from that
list) to remove one, or --apply to run the cleanup now.
Security checklist
- Keep
/setupprivate until the first administrator exists. -
Serve PixB over HTTPS through a reverse proxy, and keep the default
127.0.0.1binding unless the proxy runs elsewhere. -
Make the proxy overwrite
X-Forwarded-HostandX-Forwarded-Proto, and let nothing else reach the app directly. - Give each API key only the scopes it needs, and a short expiry.
- Store backups somewhere private: they aren’t encrypted. Keep a copy off the host.
- Turn
RECOVERY_MODEoff as soon as the recovery is done. - Never delete volumes or regenerate secrets to fix an error.
- Read the release notes, and take a backup, before every upgrade.