nostr-rs-relay icon indicating copy to clipboard operation
nostr-rs-relay copied to clipboard

nostr-rs-relay daemon not listening on custom port

Open mdotgru opened this issue 1 year ago • 9 comments

I have built the latest version of the relay from source and am running it as a daemon. While the serviced log informs me that the relay is listening on port 7777:

nostr.service - nostr-rs relay server Loaded: loaded (/etc/systemd/system/nostr.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2023-05-18 07:53:27 UTC; 5s ago Main PID: 161785 (nostr-rs-relay) Tasks: 11 (limit: 4381) Memory: 10.6M CGroup: /system.slice/nostr.service └─161785 /opt/nostr-rs/nostr-rs-relay/target/release/nostr-rs-relay

May 18 07:53:27 systemd[1]: Starting nostr-rs relay server... May 18 07:53:27 systemd[1]: Started nostr-rs relay server. May 18 07:53:27 nostr-rs-relay[161785]: May 18 07:53:27.199 INFO nostr_rs_relay: Starting up from main May 18 07:53:27 nostr-rs-relay[161785]: May 18 07:53:27.203 INFO nostr_rs_relay::server: listening on: 127.0.0.1:7777 May 18 07:53:27 nostr-rs-relay[161785]: May 18 07:53:27.215 INFO nostr_rs_relay::repo::sqlite: Built a connection pool "writer" (min=0, max=2)

.... it isn't actually listening:

sudo netstat -ltnp | grep -w ':7777'

... returns nothing.

I have tried many other port combinations, with the same outcome.

Even tried the documented 8080, with no success: May 18 08:01:59 rockpi-4c systemd[1]: Starting nostr-rs relay server... May 18 08:01:59 rockpi-4c systemd[1]: Started nostr-rs relay server. May 18 08:01:59 rockpi-4c nostr-rs-relay[161919]: May 18 08:01:59.862 INFO nostr_rs_relay: Starting up from main May 18 08:01:59 rockpi-4c nostr-rs-relay[161919]: May 18 08:01:59.867 INFO nostr_rs_relay::server: listening on: 127.0.0.1:8080 May 18 08:01:59 rockpi-4c nostr-rs-relay[161919]: May 18 08:01:59.880 INFO nostr_rs_relay::repo::sqlite: Built a connection pool "writer" (min=0, max=2)

sudo netstat -ltnp | grep ':8080'

... empty return.

If I manually run it, I get this: RUST_LOG=warn,nostr_rs_relay=info ./target/release/nostr-rs-relay May 18 08:09:22.196 INFO nostr_rs_relay: Starting up from main May 18 08:09:22.200 INFO nostr_rs_relay::server: listening on: 0.0.0.0:8080 May 18 08:09:22.212 INFO nostr_rs_relay::repo::sqlite: Built a connection pool "writer" (min=0, max=2)

and the netstat -ltnp | grep ':8080' is still empty.

Help would be greatly appreciated. I have also tried to redo the build but my issue persists.

mdotgru avatar May 18 '23 08:05 mdotgru

What does netstat -ltnp | grep nostr return?

yuvadm avatar Jun 07 '23 11:06 yuvadm

Unfortunately nothing:

/home/m# netstat -ltnp | grep nostr /home/m#

mdotgru avatar Jun 13 '23 19:06 mdotgru

ps aux | grep nostr?

lsof -i | grep nostr?

yuvadm avatar Jun 13 '23 20:06 yuvadm

So, checking that the daemon is running:

/home/m# systemctl status nostr ● nostr.service - nostr-rs relay server Loaded: loaded (/etc/systemd/system/nostr.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2023-06-03 08:15:54 UTC; 1 weeks 3 days ago Main PID: 114730 (nostr-rs-relay) Tasks: 11 (limit: 4381) Memory: 8.6M CGroup: /system.slice/nostr.service └─114730 /opt/nostr-rs/nostr-rs-relay/target/release/nostr-rs-relay

Warning: journal has been rotated since unit was started, output may be incomplete.

Then:

/home/m# ps aux | grep nostr root 114730 0.0 0.2 751936 9804 ? Ssl Jun03 2:52 /opt/nostr-rs/nostr-rs-relay/target/release/nostr-rs-relay root 390527 0.0 0.0 7700 652 pts/0 S+ 21:08 0:00 grep --color=auto nostr

/home/m# lsof -i | grep nostr /home/m#

mdotgru avatar Jun 13 '23 21:06 mdotgru

Are you able to get the relay to listen on any port?

yuvadm avatar Jun 14 '23 08:06 yuvadm

No, not even with the standart setting. Recompiled nostr-rs-relay twice.

mdotgru avatar Jun 14 '23 19:06 mdotgru

Why would you think this is a bug and not a system issue?

yuvadm avatar Jun 14 '23 19:06 yuvadm

What system issue could it be? I am running successfully multiple servers on the same machine: nginx, gotosocial, navidrome and some others.

mdotgru avatar Jun 14 '23 20:06 mdotgru

Hi. I got a similar issue but noticed I've pointed a wrong config file.

It looks the main problem is related to the fact that nostr-rs-relay will happily start with defaults if it's unable to read the configuration file. This might cause confusion or other problems (port 8080 is kinda popular).

irusensei avatar Jul 23 '23 12:07 irusensei