I want to run several instances of Squeezebox Server from one or more SVN checkouts. Are there any special considerations when doing this? File permissions, etc.?
I'm running Ubuntu 8.04 Server. Where are the various SbS directories generally located?
- server (installation)
- cache
- logs
- music
- playlists
- prefs
What about startup scripts for running these SbS as services? Are there examples somewhere?
Results 1 to 10 of 11
Thread: Running from SVN
-
2010-01-07, 16:25 #1Senior Member
- Join Date
- Apr 2005
- Location
- Colorado
- Posts
- 10,073
Running from SVN
-
2010-01-07, 22:23 #2Senior Member
- Join Date
- Oct 2005
- Posts
- 2,769
Concurrently (virtual IPs?) or just running one at a time? I have separate shell scripts to launch different checkouts (generally trunk of 7.3, 7.4, and 7.5) -- one at a time. On my prod server I use a sym link to determine the default, and a homegrown init script to launch SBS as a special user account. I haven't used the official packaged version in years; all my stuff is in dirs like /home/slimuser/subversion-7.3-trunk/server/. My "slimuser" does/owns the checkouts, so no permissions worries (and not much worry about a bug wrecking something else). All these are i386 or x86_64 with ia32-libs installed, and I've not had to compile anything or install extra perl libs, just use what's in the checkout.
http://www.tux.org/~peterw/
Note: The best way to reach me is email or PM, as I don't spend time on the forums.
Free plugins: AllQuiet Auto Dim/AutoDisplay BlankSaver ContextMenu DenonSerial
FuzzyTime KidsPlay KitchenTimer PlayLog PowerCenter/BottleRocket SaverSwitcher
SettingsManager SleepFade StatusFirst SyncOptions VolumeLock
-
2010-01-07, 23:00 #3
Running from SVN
> I'm running Ubuntu 8.04 Server. Where are the various SbS directories
> generally located?
When you're running from SVN you'll have to define them yourself. By default it will try to create cache/prefs folders etc. below the folder where slimserver.pl is stored.
> What about startup scripts for running these SbS as services? Are
> there examples somewhere?
http://wiki.slimdevices.com/index.ph...StartupScripts
--
Michael
-
2010-01-07, 23:08 #4Senior Member
- Join Date
- Apr 2005
- Location
- Colorado
- Posts
- 10,073
Thanks, that helps some. On Linux do all services either run under an account that you've created, unlike Windows, which has generic SYSTEM accounts and such? How are services launched at startup and what does a basic script to do this look like?
I'll be running each instance on a different IP address, which is what I've been doing on Windows. It was easy enough to bind all the necessary addresses to the network interface, so that's taken care of.
In Windows I have a directory tree setup for all of the different instances' folders - cache, logs, music, playlists and prefs - with each one named using the last octal of the IP address. Normally I have three or four severs running at any given time, but have run more.
/squeeze
../21
../../cache
../../logs
../../music
../../playlists
../../prefs
../22
../../cache
../../logs
../../music
../../playlists
../../prefs
../23
etc.
The music folders in this directory structure contain only links. I gather that this isn't exactly how it's done in the *nix world, with logs going in /var/log and prefs in /etc and similar conventions. Where should cache, music, and playlists be placed?
I'd probably do something like
/var
../log
../../squeeze
/../../../21
/../../../22
/../../../23
etx.
-
2010-01-08, 00:15 #5
When I like to run several SBS's as services I've started to use VirtualBox virtual machines, if you install Ubuntu Server and selects the installation option for a virtual machine it's pretty slim so it doesn't use too much extra resources. I think the plain OS works with 128MB memory assigned to the virtual machine, possibly even less. The advantage with using virtual machines is that you can use the standard installation scripts if you like to.
This is what I have in my environment:
1.
A virtual machine which runs a standard SBS 7.4.1 installed with apt-get
2.
A virtual machine which runs svn version of 7.5, this has a row like this in /etc/rc.local
And the squeezecenter75 script which is in /home/myuser/bin looks like this:Code:su - myuser -c "screen -S squeezecenter75 -d -m squeezecenter75"
I've selected to put the prefs dir under /home because that what's included in my regular backups.Code:#!/bin/sh export PERL5LIB=$PERL5LIB:/opt/squeezecenter75:/opt/squeezecenter75/CPAN export PATH=/opt/squeezecenter75:$PATH slimserver.pl --cachedir /var/lib/squeezecenter/Cache75 --prefsdir /home/myuser/Configurations/Prefs75 --logdir /var/lib/squeezecenter/Logs75 $*
The /opt/squeezecenter75 directory is just svn checkout of http://svn.slimdevices.com/repos/slim/7.5/trunk/server/
3.
On the development machine which is also a VirtualBox virtual machine I don't run them as sevices, I just start the server I like to start manually in a terminal window.
In the development setup I have a script like the squeezecenter75 script mentioned above for each configuration I like to have easy access to. For example, a squeezecenter75_small script that points to a specific prefs directory which is configured towards a Music Folder with just a few albums.
The standard debian installation scripts puts "log", "cache" and "prefs" all under /var/lib/squeezeboxserver, so I'm guessing you should do the same if you like to have a setup as similar to a real installation as possible. If you like a fully linux compliant installation, you probably want the "log" dir somewhere under /var/log/Erland Isaksson (My homepage)
(Developer of many plugins/applets (both free and commercial).
If you like to encourage future presence on this forum and/or third party plugin/applet development, consider purchasing some plugins)
You may also want to try my Android apps Squeeze Display and RSS Photo Show
Interested in the future of music streaming ? ickStream - A world of music at your fingertips.
-
2010-03-01, 03:08 #6Senior Member
- Join Date
- Apr 2005
- Location
- Colorado
- Posts
- 10,073
Out of curiosity I installed the SbS 7.5 deb package, just to see where things are normally installed and to see the default file ownerships ans startup script. It certainly is scattered about, isn't it?
Questions:Code:Program - - - - - - - - - - - - - - - - - - - - - - - - /usr/sbin/squeezeboxserver (owner: root) /usr/sbin/squeezeboxserver_safe /usr/sbin/squeezeboxserver-cleanup /usr/sbin/squeezeboxserver-scanner /usr/share/squeezeboxserver/ (owner: root) /usr/share/squeezeboxserver/strings.txt /usr/share/squeezeboxserver/bin /usr/share/squeezeboxserver/CPAN /usr/share/squeezeboxserver/Firmware /usr/share/squeezeboxserver/Graphics /usr/share/squeezeboxserver/HTML /usr/share/squeezeboxserver/IR /usr/share/squeezeboxserver/lib /usr/share/squeezeboxserver/Plugins -> /var/lib/squeezeboxserver/Plugins /usr/share/squeezeboxserver/MySQL /usr/share/squeezeboxserver/SQL Data and configuration (Cache, Prefs, Plugins) - - - - - - - - - - - - - - - - - - - - - - - - /var/lib/squeezeboxserver/ (owner: squeezeboxserver) /var/lib/squeezeboxserver/cache /var/lib/squeezeboxserver/Plugins /var/lib/squeezeboxserver/prefs convert.conf - - - - - - - - - - - - - - - - - - - - - - - - /etc/squeezeboxserver/ (owner: squeezeboxserver) /etc/squeezeboxserver/convert.conf Logs - - - - - - - - - - - - - - - - - - - - - - - - /var/log/squeezeboxserver/ (owner: squeezeboxserver)
Why is convert.conf given its own directory in /etc/?
What's the purpose of placing the four main executables in /usr/sbin/ and all the rest of the program's files in /usr/share/squeezeboxserver/?
Why are slimserver.pl and scanner.pl renamed? I notice that /usr/sbin/ contains no subdirectories. Instead of placing the four SbS executables in a /usr/sbin/squeezeboxserver/ subdirectory, /usr/sbin/ is all just one flat directory. I suppose that might explain the renaming, as 'scanner' could be anything and creating a filename conflict would be easy.
Obviously there are some philosophical aspects of all this that I haven't fully grasped.
-
2010-03-01, 11:46 #7
Philosophical questions as to the installation layout on linux distros ought to be directed to fletch, who, I believe, has changed his user profile name to Mark Markis now that he's a logitech employee: http://forums.slimdevices.com/member.php?userid=529
That said, I run a couple of different svn versions on my Fedora 12 box. The svn code is installed to, e.g.:
sbs7.5 embedded: /usr/share/squeezeboxserver_trunk/server
I keep the cache & prefs in:
/var/lib/squeezeboxserver_trunk
I keep the logs in:
/var/log/squeezeboxserver_trunk
For startup scripts, I install the "released version" and then copy the /etc/init.d/squeezeboxserver startup script to /etc/init.d/squeezeboxserver_trunk. I then modify that file so as to reference slimserver.pl.
I also copy the /etc/sysconfig/squeezeboxserver file to /etc/sysconfig/squeezeboxserver_trunk and modify it to point to the correct paths.
Eventually, I automated this whole process of downloading and setting up a new svn instance plus creating the runtime startup scripts into a single setup script. This script is for fedora, so you'd need to tweak some of this for Ubuntu.
Code:#!/bin/sh # Script to install the Squeezebox Server svn code to run as a service on Fedora and other RH like distros. # # Prerequsite: squeezeboxserver must first be installed via yum or from a rpm. # # After running this script, you can (if you want or need to) safely uninstall squeezeboxserver: 'yum erase squeezeboxserver' or 'rpm -e squeezeboxserer' user=`whoami` if [ "$user" != "root" ] then echo 'Error: This script needs to be run with root cridentials,' echo "either via # sudo $0" echo 'or under su.' exit fi # Uncomment the desired branch: # Release (source of official 7.4 release) #SOURCEREPO='http://svn.slimdevices.com/repos/slim/7.4/branches/7.4.0/server' # Testing (a.k.a 7.4.x, source of nightly releases after official 7.4 release?) #SOURCEREPO='http://svn.slimdevices.com/repos/slim/7.4/trunk/server' # Unstable (source for future touch release?) #SOURCEREPO='http://svn.slimdevices.com/repos/slim/7.5/trunk/server' SOURCEREPO='http://svn.slimdevices.com/repos/slim/7.5/branches/embedded/server' # Installation name: This will be the name of the installed service and determines the names of many folders. # You can change this to anything that strikes you as more descriptive. E.g.: 'sbs75_trunk' or whathaveyou. INSTNAME='squeezeboxserver_trunk' # Destination. This is where the code gets downloaded to.. DESTREPO="/usr/share/$INSTNAME/server/" function pause(){ read -p "$*" } if [ -e "/usr/share/$INSTNAME/server" ] then echo "$INSTNAME is already installed!" echo "Updating $INSTNAME code.." if [ ! -e "/var/log/$INSTNAME" ] then mkdir "/var/log/$INSTNAME" fi svn up "/usr/share/$INSTNAME" >> "/var/log/$INSTNAME/svn.log" #exit 1 fi echo ' ' echo "This script installs the Squeezebox Server svn code as the $INSTNAME service." echo ' ' echo "The source for the svn checkout will be $SOURCEREPO" echo ' ' echo "The destination for the svn code will be $DESTREPO" echo ' ' echo ' ' echo 'For this script to work, this machine MUST already have a working copy of' echo 'squeezeboxserver that was previously installed via yum or rpm.' echo ' ' pause 'Press Enter to continue, or ctrl-c to abort..' if [ ! -e '/usr/share/squeezeboxserver' ] then echo 'Error: squeezeboxserver v7.4 or greater must be installed via yum or rpm first!' pause 'Press Enter to exit.' exit 1 fi szSCStatus=`/sbin/service squeezeboxserver status` if (( $(echo $szSCStatus | egrep -c "running...") >= 1 )) then /sbin/service squeezeboxserver stop fi echo "Creating directory for $INSTNAME.." mkdir "/usr/share/$INSTNAME" echo 'Preparing the log dir..' mkdir "/var/log/$INSTNAME" echo 'Downloading SqueezeboxServer svn code..' echo 'This can take a LONG time...30 minutes or more.' echo 'Please be patient. The script will continue when the svn checkout is complete.' echo ' ' echo "You can the monitor progress of the checkout by viewing the /var/log/$INSTNAME/svn.log file.." echo ' ' echo 'Downloading svn code now..' /bin/date > "/var/log/$INSTNAME/svn.log" svn co "$SOURCEREPO" "$DESTREPO" >> "/var/log/$INSTNAME/svn.log" echo "Preparing /etc/sysconfig/$INSTNAME.." echo "# Edit this to suit your setup SQUEEZEBOX_USER=\"squeezeboxserver\" SQUEEZEBOX_HOME=\"/usr/share/$INSTNAME/server\" SQUEEZEBOX_CFG_DIR=\"/var/lib/$INSTNAME/prefs\" SQUEEZEBOX_LOG_DIR=\"/var/log/$INSTNAME\" SQUEEZEBOX_CACHE_DIR=\"/var/lib/$INSTNAME/cache\" SQUEEZEBOX_CHARSET=\"utf8\" SQUEEZEBOX_ARGS=\"--daemon --prefsdir=\$SQUEEZEBOX_CFG_DIR --logdir=\$SQUEEZEBOX_LOG_DIR --cachedir=\$SQUEEZEBOX_CACHE_DIR --charset=\$SQUEEZEBOX_CHARSET\"" > "/etc/sysconfig/$INSTNAME" echo "Preparing new $INSTNAME service.." cp -f /etc/rc.d/init.d/squeezeboxserver "/etc/rc.d/init.d/$INSTNAME" # Use sed to change the details of our svn service startup script sed -i -e "s/# squeezeboxserver\s*Startup script for the Squeezebox Server$/# $INSTNAME\t\Startup script for the Squeezebox server svn code/" /etc/rc.d/init.d/$INSTNAME sed -i -e "s/Squeezebox server powers the Squeezebox/$INSTNAME powers the Squeezebox/" /etc/rc.d/init.d/$INSTNAME sed -i -e "s/# processname:\s*squeezeboxserver$/# processname:\t$INSTNAME/" /etc/rc.d/init.d/$INSTNAME sed -i -e "s/# config:\s*\/etc\/squeezeboxserver\/squeezeboxserver.conf$/# config:\t\t\/etc\/$INSTNAME\/squeezeboxserver.conf/" /etc/rc.d/init.d/$INSTNAME sed -i -e "s/# config:\s*\/etc\/sysconfig\/squeezeboxserver$/# config:\t\t\/etc\/sysconfig\/$INSTNAME/" /etc/rc.d/init.d/$INSTNAME sed -i -e "s/# Provides:\s*squeezeboxserver$/# Provides:\t\t$INSTNAME/" /etc/rc.d/init.d/$INSTNAME sed -i -e 's/# Short-Description:\s*Startup script for the Squeezebox Server$/# Short-Description:\tStartup script for the Squeezebox Server svn code/' /etc/rc.d/init.d/$INSTNAME sed -i -e "s/\s*SQUEEZEBOX_CONFIG=\/etc\/sysconfig\/squeezeboxserver$/\tSQUEEZEBOX_CONFIG=\/etc\/sysconfig\/$INSTNAME/" /etc/rc.d/init.d/$INSTNAME sed -i -e 's/\s*SQUEEZEBOX_BIN=\"\$SQUEEZEBOX_HOME\/squeezeboxserver\"$/\tSQUEEZEBOX_BIN=\"\$SQUEEZEBOX_HOME\/slimserver.pl\"/' /etc/rc.d/init.d/$INSTNAME sed -i -e "s/\s*LOCKFILE=\"\/var\/lock\/subsys\/squeezeboxserver\"/\tLOCKFILE=\"\/var\/lock\/subsys\/$INSTNAME\"/" /etc/rc.d/init.d/$INSTNAME sed -i -e "s/\s*echo -n \"Starting Squeezebox Server:\s*\"$/\t\techo -n \"Starting $INSTNAME: \"/" /etc/rc.d/init.d/$INSTNAME sed -i -e "s/\s*echo -n \"Stopping Squeezebox Server:\s*\"$/\t\techo -n \"Stopping $INSTNAME: \"/" /etc/rc.d/init.d/$INSTNAME sed -i -e 's/\s*killall squeezeboxserver$/ killall slimserver.pl/' /etc/rc.d/init.d/$INSTNAME #Create services on run levels 3 and 5 cd /etc/rc.d/rc3.d ln -s ../init.d/$INSTNAME ./S80$INSTNAME cd /etc/rc.d/rc5.d ln -s ../init.d/$INSTNAME ./S80$INSTNAME echo 'Preparing the data dir..' cp -R /var/lib/squeezeboxserver/ /var/lib/$INSTNAME/ sed -i -e "s/\/usr\/share\/squeezeboxserver\//\/usr\/share\/$INSTNAME\/server\//" /var/lib/$INSTNAME/prefs/server.prefs sed -i -e "s/\/var\/lib\/squeezeboxserver\//\/var\/lib\/$INSTNAME\//" /var/lib/$INSTNAME/prefs/server.prefs # Important for proper svn updating.. cp -R /usr/share/$INSTNAME/server/Plugins/ /var/lib/$INSTNAME/ rm -rf /usr/share/$INSTNAME/server/Plugins ln -s /var/lib/$INSTNAME/Plugins /usr/share/$INSTNAME/server/Plugins chown -h squeezeboxserver:squeezeboxserver /usr/share/$INSTNAME/server/Plugins echo 'Preparing the config dir..' cp -R /etc/squeezeboxserver /etc/$INSTNAME rm -f /etc/$INSTNAME/server.conf ln -s /var/lib/$INSTNAME/prefs/server.prefs /etc/$INSTNAME/server.conf echo 'Configuring logrotate..' cp -f /etc/logrotate.d/squeezeboxserver /etc/logrotate.d/$INSTNAME sed -i -e "s/\/var\/log\/squeezeboxserver\//\/var\/log\/$INSTNAME\//" /etc/logrotate.d/$INSTNAME echo 'Fixing file permissions..' chown -R squeezeboxserver:squeezeboxserver /etc/$INSTNAME chown -R squeezeboxserver:squeezeboxserver /usr/share/$INSTNAME chown -R squeezeboxserver:squeezeboxserver /var/lib/$INSTNAME chown -R squeezeboxserver:squeezeboxserver /var/log/$INSTNAME echo "Setting up the $INSTNAME service to autorun.." chkconfig squeezeboxserver off chkconfig --level 35 "$INSTNAME" on echo "Done! The Squeezebox Server svn code is ready to run as a service (daemon)." echo "Run the command \"service $INSTNAME start\" to start the service." echo ' ' echo "Run the command \"svn up $DESTREPO\" to update $INSTNAME." echo ' ' echo 'Enjoy!'Last edited by gharris999; 2010-03-02 at 10:24.
-
2010-04-24, 15:46 #8Senior Member
- Join Date
- Apr 2005
- Location
- Colorado
- Posts
- 10,073
Does anyone know the search path for convert.conf and custom-convert.conf when running on Linux? I'm still trying to figure out why convert.conf is sitting off by itself in /etc/squeezeboxserver and whether it would be found if located in /usr/share/squeezeboxserver. If you don't want to place it with the source files in /usr/share/squeezeboxserver, why not just use the prefs folder?
-
2010-04-24, 16:27 #9
I've always found, when running from the SVN code, that convert.conf (and any custom-convert.conf) needs to reside in the same directory as slimserver.pl. I don't know why...that's just seems to be the way it is.
-
2010-04-24, 16:58 #10
From server/Slim/Player/TranscodingHelper.pm:
..and server/Slim/Utils/PluginManager.pm dirsFor():Code:sub loadConversionTables { my @convertFiles = (); main::INFOLOG && $log->info("Loading conversion config files..."); # custom convert files allowed at server root or root of plugin directories for my $baseDir (Slim::Utils::OSDetect::dirsFor('convert')) { push @convertFiles, ( catdir($baseDir, 'convert.conf'), catdir($baseDir, 'custom-convert.conf'), catdir($baseDir, 'slimserver-convert.conf'), ); } foreach my $baseDir (Slim::Utils::PluginManager->dirsFor('convert')) { ...
..and .../Slim/Utils/OS/RedHat.pm dirsFor():Code:sub dirsFor { my $class = shift; my $type = shift; my @dirs = (); for my $name (keys %$plugins) { # FIXME: for the moment include strings for disabled plugins so the settings page works if ($type eq 'strings' || $prefs->get($name) eq 'enabled') { push @dirs, $plugins->{$name}->{'basedir'}; } } return @dirs; }
So...if OS == RedHat, Slim::Utils::OSDetect::dirsFor('convert') returns "/etc/squeezeboxserver".Code:... } elsif ($dir =~ /^(?:types|convert)$/) { push @dirs, "/etc/squeezeboxserver"; ...
Not sure what Slim::Utils::PluginManager::dirsFor('convert') returns.
It looks like the convert.conf location is hard coded and OS dependent. And I'm not sure why I'm thinking that slimserver.pl picks it up in .../server, except that that's where it's found in the svn.

Reply With Quote

