Init script to run binary (not using docker)

This might be a bit strange, but I'm not using docker and therefore not using it to run traefik. I'm actually using a KVM virtualization platform (Proxmox) which also provide creating and managing LXC containers.

So I've spun up an Alpine Linux LXC container and grabbed the traefik binary. I've got traefik up and running fine as a reverse proxy with LetsEncrypt. So far I like traefik. It handles my needs for "legacy" stuff while being a natural extension if I decide to start using kubernetes, docker, etc.

Of course an issue I ran into is I don't want to just run traefik from the CLI on demand. I'd like to start/stop/restart it like any other service. Alpine Linux from what I can tell uses "openrc" and I need to write an init script for this.

Can anyone provide some help with this? Anyone done it? I haven't really found anything on this. I saw some references to systemd scripts. I was trying to follow THIS but I'm just not experienced enough with this stuff. I did managed to at least make it work but without any config checking or crash handling.

#!/sbin/openrc-run
command=/usr/sbin/traefik
# The special RC_SVCNAME variable contains the name of this service.
pidfile="/run/${RC_SVCNAME}.pid"
command_background=true
command_args="-p ${pidfile}"

Thanks.

The Rancher K3s uses Traefik. And their sh script supports Open RC. I have it installed in an Alpine VM. So you can dig it to find what you want.