Running on OpenBSD
Building
Building Betula on OpenBSD is the same as in other systems. All we need is to install Go. For older versions of Betula, a C compiler was needed, which is always available.
# pkg_add go
Otherwise, follow the build instructions for Betula.
Running as a service
It's perfectly valid to not run Betula as a service. Simply running $ betula links.betula yourself or running it inside Tmux works great. For example, you can add the following to run Betula whenever your computer boots by putting the following in your crontab:
@reboot tmux new-session -d '/path/to/betula links.betula'
But if you want to run it as a service, you can try the following:
Put the executable in a standard location
You can create a link to the existing binary or move it completely to /usr/local/bin.
# ln -s $GOPATH/bin/betula /usr/local/bin/betula
Create the user that will run this service
You can use useradd or adduser. For example:
# useradd -m betula
Create the directory where betula will live
Let's make sure to set the right permissions as well.
# mkdir /var/betula
# chown betula:betula /var/betula
Create the service
Finally, let's create the service. Create a file called /etc/rc.d/betula with the following contents:
#!/bin/ksh
daemon="/usr/local/bin/betula"
daemon_flags="/var/betula/links.betula"
daemon_user="betula"
. /etc/rc.d/rc.subr
rc_bg=YES
rc_reload=NO
rc_cmd $1
Make sure the daemon and daemon_flags variable are correct. Then, make the file executable by running:
# chmod x /etc/rc.d/betula
After that, you should be able to enable the service and start it:
# rcctl enable betula
# rcctl start betula
You should be able to see something on http://localhost:1738/. If you're on a server you can try a program like lynx to verify it:
$ lynx http://localhost:1738/
Check the logs
The logs will be put in /var/log/daemon so monitor that file if you run into any issues.
Set up a domain and HTTPS
If everything is working as expected, you can now to to the domain and HTTPS tutorial.