planning of distributed environment and sample installation
no playground for lone warriors!
VdrAssistant major goal is not the power of individual tools, but the seamless cooperation of all tools. That means, VdrAssistant consists itself of several components and additionally it uses a lot of external tools. You'll need an understanding of the workflows and roles of the tools to tap the full potential of VdrAssistant.
All components have been developed on Linux and for Linux. So - where ever external tools are used, you'll need a linux system. The command center is a java-GUI application, that may run on any platform that supports java GUI applications. Window Systems - especially those after XP are known to not really support java - therefor another command center exists, that runs in a browser. Of cause, not all of the java-GUI can be exported to the webapp. Just a sample: where the epgmanager in the java GUI performs quite well with 60,000 records showing, the webapp breaks/freezes with a few hundred records. So only basic functionality can be offered to the webapp - but that webapp should help over the parts, where windows breaks the java app.
Naturally all components can be installed to the same host, but that's no interest in this story. The sample installs the complete functionality. Of cause you can choose smaller footprints.
the sample environment
is a SOHO-network (we use sample as domain name) with the network adresses being part of the IP-segment 192.168.178.# and these machines:
VDR-Daemon is an Intel PIII/500 MHz with 3 DVB-Budget cards, that wakes up timerbased and which shutdown automatically. This machine has wake-on-lan enabled, is called vdrd.sample and has the IP-address 3. The NAS-drive will be mouted at /video0 using nfs as protocol.
NAS-Server is an Intel-Atom with low-power raid6 of 6 harddisks, that runs 24/7. This machine is called nas.sample and has the IP-address 2. The raid-system (/dev/md0) is mounted at /srv/pool0 and added to /etc/exports, so the raid will be exported via nfs.
VDR-Client is an AMD Phenom II X4 965, that drives the xineliboutput frontend for the VDR. übernimmt. The VDR-Daemon is triggered to wakeup as needed. The VDR-Client has wake-on-lan enabled too. That machine is called vdrc.sample and has the IP-Address 4. The NAS-drive will be mounted at /media/video/nas and /var/lib/video is a softlink to /media/video.
Desktop is a Netbook, which is attached to the network by WLAN. The Netbook is called master.sample and has the IP-address 5.
All machines got openssh-server installed, so we can use the Netbook as terminal to all machines. For this exercise all machines have a standard user with the id of "alice".
planning the installation
As the number of machines in our network is very manageable, we use static IP-addresses. This has the benefit, that the machine is faster on coming up and we avoid getting troubles with systemservices on lease-update. In this exercise I use Debian as Linux-system. If you use a different linux package-names may differ and of cause, configuration of package-managers may differ too.
First we create a file that holds all IP-addresses and machine names:
127.0.0.1 localhost.sample localhost
192.168.178.1 router.sample router
192.168.178.2 nas.sample nas
192.168.178.3 vdrd.sample vdrd
192.168.178.4 vdrc.sample vdrc
192.168.178.5 master.sample master
That file will be copied to all machines as
/etc/hosts.
The payload of a database is considered small, so we put the database at the NAS-server. That way the data is always accessible. The components of VdrAssistant are distributed by CPU-power and usage:
vdrproxy will be installed at the VDR-Daemon
Recording-Manager-Service and EPG-Importer will be installed at the NAS-Server
Job-Processor will be installed at the VDR-Client
the command-center will be installed at the Desktop
Finally we need to check the dependencies:
NAS-Server - needs sun-java6-jre, handbrake-cli and genindex for the recordingmanager-service, as well as dialog and sudo for the installer.
VDR-Client - needs sun-java6-jre, imagemagick, mjpegtools, transcode, m2vrequantiser, dvdauthor, handbrake-cli, genisoimage and dialog and sudo for the installer. As the NAS-Server hosts the database, we'll need a mysql-client.
Desktop - needs sun-java6-jre. If VdrAssistant shall be used to burn iso-images to disk, you'll need dvd+rw-tools and eject too. If you like to mount recordings to directly manipulate them by VdrAssistant you'll need genindex.
preparing the installation
We use our Netbook as terminal to all machines and use ssh to connect. As the desktop is better suited for humans, we create helper-files, which we'll use later at installing each machine. We're logged into the Desktop being "alice".
Download the VdrAssistant-Installers:
- VdrAssistant-0.1.###.run
- VdrAssistant-0.1.###.jar
- vdrproxy-0.1.###.run
The package sun-java6-jdk is part of the "non-free"-area at debian repositories, so we need to extend the configuration of the package managers. All machines need this extensions, so we create a script (setup.sh), that does the job:
#!/bin/bash
cat > /etc/apt/sources.list << EOF
deb http://ftp.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.debian.org/debian/ squeeze main contrib non-free
deb http://security.debian.org/ squeeze/updates main contrib non-free
deb-src http://security.debian.org/ squeeze/updates main contrib non-free
deb http://www.backports.org/debian squeeze-backports main contrib non-free
deb http://ftp.debian.org/debian/ squeeze-proposed-updates contrib non-free main
deb-src http://ftp.debian.org/debian/ squeeze-proposed-updates contrib non-free main
EOF
# add debian-multimedia Repository
wget --quiet http://www.debian-multimedia.org/pool/main/d/debian-multimedia-keyring/debian-multimedia-keyring_2008.10.16_all.deb
dpkg -i debian-multimedia-keyring_2008.10.16_all.deb
echo "deb http://www.debian-multimedia.org squeeze main non-free" > /etc/apt/sources.list.d/debian-multimedia.org.list
# add e-tobis Repository
wget --quiet http://e-tobi.net/vdr-experimental/pool-lenny/binary/base/e-tobi-keyring_2008.03.08_all.deb
dpkg -i e-tobi-keyring_2008.03.08_all.deb
cat > /etc/apt/sources.list.d/e-tobi.net.list << EOF
deb http://e-tobi.net/vdr-experimental squeeze base backports addons vdr-multipatch
deb-src http://e-tobi.net/vdr-experimental squeeze base backports addons vdr-multipatch
EOF
# packages from e-tobi have priority
cat >> /etc/apt/preferences << EOF
Package: *
Pin: release o=e-tobi.net
Pin-Priority: 1001
EOF
apt-get update
Afterwards we create a file for each machine, that contains all packages to install. We start with
nas.pkgs:
sun-java6-jdk
nfs-kernel-server
handbrake-cli
genindex
dialog
sudo
mysql-server
Next is
vdrc.pkgs:
sun-java6-jdk
nfs-common
imagemagick
mjpegtools
transcode
m2vrequantiser
dvdauthor
handbrake-cli
genisoimage
dialog
sudo
mysql-client
nfs-kernel-server
Last not least
master.pkgs:
sun-java6-jdk
nfs-common
dvd+rw-tools
eject
genindex
this is the most simple installation. We copy the installer vdrproxy-0.1.###.run to the vdrd-host:
scp hosts vdrproxy-0.1.###.run root@vdrd.sample:.
Afterwards we start the terminal session with
and run the installer. But before that, we move the
hosts-file to the right location:
mv hosts /etc
./vdrproxy-0.1.###.run
at the question "Please enter the hostname that runs the EPG-importer." we enter
nas.sample. The question "allow destop to access vdrproxy?" we enter
y and as name of the desktop host we enter
master.sample.
After the installation there's a startscript at /etc/init.d called vdrproxy. That script is upstart-capable - so if you like, you can add vdrproxy to your autostart sequence.
installing the NAS-Server
is a bit more comprehensive, so lets start with the system components
scp hosts setup.sh nas.pkgs VdrAssistant-0.1.###.run root@nas.sample:.
ssh root@nas.sample
After entering the password, we're logged into the NAS-host at the home directory of root. There we enter these commands:
mv hosts /etc
chmod +x setup.sh
./setup.sh
apt-get install $( < nas.pkgs )
Afterwards we edit
/etc/sudoers and add the standard NAS-user.
Before we start, we need to enable access to the database engine, so we edit
/etc/mysql/my.cnf and search the key "bind-address" (probabely between row 45 and 50). The value of bind-address is 127.0.0.1 normally. We change that to the IP-address of the NAS-server
192.168.13.2.
If you don't want to have an uptime of 24/7, you really want to use static IP-address (/etc/network/interfaces). If not, you may run into troubles on startup, when there's no IP-address and the mysql-server is going to start - so it will fail and you end with a system without database.
Any changes to /etc/network/interfaces require a system reboot.
If you don't change /etc/network/interfaces, you only need to restart the database engine:
/etc/init.d/mysql stop
/etc/init.d/mysql start
The recordingmanager-service needs a fast temporary storage, so we build a ramdisk. That's quite easy - we only have to add a new entry to
/etc/fstabat
none /ramdisk tmpfs size=64m 0 0
If you don't wonna reboot, you can enable the ramdisk by manually mounting it:
mkdir /ramdisk
mount /ramdisk
Now we're ready to start the bash-installer of VdrAssistant. But as it should not be startet being root, we change the login to the standard user
mv VdrAssistant-0.1.###.run /home/alice
chown alice /home/alice/VdrAssistant-0.1.###.run
su - alice
export JAVA_HOME='/usr/lib/jvm/java-6-sun'
./VdrAssistant-0.1.###.run
The "-" following the su command means, that we want an environment similar to standard login for that user. We choose to install the services "SRSrvEpgProcessor" and "SRSrvRecordingManager". At the settings page we hit ENTER on "DBServer" to open the dialog of database settings. There we change the password for the applications database user. Please keep that password in mind, as we need it at installation time of the other machines too.
Enter
/srv/pool0 as recording root.
You may want to have a look at VDRs charset, wich will be used at EPG-data import and to translate info files.
Executing the installer the first time, the installation will fail with a hint about user cannot access database. That's quite OK, cause we don't have a database yet. The installer remarks, that it created a script at the home directory to create the database. We close the installer and execute that script:
The script asks 2 times the password of the databases root-user. Afterwards we have a database and an application user. The password of the application user is readable in the script, so we delete it as soon as possible. Then we start the bash-installer again:
rm createDB.sh
./VdrAssistant-0.1.###.run
This time, the installer should create all database objects and terminate without errors. At the installation target directory there's a file be.filelist which contains all files and directories created during installation. So if you like to remove VdrAssistant, you only have to remove all entries from that file. To remove the database stuff too, you'll need to execute
mysql -u root -p
drop database dbVdrAssistant;
quit;
and you're done :)
Find a start script "SRServiceManager at /etc/init.d. That script is upstart compatible and should work in recent linux systems. If you add that script to your autostart sequence, you can manage your VdrAssistant services using just the command center.
Last not least we need to allow access to the pool of recordings. So we leave the user environment with exit and continue system administration:
cat >> /etc/exports << EOF
/srv/pool0 192.168.178.1/24(rw,sync,no_subtree_check)
EOF
exportfs -rav
The recordings need to match userid and groupid to enable the services to do their job. Userid and groupid should be checked periodically, so we create a script which we run subsequently:
cat >> /usr/sbin/checkRecordings.sh << EOF
chgrp -R vdrassist /srv/pool0
chmod -R g+w /srv/pool0
EOF
chmod +x /usr/sbin/checkRecordings.sh
checkRecordings.sh
If you like to, you can add that script to crontab to execute it periodically (once a day).
installing the VDR-Client
We start again with the installation of the system components.
scp hosts setup.sh vdrc.pkgs VdrAssistant-0.1.###.run root@vdrc.sample:.
ssh root@vdrc.sample
After entering the password, we're logged into the VDR-client at the home directory of root. There we enter these commands:
mv hosts /etc
chmod +x setup.sh
./setup.sh
apt-get install $( < vdrc.pkgs )
Afterwards we edit
/etc/sudoers and add the standard VDR-client user.
To mount the recordings pool, we create the mountpoint
mkdir -p /media/video/nas
and add an entry to
/etc/fstab so the recordings pool will be mounted at system start:
nas.sample:/srv/pool0 /media/video/nas nfs defaults,timeo=14,vers=3,intr 0 0
Subsequentially we mount the recordings pool:
Now we're ready to start the bash-installer of VdrAssistant. But as it should not be startet being root, we change the login to the standard user
mv VdrAssistant-0.1.###.run /home/alice
chown alice /home/alice/VdrAssistant-0.1.###.run
su - alice
export JAVA_HOME='/usr/lib/jvm/java-6-sun'
./VdrAssistant-0.1.###.run
We choose the service "SRSrvJobProcessor" to install and at the settings page we hit
ENTER at "DBServer" to access the dialog of database settings. There we change DB-Server to
nas.sample and enter the DB-password we used to create the applications database user on the NAS-server. Using
Enter again, we close the database settings and return to common settings. There, the entry "
Database - create and setup" should have disappeared.
Let's check all external tools and directories bevor we start installation.
At this machine, the installation should succeed at first run. Find the start script "SRServiceManager" at /etc/init.d again. The installation protocol has been created at the installation target directory as file "be.filelist".
To use conversion target DVD, its necessary to share recordings as well as images and fonts, that will be used by the menue themes. To avoid out of sync troubles, we allow the desktop to access our standard locations for shared images and fonts.
mkdir /media/images
mkdir /usr/share/fonts/truetype/vashared
cat >> /etc/exports << EOF
/media/images master.sample(rw,sync,no_subtree_check,no_root_squash)
/usr/share/fonts/truetype/vashared master.sample(rw,sync,no_subtree_check,no_root_squash)
EOF
exportfs -rav
Both directories are stil empty, but when you place the images and fonts into thes directories from the desktop, the job-processor can access them immediately.
Lets start again with the system components. As we're using the desktop we don't need terminal-access via ssh. For system administration we only need superuser privileges. So we use su, but without the "-" parameter ...
chmod +x setup.sh
su
cp hosts /etc
./setup.sh
apt-get install $( < master.pkgs )
Subsequently we edit
/etc/sudoers and add the standard desktop-user. We leave the superuser-environment with
exit.
This time we don't use the bash-installer, but the java installer. This installer shall be executed as standard user too.
java -jar VdrAssistant-0.1.###.jar
At the database settings we enter
nas.sample as database host and change username and password to the values used at installing the NAS-server. We choose
/opt as installation target and select the option "install application files via sudo?" as well as the option "install configuration-files via sudo?".
When the directories are checked and no errors pending, we start installation.
This time the installation protocol is called fe.filelist.
After the installer has finished successfully, we leave it and move into the installation target directory and from there into the sub-directory vdrassistant. There we start the command center:
cd /opt/vdrassistant
java -jar VdrAssistant.jar
First you want to check and probe all settings. When you're done, close the application - which will save the settings.
We start a new superuser environment by using su. To share images and fonts with the job-processor, we mount the exported directories from VDR-client. It is important, that the paths from VDR-client and Desktop are the same, as there's no path-conversion (yet).
su
mkdir /media/images
mkdir -p /usr/share/fonts/truetype/vashared
echo >> /etc/fstab << EOF
vdrc.sample:/media/images /media/images defaults,timeo=14,vers=3,intr 0 0
vdrc.sample:/usr/share/fonts/truetype/vashared /usr/share/fonts/truetype/vashared defaults,timeo=14,vers=3,intr 0 0
EOF
If you own Windows grafic applications like "Corel Draw" or "Photoshop" you might want to grab all *.ttf files from Windows and copy them to the font-directory
/usr/share/fonts/truetype/vashared. So all these fonts may be used at your DVD menue templates.
If you like to, you may mount the recordings pool too. We prepare the mountpoint with
mkdir -p /media/video/nas
echo >> /etc/fstab << EOF
nas.sample:/srv/pool0 /media/video/nas noauto,timeo=14,vers=3,intr 0 0
EOF
This time we don't use the "defaults" option, but the "noauto" option. That means, that the recordings pool will not be mounted at system start. As the Desktop is a Netbook, it will be quite common, that it is powered on without access to the home network.
When you like to use the direct access to the recordings pool execute:
we left the superuser environment with exit and check the running servicemanagers from NAS-server and VDR-client:
ssh root@nas.sample
/etc/init.d/SRServiceManager start
exit
ssh root@vdrc.sample
/etc/init.d/SRServiceManager start
exit
Subsequently we start the command center
cd /opt/vdrassistant
java -jar VdrAssistant.jar
Open the preferences dialog and choose the services-page. To watch the services, we open a terminal session to the NAS-server and activate an automatic log viewer:
ssh root@nas.sample
cd /var/log
tail -f ServiceManager0-0.log
Move that terminal to a screen position, where you can watch the log output parallel to the command center. Select the EPG-Importer service and press the button with the starting rocket. The smiley opens its eyes dozily. Watching the log output you'll see the start of the service - may be you have to wait a minute.
When the servicemanager has started a service, that service will create its own logfile (in this case /var/log/srvEpgImporter.log).
Lets select the RecManager-service and press the starting rocket again. Same play - the smiley opens dozily its eyes and (after a while) the servicemanager starts the service.
That's the point, where we may start the scanning of the recordings. Activate the terminal window and stop the log output by hitting "Ctrl-C". We're interested in the log output from the recordingmanager service, so we execute
tail -f srvRecManager0-0.log
We close the preferences dialog from the command center and activate the recording managers view. There's a toolbar button with a magnifier surrounded by paws - lets press it to start the scan of the recordings. You might have to wait a minute until the recordingmanager-service starts its job. Watching the log output you can see, what the recordingmanager-service is doing and whether the scan has completed successfully.
When the recordingmanager-service logs, that the scan has completet successfully we load the recordings in the recording manager view of the command center. Its the button with the blue opened folder.
When the list of recordings appears, ... congratulation!
Your installation hat been terminated successfully and the components play together.