Skip to content

Instantly share code, notes, and snippets.

@hraftery
Last active January 22, 2023 10:08
Show Gist options
  • Save hraftery/a24a10d3a42088aad8455d90d523e7b5 to your computer and use it in GitHub Desktop.
Save hraftery/a24a10d3a42088aad8455d90d523e7b5 to your computer and use it in GitHub Desktop.
Instructions on not just downloading and running QuestDB on FreeBSD, but putting the requirements elements in a sensible location and configuring it to run on boot.

There does not seem to be any guidance available for installing QuestDB on FreeBSD. An enquiry on Slack created helpful suggestions, but nothing directly actionable.

For posteriority I decided to create my own installer. This seems to do the trick, and is modelling on the Homebrew configuration, for lack of a better idea.

As root:

pkg install bash
curl -LO https://github.com/questdb/questdb/releases/download/6.0.4/questdb-6.0.4-rt-freebsd-amd64.tar.gz
tar xvf questdb-6.0.4-rt-freebsd-amd64.tar.gz
cd questdb-6.0.4-rt-freebsd-amd64
mv bin/* /usr/local/bin/
mv lib/* /usr/local/lib/
mkdir /usr/local/var
questdb.sh start -d /usr/local/var/questdb

Create /usr/local/etc/rc.d/questdb with contents:

#!/bin/sh

# PROVIDE: questdb
# REQUIRE: FILESYSTEMS NETWORKING

. /etc/rc.subr

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

name="questdb"
rcvar=`set_rcvar`

command="/usr/local/bin/questdb.sh"
questdb_flags="-d /usr/local/var/questdb"

start_cmd="$command start $questdb_flags"
stop_cmd="$command stop $questdb_flags"

load_rc_config $name
: ${questdb_enable="NO"}

run_rc_command "$1"
  • Enable with sysrc questdb_enable="YES"
  • Then reboot or service questdb onestart to get it running.

Note:

  • I had to install bash, required by questdb.sh.
  • I installed the contents of bin and lib. Not sure if it is all required, but there were no clashes on a fresh FreeBSD 12.2-RELEASE-p1 install so I figured it can’t hurt.
  • I didn’t install the contents of conf or anything else in the archive - none of it seems to be relevant or referenced anywhere in the docs.
  • While the var directory had to be created, QuestDB itself creates all other required directories (and their contents), provided the containing directory is specified in the -d flag.
  • The rc script is really cumbersome and documentation out there is not good at all. Still not quite sure what some of it does, but it mostly works.
    • Really no more functionality that a simple @reboot line in root's crontab at this stage, but rc is the FreeBSD-native way.
    • crontab solution would simple be: ( ( crontab -l ; echo "@reboot /usr/local/bin/questdb.sh start -d /var/local/var/questdb" ) | crontab - ) >& /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment