Binary and systemd
Almond always runs in the foreground, with no daemon mode, so run it under a service manager. Build and install the binary:
bash
cargo build --release
sudo install -m 0755 target/release/almond /usr/local/bin/The unit file contrib/almond.service includes its install instructions in the header:
ini
# Almond Blossom server.
# Install: sudo useradd --system --home-dir /var/lib/almond --create-home --shell /usr/sbin/nologin almond
# sudo install -m 0755 target/release/almond /usr/local/bin/ && sudo install -D -m 0640 -g almond .env.example /etc/almond/almond.env
# sudo cp contrib/almond.service /etc/systemd/system/ && sudo systemctl daemon-reload && sudo systemctl enable --now almond
[Unit]
Description=Almond Blossom server
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=almond
Group=almond
WorkingDirectory=/var/lib/almond
ExecStart=/usr/local/bin/almond --config /etc/almond/almond.env
Environment=RUST_LOG=info
Restart=on-failure
NoNewPrivileges=yes
ProtectSystem=strict
ReadWritePaths=/var/lib/almond
PrivateTmp=yes
[Install]
WantedBy=multi-user.targetSettings go into /etc/almond/almond.env, a dotenv file with the environment variables.
