Skip to content

Setup Using Synology NAS and Portainer

Note: This is contributed content and work in progress. Click the edit link to perform changes and send a pull request.

This guide will help you install PhotoPrism in your Synology NAS using Portainer, an open-source container manager system. The guide will cover the following steps:

  • install Portainer in your Synology NAS using Task Manager;
  • configure Portainer to use your Synology's docker endpoint;
  • install PhotoPrism in your Synology NAS using Portainer, accessible over http / direct IP;
  • (TO-DO) configure a reverse proxy in your Synology NAS to access Photoprism over https / custom domain name.

Step 1: install Portainer in your Synology NAS using Task Manager

Synology's official docker app is quite limited in terms of functionality and that is the reason why we will install Portainer first. It will make managing docker containers inside Synology much more easier and functional while sharing the same local docker endpoint (i.e. the same docker images / containers / volumes / etc. will be manageable in both Synology's app and Portainer). We could install it using the terminal / SSH connection to the NAS but in this way everything can be done using Synology's Diskstation Manager UI.

To install Portainer:

  1. install Synology's Docker app from the official package center;
  2. open Synology's File Station app and browse to the newly created docker shared folder;
  3. create a folder named portainer inside docker, which will persist relevant Portainer's data in our local filesystem.
  4. open Synology's Control Panel > Task Scheduler and create a new Scheduled Task > User-defined script; you'll then need to fill in some details in the General, Schedule and Task Settings sections.

    4.1. in General fill in:

    4.1.1. Task: use a meaningful name, for e.g. Install Portainer;

    4.1.2. User: keep this as root.

    4.2. in Schedule fill in:

    4.2.1. Date: set the task to run on a specific date (for eg. today) and choose Do not repeat. This task will be used just once to install Portainer, we don't want to run it afterwards;

    4.2.2. Time: leave the default settings, they have no relevance;

    4.3. in Task Settings fill in:

    4.3.1. Run command: copy/paste the user defined script below. Check if the ports are available on your NAS and that the path to the volume is correct (it should point to the folder created in step 3 above):

    docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /volume1/docker/portainer:/data portainer/portainer-ce
    

  5. click OK; then, on the list of scheduled tasks, select the newly created task and hit Run; follow the prompts to install Portainer; in the end you can delete the task or keep it – just uncheck the enabled checkbox to disable the task.

  6. Portainer should now be acessible in your local network in http://[YOUR-LOCAL-IP]:9000/.

Step 2: configure Portainer to use your Synology's docker endpoint

  1. Open Portainer by visiting http://[YOUR-LOCAL-IP]:9000/;
  2. Choose and confirm a strong password; you will manage Portainer using this password and the admin username;
  3. Select Docker - Manage the local Docker environment to link Portainer to your Synology's local docker endpoint and hit Connect; Portainer's admin page should open;
  4. Click Environment in the left menu, then local and under Public IP place your local NAS IP (it should be the same [YOUR-LOCAL-IP] of step 6.

Step 3: install Photoprism in your Synology NAS using Portainer, accessible over http / direct IP

With Portainer installed we can use a docker-compose file to deploy a stack composed by Photoprism and MariaDB to quickly get Photoprism running in our NAS. We can use Photoprism's default docker-compose yml file.

  1. open Synology's File Station app and browse to the docker shared folder;
  2. create a folder named photoprism inside docker, which will persist relevant Photoprism's data in our local filesystem;
  3. inside photoprism folder, create three more folders: storage, originals and database.
  4. Open Portainer by visiting http://[YOUR-LOCAL-IP]:9000/;
  5. Click Stacks in the left menu, then Add stack, give it a meaningful name (for eg. Photoprism) and in the Web Editor place the content of Photoprism's default docker-compose yml file.

BE SURE TO USE YOUR OWN PHOTOPRISM_ADMIN_PASSWORD, PHOTOPRISM_DATABASE_PASSWORD, MYSQL_ROOT_PASSWORD, AND MYSQL_PASSWORD BY CHANGING THE VALUES ACCORDINGLY, AND CHECK THE LOCAL VOLUMES PATHS TO MATCH THOSE DEFINED IN STEP 13.

  1. Click Deploy the stack. Give it a few minutes and PhotoPrism should be accessible in http://[YOUR-LOCAL-IP]:[LOCAL-PORT]/.

Info

Synology automatically creates thumbnail files inside a special @eaDir folder when uploading media files such as images. PhotoPrism now ignores folders starting with @ so that you don't need to manually exclude them in a .ppignore file anymore.

Step 4: configure a reverse proxy in your Synology NAS to access PhotoPrism over https / custom domain name

Synology allows you to configure a nginx reverse proxy to serve your applications over HTTPS. Configurations can be made in Diskstation manager Control Panel, Application Portal, Reverse proxy.: Click create. [Description] give it a meaningful name (for eg. Photoprism) [Protocol]=HTTPS [Hostname]=[YOUR-HOSTNAME] [Port]=[YOUR-PORT] (for eg. 2343) check Enable HSTS and HTTP/2 . under Destination [Protocol]=HTTP [Hostname]=[YOUR-LOCAL-IP][PORT]=[YOUR-PORT] (default is 2342) Last step under Custom Header.: Click create [Websocket] and hit OK (this step makes that your browser receive photo counts, log messages, or metadata updates).

IMPORTANT: make sure that you have forwarded the selected port (for eg. 2343) in your router: