Mylar 3 on Synology?

Information and Tutorials on features in Mylar and how to use it
Oizo
Posts: 72
Joined: Sat Nov 15, 2014 11:53 am

Mylar 3 on Synology?

Post by Oizo »

Has anyone installed Mylar3 on a Synology Diskstation? For years I've been using the package from the synocommunity. But there is no update to V3(yet).
Docker is not an option for my DS model (415play).
So would love to get some pointers on how to install it manually or upgrade my V2.
Who can help me out her?
Aimhere
Posts: 98
Joined: Mon Apr 06, 2015 2:32 pm

Re: Mylar 3 on Synology?

Post by Aimhere »

I'd like some help with this as well. My Linux-fu is weak. :D
Oizo
Posts: 72
Joined: Sat Nov 15, 2014 11:53 am

Re: Mylar 3 on Synology?

Post by Oizo »

anyone?
User avatar
evilhero
Site Admin
Posts: 2883
Joined: Sat Apr 20, 2013 3:43 pm
Contact:

Re: Mylar 3 on Synology?

Post by evilhero »

Personally, I can only help with git installations, as I haven't a clue on anything Synology related let alone their packages unfortunately.

Your best bet would be to bring it up with the synocommunity to see how easy it is for them to move the package to mylar3 if your only option is to use the package install. Otherwise, maybe try a git install - which is usually pretty straightforward.

I'm sure someone has done a git installation on synology before (I remember it years ago), but I can't recall who or how it went.
cnewham
Posts: 4
Joined: Mon Oct 12, 2020 10:21 am

Re: Mylar 3 on Synology?

Post by cnewham »

I managed to upgrade to mylar3 on my Synology last night, it was quite a dirty hack to be honest and relied on me having the latest sabnzbd, mylar, python3 from Synocommunity before i started and of course all done using SSH access. I can give you some instruction on how I did it if you like but the caveat would be that I take no responsibility for your Synology if something goes wrong?
anonymoez
Posts: 6
Joined: Thu Sep 19, 2019 2:47 pm

Re: Mylar 3 on Synology?

Post by anonymoez »

Please do post some pointers on how to upgrade to Mylar 3!!!
cnewham
Posts: 4
Joined: Mon Oct 12, 2020 10:21 am

Re: Mylar 3 on Synology?

Post by cnewham »

This is very messy as I'm still learning my way around a synology and building a package from scratch isn't something I've figured out yet.

I did create a completely separate volume for mylar to use. I'll make an assumption and guess this is something that the package centre would hate when following it's correct working but I noticed that the relative file path for package centre installations caused the occasional problem for mylar as it was running below /volume1/@appstore. The @ symbol in the path can cause problems for mylar as it it doesn't expect to have to escape part of the file path it runs from. Also it means I still have an intact version of the original package to fall back to if needed.

Anyway, I'm running DSM 6.2.3-25426 Update 2 on a DS216+II. I originally installed mylar, python2 and git from synocommunity. To get this started I also installed python3 from synocommunity as it's a later version than synology's. It's still behind the recommended version but as yet it's given me no problems.

So onto my hackery (most of this requires SSH access):

1) Create a volume for mylar, I called my volume mylar so I'll be referring to as that. Also my synology creates shared volumes under /volume1 so I'm making the assumption this is standard to DSM 6.

2) SSH into the server and elevate yourself to root permission, I hate using sudo :-D.

3) Go to your mylar volume and use git to clone mylar3:
git clone https://github.com/mylar3/mylar3

4) If you prefer to run off the dev branch then use git to checkout python3-dev:
git checkout python3-dev

5) Navigate to your mylar volume and create a python3 environment for mylar to use:
cd /volume1/mylar
/usr/local/python3/bin/python3 -m venv env

I can't remember if python 3 came bundled with virutalenv so if the above doesn't work try installing virtual env first:
/usr/local/python3/bin/python3 -m pip install --user virtualenv

6) Enter your python environment and install mylar's requirements, (assuming you're still at the root of your mylar volume):
source env/bin/activate
cd mylar3
pip3 install -r requirements.txt

Once you have the requirements installed you can drop from your python virtual environment:
deactivate

7) Decide where you want your cache, config, logs and data to reside. I placed them all on the mylar volume and copied what I needed from the original. If you like you can leave the as they are but as I stated earlier I wanted to create a backup of my original installation where I could.

8) Assuming that you're following my method, create the folders on your mylar volume:
cd /volume1/mylar
mkdir run conf cache logs data

