From 06c86160f51ef03b420a18873838397c45dffe83 Mon Sep 17 00:00:00 2001 From: J the Code Monkey Date: Wed, 30 Oct 2024 20:43:11 -0400 Subject: [PATCH] chore: update nostr-rs-relay db location and address setting --- pkg/relays/nostr_rs_relay/constants.go | 3 ++- pkg/relays/nostr_rs_relay/nginx_http.go | 2 +- pkg/relays/nostr_rs_relay/nginx_https.go | 2 +- pkg/relays/nostr_rs_relay/service.go | 4 +--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/relays/nostr_rs_relay/constants.go b/pkg/relays/nostr_rs_relay/constants.go index e41374c..be9435c 100644 --- a/pkg/relays/nostr_rs_relay/constants.go +++ b/pkg/relays/nostr_rs_relay/constants.go @@ -22,7 +22,8 @@ Type=simple User=nostr Group=nostr WorkingDirectory=/home/nostr -ExecStart={{.BinaryFilePath}} +Environment=RUST_LOG=info,nostr_rs_relay=info +ExecStart={{.BinaryFilePath}} --config /etc/nostr-rs-relay/config.toml --db /var/lib/nostr-rs-relay/db Restart=on-failure [Install] diff --git a/pkg/relays/nostr_rs_relay/nginx_http.go b/pkg/relays/nostr_rs_relay/nginx_http.go index f863d5a..9c18538 100644 --- a/pkg/relays/nostr_rs_relay/nginx_http.go +++ b/pkg/relays/nostr_rs_relay/nginx_http.go @@ -23,7 +23,7 @@ func ConfigureNginxHttp(domainName string) { } upstream nostr_rs_relay_websocket { - server 127.0.0.1:8080; + server 0.0.0.0:8080; } server { diff --git a/pkg/relays/nostr_rs_relay/nginx_https.go b/pkg/relays/nostr_rs_relay/nginx_https.go index ce9cc30..8402064 100644 --- a/pkg/relays/nostr_rs_relay/nginx_https.go +++ b/pkg/relays/nostr_rs_relay/nginx_https.go @@ -20,7 +20,7 @@ func ConfigureNginxHttps(domainName string) { } upstream nostr_rs_relay_websocket { - server 127.0.0.1:8080; + server 0.0.0.0:8080; } server { diff --git a/pkg/relays/nostr_rs_relay/service.go b/pkg/relays/nostr_rs_relay/service.go index 74a85dd..a9a8b3f 100644 --- a/pkg/relays/nostr_rs_relay/service.go +++ b/pkg/relays/nostr_rs_relay/service.go @@ -17,6 +17,7 @@ func SetupRelayService(domain, pubKey, relayContact string, httpsEnabled bool) { // Ensure the data directory exists and set ownership spinner.UpdateText("Creating data directory...") directories.CreateDirectory(DataDirPath, 0755) + directories.CreateDirectory(fmt.Sprintf("%s/db", DataDirPath), 0755) // Use chown command to set ownership of the data directory to the nostr user directories.SetOwnerAndGroup(relays.User, relays.User, DataDirPath) @@ -46,9 +47,6 @@ func SetupRelayService(domain, pubKey, relayContact string, httpsEnabled bool) { // Construct the sed command to change the data directory files.InPlaceEdit(fmt.Sprintf(`s|#data_directory = ".*"|data_directory = "%s"|`, DataDirPath), TmpConfigFilePath) - // Construct the sed command to change the address - files.InPlaceEdit(fmt.Sprintf(`s|address = ".*"|address = "127.0.0.1"|`), TmpConfigFilePath) - // Construct the sed command to change the remote ip header files.InPlaceEdit(fmt.Sprintf(`s|#remote_ip_header = "x-forwarded-for"|remote_ip_header = "x-forwarded-for"|`), TmpConfigFilePath)