Synology

Table of Contents
  1. Foreword
  2. To install Stash with Docker
    1. “Volume” Tab
    2. “Environment” Tab
    3. “Port” Tab
    4. “Network” Tab
  3. To install Stash without Docker
    1. Enable SSH
    2. Create a user that will run stash
    3. Connect to your NAS
    4. Download Stash
    5. Download ffmpeg
    6. Configure your NAS to run Stash upon startup
    7. Verify that it is working

Foreword

Synology devices comes in two categories : those who support containerization through Docker, and those who don’t. To see in which category you stand, refer to the “Applied Models” section of the Docker Package page.

Now, follow the installation instructions based on whether you can use Docker or you cannot use Docker.

To install Stash with Docker

“Volume” Tab

File/Folder Mount Path Description
docker/Stash/generated /generated Thumbnails, clips, etc
docker/Stash/metadata /metadata Database
docker/Stash/config /root/.stash Configuration Files
docker/Stash/cache /cache Cache Files
docker/Stash/blobs /blobs Binary data for scene covers, performer images, etc
(where your porn lives) /data Location of your porn

“Environment” Tab

(These will need to be the same as the Volumes you created in the “Volume” tab.

variable Value  
PATH (keep as is)  
STASH_CACHE /cache  
STASH_METADATA /metadata  
STASH_GENERATED /generated  
STASH_STASH /data  
     

“Port” Tab

You will need to set a default port in the “Port” tab, otherwise Docker will assign a different port every time Stash is launched. Leave the container port as-is.

“Network” Tab

Make sure that “Use The Same Network As Docker Host” is checked.

(thanks to backer Herelam80 for these instructions)

To install Stash without Docker

Warning : this method uses SSH to run command lines on the NAS. If you are unfamiliar with SSH or linux command lines, I suggest you not to go further, as making a mistake in the SSH session can really screw your NAS.

This is intended to work on DSM 7.0 and later. It will not work on any version prior to 7.0.

Enable SSH

In DSM, navigate to Control Panel > Terminal & SNMP and check the enable SSH service box.

Note : only members of the adminstrator group are able to use SSH, you’ll need one of them to complete the installation.

Create a user that will run stash

  1. In DSM, navigate to Control Panel > User & Group
  2. Click on the Create button
  3. Give it a name (eg stash) and Generate a Random Password (you won’t need it later)
  4. Click Next until you are on the “Assign shared folders permissions” screen
  5. Assign the read write permission to your porn folder (the write permission is needed to allow the deletion of clips from the stash app)
  6. Click Next until you are on the “Assign application permissions” screen
  7. Check Deny for all applications
  8. Click Next until you can click on Done

Connect to your NAS

With your terminal, connect to your NAS using an account that is part of the administrator group.

  1. SSH to your NAS
ssh admin@nas-hostname
  1. navigate to the stash user home directory
cd ../stash/

Download Stash

  1. Download the lastest ARM64 version of stash and its checksum from github
wget https://github.com/stashapp/stash/releases/download/[version]/stash-linux-arm64v8
wget https://github.com/stashapp/stash/releases/download/[version]/CHECKSUMS_SHA1
  1. Perform the checksum validation
sha1sum -c --ignore-missing CHECKSUMS_SHA1

# you should see a line that says `stash-linux-arm64v8: OK`
  1. Clean up unnecessary file
rm CHECKSUMS_SHA1

Note : DO NOT run stash yet or it will generated a bunch of files/folders where we don’t want them

Download ffmpeg

  1. Donwload the ARM64 static build of ffmpeg and its checksum
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz.md5
  1. Perform the checksum validation
md5sum -c ffmpeg-release-arm64-static.tar.xz.md5

# you should see a line that says `ffmpeg-release-arm64-static.tar.xz: OK`
  1. Unpack & move ffmpeg to the .stash/ folder
tar xvf ffmpeg-release-arm64-static.tar.xz
mv ffmpeg-4.4-arm64-static/ffmpeg ffmpeg-4.4-arm64-static/ffprobe .stash/
  1. Clean up unnecessary files
rm ffmpeg-release-arm64-static.tar.xz
rm ffmpeg-release-arm64-static.tar.xz.md5
rm -rd ffmpeg-4.4-arm64-static/
  1. Prepare a python environment (for scrapers)
sudo -H python -m ensurepip --upgrade
python3 -m venv stash-env
source stash-env/bin/activate
pip3 install pipreqs

Whenever you install a new scraper, do the following from the stash user home directory

source stash-env/bin/activate
cd your_scraper_directory
pipreqs .
sudo pip3 install -r requirements.txt

Configure your NAS to run Stash upon startup

  1. Create the service file by running cat > /etc/systemd/system/stash.service, copy/pasting the following, and hitting CTRL+D when it’s done to save the file (hit again if you are not back to the prompt) :
[Unit]
Description=Run Stash at startup
After=network.target

[Service]
Type=simple
User=stash
ExecStart=/bin/bash -c '\
   source /var/services/homes/stash/stash-env/bin/activate stash-env; \
   exec /var/services/homes/stash/stash-linux-arm64v8'
Restart=on-failure

[Install]
WantedBy=multi-user.target
# end
  1. Start and activate the service
sudo systemctl start stash.service
sudo systemctl enable stash.service

Verify that it is working

You can now access to stash by navigating to your NAS url on port 9999 : http://nas-hostname:9999