GithubHelp home page GithubHelp logo

Comments (5)

hoytech avatar hoytech commented on July 20, 2024 2

As I said in another comment, I want to build a strfry router that would let you do this with a single plugin. I don't have a timeframe for this, but maybe I can get a basic solution to this problem as a start.

from strfry.

hoytech avatar hoytech commented on July 20, 2024 2

I have pushed a commit that implements strfry router, and this will be in the next release. Docs are here: https://github.com/hoytech/strfry/blob/master/docs/router.md

I kind of think of this like "nginx for nostr". It lets you manage many up/down/both streams to remote relays using a single process and config file, and you can edit that config file without interrupting existing streams (mostly).

You can also use nostr filters and/or plugins to filter the traffic in both up and down directions, independently.

from strfry.

IngwiePhoenix avatar IngwiePhoenix commented on July 20, 2024

Just a thought: Templated SystemD units?

# [email protected]
[Unit]
Description=strfry relay: %i

[Service]
ExecStart=/usr/local/bin/strfry stream wss://%i --dir both

[Install]
WantedBy=multi-user.target

Should allow to systemctl start [email protected], as %s is...

the string between the first "@" character and the type suffix. Empty for non-instantiated units.

via: https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Specifiers

This could possibly be extended to depend on a root-service for the actual relay.

Thoughts?

from strfry.

IngwiePhoenix avatar IngwiePhoenix commented on July 20, 2024

I adapted the Headscale SystemD unit, so this could be a root unit.

[Unit]
After=syslog.target
After=network.target
Description=strfry (Nostr Relay)

[Service]
Type=simple
User=strfry
Group=strfry
ExecStart=/usr/local/bin/strfry relay
Restart=always
RestartSec=5

#If needed, this can be used to pass environment vars.
#Could be useful for passing data and other storage dirs?
#Environment="key=value"

WorkingDirectory=/var/lib/strfry
ReadWritePaths=/var/lib/strfry

AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_CHOWN
CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_CHOWN
LockPersonality=true
NoNewPrivileges=true
PrivateDevices=true
PrivateMounts=true
PrivateTmp=true
ProcSubset=pid
ProtectClock=true
ProtectControlGroups=true
ProtectHome=true
ProtectHome=yes
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectProc=invisible
ProtectSystem=strict
RemoveIPC=true
RestrictAddressFamilies=AF_INET AF_INET6
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
SystemCallArchitectures=native
SystemCallFilter=@chown
SystemCallFilter=@system-service
SystemCallFilter=~@privileged
UMask=0077

[Install]
WantedBy=multi-user.target

This can be adapted to be a template, as described before, just with an added Requires=strfry.service in the [Service] section (as explained here).

Hope this helps :)

from strfry.

Giszmo avatar Giszmo commented on July 20, 2024

@IngwiePhoenix thanks for your effort. It certainly helps to learn about using SystemD but I think it doesn't address well the "many relays" part.

from strfry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.