documentation: added build and install for alpine, with openrc service

This commit is contained in:
Philippe Loctaux 2023-06-29 20:40:53 +02:00
parent b135c49e75
commit c09f1fbe4e
2 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,71 @@
# Build ezidam on Alpine Linux
## Setup
Install alpine.
Enable `community` repository in `/etc/apk/repositories`
Install packages:
```sh
apk add rustup git build-base
```
Run `rustup-init` to download the rust compiler.
## Build
Get code, get in repo
```sh
rm rust-toolchain.toml
cargo build --release
```
## Copy
Create folders for config, assets, database
```sh
mkdir -p /etc/ezidam /usr/share/ezidam /var/lib/ezidam
```
Copy binary, config, assets
```sh
cp target/release/ezidam /usr/bin/ezidam
cp crates/ezidam/ezidam.toml /etc/ezidam/ezidam.toml
cp crates/ezidam/static/ crates/ezidam/templates/ /usr/share/ezidam/ -rv
```
## Config
Here's the paths to use in `/etc/ezidam/ezidam.toml`:
```toml
[default]
template_dir = "/usr/share/ezidam/templates"
static_dir = "/usr/share/ezidam/static"
[default.databases.ezidam]
url = "/var/lib/ezidam/ezidam.sqlite"
```
Don't forget the rest of the config! The above is only a snippet!
## Service
Copy the script `openrc.sh` as `/etc/init.d/ezidam`, then
```sh
chmod +x /etc/init.d/ezidam
```
## Start/Stop/Boot
- Start: `rc-service ezidam start`
- Stop: `rc-service ezidam stop`
- Start at boot: `rc-update add ezidam`
- Don't start at boot: `rc-update del ezidam`
## Logs
If ezidam is started with the service, logs will be available at `/var/log/ezidam.{log,err}`

16
documentation/openrc.sh Normal file
View file

@ -0,0 +1,16 @@
#!/sbin/openrc-run
name="ezidam"
command="/usr/bin/ezidam"
command_args=
command_background=true
pidfile="/run/${RC_SVCNAME}.pid"
output_log="/var/log/${RC_SVCNAME}.log"
error_log="/var/log/${RC_SVCNAME}.err"
depend() {
need net
use logger
}
export EZIDAM_CONFIG="/etc/ezidam/ezidam.toml"