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

Wiki > Audiobookshelf

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 19118 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. In your root create a directory to install audiobookshelf

     mkdir -p ~/audiobookshelf
    
  3. Enter audiobookshelf's directory

     cd ~/audiobookshelf
    
  4. Create a docker-compose file.

     touch docker-compose.yml
    
  5. Copy the following adjusting your time zone if desired and changing your directory paths for your files as needed.

version: "3.7"
services:
  audiobookshelf:
    image: ghcr.io/advplyr/audiobookshelf:latest
    ports:
      - 19118:80
    volumes:
      - /home/user/files/audiobooks:/audiobooks
      - /home/user/files/podcasts:/podcasts
      - /home/user/audiobookshelf:/config
      - /home/user/audiobookshelf:/metadata
    environment:
      - TZ=UTC
  1. Run the following commands to install it for the first time and then start it:

     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:19118/

After installation, you should immediately access Audiobookshelf and set up your Root user.

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

Managing Audiobookshelf

Stopping

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

Starting

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

Restarting

    podman-compose -f ~/audiobookshelf/docker-compose.yml restart

Upgrading

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

Auto-restarting Audiobookshelf

Here's how you can set up Audiobookshelf to start automatically when the VM is restarted:

  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 -f "podman-compose -f /home/user/audiobookshelf/docker-compose.yml up" > /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.

Auto-upgrading Audiobookshelf

Here's how you can set up Audiobookshelf to automatically attempt to update the project everyday at 22:00 UTC:

  1. Open your crontab: EDITOR=nano crontab -e
  2. Enter the following text:
0 22 * * * podman-compose -f ~/audiobookshelf/docker-compose.yml down; podman-compose -f ~/audiobookshelf/docker-compose.yml pull; podman-compose -f ~/audiobookshelf/docker-compose.yml up -d
  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.