Nostr is a new decentralized social network protocol. This guide is the easiest way to get started running your own Nostr Relay and participating in the network. From 0 to 100 in under 5 minutes.
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?
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?
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
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.
Websocket King says it couldn't connect to my relay, but I didn't get any error messages during setup that would indicate where I should look. How should I go about working backwards to figure out what I did wrong?
Edit: just realized that my terminal was hanging/stopped updating. The issue was actually that npm never finished building, and it's been well over two hours. I can't afford anything more than 0.5GB of RAM and 10GB of space on the VM I'm using. Does that mean I should just give up because I can't afford enough performance?
Set up a Nostr Relay server in under 5 minutes
minor typo:
sudo certbot —nginx -d subdomain.mydomain.com
should be:
sudo certbot --nginx subdomain.mydomain.com
what would you say is the safe amount to dedicate for storage?
what do you differently on the zbd relay that seems to be faring well with the spikes in volume?
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?
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?
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?
```
$ 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.
Is the graphic at the top of the article a network diagram of all the current relays? Thanks
would this work on a mac? not with the same cli commands ofcourse
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!
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.
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.
Do you know alternative without available static IP address? Something like no-ip.org that works for nostr...
This is cool - thanks, minor suggestions:
1) Need "sudo apt update" after doing "# Setup `apt` Docker repository"
2) Need to cp not mv here: "mv settings.sample.json ~/.nostr/settings.json" because on startup it will error if $PWD/settings.sample.json doesn't exist since it uses it for [defaults](https://github.com/Cameri/nostream/blob/c150cb2be5a03043d079e4eb31b6393f7971954f/src/utils/settings.ts#L43)
Websocket King says it couldn't connect to my relay, but I didn't get any error messages during setup that would indicate where I should look. How should I go about working backwards to figure out what I did wrong?
Edit: just realized that my terminal was hanging/stopped updating. The issue was actually that npm never finished building, and it's been well over two hours. I can't afford anything more than 0.5GB of RAM and 10GB of space on the VM I'm using. Does that mean I should just give up because I can't afford enough performance?
34130abfed524a5cd02e363a1240d382b91c9f8f5ceada8078b716743a1840bb