32 Comments
User's avatar
Lightning Network+'s avatar

minor typo:

sudo certbot —nginx -d subdomain.mydomain.com

should be:

sudo certbot --nginx subdomain.mydomain.com

Expand full comment
Plainview's avatar

Neither of these worked for me, I get "unrecognised arguments: subdomain.domain.com"

Expand full comment
André Neves's avatar

You need to pass the `-d` for `domain`. The issue was on copy-pasting from my CLI it combined two dashes into a single longer dash.

sudo certbot --nginx -d subdomain.mydomain.com

That's the correct one. It's been fixed in the post as well.

Expand full comment
Yaël Ossowski's avatar

what would you say is the safe amount to dedicate for storage?

Expand full comment
André Neves's avatar

Currently it's sub 1GB in data storage. I'd say anything in the 50GB will allow your relay to grow quite a bit before you need to worry? Not sure. New territory to be honest.

Expand full comment
bajjer's avatar

what do you differently on the zbd relay that seems to be faring well with the spikes in volume?

Expand full comment
André Neves's avatar

Likely just bigger specs? Not sure

Expand full comment
0xTexasHedge's avatar

Great guide, thank you very much! I made it to the last step, but keep getting this error when I run npm run docker:compose:start

failed to solve: executor failed running [/bin/sh -c npm run build]: exit code: 2

Anyone else run into that issue?

Expand full comment
Isabeau Vidal's avatar

Could you elaborate a bit on *why* one might want to run their own relay? Does it offer certain advantages (e.g. security,…)? Or does it simply help the network scale?

Expand full comment
Nick Junes's avatar

Is there a way to modify this to save the posgres data on a different volume?

Expand full comment
Nick Junes's avatar

I tried to change the lines in the dockercompose file to

volumes:

- altmount/.nostr/data:/var/lib/postgresql/data

- altmount/.nostr/db-logs:/var/log/postgresql

- altmount/postgresql.conf:/postgresql.conf

Now I just keep getting

nostream-db | 2025-02-13 19:11:50.359 GMT [1] LOG: input in flex scanner failed at file "/postgresql.conf" line 1

nostream-db | 2025-02-13 19:11:50.359 GMT [1] FATAL: configuration file "/postgresql.conf" contains errors

Expand full comment
Nick Junes's avatar

Well I fixed the missing conf file message by just switching it back to PWD but now I get

nostream-migrate | no pg_hba.conf entry for host "10.10.10.4", user "nostr_ts_relay", database "nostr_ts_relay", no encryption

nostream-migrate | error: no pg_hba.conf entry for host "10.10.10.4", user "nostr_ts_relay", database "nostr_ts_relay", no encry

I hope I'm not forced to use the boot drive. It's only 10 GB and my mounted drive is 100GB

Expand full comment
Silke's avatar

Why didn't you mention an AAA record? Is IPv6 not supported?

Expand full comment
mr.green's avatar

Hi, its necessary a fix IP to run the node?

i am trying from my localhost server, with a dinamic IP.

Expand full comment
martin-tct's avatar

When I upload a file (jpeg/mp4) to my nostream relay, the file itself gets uploaded to a linode server somewhere. How do I have my file uploaded to my machine instead?

Expand full comment
chovy's avatar

```

$ npm run docker:compose:start

> nostream@1.25.2 docker:compose:start

> ./scripts/start

Creating folder /home/ubuntu/www/break-19.com/relay.break-19.com/scripts/../.nostr

Copying /home/ubuntu/www/break-19.com/relay.break-19.com/scripts/../resources/default-settings.yaml to /home/ubuntu/www/break-19.com/relay.break-19.com/scripts/../.

nostr/settings.yaml

unknown shorthand flag: 'f' in -f

See 'docker --help'.

Usage: docker [OPTIONS] COMMAND

```

your instructions is broked.

Expand full comment
mimzerella's avatar

Is the graphic at the top of the article a network diagram of all the current relays? Thanks

Expand full comment
bozinovic's avatar

would this work on a mac? not with the same cli commands ofcourse

Expand full comment
Pothead History's avatar

So if I copy pasta that code you posted into a container on my VM it would work? Sorry if its a dumb question No code dude here trying to learn!

Expand full comment
Werninjo's avatar

When I start the relay with "npm run docker:compose:start" I got following error message:

npm ERR! code ENOENT

npm ERR! syscall open

npm ERR! path /home/testuser/package.json

npm ERR! errno -2

npm ERR! enoent ENOENT: no such file or directory, open '/home/testuser/package.json'

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent

Just wondering why the error points to the package file in user home folder and not to the nostream folder.

############################################

When I start the relay in folder nostream I got following error message:

> nostream@1.19.0 docker:compose:start

> ./scripts/start

permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json?all=1&filters=%7B%22label%22%3A%7B%22com.docker.compose.project%3Dnostream%22%3Atrue%7D%7D": dial unix /var/run/docker.sock: connect: permission denied

##################################################

..and with sudo "npm...:

> nostream@1.19.0 docker:compose:start

> ./scripts/start

WARNING: Error loading config file: /root/.docker/config.json: open /root/.docker/config.json: permission denied

unknown shorthand flag: 'f' in -f

Any idea? Thx.

Expand full comment
Dread's avatar

getting the exact same error.

Expand full comment
Dread's avatar

figured it out, just needed to add user to docker group

`sudo usermod -aG docker ${USER}`

Expand full comment
CJ Terry's avatar

This worked for me.. THANK YOU.

Expand full comment
SovereignHominin's avatar

This newer version of the guide fixed it for me: https://andreneves.xyz/p/how-to-setup-a-paid-nostr-relay?utm_source=substack&utm_campaign=post_embed&utm_medium=web

Just ran it minus the payments stuff.

Expand full comment
SovereignHominin's avatar

That didn't seem to work in my case. Even when I switch users away from root with 'su', after I run docker-compose:start I get:

npm ERR! code ENOENT

npm ERR! syscall open

npm ERR! path /root/package.json

npm ERR! errno -2

npm ERR! enoent ENOENT: no such file or directory, open '/root/package.json'

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent

npm ERR! A complete log of this run can be found in:

npm ERR! /root/.npm/_logs/2023-02-22T23_24_17_093Z-debug-0.log

Expand full comment
Werninjo's avatar

dito, but now I get a PostgreSQL error:

FATAL: could not map anonymous shared memory: Cannot allocate memory

nostream-db | 2023-02-03 00:04:10.019 UTC [1] HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 4438917120 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections

Looks like my VM doesn´t meet the required system requirements. But I can´t find any minimum requirements for a nostr relay.

Expand full comment
Hamish MacEwan's avatar

Not sure where to look for a more comprehensive log (the fragment below is copied from the screen ) for container db nor how to address the issue.

```

db | 2023-01-14 07:58:01.548 UTC [1] FATAL: could not map anonymous shared memory: Cannot allocate memory

db | 2023-01-14 07:58:01.548 UTC [1] HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 4438917120 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.

db | 2023-01-14 07:58:01.549 UTC [1] LOG: database system is shut down

db exited with code 1

container for service "db" is unhealthy

```

ChatGPT has made some sensible suggestions but being a naïf at Docker, I don't think I'll take the risk without guidance, any gratefully received. Oh, except, get a bigger boat.

PS. ChatGPT was wrong about the triple back tick giving monospace format, but I left the intention in place.

Expand full comment
Pablo's avatar

Do you know alternative without available static IP address? Something like no-ip.org that works for nostr...

Expand full comment