From c65c64275e6dc1757cb8c3ff8d436014fba9c713 Mon Sep 17 00:00:00 2001 From: 0xtr Date: Sun, 16 Apr 2023 15:18:37 +0200 Subject: [PATCH 1/2] docs: add systemd service file and guide --- contrib/nostr-rs-relay.service | 12 +++++++++ docs/run-as-linux-system-process.md | 39 +++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 contrib/nostr-rs-relay.service create mode 100644 docs/run-as-linux-system-process.md diff --git a/contrib/nostr-rs-relay.service b/contrib/nostr-rs-relay.service new file mode 100644 index 0000000..4c74242 --- /dev/null +++ b/contrib/nostr-rs-relay.service @@ -0,0 +1,12 @@ +[Unit] +Description=nostr-rs-relay +[Service] +User=REPLACE_WITH_YOUR_USERNAME +WorkingDirectory=/usr/bin/ +Environment=RUST_LOG=warn,nostr_rs_relay=info +ExecStart=nostr-rs-relay --config /etc/nostr-rs-relay/config.toml +TimeoutStopSec=10 +Restart=on-failure +RestartSec=5 +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/docs/run-as-linux-system-process.md b/docs/run-as-linux-system-process.md new file mode 100644 index 0000000..a5d0bbd --- /dev/null +++ b/docs/run-as-linux-system-process.md @@ -0,0 +1,39 @@ +# Run as a linux system process + +Docker makes it easy to spin up and down environments but it's also possible to run `nostr-rs-relay` as a systemd linux process. +This guide assumes you're on a Linux machine and that Rust is already installed. + +## Instructions + +### Build nostr-rs-relay from source +Start by building the application from source. Here is how to do that: +1. `git clone https://github.com/scsibug/nostr-rs-relay.git` +2. `cd nostr-rs-relay` +3. `cargo build --release` + +### Place the files where they belong +We want to palce the nostr-rs-relay binary and the config.toml file where they belong. While still in the root level of the nostr-rs-relay folder you cloned in last step, run the following commands: +1. `sudo cp target/release/nostr-rs-relay /usr/local/bin/` +2. `sudo mkdir /etc/nostr-rs-relay` +2. `sudo cp config.toml /etc/nostr-rs-relay` + +### Create the Systemd service file +We need to create a new Systemd service file. These files are placed in the `/etc/systemd/system/` folder where you will find many other services running. + +1. `sudo vim /etc/systemd/system/nostr-rs-relay.service` +2. Paste in the contents of [this service file](../contrib/nostr-rs-relay.service). Remember to replace the `User` value with your own username. +3. Save the file and exit your text editor + + +### Run the service +To get the service running, we need to reload the systemd daemon and enable the service. + +1. `sudo systemctl daemon-reload` +2. `sudo systemctl start nostr-rs-relay.service` +3. `sudo systemctl status nostr-rs-relay.service` + + +### Tips + +#### Logs +The application will write logs to the journal. To read it, execute `sudo journalctl -f -u nostr-rs-relay` \ No newline at end of file From ba0b50bc9c7aef177d23ba38d3a371cce0e5f11b Mon Sep 17 00:00:00 2001 From: Greg Heartsfield Date: Sat, 22 Apr 2023 13:47:08 -0500 Subject: [PATCH 2/2] build: bump version to 0.8.9 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5ffd022..9533514 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1652,7 +1652,7 @@ dependencies = [ [[package]] name = "nostr-rs-relay" -version = "0.8.8" +version = "0.8.9" dependencies = [ "anyhow", "async-std", diff --git a/Cargo.toml b/Cargo.toml index f9b9b11..b04ef07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nostr-rs-relay" -version = "0.8.8" +version = "0.8.9" edition = "2021" authors = ["Greg Heartsfield "] description = "A relay implementation for the Nostr protocol"