Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README request #389

Closed
Eternumkr opened this issue Sep 29, 2024 · 6 comments
Closed

README request #389

Eternumkr opened this issue Sep 29, 2024 · 6 comments

Comments

@Eternumkr
Copy link

Could you put a systemd service file example somewhere?

Thank you.

@CodyTseng
Copy link
Owner

I'm sorry. I don't use systemd to start services, and I'm not an expert in operations : (

@Eternumkr
Copy link
Author

hmm. Ok, if i figure it out ill post it here.

Thank you for being honest.

@CodyTseng
Copy link
Owner

Thank you so much!

@nikmit
Copy link
Contributor

nikmit commented Jan 4, 2025

Here's a systemd setup in case it's useful.

It is best practice to not run services as root where possible. If you want to ignore that, remove the User and Group lines from the service file. Otherwise, start with creating a locked down user to run the service as:

useradd --shell /bin/false nestjs
usermod -L nestjs
chown -R nestjs:nestjs /opt/nostr-relay-nestjs
chmod g+s /opt/nostr-relay-nestjs

The last two lines assume you cloned the project to /opt/nostr-relay-nestjs

Copy and paste the below to /etc/systemd/system/nostr-relay-nestjs.service

[Unit]
Description=Nostr Relay Nestjs Service
After=network.target

[Service]
User=nestjs
Group=nestjs
ExecStart=/usr/bin/npm run start
WorkingDirectory=/opt/nostr-relay-nestjs
Restart=always
MemoryLimit=2G

[Install]
WantedBy=multi-user.target

Run sudo systemctl daemon-reload
Start, stop or check status with systemctl start|stop|status nostr-relay-nestjs

So far working fine for me :)

@CodyTseng
Copy link
Owner

This looks good! Would you like to create a PR for this?

@CodyTseng
Copy link
Owner

#451

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants