Synology SPK-Package: Development

Hi,
I am currently investigating in creating a SPK package for x64 Synology devices.
As I am new to SPK, I would like to share some info about my progress.

I currently finished a SPK which installs fine on my DS716+. There are a few issues that I still have.
I need a start-stop-status script to launch the client. This script seems to work from the command line. When I start the package from the Package Center it starts too, but The Package Center does find out that it is actually running and states “Stopped” afterwards. I can stop it again from the command line (sudo start-stop-status stop) and it stops.
The status in the shell is also given correctly. I am unsure if this is due to the way I tried to get the RoonServer PID (by “ps” command) which is saved to a pid-file afterwards.

Also I read evand’s post howto redirect the database path to a different location This works and the root partition won’t be filled. The new location is now in a subdirectory of the package (RoonServer/database)
But I don’t know yet howto redirect the Log directory to a different location.

Maybe someone else has some ideas on this. :slight_smile:

2 Likes

Have a look at my Arch install howto - you can point the log folders to tmpfs…assuming of course modifying fstab isn’t going to break your nas’ operation.

Hi evan,
I was trying not to touch system files like fstab and to pass the relevant pathes with the start/stop script. For the database this seems already to work (i used sed to insert “export ROON_DATAROOT=…” in the start.sh script).

You could make symbolic links for the log folders pointing to an alternative location.

a symbolic link was also my first thought. I was a little bit confused that there are no more log files at all as soon as I redirect the Roon database location to a different path. Before the database and the logs were stored in /root/.RoonServer and after redirecting the path to /Packagedirectory/database no more logs were generated anywhere. That’s why I was wondering if the log path could also be written explicitly in the start.sh script.

I’ll check my setup and revert - I’m almost certain my logs are stored in the same location as the database.

Sorry, you were right and I was blind!
I was expecting the logs to appear directly in the ROON_DATAROOT folder. You are right they are stored at ROON_DATAROOT/RoonServer/Logs. Thank you for your input. Sometimes it really helps just to talk/write about it to see your faults… :grinning:
Then I just need to figure out the start-stop script…

Take a look at one installed on a regular Linux box and modify it to suit the nas’ config. I can post the contents of the Arch equivalent on my server if it helps?

The synology spk-package works now. I have tested it on my DS716+ and DS1511+. Both run the server.
But the status is not correctly displayed. It will tell you that Roon is currently not running even though it is.
I still have to figure that out.
I was also running a Synology System (DSM 5.2) with XPEnology Bootloader in a VM. It did not work there, so I guess DSM 6 is required. I can’t say that for sure at the moment as I have no clean installed DSM 6 here.

And your database currently also gets deleted if you uninstall the package from the device.

Just to share what I have done yesterday:

Unzipped the http://download.roonlabs.com/builds/roonserver-installer-linuxx64.sh to a new folder
/volume1/Roon/RoonServerApp.

Via Telnet:
$ sudo ROON_DATAROOT=/volume1/Roon /volume1/Roon/RoonServerApp/start.sh
It worked. Closed the Telnet session what killed the process.

Opended a scheduled task in DSM accordingly to be executed on NAS startup:
Manual task, User root, “on startup” with the same Linux command:
$ sudo ROON_DATAROOT=/volume1/Roon /volume1/Roon/RoonserverApp/start.sh

Rebootet the NAS - processes RAATServer, RoonServer and RoonApplication running again.
Started RoonApp on my iPad.

Everything was working like a charm. Database has been built up with around 90k tracks from the local library stored on the same NAS within 4-5 hours. Played tracks from library and TIDAL without any hiccups, covers have been displayed always instantly without any delays, as the whole GUI did, even while scanning the database.

Workload on the Synology 1813+ (2GH 2core CPU Intel Atom D2700 with 4GB RAM) of the RoonApplication was around 30% CPU and 600-1000 MB RAM while scanning library. After that CPU load dropped to 8% (while still analysing track waveforms).
There is a process called “esynoscheduler” which took about 25% CPU on top and is still there. Do not know if this process is there because of Roon, didn’t notice it before, maybe someone has a hint.

For sure not as comfortable as an SPK-package, but:

  • Finding that my Synology NAS is pretty much capable of running RoonServer.
  • The way I did it works and addresses the issue that the easy instll routine didn’t find an ALSA lib on my NAS and skipped the setup process.

Note: I use a separate RoonReady endpoint for audio rendering and I think therefore I do not need ALSA and it works fine. For those looking to play from there NAS not via LAN but via USB sound card or something similar they very likely might need ALSA. So better follow the hints from the Roon guys and do not go this way.

