Shoko Server - Linux Setup

This guide is designed to get Shoko Server installed and properly setup so you can start importing and organizing your anime collection.


Installing Docker on Linux

Installing Docker will depend on what distribution you are running.

For most users installing docker from their package manager is advised, this way you will keep up with the latest updates and security updates. On the homepage of Docker you can find the installation procedure for your distribution of the Docker Community Edition.

Use the Package Center to install Docker.

Synology Docker Install

Running Shoko Server on Docker

Getting the latest Shoko Server Docker Image

The latest Docker image is available here. To get the image run the following in the command line.

docker pull cazzar/Shoko Server

Docker Run

To run a basic docker container for Shoko Server, you can run the following from the command line.

docker run -p 8111:8111 cazzar/Shoko Server

This command will run a new empty docker instance with Shoko Server installed and at the same time port 8111will be made available to the host to reach Shoko Server. At this point you'll be able to use Shoko Desktop.

However, this won't be enough to keep a persistent Shoko Server instance running. We will add a few things to the docker command to make sure we can survive a reboot after we make some changes.

docker run -d --name Shoko Server --restart always -p 8111:8111/tcp -v "/path/to/shoko/settings:/root/.shoko" -v "/path/to/webui:/usr/src/app/build/webui" -v "/path/to/anime:/anime" -v "/path/to/import:/import" cazzar/Shoko Server

Note: If you run the Docker container as any other uid/gid other than the default Shoko user see the Advanced Settings section.

Command Breakdown

Command Purpose
-d

Runs in detached mode.

This prevents docker from running Shoko Server within your session. If your client does not have a return to shell feature, this will prevent Docker from running within your shell's instance.

--name Shoko Server

Names your container.

This is useful if you have a utility that manages docker by container names. Without this, your container will have a randomly generated name.

--restart always
Defines a restart policy.
-p 8111:8111/tcp

Publishes the containers Ports.

Simply put, you are binding the port on container to the port on host, otherwise a random port will be chosen on the host.

TCP is used since UDP is not required.

-v "/path/to/shoko/settings:/home/shoko/.shoko"

Mounts volumes.

To preserve settings between updates, the settings folder must be remapped to a location outside the container.

-v "/path/to/anime:/anime"

Mounts volumes.

In order for Shoko Server to manage your collection, you must map at least one volume to the container.

Note: You can have multiple volumes, and they can be named any way you like (/anime, /tv_shows, /media, etc.)

-v "/path/to/import:/import"

Mounts volumes.

Optional: You may also map a import volume, there is no difference between this and the previous command - This is just another example to illustrate how adding additional volumes work.

Note: You can have multiple volumes, and they can be named any way you like (also try: /downloads, /completed_torrents, etc.)

cazzar/Shoko Server

Specifies the Image to derive the container from.

Open Docker from the Main Menu.

Open the Docker Registry.

Open Docker Registry Settings.

By default, Synology's Docker is only configured to allow images downloaded from it's own private registry. Shoko Server is published to the Docker Hub, and that registry needs to be added to Synology Docker.

Add a new registry.

Enter Docker Hub's registry details

Name Value
Registry Name Docker Hub
Registry URL https://registry.hub.docker.com
Trust SSL Self-Signed Certificate
Synology Running Docker - Enter Registry Details

Click OK to close Synology Docker Registry Settings.

Synology Running Docker - Close Synology Docker Registry Settings

You can now search repositories from the Docker Hub Registry. Enter "cazzar/Shoko Server" into the search box above and click the search button.

Check to make sure your results are accurate and click on the "cazzar/Shoko Server" to chose a release to download.

Synology Running Docker - Search for Shoko Server

Chose the latest release to download.

Synology Running Docker - Select Release

After selecting the release, a notification under images will appear and Shoko Server download will begin.

Synology Running Docker - Download Started

Wait for the download to complete, then click Launch to create a container for Shoko Server (download size may differ).

Synology Running Docker - Launch Image

Click on Advanced Settings.

Synology Running Docker - Advanced Settings

OPTIONAL: Enable Auto Restart.

Click on 'Volume' to continue.

Synology Running Docker - Enable Auto Restart

Here you will mount volumes to folders on the host. This is done to preserve your settings between updates and to grant the container access to your shared folders.

Click on 'Port Settings' to continue.

Synology Running Docker - Add Volumes

Bind Local TCP Port 8111 to Container TCP Port 8111.

Synology Running Docker - Bind Ports

Click Next to review your settings.

Synology Running Docker - Review Container Settings

Review your settings and, if everything is correct, click Apply.

Synology Running Docker - Create Container

Click on container to view your newly created Shoko Server.

Synology Running Docker - View Containers

Manage Shoko on Docker

Docker Compose

To make management easier, we can combine all the previous items in a docker compose file.

In order to make this work, install docker-compose, a guide how to can be found here on the Docker website. Once docker-compose is installed create a docker-compose.yml file anywhere on your system. Open the file and put the following inside.

