Installing Icecast 2 on DreamHost VPS

Weather Underground Radio Streams

Weather Underground provided a free service to host all of these streams so you could listen into important weather bulletins over the Internet. Weather Underground was purchased by the Weather.com parent company The Weather Company in 2012 and then IBM purchased The Weather Company in 2016. Weather Underground moved all of their services over to Amazon Web Services and canned a few legacy products including the NOAA Weather Radio streams.

For years I’ve been streaming our local NOAA Weather Radio station, KEC60, over the Internet to Weather Underground. I was extremely disappointed when the weather radio service was cut off with no notice to the listeners or the people graciously providing the audio source stream to share. Uploading the audio stream from my home doesn’t use a ton of bandwidth but letting 50-100 people listen during peak times wouldn’t be practical. I have a web server running in DreamHost’s VPS cloud so why not use that and host my own streams?

DreamHost VPS

DreamHost VPS (virtual private server) is an inexpensive high-performance web hosting solution that lets you dial up and down the resources you need to run your sites. I moved over to their VPS service after having hosted a Mac mini in a local data center for years. I couldn’t beat the cost difference and DreamHost VPS is managed meaning they install security updates and mitigate any attacks on the server.

In the recent past DreamHost has removed one feature I specifically moved over to them for: having root access on your server instance. The rationale behind that change is their team needs the ability to maintain the server, install patches, inspect traffic, and do whatever other voodoo is necessary that falls under a “managed” server. The upside is I don’t have to worry about much with the server. The downside is I can’t install software on the server for all users using Aptitude, the Ubuntu system software package manager.

I need to install the streaming audio/video server Icecast 2 to be able to host my own weather radio stream for Milwaukee. Not being able to use Aptitude on my VPS instance makes this more difficult, but not impossible. The process isn’t straightforward and can be very daunting if you’ve never compiled software before on a Linux machine via the command line. I’ve documented my experience here in case you’re interested in doing something similar.

Installation

You don’t have root access on DreamHost VPS so you can’t install Icecast using apt-get. There are ways to download the apt-get packages and manually install but that has its own drawbacks and breakages. I opted to download the source code for Icecast, compile it, and install in the user directory of the site I’m hosting the stream on. By installing in the user directory I require no system-level permissions whatsoever to run Icecast.

The basic steps are:

  1. Download the source code for Icecast and a few related dependencies (libxslt, libogg, and libvorbis).
  2. Configure, compile, and install the three dependencies.
  3. Configure, compile and install Icecast.
  4. Set up the Icecast configuration.
  5. Launch Icecast.
  6. Configure Icecast to launch on startup.

Preconditions

I’m making the assumption you have a basic understanding of Linux command line operations, SSH, and how to use DreamHost’s control panel. You’ll need the following things completed before starting the process I’ve detailed:

  • Purchase a DreamHost VPS instance and have it running. (sometimes you need to be explicit with a tutorial 😝)
  • Create a shell user for your Icecast install. I suggest a separate account with DreamHost’s “Enhanced Security” turned on. This is just in case Icecast introduces any security vulnerabilities to your server and limits the access the process has to your system.
  • My VPS is using Ubuntu 12.04.5 LTS at the time of this post. At one time I did have root access on my machine and may have installed other dependencies that your instance may not have. Feel free to comment on this post if you need help installing those as well.
  • The tutorial starts with the assumption you’re logged into your account via SSH and sitting at the ~/ (home) folder location.
  • I use Bash for my shell. Other shells like Zsh should be fine but you’ll need to adjust where you edit your path.
  • The source file URLs may change and will probably be outdated shortly after I write this post. I suggest you visit the project home pages for the most recent versions when doing this yourself. You’ll also want to occasionally update Icecast as time passes to make sure you patch any security issues. This is the downfall of not being able to use Aptitude or a similar package manager.

Please note: DreamHost currently has “unlimited” bandwidth for VPS customers. This could change in the future and understand that streaming audio and video could consume a ton of bandwidth.

