OpenRC service guide #639
Replies: 3 comments
-
|
Mine looks more bare-bones than yours but you might consider using |
Beta Was this translation helpful? Give feedback.
-
|
Hey @Serrindipity and @dominicdoty! Thank you for starting this conversation. If you feel like writing a document for setting up OpenRC, please don't hesitate to do so. We welcome and appreciate all sorts of contributions 🙂 |
Beta Was this translation helpful? Give feedback.
-
|
I can contribute my openrc initd to the discussion, a year later. I spend a lot of time looking at other init and the documentation and hack this together. #!/sbin/openrc-run
: ${pidfile:="/run/supervise-$RC_SVCNAME.pid"}
: ${wait:=200} # milliseconds
command="/usr/bin/soft"
command_args="serve"
command_user="soft-serve"
command_group="soft-serve"
command_background=true
name="Soft-Serve"
description="A tasty, self-hostable Git server for the command line."
# Set a server name
: ${server_name:="Soft Serve"}
export SOFT_SERVE_NAME=$server_name
depend() {
want net
}
start_pre() {
# Data location
: ${data_location:="/var/local/lib/soft-serve"}
export SOFT_SERVE_DATA_PATH=$data_location
checkpath --directory -m 0755 -o $command_user:$command_group "$data_location"
# Environment variables checks
if [ "$git_listen_addr" ]; then
export SOFT_SERVE_GIT_LISTEN_ADDR=$git_listen_addr
fi
if [ "$http_listen_addr" ]; then
export SOFT_SERVE_HTTP_LISTEN_ADDR=$http_listen_addr
fi
if [ "$ssh_listen_addr" ]; then
export SOFT_SERVE_SSH_LISTEN_ADDR=$ssh_listen_addr
fi
if [ "$ssh_key_path" ]; then
export SOFT_SERVE_SSH_KEY_PATH=$ssh_key_path
fi
# Check for initial startup
if [ ! -f "$data_location/config.yaml" ] &&
[ -z "$initial_admin_keys" ]; then
eerror "Not initialized and no initial_admin_keys setup in conf.d"
else
if [ "$initial_admin_keys" ]; then
einfo "Initializing with initial_admin_keys"
export SOFT_SERVE_INITIAL_ADMIN_KEYS=\"$initial_admin_keys\"
fi
fi
# Write the log somewhere
: ${logfile:="/var/log/${RC_SVCNAME}.log"}
checkpath -f -m 0755 -o $command_user "$logfile"
start_stop_daemon_args="--stdout $logfile --stderr $logfile"
}And the conf.d file: # Server name
#server_name="Soft Serve"
# Location for the data directory
data_location="/srv/soft-serve"
# Change the respective listen addresses
# git_listen_addr=":9418"
# http_listen_addr=":23232"
# ssh_listen_addr=":23231"
# The path to the SSH server's private key.
# ssh_key_path="ssh/soft_serve_host_ed25519"
# Keys defined in `$intial_admin_keys` will be merged with
# the `initial_admin_keys` from /var/local/lib/soft-serve/config.yaml via environment variable.
# initial_admin_keys=""Looking at the other two options, mine appear to be way more than needed, but it was also an exercise to learn a bit more about Alpine and openrc as I was re-building my home servers. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
I'm running soft-serve on Alpine, and there's no documentation for an OpenRC file to run it as a service.
Describe the solution you'd like
It would be great to have a simple starter config file, or even a guide like the one for systemd. It shouldn't be too hard, really you just have to move around some syntax.
Describe alternatives you've considered
Additional context
I have a service file that I'm using for OpenRC. I'd be perfectly willing to write a guide for it, but I'd like to have someone take a look at it first to make sure there aren't any glaring flaws. It's my first time writing an OpenRC script so I'm not sure if there's more that could be done.
/etc/init.d/soft-serveBeta Was this translation helpful? Give feedback.
All reactions