readme for portable server
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
|
||||
This build produces one `x86_64` Linux server executable with embedded
|
||||
PostgreSQL. The Rust program is statically linked against musl. PostgreSQL is
|
||||
compiled against musl without optional host-library dependencies and is stored
|
||||
inside the executable by `postgresql_embedded`.
|
||||
compiled against musl and stored inside the executable.
|
||||
|
||||
PostgreSQL itself remains dynamically loadable so the `btree_gist` extension
|
||||
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'
|
||||
```
|
||||
|
||||
The `submodules=1` flag includes the workspace's nested Rust repositories. The
|
||||
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.
|
||||
Output: `result/bin/server`.
|
||||
|
||||
The resulting executable is intended for 64-bit Linux kernels. Run it normally:
|
||||
|
||||
```sh
|
||||
cp .env_template .env
|
||||
# Replace JWT_SECRET in .env before starting.
|
||||
./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:
|
||||
|
||||
```sh
|
||||
|
||||
Reference in New Issue
Block a user