Whatbox Logo
Login for certain variables to be updated with your slot's information

Wiki > Audiobookshelf

At this time, Whatbox servers have limited support for Audiobookshelf and containers. It may stop working at any time.

Setup

Intro

Audiobookshelf is an open-source self-hosted media server for your audiobooks and podcasts.

The software will be configured in the /home/user/audiobookshelf directory.

You will need a port number to access Audiobookshelf. Port 15540 has been automatically generated for you, but you may use another 5 digit port between 10000 and 32767.

Pre-requisites

The directions below assume:

  1. You have a directory of audiobook files in /home/user/files/audiobooks
  2. You have a directory of podcast files in /home/user/files/podcasts

Note: If you do not have directories with existing audiobooks or podcasts create them before starting the installation. Alternatively, you can use your existing folders and change directory paths for your files as needed.

Installation

  1. Connect to your slot through SSH

  2. Create a directory for audiobookshelf

     mkdir -p ~/audiobookshelf
    
  3. Create a compose file.

     touch ~/audiobookshelf/docker-compose.yml
    
  4. Edit the compose file

     nano ~/audiobookshelf/docker-compose.yml
    
  5. Copy the following adjusting your time zone if desired and changing your directory paths for your files as needed. Paste into the text editor. Once pasted, press Ctrl+S then Ctrl+X

services:
  audiobookshelf:
    image: ghcr.io/advplyr/audiobookshelf:latest
    ports:
      - 15540:80
    volumes:
      - /home/user/files/audiobooks:/audiobooks
      - /home/user/files/podcasts:/podcasts
      - /home/user/audiobookshelf:/config
      - /home/user/audiobookshelf:/metadata
    environment:
      - TZ=UTC
    restart: unless-stopped
  1. Start the compose file:

     podman-compose -f ~/audiobookshelf/docker-compose.yml up -d
    

Accessing Audiobookshelf

You will now be able to access your files folder using the username and password you defined from http://server.whatbox.ca:15540/

After installation, you will need to immediately access Audiobookshelf and set up your first administrator user.

If you need to stop the container, you can shut it down with podman-compose -f ~/audiobookshelf/docker-compose.yml down -t 300 and wait for it to shut down. If the container does not shut down, run pkill -f index.js and try the down command again.

Updating Audiobookshelf

This container updates when it is restarted. Shut it down with

podman-compose -f ~/audiobookshelf/docker-compose.yml down -t 300

and wait for it to shut down. Then, run

podman-compose -f ~/audiobookshelf/docker-compose.yml up -d

to start the container again.

If you want to access your Audiobookshelf instance with HTTPS access, add a custom app managed link with port 15540 and select Enable websockets (optional)

Auto-restarting Audiobookshel

  1. Create a file to be used for the script: touch ~/audiobookshelf_restart.cron
  2. Edit the file and enter the following text: nano -w ~/audiobookshelf_restart.cron
#!/bin/bash
if pgrep -fx ".*audiobookshelf_1.*" > /dev/null
then
    echo "Audiobookshelf is running."
else 
    echo "Audiobookshelf is not running, starting Audiobookshelf"
    podman-compose -f /home/user/audiobookshelf/docker-compose.yml up -d
fi
exit
  1. Save the file with Ctrl+x, then press "y" and Enter to accept overwriting.
  2. Make the script executable: chmod +x ~/audiobookshelf_restart.cron
  3. Open your crontab: EDITOR=nano crontab -e
  4. Enter the following text:
@reboot /home/user/audiobookshelf_restart.cron >/dev/null 2>&1
*/5 * * * * /home/user/audiobookshelf_restart.cron >/dev/null 2>&1
  1. Save the file with Ctrl+x, then press "y" and Enter to accept overwriting.

Removing

  1. Navigate to the directory containing the docker-compose.yml file

     cd audiobookshelf
    
  2. Remove the services including networks and volumes created

     podman-compose down --volumes
    
  3. Remove the directory

     rm -r /home/user/audiobookshelf
    
  4. To remove any crontab -e entries open your crontab: EDITOR=nano crontab -e and delete or comment out any of the restart/upgrade commands you might have added. Then, save the file with Ctrl+x, then press "y" and Enter to accept overwriting.