Sound:
Before RoonServer was installed on my W7 PC with Fidelizer Pro running, streaming the library from the NAS. Removing the PC out of the chain resulted in a noticable sound impovement as well!

I’m a happy camper now. If somebody is interested in more details like screenshots let me know, happy to share.

However keep up the work with the package, I’ll love to try this.

Cheers
NOA

Here is a short update: I managed to install the package without modifying any files of the package provided by Roon.
I am still investigating in the status indicator of the package center. In the screenshot below you can see that it does not realize the package is actually running (the DS716+ is called “Mediator”).

I am still guessing it has something to do with the start-stop-status script. This looks like this at the moment:
#!/bin/sh

# Package
PACKAGE="RoonServer"
DNAME="RoonServer"
USER="root"
ROON_DIR="/var/packages/RoonServer/target"
PID_FILE="${ROON_DIR}/var/RoonServer.pid"
ARCH=$(uname -m)

start_daemon ()
{
    # Launch the service in the background.
    chown -R root:root ${ROON_DIR}/var
    chown -R root:root ${ROON_DIR}/database
    su - root -c "umask 000; export ROON_DATAROOT="$ROON_DIR/database"; export ROON_ID_DIR="${ROON_DIR}/var"; ${ROON_DIR}/start.sh &"
    # wait for RoonServer to be started...
    sleep 4
    PID=`( ps -Awwo pid,args | grep "RoonServer " | grep -v grep | awk '{print $1}' )`
    echo $PID > $PID_FILE
}

stop_daemon ()
{
    kill `cat ${PID_FILE}`
    wait_for_status 1 20 || kill -9 `cat ${PID_FILE}`
    rm -f ${PID_FILE}
}
daemon_status ()
{
    if [ -f ${PID_FILE} ] && kill -0 `cat ${PID_FILE}` > /dev/null 2>&1; then
        return
    fi
    rm -f ${PID_FILE}
    return 1
}

wait_for_status ()
{
    counter=$2
    while [ ${counter} -gt 0 ]; do
        daemon_status
        [ $? -eq $1 ] && return
        let counter=counter-1
        sleep 1
    done
    return 1
}


case $1 in
    start)
        if daemon_status; then
            echo ${DNAME} is already running
        else
            echo Starting ${DNAME} ...
            start_daemon
        fi
        ;;
    stop)
        if daemon_status; then
            echo Stopping ${DNAME} ...
            stop_daemon
        else
            echo ${DNAME} is not running
        fi
        ;;
    status)
        if daemon_status; then
            echo ${DNAME} is running
            exit 0
        else
            echo ${DNAME} is not running
            exit 1
        fi
        ;;
    log)
        exit 1
        ;;
    *)
        exit 1
        ;;
esac

Hi Christopher,

ich schreibe jetzt mal in Deutsch :slight_smile:

Habe mir jetzt eine DS716+ bestellt und verfolge diesen thread hier mit grosser Aufmerksamkeit.

Wäre wirklich toll, wenn roon auf der DS ohne Probleme läuft :sunglasses:

GruĂź

Marco

I have added import and export options to the install and uninstall progress.

Install window:

Uninstall window:

@Crieke this looks very promising! Great you took the effort. Do you have a download link to the spk package you made? I’d like to try it out on my Synology 1815+.

Indeed! Great work! Would love to try as well @crieke

I figured out the start-stop-status issue. I’ll recheck the scripts again before I’ll let test anyone… :wink:

1 Like

Today was a good day. A new build has been released. That was perfect to see how the RoonServer on the Synology acts in case of an update. I managed to adjust a few things in the folderstructure and it works now.
I also managed to grab the RoonServer package from the roonlabs website during the install process. (I was not sure if I was allowed to put the software in the spk file and host it on my webserver).

Below you will find the SPK file for testing.
As this is for testing purpose I will not be responsible if anything does not work as expected.

There are a few things I will still look into.

  • Improve the Database Import/Export Wizard during Install/Uninstall
  • Clean up the scripts
  • Possibly other stuff

EDIT: Before you install, check the Package Center settings: the trust level should be set to “Any Developer”.
(You can revert to your previous settings after installation)

1 Like

Thanks. I get the error: ’ The package does not contain a digital signature’ after which it aborts.

@rovinggecko
Sorry, I forgot to mention: In the Package Center settings:
The “Trust Level” should be set to --> “Any publisher” before installation. After installation you can revert to “Synology” or “Synology and trusted developers”. I added this info to my previous post.

Hi, @crieke

I installed your package on my DS1515+ and it is running /volume1/music.
It works very fine. This is really Great Work !!

Thank you.