9) Copy your data and config.ini from the existing package over to your volume.
cp -rvp /volume1/\@appstore/mylar/var/data/* /volume1/mylar/data/.
cp -rvp /volume1/\@appstore/mylar/var/config.ini /volume1/mylar/conf/.

Note the use of backslash to escape the @ symbol for referencing the packages original location.

10) Edit these entries in your config file to match something like:
cache_dir = /volume1/mylar/cache
git_user = mylar3
git_branch = python3-dev (only do this if you want to follow the dev branch)
log_dir = /volume1/mylar/logs
ddl_location = /volume1/mylar/downloads

11) Ensure that everything in your new mylar volume has the necessary user permissions (the synocommunity mylar installation created the user sc-mylar and group mylar on my synology so I stuck with them):
cd /volume1/mylar
chown -R sc-mylar:mylar run conf cache logs data

At this point we could potentially start up mylar manually from the command line but I hacked away at the package a little so the synology could have some control over it.

12) Shut down the existing mylar instance using the package centre GUI or the following from the command line:
synoservice --disable pkgctl-mylar

13) Most of the mylar service detail resides in the folder /var/packages/mylar/ on my synology so we'll be doing a lot of work in that folder from here on in. So navigate to that folder:
cd /var/packages/mylar/

14) First remove the dependencies for the original mylar package by editing the INFO file, I use vi, (this stops mylar insisting it needs python 2 when you start it up):
vi INFO

and then remove the line thats starts with install_dep_package or change this to include the version of python3 you've installed.

15) Change the symlink to the mylar installation itself:
unlink target
ln -s /volume1/mylar/mylar3 target

16) We now start hacking away at the service scripts so at this point you'll need to have your file and new folder locations handy.

17) In the folder scripts, /var/packages/mylar/scripts, there are two main files that package centre relies on. One is start-stop-status, you can guess what this does from it's title but if this script breaks then the package centre will not play ball with mylar. The second script is service-setup, this pulls together various configuration settings and locations for the start-stop-status script to use. Here is what I changed in these two for my installation:

In service-setup, (using the editor of your choice):

replace this line:

if [ -n "${SYNOPKG_DSM_VERSION_MAJOR}" -a "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 6 ]; then EFF_USER="${SYNOUSER_PREFIX}${USER}"; else EFF_USER="${PRIV_PREFIX}${USER}"; fi

with:

EFF_USER="${PRIV_PREFIX}${USER}"

Now find and amend the variables below, (again these are based on the preference for how i want to run my version of mylar, your setup may vary but this is where you need your new locations):

LOG_FILE="/volume1/mylar/logs/mylar.log"
PID_FILE="/volume1/mylar/run/mylar.pid"
PYTHON_DIR="/usr/local/python3"
GIT_DIR="/usr/local/git"
PATH="/volume1/mylar/bin:/volume1/mylar/env/bin:${PYTHON_DIR}/bin:${GIT_DIR}/bin:${PATH}"
PYTHON="/volume1/mylar/env/bin/python3"
VIRTUALENV="${PYTHON_DIR}/bin/virtualenv"
MYLAR="/volume1/mylar/mylar3/Mylar.py"
CFG_FILE="/volume1/mylar/conf/config.ini"
DATA_DIR="/volume1/mylar/data

18) Edit the start-stop-status script:

Change the line:

DNAME="${SYNOPKG_PKGNAME}"

to

DNAME="mylar"

19) That's all folks! Now feel free to start up your mylar installation and fingers crossed it works. Either use package centre or the CLI command:
synoservice --enable pkgctl-mylar


So as I've been writing this I feel there are things I might have forgotten or neglected to mention, I did a lot of messing about to get this working and broke the package centre a few times on my synology. It have got to all working fine now and I reckon the above steps should be all you need. I'll be happy to help if you want to give this a go yourselves.

I'm dyslexic so proof reading is not my bag, if incorrect spellings or grammar haven't been caught as I type by my PC then I'll have missed them, If something looks like garbage then just pull me up on it.
WedgeSparda
Posts: 6
Joined: Fri Oct 14, 2016 8:08 am

Re: Mylar 3 on Synology?

Post by WedgeSparda »

I tried to follow your steps (thanks, by the way) but couldn't pass from this one:
cnewham wrote: Fri Oct 16, 2020 11:13 pm 5) Navigate to your mylar volume and create a python3 environment for mylar to use:
cd /volume1/mylar
/usr/local/python3/bin/python3 -m venv env
Problem is that route /usr/local/python3/bin/python3 doesn't exists in my NAS. I've installed both Python and Python3 from DSM. Don't know what I'm missing here.
cnewham
Posts: 4
Joined: Mon Oct 12, 2020 10:21 am

Re: Mylar 3 on Synology?

Post by cnewham »

I would definitely recommend you install the python 3 package from synocommunity over the standard one from synology. If you already have installed synocommunities python3 then I guess my installation of something else like sabnzbd may have created the link. Anyway the synocommunity python3 install should have installed at /volume1/@appstore/python3 so we can go from there.

So you have two choices:

1) Create the link so it matches my setup:
cd /usr/local
ln -s /volume1/\@appstore/python3 python3

(remember we have to use \ to escape the @ symbol when using command line or the shell will take it literally. This is why I hate using punctuation in folder and filenames but ho hum thats just a pet hate of mine.

2) Change the flow of my earlier post to match where the package should be instead of where I've found it.
So step 5 would now be:

cd /volume1/mylar
/volume1/\@appstore/python3/bin/python3 -m venv env

And step 17, change the line in the service-setup script from:
PYTHON_DIR="/usr/local/python3"
to:
PYTHON_DIR="/volume1/@appstore/python3"

Hope either of those works for you. If you choose option 2 then you may need to add the \ in the PYTHON_DIR line to escape the @ though I'm completely unsure how the synology startup script would handle that and it's been a while since I've done any serious shell scripting so I can't remember just how literally that variable will be read in.
WedgeSparda
Posts: 6
Joined: Fri Oct 14, 2016 8:08 am

Re: Mylar 3 on Synology?

Post by WedgeSparda »

Thanks a lot, that helped me :D

But now I'm facing another issue in this step
cnewham wrote: Thu Oct 22, 2020 6:36 pm
6) Enter your python environment and install mylar's requirements, (assuming you're still at the root of your mylar volume):
source env/bin/activate
cd mylar3
pip3 install -r requirements.txt
I run the "pip3 install -r requirements.txt" command but got this error when Pillow is being installed
The headers or library files could not be found for zlib, a required dependency when compiling Pillow from source.
I've been looking for a way to install zlib in Synology, but with no luck. What' I'm missing?

Thanks again
Post Reply