Download Sources

  1. Create a temporary folder:
    mkdir tmp
    cd tmp
  2. Download the source files for Icecast and the dependencies.
    wget http://downloads.xiph.org/releases/icecast/icecast-2.4.3.tar.gz
    wget https://git.gnome.org/browse/libxslt/snapshot/libxslt-1.1.29.zip
    wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.zip
    wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.zip
  3. Unpack each of those downloads.
    tar xvfz *.tar.gz
    unzip *.zip

Compile All the Things

First create the usr (pronounced user) folder and add it to your path.

cd ~/
mkdir -p usr/bin
mkdir -p usr/var/log/icecast
echo 'PATH=$PATH:~/usr/bin' >> ~/.bash_profile
. ~/.bash_profile

The last command re-executes the login script so your path is updated right away.

In the following commands replace “/home/username” with the actual path of the folder you want to install everything into. In most cases you’ll just replace username with the username of the account you created.

cd ~/tmp/libxslt-1.1.29/
./autogen.sh --prefix=/home/username/usr
make install

cd ../libogg-1.3.2/
./configure --prefix=/home/username/usr
make install

cd ../libvorbis-1.3.5/
./configure --prefix=/home/username/usr
make install

cd ../icecast-2.4.3/
./configure --prefix=/home/username/usr
make install

The Autogen & Configure scripts will scan your system for dependencies and set up the configuration file that Make uses to do the actual compilation. Configure will bark if your system is missing anything important that you’ll need to additionally compile.

Configure Icecast

If everything went well you should have a fresh new Icecast installed as ~/usr/bin/icecast and a default configuration file at ~/usr/etc/icecast.xml.

I’m not going to go into too much depth on how to configure Icecast. There is a good amount of documentation on the Icecast website detailing how to get the service up and running.

At a minimum you want to replace all of the default passwords in the configuration file with something other than “hackme”.

Launch Icecast

Go ahead and launch Icecast.

cd ~/
icecast -c usr/etc/icecast.xml

This launches Icecast in interactive mode. If you exit your SSH session, Icecast shuts down. Verify that you can connect to Icecast by visiting:

http://yourserver.dreamhostps.com:8000

Change the hostname to match yours and the port number if you changed the default one in the configuration file. If everything went right you should see an Icecast status page. If you get any errors double check you launched the service properly and that you specified the server hostname correctly.

When you’re done, hit Control+C to kill Icecast. When you’re ready to keep Icecast running long-term, re-launch with -b at the end to background the process:

icecast -c usr/etc/icecast.xml -b

Launch on Startup

The last step to setting up Icecast on a DreamHost VPS is to configure it to launch when your server is rebooted. The easiest option is to use the Cron Jobs control panel provided by DreamHost.

  1. Open the Cron Jobs page in your DreamHost control panel.
  2. Click the Add New Cron Job button.
  3. Select the user you created and installed Icecast into.
  4. Enter a Title that is helpful like Icecast.
  5. Enter an e-mail address if you want log files sent to you. I left this blank.
  6. Enter the following in Command to Run (updating the path with your actual install path for Icecast):
    /home/username/usr/bin/icecast -c /home/username/usr/etc/icecast.xml -b

    The full paths are required so Cron knows exactly where Icecast is. The -b switch puts Icecast into the background.

  7. Make sure Use locking is turned on.
  8. Set When to run to Server Reboot.
  9. Click Add.

Questions?

Let me know if you have any questions in the comments on this post! I’ll probably do a follow-up post with the actual setup I’m using for streaming Weather Radio.

Check out the Milwaukee NOAA Weather Radio stream for KEC60 here:

http://milwaukeeweather.audio

Featured image courtesy of cogdog on Flickr.

SourceTree – Delete Multiple Branches at One Time

Do you use SourceTree to help manage your Git repos? Ever work on a bunch of pull requests and have a lot of local branches you need to delete? I found a way to delete multiple branches at one time.

  1. Click Repository then click Branch.
    2015-12-08_16-24-19
  2. Click Delete Branches.
    2015-12-08_16-23-22
  3. Select the branch(es) you want to delete. Be sure not to select other than Local branches unless that’s your intention.

 

 

