Skip to content
Northguy edited this page Dec 6, 2020 · 25 revisions

COPS on Synology

This Howto describes how COPS can be installed on a Synology NAS box. You can use one of the following options:

  1. Via Synology package
  2. Via SSH
  3. Via Docker container

Synology package (deprecated)

A package is available though http:https://www.synocommunity.com/ but the package is not actively maintained.

You can install the package repository by following this how to https://synocommunity.com/#easy-install or by downloading the package here : http:https://www.synocommunity.com/packages.

You may have to change your open_basedir parameter like it's explained afterwards.

If you're using DSM 5 please read the FAQ.

if you're using DSM 6: Install package "Web Station", the settings are there AND give the group http read access to the ebooks shared folder.

From here you can continue with the Common steps as described below

Via SSH

  1. Log into your NAS via SSH and go to the web folder: cd /volume1/web
  2. Become super-user by issueing sudo -i
  3. Download the COPS repository, by issueing wget https://github.com/seblucas/cops/releases/download/1.1.3/cops-1.1.3.zip. You can change the URL when the release of COPS is upgraded.
  4. Unzip the zip file with 7z x cops-1.1.3.zip -ocops
  5. Change ownership of the COPS directory by issueing chown -R http:http cops
  6. Change rights of the COPS directory by issuing chmod -R 700 cops
  7. Start configuring your server

Proceed with the Common steps as described below

Common steps

1) On Synology, enable Web Station

Control Panel -> Web Services -> Web Applications Tab: "Enable Web Station". Checked the following boxes: "Enable PHP Cache" and "Enable PHP safe mode..." [This option does not exist in DSM 6.0.1-7393_1]

2) Change your open_basedir

I choose to install in a shared folder named "logiciel" and the full path is :

/volume1/logiciel/feedbook

I had to go to Control Panel -> Web Services -> Web Applications and Customise PHP open_basedir to append :

:/volume1/logiciel/feedbook/

You'll have to load your Calibre database to your shared folder and set permission to the new 'http' group if your database is not found

3) If needed, edit the file "config_local.php"

$config['calibre_directory'] = '/volume1/logiciel/feedbook/';

If you use at least DSM 4.1 you can also enable URL rewriting :

$config['cops_use_url_rewriting'] = "1";

4) Avoid default 'public' shared folder

Note that the default 'public' shared folder cannot be used for your Calibre database. It seems to create access issues. Avoid it in order to allow COPS to work fine.

5) Other access issues

When your database is not on level 1 of a shared folder this might create access issues when folder traversing is not enabled for the http group.

Example:

Access errors when trying to use the folder /volume1/Library/CalibreLibrary/

SynoCommunity packages only set permissions on the lowest directory level for the library. This is most likely where the issue lies: the http user tries to access CalibreLibrary, but cannot get past Library because it doesn't have access on that dir.

Set at least traverse folders permissions (under custom, or set the whole read permissions set) for the http user to the folder Library. Alternatively, put your library a directory level higher (i.e. directly in a shared folder)

If you have done all these steps and still get a "metadata.db not found" error, this may be because the Web Station setting for open_basedir is being overridden by another PHP settings file. You can try to fix this by manually appending the library directory to the open_basedir variable in the file /usr/local/etc/php56/conf.d/user-settings.ini

For more info, see the following post:

6) How to set folder traversing for the http user

  1. File Station
  2. Select 'YOUR/OWN/SUB/FOLDER/'
  3. Right mouse click -> Properties
  4. Permissions tab
  5. Create
  6. Group: 'http'
  7. Copy from: none
  8. Apply to: All
  9. Permissions: Check every box under 'READ'

Via Docker container

Follow the instructions here: https://hub.docker.com/r/linuxserver/cops/