version: "3"
services:
    Shoko Server:
        container_name: Shoko Server
        image: cazzar/Shoko Server:daily
        restart: always
        ports:
            - "8111:8111/tcp"
        volumes:
            - "/path/to/config:/home/shoko/.shoko"
            - "/path/to/anime:/anime"
            - "/path/to/import:/import"

This combines all of our previous configuration in an easy to read and edit format, and will allow you to create a powerful startup script that could (for example) include a MySQL server, a download client, and anything else you can think off that's available in a docker format.

While viewing the Docker panel in the Synology web interface, click on container to view the running containers.

If everything was set up correctly, Shoko Server should be automatically running and the details button will become available. Select the container and then Push the details button.

Synology Manage Docker - View Details

Here you can view and verify the Port settings and volume settings, as well as other information.

Press the Terminal tab to continue.

Synology Manage Docker - Details Overview

The terminal view gives you the output of the Shoko Server session. It is a useful aid in quickly determining if there is an issue.

Synology Manage Docker - Terminal

Creating settings.json

The default settings.json is stored within the image. When Shoko Server for Linux is started for the first time, it checks for the presence of settings.json and if it does not exist, then it copies the one from the image.

If at any time you need to reset the configuration back to the default settings, shut down Shoko Server for Linux and delete the settings.json file.

To create the settings.json file, start Shoko Server for Linux.

Default Setting Options Notes
/home/shoko/.shoko/Shoko.CLI/settings.json Volume can be mounted to relocate files. Default Location for settings.json
Please note that this is the location as seen within the container.
Depending on your installation, the actual location for settings.json may be in an alternate location.

Modify settings.json

Since Shoko Server for Linux runs without a graphical interface configurations must be made to the configuration file directly. Please note that the configurations shown below are the minimum required configurations needed to start the server. Not all configurable options are defined below. The default settings.json is stored within the image. When Shoko Server for Linux is started for the first time, it checks for the presence of settings.json. If it does not exist, it will copy the default one from the image. If at any time you need to reset the configuration back to the default settings, shut down Shoko Server for Linux and delete the settings.json file. To create the settings.json file, start Shoko Server for Linux.

Default Setting Options Notes
"DatabaseType": "SQLite", "SQLite", "SQLServer", "MySQL" By default it should be SQLite.
"SQLServer_DatabaseServer": "localhost", "localhost", "xxx.xxx.xxx.xxx" SQLServer ONLY: This is the IP Address of the SQL Server
"SQLServer_DatabaseName": "", "Shoko Server", "my_existing_name" SQLServer ONLY: This is the name of the SQL Server Database. If the database does not exist then it will be created.
"SQLServer_Username": "", "sa","my_existing_username" SQLServer ONLY: This is username for the SQL Server Database.
"SQLServer_Password": "", "my_sql_password" SQLServer ONLY: This is the password for the user account above, to be used for the SQL Server Database.
"MySQL_Hostname": "localhost", "localhost", "xxx.xxx.xxx.xxx" MySQL ONLY: This is the IP Address of the MySQL Server
"MySQL_SchemaName": "", "Shoko Server", "my_existing_name" MySQL ONLY: This is the name of the MySQL Server Schema. If the schema does not exist then it will be created.
"MySQL_Username": "", "root","my_existing_username" MySQL ONLY: This is the username for the MySQL Server Database.
"MySQL_Password": "", "my_mysql_password" MySQL ONLY: This is the password for the user account above, to be used for the MySQL Server Database.
"AniDB_Username": "", "","my_AniDB_Username" OPTIONAL: This is your AniDB username. It is recommended to add your username if you are using an existing database.
"AniDB_Password": "", "","my_AniDB_Password" OPTIONAL: This is your AniDB password. It is recommended to add your username if you are using an existing database.

Advanced Settings

Running shoko via docker has some additional features / options that might be useful some users.

WebUI

To be able to add a different version from the WebUI into docker we need to expose the Web UI dir inside docker to the outside world. This can be done by adding the following to your docker run command.

Command Purpose
-v "/path/to/webui:/usr/src/app/build/webui"

Mounts volumes.

To preserve Web UI between updates, the Web UI folder must be remapped to a location outside the container.

WebUI is a web based interface that can be used to manage the Shoko Server. You can download it from GitHub.

UID / GUID

In order to run the docker as a specific UID / GID you can specify it in the environment variables.

By default shoko runs with UserID 1000 and GroupID 100.

Command Purpose
-e PUID=xxx -e GUID=xxx

Set Environment Variables.

To make docker run as a certain user/group you can define this through the ENV variables.

This makes working with permissions a lot easier since you can match your docker with the local accounts on your machine without doing much work

If you getting errors with Denied folder access then the wrong PUID and GUID could be the cause.

GUID 101 should be your admin group.

To find the PUID on any user, login with said user with SSH or Telnet with Putty or something similar with the ID command.