- To start from an empty cloud instance, follow Deploy Sediment on EC2. It supplies PostgreSQL, HTTPS, and the supervisor.
- To try Sediment on one machine first, follow the Quickstart.
Before you begin
You need the following:- A Debian or Ubuntu host, or macOS with Homebrew, with at least 4 CPU cores and 8 GB of memory
- Git,
curl, and OpenSSL - A dedicated operating-system account to run Sediment
- A dedicated, empty PostgreSQL 17 database on a private network, and either
an administrator connection to it or a database administrator who creates
Sediment’s roles for you. The administrator is a superuser, or a role with
CREATEROLEthat owns the database. - A reverse proxy that serves a stable HTTPS hostname
- Persistent storage for the account’s home directory
Install Sediment
As the account that runs Sediment, install a published release. Replace the example version with the release that you want. Optional: check the release first with Verify a release.PATH, follow it. Then check
the installed version:
sediment guide for guidance that matches the installed release.
Create the database roles
Sediment uses three PostgreSQL roles:sediment_migrator owns the schema and
migrates it, sediment_runtime serves the API, and sediment_operator runs
operator commands. The API can’t change or delete a Fact. Don’t point Sediment
at a database that another application uses.
Sediment doesn’t claim support for a managed PostgreSQL service, such as Amazon
RDS, until the service passes the
qualification in ADR 0027.
-
Optional: If your organization names the roles itself, export
SEDIMENT_MIGRATOR_ROLE,SEDIMENT_RUNTIME_ROLE, andSEDIMENT_OPERATOR_ROLE. Set them in the server’s environment too, and use those names in place ofsediment_migrator,sediment_runtime, andsediment_operatorin every URL on this page. Two deployments with different role names and databases can share one PostgreSQL instance. -
As the server account, generate the three role passwords into a private
file. The command refuses to overwrite an existing file, which holds the
only copy of the passwords:
-
Create the roles in one of two ways:
-
If you hold the administrator connection, let Sediment create the roles.
Enter the administrator URL at the prompt, for example
postgresql+psycopg://admin:<password>@db.internal:5432/sediment. Percent-encode any reserved URL character in the password. The URL reaches only this command:The command printsdatabase roles provisioned and schema upgraded. If the administrator lacks a capability, the command names it and the statement that fixes it, and changes nothing. -
If a database administrator creates the roles, print the SQL for them:
The administrator runs
sediment-roles.sqlconnected to thesedimentdatabase, then sets each role’s password to the value in~/.sediment/database-roles.env.sediment-roles.sqlcontains no password.
-
If you hold the administrator connection, let Sediment create the roles.
Enter the administrator URL at the prompt, for example
Configure the server
In the server account’s private environment, set the following variables. Replace the organization, the database host, the two passwords from~/.sediment/database-roles.env, and the Git hosts that Sediment may clone
from. Percent-encode any reserved URL character in a password:
sslmode and sslrootcert.
Check the database before the first start. The URL goes through the
environment, so it stays out of process listings:
passed. Otherwise, it lists each failed check with the
statement that fixes it. Before the first start, the schema is absent after
the administrator’s SQL, or at_head after sediment db provision.
Start the API
-
Start the server:
On each start, Sediment migrates the database as
sediment_migrator, applies the table grants, and checks all three roles. It then removes the migrator credential from its environment before the API and its workers start, and serves with the runtime role only. Replicas that start together wait up to two minutes for one migration. -
In a second terminal, check readiness:
The response shows
"status":"ok"and the installed version. - Stop the server. Configure your process supervisor to run the same command as the same account, with the same private environment. Set it to restart Sediment after a failure and after a host restart.
~/.sediment/server/server.env,
and its Git mirrors to ~/.sediment/server/mirror. Keep ~/.sediment on
persistent storage.
Expose HTTPS
-
Configure your reverse proxy to forward your HTTPS hostname to
http://127.0.0.1:8000. Preserve request bodies andAuthorizationheaders, and rate-limit authentication attempts. The API doesn’t rate-limit them. -
From another machine, check the public endpoint:
The response matches the local check.
Set up an operator shell
Reports, Derivations, exports, and quarantine commands read PostgreSQL directly through thesediment_operator role.
-
On the server, as the server account, set the following variables. Replace
the organization and the database host:
-
Check the schema:
The output shows
at_head. -
Sign in to the API with the operator token:
On loopback,
sediment loginreads the operator token from~/.sediment/server/server.env.sediment factsprints zero counts until the first capture arrives.
Next steps
- Enroll your team.
- Before you rely on the data, set up backups with Maintain a deployment.