diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 29e0799a0..254312b4b 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -300,39 +300,4 @@ amongst other things. ### Set up Systemd Services _(polylith)_ -In order to run the whole polylith deployment daemonized with Systemd -the following script can set them up for you **(root-privileges required)**: -```bash -# ./install-polylith-systemd-units.sh -``` - - -Example: - -```bash -# ./install-polylith-systemd-units.sh -u dendrite -d /home/dendrite/server/ all -``` -* user: dendrite -* path: /home/dendrite/server/ -* selection: all - -How to start a specific service (e.g clientapi): -```bash -# systemctl start dendrite@clientapi -``` - -...or all services using a wildcard: -```bash -# systemctl start dendrite@* -``` - -Monitor with journalctl: - -```bash -# journalctl -fu dendrite@clientapi -``` -or - -```bash -# journalctl -fu dendrite@* -``` +Go to [SYSTEMD.md](docs/systemd/SYSTEMD.md) for instructions on how to set up dendrite as a daemonized service. diff --git a/docs/systemd/SYSTEMD.md b/docs/systemd/SYSTEMD.md new file mode 100644 index 000000000..25643e3f6 --- /dev/null +++ b/docs/systemd/SYSTEMD.md @@ -0,0 +1,52 @@ +## Systemd setup and usage + +#### Manual install +* Edit `docs/systemd/*.service` and copy the file to `/etc/systemd/system/` +* Reload systemd: `systemctl daemon-reload` + +_Monolith:_ +* Enable the service with: `systemctl enable monolith-example.service` +* Start the service: `systemctl start monolith-example.service` + +_Polylith:_ +* Enable the services with: `systemctl enable polylith-example@.service` (repeat for each server) +* Start the services: `systemctl start polylith-example@*.service` + +___ +#### Scripted install (Polylith) +In order to run the whole polylith deployment daemonized with Systemd +the following script can set them up for you **(root-privileges required)**: +```bash +# ./install-polylith-systemd-units.sh +``` + + +Example: + +```bash +# ./install-polylith-systemd-units.sh -u dendrite -d /home/dendrite/server/ all +``` +* user: dendrite +* path: /opt/dendrite/ +* selection: all + +How to start a specific service (e.g clientapi): +```bash +# systemctl start dendrite@clientapi +``` + +...or all services using a wildcard: +```bash +# systemctl start dendrite@* +``` + +Monitor with journalctl: + +```bash +# journalctl -fu dendrite@clientapi +``` +or + +```bash +# journalctl -fu dendrite@* +``` \ No newline at end of file diff --git a/docs/systemd/polylith-example@.service b/docs/systemd/polylith-example@.service new file mode 100644 index 000000000..f5f8fe064 --- /dev/null +++ b/docs/systemd/polylith-example@.service @@ -0,0 +1,14 @@ +[Unit] + Description= Dendrite Polylith Multi - %I + PartOf=polyDendrite.service + After=network.target + + [Service] + User=dendrite + WorkingDirectory=/opt/dendrite + Type=forking + ExecStart=/opt/dendrite/bin/dendrite-polylith-multi --config=dendrite.yaml %i + Restart=on-failure + + [Install] + WantedBy=multi-user.target \ No newline at end of file diff --git a/install-polylith-systemd-units.sh b/install-polylith-systemd-units.sh index 35431b717..92bc78622 100644 --- a/install-polylith-systemd-units.sh +++ b/install-polylith-systemd-units.sh @@ -60,7 +60,7 @@ function generateServiceUnit() User=$USER WorkingDirectory=$DENDRITEDIR Type=forking - ExecStart=/home/dendrite/server/bin/dendrite-polylith-multi --config=dendrite.yaml %i + ExecStart=$DENDRITEDIR/bin/dendrite-polylith-multi --config=dendrite.yaml %i Restart=on-failure [Install]