Changing the volume on a USB Headset on Mac OS X

Do you use a USB headset for video/audio conferencing on your Mac? Ever been frustrated that you can’t really change the volume of just the headset if you keep your main audio coming through your speakers? There is a solution – use the Audio MIDI Setup app nestled in Applications/Utilities.

2015-12-07_14-04-30.png

  1. Look for the device that matches your USB device – sometimes it only shows the manufacturer of the USB to Analog converter if its a cheapie device.
  2. Look for the “out” device if you’re looking at changing what you hear, the “in” device for your microphone audio level.
  3. Slide the master control to the right if its available. If master isn’t selectable, slide the individual left/right channels. The individual channels don’t stop at any specific points along the line so you might want to manually match up the dB (gain) value so each ear is an identical volume level.

Easy Mac to Mac Screen Sharing

Screen sharing over iMessage is not a terribly well-known feature of Mac OS X – but it’s incredibly awesome and easy to use. The only requirements are the person needs a relatively new Mac OS X install (Yosemite or higher) and iMessage enabled on their Mac.

  1. In Messages, find your existing conversation (or create a new one with the user).
  2. Click the Details button up top and click it.
    2015-11-02_19-09-28
    2015-11-02_18-50-29
  3. Find the little icon that looks like two squares with an offset between them and click it.
    2015-11-02_18-53-03
  4. Select Ask to Share Screen.
  5. The other person should get a notice and they can accept it.
    2015-11-02_18-54-08
  6. Once you’re sharing you are in view-only mode – you have to click the icon in the upper left to request control of their desktop.

Pretty simple! I’ve had some issues in the past with the notifications never coming through for screen sharing but it seems to be resolved with Mac OS X 10.11 (El Capitan).

View Apple’s Support Documentation on screen sharing in Yosemite

Biggest Lie To Your ADHD Self

Most of my journey the past couple of years with coping with attention problems is increasing my self-awareness. I am my own obstacle and I must hack my own consciousness to work the way I need it to.

It’s easy to slip into old habits and totally forget the tools you’ve put in place. All it takes is one of those well-known “ooh shiny” moments and you’re off track for an hour reading about nuclear testing instead of solving the problem for work.

One of the tools I use is keeping a log of things I’ve accomplished in the day/week. The log gives me a complete picture of what I’ve been able to focus on and lets me easily reflect on the past week. I tend to find the holes this way – places I’ve let tasks slip through. This seems to work much like the effect looking at photographs lets you recall and retain memories. The problem I have is I don’t remember to write things in the log all the time. Then I forget about the log.

I’ve discovered one of the biggest lies I keep telling myself even with all of these tools and practices. What is that lie?

I’ll get to it [the task] in a few minutes.

Yeah, it never happens. Ever. I always forget or something more important on the signal to noise ratio scale eclipses it. My goal is to stop letting this little lie derail me. If the task takes a few moments to complete, DO IT NOW.

Recording Your iOS Device with QuickTime Player

The Task

You need to record your iPhone or iPad’s screen to show someone a bug or demo a feature to your customers. In the past the only method available was to use a program like Reflector to emulate an AirPlay/Apple TV and then record on your machine. This works fairly decently although the quality over WiFi isn’t very good leaving you with a less-than-crisp recording. Reflector also isn’t free which makes it difficult for users in the wild to record bugs.

Enter iOS 8 & Yosemite

Apple introduced the ability to record the screens of iOS 8 devices with QuickTime Player in Mac OS X Yosemite. You may have already been familiar with the ability to do a screen recording with QuickTime but now those screens includes any of the iOS 8 devices you have connected with a cable. The implications of this new feature include:

  • High quality video recording – the video is going over the wire instead of WiFi
  • Capture audio from the device or your computer
  • Easy access to QuickTime’s built-in exporting tools
  • No new software to install – Yosemite and iOS 8 are the only requirement

