README: Document the build process, add systemd service

Fixes #269.
This commit is contained in:
Valentin Tolmer 2022-08-01 08:45:55 +02:00
parent 42e3293f7f
commit d96ec93fb0
2 changed files with 43 additions and 4 deletions

View File

@ -163,6 +163,20 @@ front-end.
### From source ### From source
To compile the project, you'll need:
* npm, curl: `sudo apt install curl npm`
* Rust/Cargo: [rustup.rs](https://rustup.rs/)
Then you can compile the server (and the migration tool if you want):
```shell
cargo build --release -p lldap -p migration-tool
```
The resulting binaries will be in `./target/release/`. Alternatively, you can
just run `cargo run -- run` to run the server.
To bring up the server, you'll need to compile the frontend. In addition to To bring up the server, you'll need to compile the frontend. In addition to
cargo, you'll need: cargo, you'll need:
@ -172,10 +186,13 @@ cargo, you'll need:
Then you can build the frontend files with `./app/build.sh` (you'll need to run Then you can build the frontend files with `./app/build.sh` (you'll need to run
this after every front-end change to update the WASM package served). this after every front-end change to update the WASM package served).
To bring up the server, just run `cargo run`. The default config is in The default config is in `src/infra/configuration.rs`, but you can override it
`src/infra/configuration.rs`, but you can override it by creating an by creating an `lldap_config.toml`, setting environment variables or passing
`lldap_config.toml`, setting environment variables or passing arguments to arguments to `cargo run`. Have a look at the docker template:
`cargo run`. `lldap_config.docker_template.toml`.
You can also install it as a systemd service, see
[lldap.service](example_configs/lldap.service).
### Cross-compilation ### Cross-compilation

View File

@ -0,0 +1,22 @@
[Unit]
Description=Nitnelave LLDAP
Documentation=https://github.com/nitnelave/lldap
# Only sqlite
After=network.target
[Service]
# The user/group LLDAP is run under. The working directory (see below) should allow write and read access to this user/group.
User=root
Group=root
# The location of the compiled binary
ExecStart=/opt/nitnelave/lldap \
run
# Only allow writes to the following directory and set it to the working directory (user and password data are stored here).
WorkingDirectory=/opt/nitnelave/
ReadWriteDirectories=/opt/nitnelave/
[Install]
WantedBy=multi-user.target