New Server – Streaming Help Needed!
Help Radio Rivendell!Elrond
44714 XP
Updated 3 January 2016 (14:51)
Daften
843 XP
Tyler Max
732 XP
-
#idontloginoften
Pinwheel
12182 XP
Mekkis
195 XP
Mekkis
195 XP
Underhill
438 XP
Arclayn
923 XP
Hello there,
It's been very quiet in my office without Radio Rivendell, and since you've asked for IT advice -- I created an account to help out.
Where I work (as a software engineer and programmer) is primarily served by Ubuntu Linux. First advice I have is please do not use Ubuntu 15.10. That is one of Canonical's short term releases that are abandoned after 9 months. These aren't meant to be put online for great lengths of time.
The most recent "long term release" (supported for five years) is 14.04, which came out in April 2014. The next will be 16.04, due out this April. But even 14.04 has three more years of official support left.
I took a quick look and saw that Icecast is easily available and installable to Ubuntu 14.04 via apt-get.
sudo apt-get install icecast2
Unfortunately, my knowledge of hosting streams (in and of itself) is nearly non-existent. But I'd be happy to provide knowledge where I can.
Best of Luck (and eagerly awaiting Radio Rivendell's return),
Arclayn
Updated 5 January 2016 (00:13)
Not_Rich
1722 XP
Arclayn
923 XP
Posted by Alanar Raskinn
Where I work isn't a bank or government agency, either.
I asked my office-mate, who is primary sysadmin. He suggested that migrating from one Ubuntu to the next is not always straightforward. It just depends on what's been done on the server. e.g. Lots of customization (maybe grabbing applications from non-canonical repositories) makes direct migration inefficient. In our ecosystem, he's actually found it faster to backup data, format/install new version, reload data (as this also usually involves migration to new hardware as well, and he has his own custom scripts).
However, office-mate/sysadmin also said that directly migrating from 15.10 to 16.04 would likely be less potential trouble than migrating from 14.04 to 16.04. So that question would partly entail whether Elrond would be willing to attempt a migration in a few months or not.
But whether it's a bank or a hobby server -- unpatched servers (of any kind and platform) usually lack the immune-system needed to prevent becoming an involuntary vector to spreading Internet sadness. I imagine we all want Radio Rivendell to spread happiness, not sadness.
Updated 5 January 2016 (23:45)
Elrond
44714 XP
Tyler Max
732 XP
Posted by Elrond
I would say that Linux is much more secure than windows. for one thing, almost no one makes any virus for it... and its open source, so if there is a problem, it will get fixed really quick, unlike windows, where the bureaucracy of Microsoft does not get a fix until its old news....
-
#idontloginoften
Arclayn
923 XP
Posted by Elrond
These days -- which platform is safest is less relevant than which platform gets timeliest and most reliable security patches. That means, anything unsupported is no good, which today includes Windows XP. Ubuntu has been pretty good about providing updates. e.g. When news of the heartbleed exploit hit in 2014, Canonical had a patch out really quick, and office-mate/sysadmin had that patch installed into our ecosystem right away.
When you installed Ubuntu, you may have been given the option to have the system automatically download updates -- and that is a good thing to have turned on. But if you need to get updates manually, it's just another pair of apt-get commands.
sudo apt-get update
sudo apt-get upgrade
And then you need to reboot the server. But because of the modern era of rapid exploits and patches (a cat and mouse game, to be sure), server uptime isn't as much valued anymore. Since you have usage statistics, another idea would be to have the server automatically retrieve updates followed by an automatic reboot, done regularly once a week ( maybe as a cron job ) at a time when demand is consistently at a low point. Maybe even post that time on the website as a "maintenance window" (and it really is).
Something to consider about hacks is that an effective hack appears silent. That goes for desktop viruses too. The goal is not to destroy the server, but turn it into something like a "double agent" that additionally serves the badguys in some nefarious way. Therefore, never being hacked "as far as you know" is not a good indicator of safety. Keeping up with security updates and best practices, is. And I'm not saying that your old server had been hacked. It's nearly impossible to know at this point, and there is no need to dwell on it.
Got any more questions along the way -- let me know. I think (maybe) office-mate/sysadmin might be missing the music a little, too. Although I'm the one who plays it.
Updated 6 January 2016 (18:47)
Sork
14 XP
Mekkis
195 XP
Sorry about not getting back sooner.
As I understand it, you already have a working shoutcast instance (which I'm assuming is similar to those created by people who are donating bandwidth (myself included)).
So all you need to do is setup a source to point at it.
As I see it, what you need to do is use liquidsoap in order to get Things To Work.
Fortunately, setting up liquidsoap on a ubuntu box is simple:
sudo apt-get install liquidsoap
Now you need to create a liquidsoap script. This can be complicated, depending on how you're defining your stream, but for something simple like just playing back a playlist of audio files (I've run this with a combination of mp3s and oggs), the following works:
#!/usr/bin/liquidsoap
# set log path - default will be /var/log/ - which causes permissions issues
set("log.file.path","/tmp/radio.log" )
# Generate the radio stream
radio = mksafe(playlist("ccmusic.pls" ))
# output to a shoutcast server
output.shoutcast(%mp3, host = "myserver.net", port = 8000, password = "streampassword", radio)
Outputting to icecast is just as easy:
#!/usr/bin/liquidsoap
# set log path - default will be /var/log/ - which causes permissions issues
set("log.file.path","/tmp/icecastradio.log" )
# Generate the radio stream
radio = mksafe(playlist("ccmusic.pls" ))
# output to an icecast server
output.icecast(%vorbis, host = "server.ip", port = 8000, password = "radio", mount = "/stream", radio)
Then it's just a matter of running it:
liquidsoap _filename_.liq
It should connect and start streaming.
For further, funky things, Airtime (https://www.sourcefabric.org/en/airtime/) can be used to help with the whole management side of things.
Updated 8 January 2016 (14:14)
Arclayn
923 XP
In regards to Mekkis's Instructions:
I've run this by office-mate/sysadmin, and we both agree that pointing the streaming logs to /tmp is ill advised if Elrond wants to retain the logs. Anything stored in /tmp will be automatically deleted on reboot, and if Elrond follows my advice on keeping up on security patches, regularly scheduled reboots will be necessary.
I am curious as to the nature of the permissions problem with /var/log. Permission problems are both a boon and bane of Linux. Maybe a suitable alternative can be discussed... But then if the logs don't matter in the slightest -- then placing them into /tmp is no problem.
-- OR -- if someone wants to send logs far away into oblivion, point them to /dev/null. It won't even bother the hard drive. Please use /dev/null with care. I've heard it called a "Black Hole" for a reason.
Updated 8 January 2016 (22:21)
Mekkis
195 XP
It isn't really much of a permissions problem, more a few extra hoops you need to jump through: ideally, you'd run it as a service under a separate user and chown /var/log/liquidsoap to that user (and set selinux contexts accordingly).
Then use something like logrotate to ensure that the logs don't take up too much space.
That being said, something like liquidsoap, that only makes outgoing connections (rather than accepting connections from the internet) has a much narrower threat profile than most online services.
Elrond
44714 XP
Elrond
44714 XP
Mekkis
195 XP
Firstly, Thanks for getting everything up. It's good to have music again.
As far as I can tell, you're already sending metadata to the icecast server: you can view it in parseable json at http://server-ip:8000/status-json.xsl However, polling something like that seems very inelegant.
A more correct way would be using store_metadata/on_metadata and defining a function, like the following:
#!/usr/bin/liquidsoap
# set log path - default will be /var/log/ - which causes permissions issues
set("log.file.path","/tmp/radio.log" )
# Here's what we do to the currently playing track: currently writing it to a file, but
# we could be doing whatever: using system() lets us run any linux command, or we could
# be safer and use http.post
def history_func(h)
# in this case, just write it to a file.
system("echo #{quote(h'filename')} > /tmp/currentplay" ) # That's supposed to be 'filename' in square brackets (with quotes)
end
radio = mksafe(playlist( "ccmusic.pls" ))
radio = store_metadata(size=20, id="history", radio)
radio = on_metadata(history_func, radio)
output.shoutcast(%mp3, host = "myshoutcastserver.info", port = 8000, password = "mupassword", radio)
output.icecast(%vorbis, host = "myicecastserver", port = 8000, password = "password", mount = "/stream", radio)
(Edited to try and remove smilies)
Updated 11 January 2016 (14:54)