[bug] OpenBSD RC script does not work #864

Closed
opened 2024-12-29 19:43:01 +00:00 by eviloatmeal · 3 comments

Your setup

From source

Extra details

OpenBSD

Version

v3.12.1

PostgreSQL version

16.4

What were you trying to do?

Attempting to run Akkoma as a service (daemon) on OpenBSD using the provided RC script.

What did you expect to happen?

Anything.

What actually happened?

Nothing (the script does not work).

But I have this patch which represents the changes we made to the script to get it working on our OpenBSD:

diff --git a/installation/openbsd/rc.d/akkomad b/etc/rc.d/akkomad
index 68be46c9a..56e939e91 100755
--- a/installation/openbsd/rc.d/akkomad
+++ b/etc/rc.d/akkomad
@@ -11,11 +11,13 @@
 #
 
 daemon="/usr/local/bin/elixir"
-daemon_flags="--detached -S /usr/local/bin/mix phx.server"
+daemon_flags="-S /usr/local/bin/mix phx.server"
 daemon_user="_akkoma"
 
 . /etc/rc.d/rc.subr
 
+rc_bg="YES"
 rc_reload=NO
 pexp="phx.server"
 
@@ -24,7 +26,7 @@ rc_check() {
 }
 
 rc_start() {
-	${rcexec} "cd akkoma; ${daemon} ${daemon_flags}"
+	rc_exec "${daemon} ${daemon_flags}"
 }
 
 rc_stop() {
  1. Elixir does not seem to have the flag --detached, so we simply removed it.
  2. Instead of what --detached would supposedly do, we add the rc_bg key and set its value to YES.
  3. Fixed the rc_exec line.

I didn't want to make a whole fork or whatever to submit this as a pull request, but if I should then let me know.

Logs

No response

Severity

I cannot use it as easily as I'd like

Have you searched for this issue?

  • I have double-checked and have not found this issue mentioned anywhere.
### Your setup From source ### Extra details OpenBSD ### Version v3.12.1 ### PostgreSQL version 16.4 ### What were you trying to do? Attempting to run Akkoma as a service (daemon) on OpenBSD using the provided RC script. ### What did you expect to happen? Anything. ### What actually happened? Nothing (the script does not work). But I have this patch which represents the changes we made to the script to get it working on our OpenBSD: ``` diff --git a/installation/openbsd/rc.d/akkomad b/etc/rc.d/akkomad index 68be46c9a..56e939e91 100755 --- a/installation/openbsd/rc.d/akkomad +++ b/etc/rc.d/akkomad @@ -11,11 +11,13 @@ # daemon="/usr/local/bin/elixir" -daemon_flags="--detached -S /usr/local/bin/mix phx.server" +daemon_flags="-S /usr/local/bin/mix phx.server" daemon_user="_akkoma" . /etc/rc.d/rc.subr +rc_bg="YES" rc_reload=NO pexp="phx.server" @@ -24,7 +26,7 @@ rc_check() { } rc_start() { - ${rcexec} "cd akkoma; ${daemon} ${daemon_flags}" + rc_exec "${daemon} ${daemon_flags}" } rc_stop() { ``` 1. Elixir does not seem to have the flag `--detached`, so we simply removed it. 2. Instead of what `--detached` would supposedly do, we add the `rc_bg` key and set its value to `YES`. 3. Fixed the `rc_exec` line. I didn't want to make a whole fork or whatever to submit this as a pull request, but if I should then let me know. ### Logs _No response_ ### Severity I cannot use it as easily as I'd like ### Have you searched for this issue? - [x] I have double-checked and have not found this issue mentioned anywhere.
eviloatmeal added the
bug
label 2024-12-29 19:43:01 +00:00
Member

Yeah, --detached was removed in elixir 1.9.

To be frank, nobody looked at the OpenBSD instrcutions and files since they were added. Good to hear they are still at least mostly working and thanks for taking a look and fixing it. Were there any issues in the install instructions besides the rc file?

Regarding the change, the cd was also removed, but mix must run in the akkoma source directory. How is or can this be achieved now? I can't test it but suppose it’s good otherwise, thx!

I cannot say what FloatingGhost prefers, but if you end up changing more than just a few lines in the rc file down the line, I suspect a proper PR will be better.

Yeah, `--detached` was removed in elixir 1.9. To be frank, nobody looked at the OpenBSD instrcutions and files since they were added. Good to hear they are still at least _mostly_ working and thanks for taking a look and fixing it. Were there any issues in the install instructions besides the rc file? Regarding the change, the `cd` was also removed, but `mix` must run in the akkoma source directory. How is or can this be achieved now? I can't test it but suppose it’s good otherwise, thx! I cannot say what FloatingGhost prefers, but if you end up changing more than just a few lines in the rc file down the line, I suspect a proper PR will be better.
Author

I'll be honest, I'm not sure we looked at the install instructions.

We have always configured our systems so that the Akkoma source directory and the akkoma user's home directory are one and the same. I'm not sure if you have a particular reason for why they should not be the same, or if it just ends up being /home/_akkoma/akkoma/ by coincidence because of the way the docs specify to clone the repository.

I believe the most idiomatic way to do it would be to add:

daemon_execdir="/home/_akkoma/akkoma" directly below the daemon_user line.

That will match where the source ends up when you follow the install instructions for OpenBSD.

I'll be honest, I'm not sure we looked at the install instructions. We have always configured our systems so that the Akkoma source directory and the akkoma user's home directory are one and the same. I'm not sure if you have a particular reason for why they should not be the same, or if it just ends up being `/home/_akkoma/akkoma/` by coincidence because of the way the docs specify to clone the repository. I believe the most idiomatic way to do it would be to add: `daemon_execdir="/home/_akkoma/akkoma"` directly below the `daemon_user` line. That will match where the source ends up when you follow the install instructions for OpenBSD.
Member

Yeah, current install instructions clone into an akkoma folder inside the home dir.
User home directories typically end up containing a bunch of files like .bashrc, .bash_history (or the equivalent for $SHELL), .profile, and more config files for e.g. editors. If the git repo of the backend source is the home directory, they’ll show up as "untracked" files and may by accident be removed via a git clean, so a subdirectory is safer as a general recommendation. It also allows e.g. moving uploads and static dir out of the repository easily (just using a different subdir in $HOME)

The daemon_execdir option seems perfect, thank you!

Yeah, current install instructions clone into an `akkoma` folder inside the home dir. User home directories typically end up containing a bunch of files like `.bashrc`, `.bash_history` *(or the equivalent for `$SHELL`)*, `.profile`, and more config files for e.g. editors. If the git repo of the backend source is the home directory, they’ll show up as "untracked" files and may by accident be removed via a `git clean`, so a subdirectory is safer as a general recommendation. It also allows e.g. moving uploads and static dir out of the repository easily (just using a different subdir in `$HOME`) The `daemon_execdir` option seems perfect, thank you!
Oneric referenced this issue from a commit 2025-01-03 20:21:16 +00:00
Oneric referenced this issue from a commit 2025-01-03 20:22:47 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: AkkomaGang/akkoma#864
No description provided.