The Steps

  1. Connect your iOS 8 device to your Mac OS X Yosemite (10.10) computer with the USB to lightning or dock connector cable.
  2. Launch QuickTime Player (inside of /Applications in Finder).
  3. Click Done on the file browser window that appears by default when QuickTime launches.
  4. Click File > New Movie Recording. A window will appear typically picking your built-in FaceTime camera by default. Smile.
    QuickTime File New Recording
  5. Click the little arrow next to the red recording button.
    QuickTime Recording Inputs
  6. Under Camera select the iOS device you wish to record.
  7. Your iOS device’s screen should appear on your Mac.
  8. Optionally select your device under Microphone as well if you want to record the audio from the device rather than your computer’s microphone.
  9. Click the red record button when you want to record, clicking it again when you’re done.
  10. Export the video under File > Export picking an appropriate resolution.

Notice that Apple took the time to replace your device’s status bar with one being carrier-free and fixed at 9:41am.

QuickTime Sanitized Status Bar

Nice touch.

Limitations

There are only a couple limitations that I’ve found so far. Finger tips are not shown in the video, so it can be hard to demonstrate things. My suggestion is to talk through the issue or provide a list of things you tapped if its not obvious. Secondly if you’re trying to demonstrate something that involves going full screen (like watching a video on the phone) then the recording will not capture the full screen presentation (it’ll go black). Lastly there is a little bit of lag when you’re recording so make sure to watch the actual device screen and not your computer. If you record audio from your microphone, QuickTime does a good job syncing it up afterwards. This process also works a bit better on newer devices.

Next Steps

Sharing the video you’ve recorded can be a challenge since these videos tend to be of a very very large size in a matter of seconds. Exporting in 480p can definitely help. If you’re providing a demonstration of a bug then you may wish to clip the beginning and end of the movie to only show the actual reproduction of the bug. Follow Apple’s instructions on how to clip a video here.

Reflector is still a great program and very useful. Simple things like being able to add a fake iPhone or iPad frame around the video makes a big difference for demo purposes. I will still continue to use Reflector especially since it’s still the only way to record iOS 7 devices.

Providing Emergency Contacts with iOS 8

The Problem

Something that has been missing on iOS for a long time is a reliable way to provide emergency contact information.  Imagine you’re out and about and you end up having an accident or have an acute attack from a known medical condition you have.  We all tend to carry our mobile phones with us.  Most emergency personnel are trained to review personal data in your wallet/purse and now mobile phones.  The issue is most of us have a lock code on our devices, preventing access to potential life-saving communication with a loved one about your medical condition.

Setting up Medical ID

iOS 8 now has a feature that lets you provide that critical medical information to emergency responders.  It’s called Medical ID.  Here’s how to set it up in a few steps:

First, select the “Health” app.

IMG_0004

 

Then, select “Medical ID” on the far right.  And then tap “Create Medical ID”.

IMG_0005

 

Enter in your personal information you’d like to provide to emergency workers.  At a minimum you should select a contact from your phone to allow someone to call on your behalf.  I’d also suggest entering in your blood type.

IMG_0007 IMG_0008

Tap Done when you’re finished.

IMG_0009

 

Now when someone swipes to “Emergency Call” on your device, Medical ID is listed with the details you provided.

IMG_0010

IMG_0011

Share This Information

Make sure to share this information with your loved ones that have iOS devices.  A few minutes of setting this up could mean a huge help down the road!

 

Mac OS X 10.9 Mavericks Calendar + Google Sync Problems

On occasion my Calendar on Mavericks gets hosed when syncing with Google.  If I look in the console, I see errors like the following mentioning “An error exists on principal”:

