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

Compatibility for OpenRC to manage oxen service node #1395

Open
wants to merge 7 commits into
base: debian/sid
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/oxen-node-openrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

name: Test for OpenRC script 'oxen-node'
on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]
paths:
- 'debian/oxen-node.openrc'
env:
CLICOLOR_FORCE: 1
jobs:
ci:
runs-on: ubuntu-latest
container: debian:unstable
steps:
- name: Installing dependencies..
run: |
apt-get update
apt-get install curl lsb-release --yes
curl -so /etc/apt/trusted.gpg.d/oxen.gpg https://deb.oxen.io/pub.gpg
echo "deb https://deb.oxen.io $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/oxen.list
apt-get update
apt-get install openrc oxen-service-node --yes
- name: Pulling git dir..
uses: actions/checkout@v2
- name: Testing the service file..
run: |
cp "$GITHUB_WORKSPACE/debian/oxen-node.openrc" /etc/init.d/oxen-node
service oxen-node status || true
service oxen-node start
service oxen-node status
service oxen-node stop
service oxen-node status || true
shellcheck:
runs-on: ubuntu-latest
container: debian:unstable
steps:
- name: Installing dependencies..
run: |
apt-get update
apt-get install shellcheck --yes
- name: Pulling git dir..
uses: actions/checkout@v2
- name: Lint the service file..
run: |
shellcheck --external-sources --shell=sh "$GITHUB_WORKSPACE/debian/oxen-node.openrc"
31 changes: 31 additions & 0 deletions debian/oxen-node.openrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
# shellcheck shell=sh # Written to comply with IEEE Std 1003.1-2017
# shellcheck disable=SC2034 # Krey: OpenRC is using variables that are not expected to be set
# Generated by sysd2v v0.3 -- http://www.trek.eu.org/devel/sysd2v
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides: oxen-node
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Should-Start: $network
# Should-Stop: $network
# X-Start-Before: loki-storage
# X-Stop-After: loki-storage
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Oxen network node
### END INIT INFO
set -a
TERM=xterm
set +a

DESC="oxen-node"
DAEMON="/usr/bin/oxend"
DAEMON_ARGS="--non-interactive --config-file /etc/oxen/oxen.conf"
PIDFILE="/var/run/oxen-node-sysd2v.pid"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason for this pid filename convention?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really.. This part was generated by the mentioned script

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where afaik the concern are systems with both systemd compatibility and openrc runner?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, systemd doesn't write a pidfile, and AFAIK systemd will ignore a sysvinit script in /etc/init.d/whatever as long as a systemd service file is installed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems sane for me to not use the sysd2v then.. Note script generated using sysd2v converter.

START_ARGS="--user _loki --chuid _loki --chdir /var/lib/oxen --background --make-pidfile --notify-await" # --notify-timeout infinity
STOP_ARGS="--user _loki"