Good practice for upgrading?

Linux and UNIX specific discussions
Post Reply
Busywait
Posts: 6
Joined: Sat Nov 25, 2017 3:15 pm
AV Hardware: Xbox One, Bubble uPNP

Good practice for upgrading?

Post by Busywait » Mon Jun 25, 2018 4:40 pm

I have the Linux ARM (Little Endian) Twonky Server 8.3.0 running and configured.

What's the expected way to upgrade this to the new version, 8.5.1?
http://download.twonky.com/

I'd like to keep my configuration so that I don't have to try and remember all of my changes, but I don't want the server to behave incorrectly because the configs don't match.

What's the wisdom of the forum in this case?

egorlopatin
Posts: 2
Joined: Thu Jun 28, 2018 9:40 am
AV Hardware: Twonky server on PC

Re: Good practice for upgrading?

Post by egorlopatin » Thu Jun 28, 2018 9:53 am

Hello,

I had the same Twonky server on my Ubintu PC and when I need to update Twonky I just:
- stop of Twonky (systemctl --user stop twonky.service)
- move installation dir (like /usr/lib/twonky or similar what you use on your side) and name it like twonky_8.3
- create new directory there
- unzip an installation archive in new directory
- start Twonky server

It shouldn't change any config/ini files of your user (if you do not store it in the installation directory sure).

But I really do not recommend you update your 8.3 version to 8.5.x. The developers changed login and license check methods and now you will need to create an account on their web-site, then enter login detail on your GUI Twonky server panel and then you might have issues with your license.

For example I had to downgrade my 8.5 to 8.3 because the licence became invalid, and the Lynx web-site do not allow me to use Twonky.

If you have some any questions or some details are required, please let me know.

--
Regards,
Egor L.

Busywait
Posts: 6
Joined: Sat Nov 25, 2017 3:15 pm
AV Hardware: Xbox One, Bubble uPNP

Re: Good practice for upgrading?

Post by Busywait » Fri Jun 29, 2018 9:40 am

Thank you - that's helpful!

Especially your suggestion to remove the appdata for upgrade. I hadn't done that in my 8.5.0 upgrade, and I was having to log to the Lynx website via the Twonky admin UI every time my server (NAS box) was restarted. I just noticed that some advice has been added to do this on the download page http://download.twonky.com/ too:
"Please also note that if you are having trouble entering your license key or if it is not saved correctly the workaround is to delete the “appdata” folder.
You can retrieve the path by entering: http://yourip:9000/rpc/get_option?appdata"

I wondered if there was some trick I'd been missing. For example, the twonkyserver.ini file contains these lines

Code: Select all

# Indicates whether initial setup is completed or not
initialsetupdone=1
Maybe editing that at each upgrade would have helped me? In future I think that I'll just bite off the annoyance of always starting with a clean configuration.

I run twonky from a normal user account. In my install I've been keeping the Twonky appdata folder inside the Twonky install folder, so I have a history of Twonky install folders on my disk like this:
drwxrwxrwx 6 504 703 4096 Apr 26 2015 twonky639
drwxrwxrwx 6 root root 4096 Apr 26 2015 twonky709
drwxrwxrwx 6 504 703 4096 Apr 26 2015 twonky728
drwxrwxrwx 6 504 703 4096 Aug 10 2016 twonky803
drwxrwxrwx 7 504 703 4096 Aug 10 2016 twonky830
drwxrwxrwx 7 504 703 4096 May 23 21:27 twonky850

And also set of simple start scripts that look like this:
-rwxrwxrwx 1 504 703 2465 Apr 26 2015 starttwonky639.sh
-rwxrwxrwx 1 root root 2549 Apr 26 2015 starttwonky709.sh
-rwxrwxrwx 1 504 703 2638 Apr 26 2015 starttwonky728.sh
-rwxrwxrwx 1 504 703 2472 Apr 26 2015 starttwonky803.sh
-rwxrwxrwx 1 504 703 2472 Aug 10 2016 starttwonky830.sh
-rwxr-xr-x 1 root root 2472 Nov 25 2017 starttwonky850.sh

The start scripts start twonky using a command line that includes the -appdata and -logfile command line options, which allows me to very easily switch between them.

My steps to upgrade have been:
- Log in (ssh) to the twonky user account
- Create a new directory for the new release (so for Twonky version 8.5.1, mkdir twonky851)
- Unpack the release zip file into the new folder (unzip twonky-XXX.zip -d twonky851)
- [I won't do this any more] Copy the config from my previously used twonky into it (cp -R ./twonky850/appdata ./twonky851)
- Copy my previously used starttwonkyxxx.sh script, and edit it to point to the new install (see below)
- Make some edits to the resources/views/view-definitions.xml file to make the Navigation Trees look like I want them too

My starttwonkyXXX.sh files look like this (where XXX is the version numbers):

Code: Select all

#!/bin/sh
TWONKYDIR=/home/twonky/twonkyXXX

# Stop any twonky server that is already running
killall twonkystarter && sleep 5
killall -9 twonkystarter
killall -9 twonkyserver
killall -9 twonkymedia

APPDATADIR=${TWONKYDIR}/appdata
TWONKYLOG=${APPDATADIR}/twonkyserver-log.txt
TWONKYSRV=twonkystarter

cd ${TWONKYDIR}

## Create a directory for working files (-p for 'if not existing already'):
mkdir -p "${APPDATADIR}"

# Use a command line option to specify the location of the application data
# (which includes the ini file) and log file:
"./$TWONKYSRV" -logfile "${TWONKYLOG}" -appdata "${APPDATADIR}"

# If -appdata is not given on the command line and the user running twonky has a home
# directory then .twonky is created in the home directory and used for appdata.

# If Upload is enabled but no upload folders are specified then a directory 
# Twonky will be created and used for music, photo and video uploads

egorlopatin
Posts: 2
Joined: Thu Jun 28, 2018 9:40 am
AV Hardware: Twonky server on PC

Re: Good practice for upgrading?

Post by egorlopatin » Tue Jul 03, 2018 10:51 am

Hi,

I'm sorry for the delay in replying.

Oh dear, I use Twonky on my PC with Ubuntu 16.04, so my start/stop script is pretty simple, but should feet to systemd start manager and it looks like this:

Code: Select all

$ cat /usr/lib/systemd/user/twonky.service
[Unit]
Description=Twonky Server
After=network.target

[Service]
Type=simple
ExecStart=/usr/lib/twonky/twonkyserver \
    -inifile %h/.twonky/twonkyserver/twonkyserver.ini \
    -logfile %h/.twonky/twonkyserver/twonkyserver.log \
    -appdata %h/.twonky/twonkyserver/
Restart=always
WorkingDirectory=/usr/lib/twonky

[Install]
WantedBy=default.target
Then, each user can enable it and make autostart with common systemd, like (not from root, but common system user you use when OS is loaded):

Code: Select all

$ systemctl --user enable twonky
$ systemctl --user start twonky


So in this situation you config files and appdata will store in your user profile. It is very comfortable. So when you update Twonky you just need to do (for your twonky installation path, sure and with system user permissions):

Code: Select all

# mkdir /usr/lib/twonk851
# ln -s /usr/lib/twonky /usr/lib/twonky/851
So each Twonky installation is stored in its own directory and what you need to do to change version, to recreate the simlink.
I actually do not know if it feet your installation on a NAS, but you may modify start and stop script with my example of start command arguments (ExecStart). If you have just one system user, you may set ini file path in the start script.

I hope I helped you a little bit.

--
Regards,
Egor L

Post Reply