readme for portable server

This commit is contained in:
Priec
2026-08-14 13:59:23 +02:00
parent 0e79c62511
commit 0bca319a50
3 changed files with 25 additions and 7 deletions

View File

@@ -34,6 +34,17 @@ To connect a client to a second server instance, override its gRPC endpoint:
GRPC_ENDPOINT='http://[::1]:50052' cargo watch-client GRPC_ENDPOINT='http://[::1]:50052' cargo watch-client
``` ```
## Server database builds
| Build | PostgreSQL | Intended use |
|---|---|---|
| `cargo build --release --package server` | Upstream embedded | Development and compatible Linux targets |
| `nix build '.?submodules=1#portable-server'` | Musl embedded | Portable x86-64 Linux deployment |
| `cargo build --release --package server --no-default-features` | External | Separately managed PostgreSQL |
All builds contain and apply the SQLx migrations. See
[`server/README.md`](server/README.md) for configuration.
Client with tracing: Client with tracing:
``` ```

View File

@@ -2,8 +2,7 @@
This build produces one `x86_64` Linux server executable with embedded This build produces one `x86_64` Linux server executable with embedded
PostgreSQL. The Rust program is statically linked against musl. PostgreSQL is PostgreSQL. The Rust program is statically linked against musl. PostgreSQL is
compiled against musl without optional host-library dependencies and is stored compiled against musl and stored inside the executable.
inside the executable by `postgresql_embedded`.
PostgreSQL itself remains dynamically loadable so the `btree_gist` extension PostgreSQL itself remains dynamically loadable so the `btree_gist` extension
used by the migrations works. Its musl loader is included in the embedded used by the migrations works. Its musl loader is included in the embedded
@@ -17,17 +16,25 @@ Build directly through the repository's Nix flake:
nix build '.?submodules=1#portable-server' nix build '.?submodules=1#portable-server'
``` ```
The `submodules=1` flag includes the workspace's nested Rust repositories. The Output: `result/bin/server`.
artifact is available as `result/bin/server`. The derivation initializes a
temporary cluster, creates `btree_gist`, sets the timezone to `UTC`, and checks
that the final Rust executable has no ELF interpreter.
The resulting executable is intended for 64-bit Linux kernels. Run it normally: The resulting executable is intended for 64-bit Linux kernels. Run it normally:
```sh ```sh
cp .env_template .env
# Replace JWT_SECRET in .env before starting.
./result/bin/server server ./result/bin/server server
``` ```
Required: `JWT_SECRET`.
Optional: `KOMP_AC_POSTGRES_DIR` selects the persistent PostgreSQL directory.
`DATABASE_URL` and `RUST_DB_*` are not required in embedded mode.
The portable binary can still use a separately managed PostgreSQL server at
runtime. Set `RUST_DB_MODE=external` and provide `RUST_DB_USER`,
`RUST_DB_PASSWORD`, `RUST_DB_HOST`, `RUST_DB_PORT` and `RUST_DB_NAME`.
Use the external PostgreSQL build on NixOS when preferred: Use the external PostgreSQL build on NixOS when preferred:
```sh ```sh

2
server

Submodule server updated: 440e0cf0dc...f075e3a1f4