6/5/14 10:05:00.337 AM Calendar[59555]: [com.apple.calendar.ui.log] [An error exists on principal: [iCloud]]
6/5/14 10:05:00.338 AM Calendar[59555]: [com.apple.calendar.ui.log] [An error exists on principal: [Time Off]]
6/5/14 10:05:00.340 AM Calendar[59555]: [com.apple.calendar.ui.log] [An error exists on principal: [Events]]
6/5/14 10:05:00.341 AM Calendar[59555]: [com.apple.calendar.ui.log] [An error exists on principal: [Launch]]
6/5/14 10:05:00.341 AM Calendar[59555]: [com.apple.calendar.ui.log] [An error exists on principal: [Conferences]]
6/5/14 10:05:00.342 AM Calendar[59555]: [com.apple.calendar.ui.log] [An error exists on principal: [Some Team]]

Hitting Command-R in calendar results in it sitting on Updating for some time (minutes?) and then an exclamation point appearing next to the calendars in question.  I finally found a solution to fix it until the next time it happens.  I’m not sure what the actual cause is but this can get you back up & running.

  1. Close the Calendar app.
  2. Go into System Preferences.
  3. Click on Internet Accounts.
  4. Click on the Google account (if you have multiple you may have to do this for each).
  5. Uncheck “Calendars”.
  6. Click Show All or close preferences.
  7. Open Terminal.app (Applications > Utilities)
  8. type: killall -9 CalendarAgent
  9. type exit or close the window.
  10. Go back into System Preferences and turn Calendar back on for the Google Account(s).
  11. Start up Calendar and hit command-R – everything should refresh properly.

Let me know if you have questions!

Xcode 4 – Problem submitting App with Static Library

I’m submitting a new version of my Migraine Diary App to the App Store and was running into problems with Xcode 4 giving me the following error: “[Your App Name] does not contain a single-bundle application or contains multiple products. Please select another archive, or adjust your scheme to create a single-bundle application.”

There is an issue or maybe it’s an intentional design thing with Xcode 4 and how it handles statically built libraries being included in your project.  I’m specifically using Core Plot and it’s instruction set hasn’t been updated for Xcode 4 yet.  Here are the things I had to do to get Core Plot to bundle correctly with my App to submit it:

  1. Click on the Core Plot project which should be a child of your App’s project.
  2. Click on the Project CorePlot-CocoaTouch and go to the Build Settings.  Set “Skip Install” to Yes.
  3. Click on the CorePlot-CocoaTouch target and set “Skip Install” to Yes.
  4. Click Build Phases and under Copy Headers, move all of the Public and Private entries to the Project section.

You should then be able to build your project for Archive and submit to Apple.

Thanks to Apple Dev Forums – https://devforums.apple.com/thread/86137

iOS Basics – UINavigation Controller & Back Button Text

I’ve brought an old project out of the moth balls recently, the Migraine Diary application I wrote as part of my master’s thesis.  It was my first “real” iPhone app and I call tell I didn’t know what I was doing entirely looking through the code.  What this has forced me to do, however, is re-learn some of the basics of iOS development and of Apple design patterns.  I have been spending some time back in the Apple developer documentation and will probably be posting some of the gotchas that tripped me up two years ago and I’m solving now with the better, more elegant solution.

Navigation controllers are very useful things to have in your app, and are probably the easiest thing to implement WRONG.  Two years ago, I assumed any time I needed a navigation bar up top that I needed to create a UINavigationController and make my view the root controller of it.  Silly me.

One of the problems I was facing in the Migraine Diary app was changing the back button text when I was one or more levels deep into a navigation controller.  My main view was titled “Journal Entries” and my child view “Journal Entry”.  By default, the controller will title the back button as “Journal Entries” which you can see clutters up the screen.

I found a lot of ways of hacking the title online, but there is really only one “right way” according to Apple.  The button titled “Journal Entries” is actually owned by the parent view.  Before you push the child view onto the navigation controller, do something like this:

UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@”Back” style:UIBarButtonItemStyleBordered target:nil action:nil];
[[self navigationItem] setBackBarButtonItem:backButton];
[backButton release];

Take note that you’re referring to [self navigationItem] not [[self navigationController] navigationItem] since you are in the PARENT controller.

That’s it!