From 36eed1e09151e75d5546952d046ef5cf2929da15 Mon Sep 17 00:00:00 2001 From: Valentin Tolmer Date: Mon, 1 Aug 2022 08:45:55 +0200 Subject: [PATCH] README: Document the build process, add systemd service Fixes #269. --- README.md | 25 +++++++++++++++++++++---- example_configs/lldap.service | 22 ++++++++++++++++++++++ 2 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 example_configs/lldap.service diff --git a/README.md b/README.md index 325fe9c..8343f1e 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,20 @@ front-end. ### 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 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 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 -`src/infra/configuration.rs`, but you can override it by creating an -`lldap_config.toml`, setting environment variables or passing arguments to -`cargo run`. +The default config is in `src/infra/configuration.rs`, but you can override it +by creating an `lldap_config.toml`, setting environment variables or passing +arguments to `cargo run`. Have a look at the docker template: +`lldap_config.docker_template.toml`. + +You can also install it as a systemd service, see +[lldap.service](example_configs/lldap.service). ### Cross-compilation diff --git a/example_configs/lldap.service b/example_configs/lldap.service new file mode 100644 index 0000000..0313172 --- /dev/null +++ b/example_configs/lldap.service @@ -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