Installation
slonbase is a single binary. It needs a PostgreSQL 14 or newer server, which it doesn't
bundle: use one on the same machine, another machine, or a managed service (Amazon RDS, Google
Cloud SQL, Azure, Supabase, Neon, ...). Everything slonbase creates lives in two schemas,
_slonbase (system tables) and slonbase (your collections), so the database can be shared with
other applications.
Release builds are static Linux binaries for x86_64 (amd64) and aarch64 (arm64). Other platforms can build from source.
- Docker Compose
- Docker
- Hosting platforms: Render, Railway, Fly.io, Coolify, Dokploy
- Debian, Ubuntu, Fedora, RHEL packages
- Plain binary
- From source
- First-run setup
- Upgrading
- Uninstalling
#Docker Compose
compose. runs slonbase and PostgreSQL 17 together:
mkdir slonbase && cd slonbase
curl -fsSLO https://raw.githubusercontent.com/ayeshrodz/slonbase/main/compose.yaml
echo "POSTGRES_PASSWORD=$(openssl rand -hex 24)" > .env # URL-safe, see .env.example for the rest
docker compose up -d
docker compose logs slonbase | grep "setup?token"Open the printed link (the token in it is required) to create the first superuser. Data lives in
two volumes: pgdata (the database) and slonbase_data (/: files, backups, hooks and the
config file).
SLONBASE_VERSION in . pins a release (2.); the default is latest. When the image
can't be pulled, or with docker compose up --build, Compose builds it from a checkout of the
repository (run it there).
#Docker
The image ghcr. (amd64 and arm64) contains only the binary. It runs as an
unprivileged user (65532), listens on 0., keeps everything under the / volume,
and has a health check (slonbase health).
docker run -d --name slonbase -p 8090:8090 -v slonbase_data:/data \
-e SLONBASE_DATABASE_URL='postgres://user:pass@db.example.com:5432/app?sslmode=require' \
ghcr.io/ayeshrodz/slonbase:2.1.3
docker logs slonbase 2>&1 | grep "setup?token"Without SLONBASE_DATABASE_URL the setup wizard asks for the connection and saves it in
/. JavaScript hooks go in /.
#Debian, Ubuntu, Fedora, RHEL packages
The packages are in signed apt and dnf repositories at
https://ayeshrodz.github.io/slonbase/, for amd64 and arm64. Installing from them means
apt upgrade and dnf upgrade bring new versions.
Debian, Ubuntu:
curl -fsSL https://ayeshrodz.github.io/slonbase/slonbase.gpg | sudo tee /usr/share/keyrings/slonbase.gpg > /dev/null
curl -fsSL https://ayeshrodz.github.io/slonbase/slonbase.list | sudo tee /etc/apt/sources.list.d/slonbase.list
sudo apt update && sudo apt install slonbase
sudo journalctl -u slonbase | grep "setup?token" # the one-time setup linkFedora, RHEL, Rocky, Alma:
sudo curl -fsSL -o /etc/yum.repos.d/slonbase.repo https://ayeshrodz.github.io/slonbase/slonbase.repo
sudo dnf install slonbase # accept the signing key when asked
sudo journalctl -u slonbase | grep "setup?token"The repositories carry the five newest versions. The signing key's fingerprint is shown on the
repository page. To install an older version, or a package file instead, download the . or . for your
architecture from the releases page and check it against
SHA256SUMS:
sha256sum --ignore-missing -c SHA256SUMS
sudo apt install ./slonbase_2.1.3_amd64.deb # Debian, Ubuntu
sudo dnf install ./slonbase-2.1.3-1.x86_64.rpm # Fedora, RHEL, Rocky, Alma
sudo journalctl -u slonbase | grep "setup?token" # the one-time setup linkThe packages recommend (but don't require) the distribution's PostgreSQL server. They install:
| Path | |
|---|---|
/ | the binary |
/ | a hardened systemd service, enabled and started on install |
/ | the service's environment (listen address, log level) |
/ | the config file, written by the setup wizard (0600) |
/ | storage/ (files), backups/, hooks/ |
The service runs as the slonbase system user and listens on 127.. To reach the
setup wizard from another machine, use an SSH tunnel (ssh -L 8090:127.), or
set SLONBASE_BIND=0. in / and
sudo systemctl restart slonbase. For production, put a reverse proxy in front instead (see
deployment).
If PostgreSQL runs on the same machine, create a role and a database for slonbase:
sudo -u postgres psql -c "CREATE ROLE slonbase LOGIN PASSWORD 'change-me'" \
-c "CREATE DATABASE slonbase OWNER slonbase"and enter postgres:/ in the wizard.
#Plain binary
curl -LO https://github.com/ayeshrodz/slonbase/releases/download/v2.1.3/slonbase-2.1.3-linux-amd64.tar.gz
tar xzf slonbase-2.1.3-linux-amd64.tar.gz
./slonbase serve # starts in setup mode and prints the setup linkBy default it listens on 127. and keeps its config (slonbase.) and data
(slonbase_data/, slonbase_hooks/) in the current directory; see
configuration.
#From source
Rust 1.87 or newer:
git clone https://github.com/ayeshrodz/slonbase && cd slonbase
cargo build --release --locked
./target/release/slonbase serve--no-default-features leaves out the JavaScript engine (no *. hooks, a smaller binary).
docker build . builds the image from source.
#First-run setup
On first start slonbase has no database configured, so it starts in setup mode and prints a one-time link. The token in it is required, so nobody else who can reach the port can take over the installation. The wizard:
- asks for the PostgreSQL connection and tests it (version, permissions, existing installs);
- creates the system tables in the
_slonbaseschema; - creates the first superuser;
- saves the connection in the config file (
0600) and switches to normal mode without a restart.
When the database URL comes from the environment or a flag (as with Docker Compose), the wizard skips step 1. Pointing a new server at a database that already has a slonbase installation requires signing in as one of its superusers.
The database role needs to create schemas and tables in its database: the owner of the database is enough; it doesn't need to be a PostgreSQL superuser.
Once set up, slonbase never returns to setup mode. If the database goes down, requests fail with
503 while it reconnects.
Headless setup skips the wizard:
SLONBASE_SUPERUSER_PASSWORD='...' slonbase setup \
--database-url 'postgres://user:pass@host:5432/db' --email you@example.com(for the packages, run it as the service user:
sudo -u slonbase env SLONBASE_SUPERUSER_PASSWORD=.).
Lost superuser access? On the server, slonbase superuser upsert you@example.
creates or resets a superuser, and slonbase superuser otp you@example. prints a one-time
password for signing in when MFA is on and emails can't be sent. Pass the same --config (or
environment) the server uses.
#Upgrading
Back up first (a slonbase backup, a database dump, or both; see deployment). Then:
- Compose:
docker compose pull && docker compose up -d(or setSLONBASE_VERSION). - Docker: run the new tag with the same volume and environment.
- Packages:
sudo apt update && sudo apt upgradeorsudo dnf upgradewith the repositories (an installation from a package file can add them at any time), or install the new./deb .file. The service restarts with the new version, andrpm /andetc/ default/ slonbase /are kept.etc/ slonbase/ config. toml - Binary: replace the file and restart.
A new version applies its system migrations on start, in one transaction under an advisory lock,
so several instances starting at once apply them once, and a failed migration changes nothing.
Downgrading after a migration isn't supported: restore the backup instead. Every change is tested
for upgrades in place from the first release (0.1.0) and from the previous one: CI seeds the
old release with data, starts the new build on it, and checks the data, files, settings, old
passwords and tokens, rules, realtime and backups (compat/).
Several instances, to 1.7: upgrade them all together (stop the old ones, then start the new). Instances before 1.7 rely on a notification sent with each write to deliver realtime events, which 1.7 no longer sends (see several instances).
#Uninstalling
- Packages:
sudo apt remove slonbase/sudo dnf remove slonbase. The config and/are kept (var/ lib/ slonbase apt purgeremoves them). To remove the repository too:sudo rm /oretc/ apt/ sources. list. d/ slonbase. list / usr/ share/ keyrings/ slonbase. gpg sudo rm /.etc/ yum. repos. d/ slonbase. repo - Docker: remove the container and, if you no longer need it, the
/volume.data
slonbase never drops the database. To remove its data from PostgreSQL:
DROP SCHEMA slonbase CASCADE; DROP SCHEMA _slonbase CASCADE;.