Archive for the ‘Development’ Category

Phusion Passenger (mod_rails) + DreamHost FTW!

I just converted five production sites from my custom-built lighttpd installation to Passenger on DreamHost.  The speed is impressive, and I only had to update a couple things in environment.rb to get one site to work.

DreamHost now appears to be a bonafide Rails Host!  Who knew?!

The Guy posted this article on May 15th, 2008.

Tagged

Categorized

Leave a comment (You'd be the first)→

A few notes on using Passenger (mod_rails) with Mac OS X

I installed Phusion Passenger aka mod_rails this evening on my Leopard installation.  It didn’t go quite as smoothly as I’d expected, although it did ultimately work.  If you’re having some issues getting it running, this may help.

The first thing that went “awry” was the fact I was using Mac OS X at all.  There is something wrong/non-standard with the apache2 installation included with Leopard, and Passenger doesn’t work with it.  When I ran the passenger-install-apache2-module utility I was notified of this, and the tool suggested installing a new copy of apache2.  Rather than compile it manually, I opted to go the MacPorts route.

Unfortunately, that too had a problem: it wouldn’t compile.  A quick perusal of the configure script log indicated that a suitable version of awk wasn’t installed, and the portfile didn’t know enough to install a proper version as a prerequisite.  A quick sudo port install gawk took care of that.

I then reran the passenger-install-apache2-module, which didn’t automatically locate the new apache installation.  I followed the instructions to set the APXS2 environment variable, but it didn’t take.  Ultimately the problem ended up being that the new apxs wasn’t on my path.  I updated it in my .profile to include /opt/local/apache2/bin, which fixed that issue.

In order to ensure no additional conflicts, I deactivated web sharing in OS X.  This disables the built-in apache installation.  I then copied the sample apache configuration file in the /opt/local/apache2/conf/ directory to httpd.conf, and added the lines requested by the tool.  Next I configured apache’s virtual host file to point to a new hosts.conf I created in the same directory.  From there I added a virtual host as instructed to point to my Rails app.

Upon visiting localhost in a web browser my app fired right up, but none of my styles or javascripts loaded.  It turns out I had to add a <Directory> directive in the vhost with the contents allow from all.  That fixed the last issue.  Note that by default Passenger runs your app in production mode.  The documentation states to change this in your config/environment.rb file, but when I tried it this didn’t work.  You can add a RailsEnv development to your httpd.conf, but this is a global setting.  I’ve logged this bug in the tracker.

Despite these glitches, I’m really excited about Passenger.  I went through the installation process at work earlier today on a CentOS installation, and it went seamlessly.  Most of us aren’t deploying to Mac OS X, so I’m willing to overlook the minor shortcomings on OS X because the Linux deployment went so well.  In either case, it’s free, and it’s only going to get better from here.

Passenger has the power to do wonderful things for the Rails community.  It will be very interesting to see this start to roll out at shared web hosts around the globe.  The widespread availability of cheap, easy Rails hosting could be a game-changer.  I look forward to meeting the fine fellows at Phusion at RailsConf this year.

If you find Passenger useful, please consider donating to the Phusion guys.  They’ve sweat a lot of time into this code, and as far as 1.0 releases go you couldn’t ask for much more.

The Guy posted this article on April 12th, 2008.

Tagged

Categorized

Leave a comment (3 so far)→

Building FlowPlayer from Source on Mac OS X

FlowPlayer is a Flash media player for the web.  It’s a nice alternative to Jeroen Wijering’s FLV Media Player, although I’d never knock the latter.  It’s still arguably still the best.

One reason to use FlowPlayer is its GPL license.  There aren’t many reasons to build it from source, as the precompiled SWFs work identically.  The only reason I was curious enough to try it was to change the embedded logo in full-screen mode.  FlowPlayer is offered with a “commercial” license, which nets you FlowPlayer minus that logo.  That doesn’t sound like much of a benefit to me.  I’d want a logo there - just not that one.

It occurred to me that CentOS, the free Linux distribution based on Red Hat Enterprise Linux, is able to do exactly that.  They take RHEL, swap out logos and the “Red Hat” phrases, compile, and that’s about it.  It’s a nice way to work with Red Hat without forking over the cash, and it’s legal thanks to the GPL (I’ll still take Debian/Ubuntu any day - enterprise be damned).

This is tangential, but I’m noting it because I’m publishing these instructions simply because I figured it out and there isn’t a lot of good information out there to this effect.  These instructions are based on a somewhat outdated post I found that didn’t make an OS distinction and turned out not to work as written on Macs.

One note before we continue: I’m a developer, and if you’ve read this far I’m assuming you are, too.  I didn’t investigate some of the more basic prerequisites typical for development on Mac OS X, as I’ve got the Developer kit installed, as well as MacPorts and Fink.  If these instructions don’t work for you, make sure you’ve got the basics ready to go.  We’ll only be using two external tools you probably don’t have, and we won’t be installing them on the system itself.  For the record, I’m running 10.5.2.

Here we go:

  1. Head over to the FlowPlayer project page and download the FlowPlayer sources.
  2. Download swfmill v0.2.11 to the same directory where you downloaded FlowPlayer.  As of this writing the current version is 0.2.12.  This version does not work with FlowPlayer as it’s currently written, so I’ve linked to the older version.  It is possible by the time you read this that a new version that does work is available.  Google accordingly.
  3. Download the mtasc Mac OS X package from the Motion Twin web site to the same directory where you downloaded FlowPlayer.
  4. Open a Terminal, cd to the directory where you downloaded the archives, and extract them:
    $ unzip flowplayer-2.0.1-src.zip
    $ unzip mtasc-1.12-osx.zip
    $ tar zxf swfmill-0.2.11-macosx.tar.gz
  5. Copy the binaries into their respective directories:
    $ cp swfmill-0.2.11-macosx/swfmill flowplayer-src/bin/swfmill/
    $ cp mtasc-1.12-osx/mtasc flowplayer-src/bin/mtasc
  6. cd into each directory, rm the Windows binaries, and symlink the Mac OS X versions:
    $ cd flowplayer-src/bin/mtasc/
    $ rm mtasc.exe
    $ ln -s mtasc mtasc.exe
    $ cd ../swfmill/
    $ rm swfmill.exe
    $ ln -s swfmill swfmill.exe
    $ cd ../../
  7. At this point you should be in the flowplayer-src directory. It’s time to compile!
    $ ant
  8. If all went according to plan, you’ll see some text output as the compile progresses. You should see the following lines at the end (your build time will vary):
    BUILD SUCCESSFUL
    Total time: 22 seconds
  9. You’ll find the various players in the build/ directory.  As a quick test, open FlowPlayer.html in a text editor, and look for ../FlowPlayerDark.html. Remove the ../ at the beginning so it just reads FlowPlayerDark.html. Next, search for http://flowplayer.org/video/honda_accord.flv and replace it with a reference to another FLV (the original doesn’t currently exist on the FlowPlayer web site).  Save the file. Open it up in your favorite web browser, and you should see the player.

That’s all there is to it.  Feel free to get in touch if you find anything amiss.  This just worked for me.

The Guy posted this article on March 25th, 2008.

Tagged

Categorized

Leave a comment (4 so far)→

This is my blog. Who am I? That's a swell question.

2fkd is proudly powered by WordPress
Entries (RSS) and Comments (RSS).