Debian instructions only. Ubuntu should be similar. Suppose that the user on the server is barkyq
.
-
Install
postgresql
bysudo apt install postgresql
. -
Run the following commands to give your user administrative rights, and create a database.
sudo -u postgres createuser --pwprompt barkyq sudo -u postgres createdb -O barkyq nostrdb
Suppose the password you set is
super_secret_password
. -
Check if
postgresql
is listening at127.0.0.1:5432
by runningsudo netstat -tlpn
(install withapt install net-tools
)
-
Download a recent version of
go
from https://go.dev/dl/. Follow the installation instructions. -
Clone this repository.
-
Build the
gnost-relay
executable by runninggo build .
in the directory you cloned the repository to. -
Edit the
config.json
file. You need to changerelay_url
field if you want NIP-42 to work. You can also change thenip11_info_document
field if you like. -
Run the executable.
DATABASE_URL=postgres://barkyq:super_secret_password@localhost:5432/nostrdb ./gnost-relay
The above command starts a relay listening at
localhost:8080
and sets theDATABASE_URL
environment variable for the execution of the program.
-
Install
nginx
andcertbot
sudo apt install nginx python3-certbot-nginx
-
Download a SSL certificate (assuming you own
foo.bar
)sudo certbot --nginx certonly -d relay.foo.bar
-
Copy the nginx configuration from
nginx.txt
to/etc/nginx/sites-available/relay.foo.bar
and then make a symlink to this file in/etc/sites-enabled/
by running:cd /etc/nginx/sites-enabled/ sudo ln -s ../sites-available/relay.foo.bar .
-
Restart
nginx
by runningsudo nginx -s reload
-
If all went well, you should be able to connect to your relay at
wss://relay.foo.bar