feat: add instructions on how to run nostr-ts-relay as a system service

Based on the gist published at https://www.swissrouting.com/nostr.html#installing-as-a-service
This commit is contained in:
Swiss Routing 2022-12-23 22:12:00 +00:00 committed by Ricardo Arturo Cabral Mejía
parent b99a2a243f
commit 28117aee5b

View File

@ -106,6 +106,48 @@ Print the Tor hostname:
./scripts/print_tor_hostname
```
### Running as a Service
By default this server will run continuously until you stop it with Ctrl+C or until the system restarts.
You can [install as a systemd service](https://www.swissrouting.com/nostr.html#installing-as-a-service) if you want the server to run again automatically whenever the system is restarted. For example:
```
$ nano /etc/systemd/system/nostr-ts-relay.service
# Note: replace "User=..." with your username, and
# "/home/nostr/nostr-ts-relay" with the directory where you cloned the repo.
[Unit]
Description=Nostr TS Relay
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=5
User=nostr
WorkingDirectory=/home/nostr/nostr-ts-relay
ExecStart=/home/nostr/nostr-ts-relay/scripts/start
ExecStop=/home/nostr/nostr-ts-relay/scripts/stop
[Install]
WantedBy=multi-user.target
```
And then:
```
systemctl enable nostr-ts-relay
systemctl start nostr-ts-relay
```
The logs can be viewed with:
```
journalctl -u nostr-ts-relay
```
## Quick Start (Standalone)