diff --git a/CHANGELOG.md b/CHANGELOG.md index db4a2285..772460ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Changes from version 0.10.4 to master +- Added SystemD example. See `examples/systemd/README.md`. - Added `--log.dir` option to configure a custom directory to which all log files will be written. - It is no longer allowed to use `log.file` as a passthrough option. - Added `--starter.host` option, to bind the HTTP server to a specific network interface instead of the default `0.0.0.0`. diff --git a/examples/systemd/README.md b/examples/systemd/README.md new file mode 100644 index 00000000..829f6ddc --- /dev/null +++ b/examples/systemd/README.md @@ -0,0 +1,27 @@ +# Run ArangoDB Starter with SystemD + +This example shows how you can run the ArangoDB starter in a systemd service. + +The example will run the starter as user `arangodb` in group `arangodb`. +It requires an environment variable file called `/etc/arangodb.env` +with the following variables. + +```text +STARTERENDPOINTS= +CLUSTERSECRET= +CLUSTERSECRETPATH= +``` + +To use this service, do the following on every machine on which the starter should run: + +- Create the `/etc/arangodb.env` environment file as specified above. +- Copy the `arangodb.service` file to `/etc/systemd/system/arangodb.service`. +- Trigger a systemd reload using `sudo systemctl daemon-reload`. +- Enable the service using `sudo systemctl enable arangodb.service`. +- Start the service using `sudo systemctl start arangodb.service`. + +Once started, you can view the logs of the starter using: + +```bash +sudo journalctl -flu arangodb.service +``` diff --git a/examples/systemd/arangodb.service b/examples/systemd/arangodb.service new file mode 100644 index 00000000..26f5365d --- /dev/null +++ b/examples/systemd/arangodb.service @@ -0,0 +1,23 @@ +[Unit] +Description=Run the ArangoDB Starter +After=network.target + +[Service] +Restart=on-failure +User=arangodb +Group=arangodb +EnvironmentFile=/etc/arangodb.env +Environment=DATADIR=/var/lib/arangodb/cluster +ExecStartPre=/usr/bin/sh -c "mkdir -p $(dirname $CLUSTERSECRETPATH)" +ExecStartPre=/usr/bin/sh -c "mkdir -p ${DATADIR}" +ExecStartPre=/usr/bin/sh -c "echo ${CLUSTERSECRET} > ${CLUSTERSECRETPATH}" +ExecStart=/usr/bin/arangodb \ + --starter.data-dir=${DATADIR} \ + --starter.join=${STARTERENDPOINTS} \ + --server.storage-engine=rocksdb \ + --auth.jwt-secret=${CLUSTERSECRETPATH} \ + --all.log.level=info --all.log.output=+ +TimeoutStopSec=60 + +[Install] +WantedBy=multi-user.target