Skip to content

Adds systemd guide to run a bun application as a daemon#6451

Merged
colinhacks merged 7 commits intooven-sh:mainfrom
RaresAil:ecosystem-systemctl-guide
Oct 13, 2023
Merged

Adds systemd guide to run a bun application as a daemon#6451
colinhacks merged 7 commits intooven-sh:mainfrom
RaresAil:ecosystem-systemctl-guide

Conversation

@RaresAil
Copy link
Copy Markdown

What does this PR do?

Adds a guide for using systemd to run a bun application as a daemon

  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)

@zjhendryx
Copy link
Copy Markdown

@RaresAil One quick change I would suggest is, you have "User=root" in your systemd file, when going by your guide you likely want that to be the value of YOUR_USER, as it doesn't need to run as root. So it's best to avoid a possible security situation, especially since you have both bun and the application installed in /home/YOUR_USER following your guide.

@RaresAil
Copy link
Copy Markdown
Author

You are right, I will modify that, in copy pasted from my current case because i run the app as root cause i was lazy to give permission to my user to can run the app on port 443 😂

@RaresAil
Copy link
Copy Markdown
Author

@zjhendryx i added that and explain how to allow the non-root user to use the privileged ports

@colinhacks
Copy link
Copy Markdown
Contributor

Made some fairly heavy edits. I don't think there's much value in re-iterating systemd documentation here—better to provide a minimal guide that is easy to modify and follow.

Comment thread docs/guides/ecosystem/systemd.md Outdated
@RaresAil RaresAil force-pushed the ecosystem-systemctl-guide branch from 26a206a to 73a4f21 Compare October 13, 2023 07:05
@RaresAil RaresAil force-pushed the ecosystem-systemctl-guide branch from 73a4f21 to a627076 Compare October 13, 2023 18:04
@colinhacks colinhacks merged commit 0794767 into oven-sh:main Oct 13, 2023
@colinhacks
Copy link
Copy Markdown
Contributor

Thanks @RaresAil, this was excellent!

@RaresAil RaresAil deleted the ecosystem-systemctl-guide branch October 14, 2023 07:03
@karimfromjordan
Copy link
Copy Markdown

@RaresAil One quick change I would suggest is, you have "User=root" in your systemd file, when going by your guide you likely want that to be the value of YOUR_USER, as it doesn't need to run as root. So it's best to avoid a possible security situation, especially since you have both bun and the application installed in /home/YOUR_USER following your guide.

Small suggestions, DynamicUser=yes would be even better. systemd will then dynamically allocate a user for you and also enable PrivateTemp, ProtectHome and ProtectSystem automatically.

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

Successfully merging this pull request may close these issues.

4 participants