Build
We're now going to discuss how to build nostr-rs-relay.
Dependencies
It's recommended to install the following packages before building the binary:
Git
We also need to install Git to be able to clone the nostr-rs-relay repository:
Rust
Lastly, we need to install Rust and Cargo to build the binary:
After running the above command, you'll be asked if you want to proceed with the standard installation or if you want to customize the installation. We're going to use the standard installation, so when prompted just press enter.
To configure your current shell after installing Rust, you need to source the corresponding env
file under $HOME/.cargo
.
This can be accomplished for sh
, bash
, zsh
, ash
, dash
, and pdksh
using:
To check Rust is installed and in your path:
To check cargo is installed and in your path:
Clone the Repository
Before cloning the nostr-rs-relay repository, we're going to first create the following directories in the $HOME
directory:
We can now navigate to the relays
directory:
We're now ready to clone the nostr-rs-relay repository:
After cloning the repository, navigate to the nostr-rs-relay
directory:
You can use the repository to update the nostr-rs-relay, so we're going to keep the repository on the relay.
Build nostr-rs-relay
We're now ready to build a release version of nostr-rs-relay:
The compilation could take a while depending on your server's specs, so be patient while the binary is being built.
When the compilation is finished the binary will be located in the target/release
directory.
To navigate to that directory run the following:
You can list out the contents of that directory to see the binary:
You should see the binary file which should be named nostr-rs-relay
.
Check Version
Here's how to check which version of nostr-rs-relay you've installed:
At the time of writing, the latest version of nostr-rs-relay is 0.9.0
which is what the rest of the guide is currently based on.
Run Binary
You can now run the binary with logging enabled:
The nostr-rs-relay should now be listening on 0.0.0.0:8080
.
To stop the relay press Ctrl+C
.