Running multiple instances of Firefly Media Server

Tagged:  •    •  

I recently bought the fantastic Roku Soundbridge Radio for streaming internet radio and MP3s over the network. It works really well and is a welcome replacement for the old CD player in the kitchen. For the backend server (running on my MythTV box) I'm running the open-source Firefly Media Server which uses the DAAP protocol. After setting it up I discovered I really needed two servers; one for my own collection of MP3s and one for my partners. After a bit of googling and a couple of hours fiddling I now have two seperate mt-daapd processes running, serving up two collections of MP3s. This guide was written using Ubuntu Hardy Heron but it should be pretty easy to adapt to other versions of Ubuntu or other distros.

Firstly you'll need to have a seperate config file for the second server.Run the following commands:

cp /etc/mt-daapd.conf /etc/mt-daapd-<server_name>.conf
cp /etc/mt-daapd.playlist /etc/mt-daapd-<server_name>.playlist

Now edit the configuration file and make sure you change all of the following properties:

  • port - 3690 should do.
  • db_parms - This is the folder containing the Sqlite database for your collection. I suggest you postfix the existing path with '-<server_name>'.
  • mp3_dir - point to your collection.
  • servername - change to a distinct name so you can tell them apart.
  • logfile - if you have logging enabled then make sure you log to a different file. Again I suggest postfixing with '-<server_name>'.
  • playlist - point to the playlist file you created in the previous step.

Note that mt-daapd will create a sqlite database if one doesn't already exist but you will need to create the containing folder if it doesn't already exist and ensure it has the correct permissions (have a look at the permissions on the existing folder).

Now you need to test the new configuration works. With your first server still running, execute the following command:

 mtdaapd -c /etc/mt-daapd-<server_name>.conf

If everything has worked then running 'ps -ef | grep mt-daapd' should reveal two mt-daapd processes are running. You should now be able to test that both of them are working using a daapd client such as Rhythmbox.

Next we need to create an init.d script to start and stop the server:

 sudo cp /etc/init.d/mt-daapd /etc/init.d/mt-daapd-<server_name>

Edit /etc/init.d/mt-daapd-<server_name> and add the following to the properties near the top:

DAEMON_OPTS="-c /etc/mt-daapd-<server_name>.conf"

Change the NAME and DESC properties as follows:

NAME=mt-daapd-<server_name>
DESC=mt-daapd-<server_name> 

Now edit /etc/init.d/mt-daapd and add the following:

DAEMON_OPTS="" 

This ensures that if you start the new server before the old the DAEMON_OPTS property will be reset.

Finally we need to make sure our new server is started at boot time:

cd /etc/rc0.d
ln -s /etc/init.d/mt-daapd-<server_name> K25mt-daapd-<server_name>
cd /etc/rc1.d 
ln -s /etc/init.d/mt-daapd-<server_name> K25mt-daapd-<server_name> 
cd /etc/rc2.d 
ln -s /etc/init.d/mt-daapd-<server_name> S25mt-daapd-<server_name> 
cd /etc/rc3.d 
ln -s /etc/init.d/mt-daapd-<server_name> S25mt-daapd-<server_name>  
cd /etc/rc4.d 
ln -s /etc/init.d/mt-daapd-<server_name> S25mt-daapd-<server_name>  
cd /etc/rc5.d 
ln -s /etc/init.d/mt-daapd-<server_name> S25mt-daapd-<server_name>  
cd /etc/rc6.d 
ln -s /etc/init.d/mt-daapd-<server_name> K25mt-daapd-<server_name> 

And that's it. Obviously repeat these steps with a different server name if you want even more servers. Let me know if this guide is useful or if you run into any problems.