Audiobookshelf

I would dearly like to see Audiobookshelf ported to FreeBSD. Then you can toy with an audiobook server on FreeBSD. It's one of the things I would like to do with a ZFS mirror-0 raid setup.
 
I would dearly like to see Audiobookshelf ported to FreeBSD. Then you can toy with an audiobook server on FreeBSD. It's one of the things I would like to do with a ZFS mirror-0 raid setup.


It claims Audiobookshelf is an open-source self-hosted media server for your audiobooks and podcasts.
 
It looks like you could pretty easily throw together a Linux VM and put it on that. Also, it looks like there's a podman version and there's a FreeBSD podman pacakge.
 
Audiobookshelf is easy enough to install manually if you're still keen:

Dependencies:
- ffmpeg
- git
- node24
- npm-node24

Follow the instructions for Manual Environment Setup (https://github.com/advplyr/audiobookshelf#manual-environment-setup), putting this into your dev.js file in the audiobookshelf folder:

Code:
# cat dev.js
// Using port 3333 is important when running the client web app separately
const Path = require('path')
module.exports.config = {
  Port: 3333,
  ConfigPath: Path.resolve('config'),
  MetadataPath: Path.resolve('metadata'),
  FFmpegPath: '/usr/local/bin/ffmpeg',
  FFProbePath: '/usr/local/bin/ffprobe',
  SkipBinariesCheck: true
}

I haven't got around to setting up a custom rc script - but I can post back once I've got it working if you need it.
 
Audiobookshelf is easy enough to install manually if you're still keen:

Dependencies:
- ffmpeg
- git
- node24
- npm-node24

Follow the instructions for Manual Environment Setup (https://github.com/advplyr/audiobookshelf#manual-environment-setup), putting this into your dev.js file in the audiobookshelf folder:

Code:
# cat dev.js
// Using port 3333 is important when running the client web app separately
const Path = require('path')
module.exports.config = {
  Port: 3333,
  ConfigPath: Path.resolve('config'),
  MetadataPath: Path.resolve('metadata'),
  FFmpegPath: '/usr/local/bin/ffmpeg',
  FFProbePath: '/usr/local/bin/ffprobe',
  SkipBinariesCheck: true
}

I haven't got around to setting up a custom rc script - but I can post back once I've got it working if you need it.
Just to add to this, I also installed Audiobookshelf manually in a FreeBSD 15.1-Release jail, in my user directory. I couldn't get the npm ci command mentioned in Manual Environment Setup to work just with the deps brendans-bits mentioned so I had to pkg install py312-pip in addition as well as ln -s /usr/local/bin/python3.12 /usr/local/bin/python. Again as my user in the jail, I ran pip install setuptools (to get distutils) and finally npm install before I could follow the instructions on Github. Verify it works after this by running npm run dev. I'm fine with keeping the install in my home directory and run it from there.

Here is my rc script in /usr/local/etc/rc.d/audiobookshelf:
#!/bin/sh

# PROVIDE: audiobookshelf
# REQUIRE: LOGIN
# KEYWORD: shutdown

. /etc/rc.subr

name="audiobookshelf"
rcvar="${name}_enable"

load_rc_config $name

: ${audiobookshelf_enable:="NO"}
: ${audiobookshelf_user:="myusername"}
: ${audiobookshelf_dir:="/home/myusername/audiobookshelf"}

pidfile="/home/myusername/audiobookshelf/audiobookshelf.pid"

start_cmd="${name}_start"
stop_cmd="${name}_stop"
status_cmd="${name}_status"

audiobookshelf_start()
{
if [ -f "${pidfile}" ]; then
echo "${name} already running?"
return 1
fi

echo "Starting ${name}."

su -m "${audiobookshelf_user}" -c \
"cd ${audiobookshelf_dir} && /usr/local/bin/node index.js --dev > ${audiobookshelf_dir}/audiobookshelf.log 2>&1 & echo \$! > ${pidfile}"
}

audiobookshelf_stop()
{
if [ -f "${pidfile}" ]; then
echo "Stopping ${name}."
kill "$(cat ${pidfile})"
rm -f "${pidfile}"
else
echo "${name} is not running."
fi
}

audiobookshelf_status()
{
if [ -f "${pidfile}" ] && kill -0 "$(cat ${pidfile})" 2>/dev/null; then
echo "${name} is running (pid $(cat ${pidfile}))."
else
echo "${name} is not running."
return 1
fi
}

run_rc_command "$1"

Make it executable, service audiobookshelf enable, service audiobookshelf start and you should have it running as your user at http://yourip:3333. Good to go!

I use nullfs to pass through my audiobook library from my zfs pool, same UID/GID as the user in the jail.

I'm not used to npm and the whole ecosystem around it, but I assume upgrading at some point should be possible by following the same instructions basically.
 
Back
Top