<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>Greg Benedict</title>
	
	<link>http://www.gregbenedict.com</link>
	<description>Thoughts on the web and creativity.</description>
	<lastBuildDate>Mon, 13 Dec 2010 15:19:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/GregBenedict" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="gregbenedict" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">GregBenedict</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>★ Backing Up Your Heroku Database With PGBackups</title>
		<link>http://www.gregbenedict.com/2010/12/13/heroku-database-backups/</link>
		<comments>http://www.gregbenedict.com/2010/12/13/heroku-database-backups/#comments</comments>
		<pubDate>Mon, 13 Dec 2010 15:19:27 +0000</pubDate>
		<dc:creator>Greg Benedict</dc:creator>
				<category><![CDATA[photography]]></category>

		<guid isPermaLink="false">http://www.gregbenedict.com/?p=187</guid>
		<description><![CDATA[Heroku recently announced that they are changing the way you backup your app&#8217;s database. They are deprecating their bundles add-on and have added a new PostgreSQL only backup feature. This is great news as the old bundles method included a copy of your source code as well. In one instance, our backups went from 90MB [...]]]></description>
			<content:encoded><![CDATA[<p>Heroku recently announced that they are changing the way you backup your app&#8217;s database. They are deprecating their bundles add-on and have added a new PostgreSQL only backup feature. This is great news as the old bundles method included a copy of your source code as well. In one instance, our backups went from 90MB compressed to just 17MB uncompressed.</p>
<h2>Installing the Heroku PGBackups Add-On</h2>
<p>First, you&#8217;ll need to install the latest version of the <em>heroku</em> gem.</p>
<p><code>sudo gem install heroku</code></p>
<p>Next, go into your project directory and install the pgbackups add-on.</p>
<p><code>cd ~/projects/MyProject/<br />
heroku addons:add pgbackups<br />
</code></p>
<p>Once installed you can easily make a backup to the cloud.</p>
<p><code>heroku pgbackups:capture --expire</code></p>
<p>There are two things to note here:</p>
<ol>
<li>This backup now happens synchronously instead of in the background. This makes automation much easier as you don&#8217;t have to sleep for a few minutes and hope it&#8217;s done.</li>
<li>The <em>&ndash;&ndash;expire</em> parameter automatically deletes the oldest backup, making historical cleanup a cinch.</li>
</ol>
<p>Once the backup completes you can fire the download command off. This will get a public url (<em>heroku pgbackups:url</em>) and download it using <em>curl</em> to a directory on your computer. The file is also renamed with a timestamp like 20101213 for easy sorting.</p>
<p><code>curl -o /MyComputer/Drobo/backups/MyProject/MyProject_pgbackup_`date '+%Y%m%d'`.sql `heroku pgbackups:url`</code></p>
<p>That&#8217;s it. They&#8217;ve really done a great job making it easier to backup your database and it works every time.</p>
<h2>What else can you do?</h2>
<p>For more information, checkout the <a href="http://docs.heroku.com/pgbackups">Heroku documentation on pgbackups</a>. They have a great example at the bottom for transferring your database between production and staging sites, something we do all the time.</p>
<img src="http://feeds.feedburner.com/~r/GregBenedict/~4/46Dx57iyfXE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gregbenedict.com/2010/12/13/heroku-database-backups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>★ Installing PostgreSQL on Snow Leopard 10.6</title>
		<link>http://www.gregbenedict.com/2009/08/31/installing-postgresql-on-snow-leopard-10-6/</link>
		<comments>http://www.gregbenedict.com/2009/08/31/installing-postgresql-on-snow-leopard-10-6/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 16:23:27 +0000</pubDate>
		<dc:creator>Greg Benedict</dc:creator>
				<category><![CDATA[apple]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[snow leopard]]></category>

		<guid isPermaLink="false">http://www.gregbenedict.com/?p=154</guid>
		<description><![CDATA[Good news! Whether you are using PostgreSQL for general development, or need a version to match your setup on Heroku, getting PostgreSQL 8.3 installed on Snow Leopard is fairly straight forward. However, you&#8217;ll want to make some changes so that it works right for you. Installing PostgreSQL 8.3 First, you&#8217;ll need to install Xcode if [...]]]></description>
			<content:encoded><![CDATA[<p>Good news! Whether you are using PostgreSQL for general development, or need a version to match your setup on <a href="http://www.heroku.com/"><strong>Heroku</strong></a>, getting PostgreSQL 8.3 installed on Snow Leopard is fairly straight forward. However, you&#8217;ll want to make some changes so that it works right for you.<br />
<span id="more-154"></span></p>
<h2>Installing PostgreSQL 8.3</h2>
<p>First, you&#8217;ll need to install Xcode if you haven&#8217;t already. This is available on the Snow Leopard DVD in the Optional Installs directory.</p>
<p>Second, if you aren&#8217;t already using it, download <a href="http://distfiles.macports.org/MacPorts/MacPorts-1.8.0-10.6-SnowLeopard.dmg">Mac Ports for Snow Leopard</a> and install it. Mac Ports has come a long way in the last few years and will make your life much easier.</p>
<p>Once those are installed, run the following command:<br />
<code>sudo port install postgresql83 postgresql83-server</code></p>
<h2>Setup Your First Database</h2>
<p>At the very end of the install it tells you how to setup your first database:</p>
<p><code>sudo mkdir -p /opt/local/var/db/postgresql83/defaultdb</code><br />
<code>sudo chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb</code><br />
<code>sudo su postgres -c '/opt/local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql83/defaultdb'</code></p>
<p>You&#8217;ll also want to setup Postgres to auto-run as a server on start up.</p>
<p><code>sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql83-server.plist</code></p>
<p>If you want to start it right now, you can either reboot or do the following:</p>
<p><code>sudo su postgres -c '/opt/local/lib/postgresql83/bin/postgres -D /opt/local/var/db/postgresql83/defaultdb'</code></p>
<h2>Make psql Available from the Command Line</h2>
<p>The executable files for PostgreSQL get shoved into a non-standard place (just like MySQL), so you&#8217;ll need to edit the default profile.</p>
<p><code>sudo vi /etc/profile</code></p>
<p>You can also do this using <code>sudo mate /etc/profile</code> if you aren&#8217;t comfortable in VI.</p>
<p>The <code>PATH=</code> line needs to be changed to include the PostgreSQL bin directory.</p>
<p>Mine was <code>PATH="/opt/local/bin:$PATH"</code> and is now:</p>
<p><code>PATH="/opt/local/bin:/opt/local/sbin:/opt/local/lib/postgresql83/bin:$PATH"</code></p>
<p>If you open a new terminal window you can now type <code>psql</code> and it will find it.</p>
<h2>Create a New User and Database</h2>
<p>By default, PostgreSQL creates a <em>postgres</em> user for you. However, it&#8217;s not good practice to use the default and it&#8217;s a pain in the ass. Let&#8217;s just create a new database user to make it easier.</p>
<p><code>createuser --superuser macusername -U postgres</code></p>
<p>You need to change <code>macusername</code> to your mac username. This will make your life ALOT easier. Trust me here.</p>
<p>Next, create your database:</p>
<p><code>createdb my_database</code></p>
<h2>Installing the PostgreSQL Ruby Gem</h2>
<p><strike>Unlike the MySQL driver, we don&#8217;t need to pass the ARCHFLAGS variable as 64 bit. PostgreSQL comes with both 32 and 64-bit versions. Yeah!</strike></p>
<p><strike><code>sudo gem install postgres-pr</code></strike></p>
<p>Per Tom&#8217;s comment below, we should be using the native driver for better performance.</p>
<p><code>sudo env ARCHFLAGS="-arch x86_64" gem install pg</code></p>
<h2>Configuring your Rails Application</h2>
<p>Inside your Ruby on Rails application, open up config/database.yml and change your development adapter to be similar to the following:</p>
<p><code>development:<br />
  adapter: postgresql<br />
  database: defaultdb<br />
  username: defaultdb<br />
</code></p>
<p>You can change <code>defaultdb</code> to the name you need for your application.</p>
<img src="http://feeds.feedburner.com/~r/GregBenedict/~4/AKAKpteS420" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gregbenedict.com/2009/08/31/installing-postgresql-on-snow-leopard-10-6/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>★ Fixing Ruby Gems, MySQL and Passenger Phusion on Snow Leopard 10.6</title>
		<link>http://www.gregbenedict.com/2009/08/29/fixing-ruby-gems-mysql-and-passenger-phusion-on-snow-leopard-10-6/</link>
		<comments>http://www.gregbenedict.com/2009/08/29/fixing-ruby-gems-mysql-and-passenger-phusion-on-snow-leopard-10-6/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 00:57:54 +0000</pubDate>
		<dc:creator>Greg Benedict</dc:creator>
				<category><![CDATA[apple]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[thin]]></category>

		<guid isPermaLink="false">http://www.gregbenedict.com/?p=121</guid>
		<description><![CDATA[One of the first things I noticed after upgrading to Snow Leopard is that my Passenger based sites stopped working. I use this heavily for Rails development, so I needed it fixed. The first thing I tried was reinstalling Passenger Phusion, which led to an error. ERROR: Error installing passenger: ERROR: Failed to build gem [...]]]></description>
			<content:encoded><![CDATA[<p>One of the first things I noticed after upgrading to Snow Leopard is that my Passenger based sites stopped working. I use this heavily for Rails development, so I needed it fixed. The first thing I tried was reinstalling Passenger Phusion, which led to an error.<br />
<span id="more-121"></span><br />
<code>ERROR:  Error installing passenger:<br />
ERROR: Failed to build gem native extension.<br />
</code><br />
<code>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install passenger<br />
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h</code></p>
<p>Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/passenger-2.2.4 for inspection.<br />
Results logged to /Library/Ruby/Gems/1.8/gems/passenger-2.2.4/ext/phusion_passenger/gem_make.out</p>
<p>There are several reasons for this.</p>
<ol>
<li>You have a new operating system with new binaries. Things don&#8217;t line up anymore.</li>
<li>You have a new version of Ruby (1.8.7 instead of 1.8.6) and you may need updated gems.</li>
<li>The upgrade deletes your mysql symlink</li>
</ol>
<p>Here are the steps to take to fix the issues.</p>
<h2>Install Xcode</h2>
<p>This is available on the Snow Leopard DVD in the Optional Installs directory.</p>
<h2>Install the iPhone SDK</h2>
<p>If you have previously installed the iPhone SDK for Leopard, you&#8217;ll need to reinstall. You can <a href="http://developer.apple.com/iphone/index.action#downloads">download</a> and Install the iPhone SDK for Snow Leopard. It is build specific to Snow Leopard, so be sure to grab the right dmg file.</p>
<h2>Install MySQL 64-bit</h2>
<p>If you are running 64-bit hardware, OS X is now fully 64-bit compliant and your MySQL libraries probably aren&#8217;t! You&#8217;ll need to <a href="http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.37-osx10.5-x86_64.dmg/from/pick#mirrors">download</a> the 64-bit version and reinstall.</p>
<p>Next we are going to move the default data files out and restore our original data files that the install moved.</p>
<p>First, go stop mysql using the preference pane. I&#8217;ll wait.</p>
<p>Ok, now go run the following commands:</p>
<p><strong>Note:</strong> You need to tailor the last command to pull from the previously installed version of MySQL. You can do an <code>ls /usr/local/</code> directory to find out.</p>
<p><code>sudo mv /usr/local/mysql/data /usr/local/mysql/data.default</code><br />
<code>sudo mv /usr/local/mysql-5.0.67-osx10.5-x86/data /usr/local/mysql/data</code></p>
<p>You&#8217;ll also need to recreate the symlink for you socket.</p>
<p><code>sudo ln -s /var/mysql/mysql.sock /tmp/mysql.sock</code></p>
<h2>Re-Install Your Broken Gems</h2>
<p>Any gem that requires compilation (passenger, mysql, RedCloth, thin and hpricot are good examples) must be recompiled using the new gcc compiler that is installed with XCode.</p>
<p><code>sudo gem install passenger</code><br />
<code>sudo gem uninstall mysql</code><br />
<code>sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config</code></p>
<p>You still need to pass the ARCHFLAGS command like you did under 10.5 Leopard.</p>
<h2>More to Come?</h2>
<p>Probably, but that&#8217;s it so far. I&#8217;ll update this post if I find any more issues.</p>
<h2>Update 1a: Passenger PrefPane</h2>
<p>It doesn&#8217;t load and reinstalling it doesn&#8217;t work for me. <span style="text-decoration: line-through;">It appears to be an issue with RubyCocoa, but not sure yet. In the mean time, just add your *.local domains to to your /etc/hosts file.</span> Thanks to David for the fix in the comments.</p>
<p>Once you install Ruby Cocoa 0.13.2 with the plist change (allows you to install on 10.6) you may need to change your pref pane entries. I added a letter to the alias of each, then deleted it back out and applied the change.</p>
<p><code>sudo apachectl restart</code></p>
<p>After that it picked the local domains right up and I was good to go.</p>
<h2>Update 1b: Passenger PrefPane 1.3 is Out!</h2>
<p>Eloy has release a new update that is compatible with Snow Leopard. Great work! Read more about it and <a href="http://www.fngtps.com/2009/09/new-os-more-pane-passenger-preference-pane-v1-3">download it on his blog</a>.</p>
<h2>Update 2: ImageMagick and RMagick</h2>
<p>So the upgrade toasts Mac Ports and ImageMagick.</p>
<p>Yep, blow it all away. It&#8217;s too much of a pain.</p>
<p><code>rm -rf /opt/local</code></p>
<p>Now download <a href="http://distfiles.macports.org/MacPorts/MacPorts-1.8.0-10.6-SnowLeopard.dmg">Mac Ports for Snow Leopard</a> and install.</p>
<p>You might want to go eat or get a beer for this next step. <span style="text-decoration: line-through;">Then again, maybe not. You have a faster OS now!</span> Nope, you still need that beer.</p>
<p><code>sudo port install libxml2</code><br />
<code>sudo port install ImageMagick</code><br />
<code>sudo gem install rmagick</code></p>
<h2>Update 3: Git</h2>
<p>I just don&#8217;t trust potential binary issues and am upgrading to the latest. <span style="text-decoration: line-through;"><a href="http://git-scm.com/">You should too</a>. <strong>WARNING</strong>: As of 8/29/2009 expat is not the correct architecture and you can&#8217;t install git yet so wait a few days. I did some testing and git seems good to go. I will upgrade as soon as this is fixed though.</span></p>
<p>Blowing away Mac Ports in Update 2 solves the issue!</p>
<p>If you were using Mac Ports previously, you&#8217;ll have problems you need to fix.</p>
<p><code>sudo port install git-core +bash_completion +doc</code></p>
<p>or via downloaded file</p>
<p><code>cd /download/and/untarred/folder/</code><br />
<code>./configure</code><br />
<code>make</code><br />
<code>sudo make install</code></p>
<h2>Update 4: Fixing an Incorrect DirectoryIndex in Apache</h2>
<p>We came across an issue this morning with Apache not using the correct DirectoryIndex (default document such as index.php). It seems the code to include the passenger prefpane vhosts has changed slightly.</p>
<p>In the <code>/etc/apache2/httpd.conf</code> file they added three new lines. It was this:</p>
<p><code>&lt;IfModule passenger_module&gt;</code><br />
<code> NameVirtualHost *:80</code><br />
<code> Include /private/etc/apache2/passenger_pane_vhosts/*.conf</code><br />
<code>&lt;/IfModule&gt;</code></p>
<p>and is now this:</p>
<p><code>&lt;IfModule passenger_module&gt;</code><br />
<code> NameVirtualHost *:80</code><br />
<code> &lt;VirtualHost *:80&gt;</code><br />
<code> ServerName _default_</code><br />
<code> &lt;/VirtualHost&gt;</code><br />
<code> Include /private/etc/apache2/passenger_pane_vhosts/*.conf</code><br />
<code>&lt;/IfModule&gt;</code></p>
<img src="http://feeds.feedburner.com/~r/GregBenedict/~4/4rMuANvQ8Ho" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gregbenedict.com/2009/08/29/fixing-ruby-gems-mysql-and-passenger-phusion-on-snow-leopard-10-6/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>★ Is Delayed Job :run_at =&gt; DateTime Giving You Fits?</title>
		<link>http://www.gregbenedict.com/2009/08/19/is-delayed-job-run_at-datetime-giving-you-fits/</link>
		<comments>http://www.gregbenedict.com/2009/08/19/is-delayed-job-run_at-datetime-giving-you-fits/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 21:15:57 +0000</pubDate>
		<dc:creator>Greg Benedict</dc:creator>
				<category><![CDATA[photography]]></category>

		<guid isPermaLink="false">http://www.gregbenedict.com/?p=114</guid>
		<description><![CDATA[I&#8217;ve been implementing Delayed Job to poll Twitter every minute for changes. However, it was immediately running everything and ignoring the run_at time in the database. Or so I thought. Upon inspection of the code for Delayed Job, it is polling the database time to UTC and not local time. def self.db_time_now (ActiveRecord::Base.default_timezone == :utc) [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been implementing <a href="http://github.com/collectiveidea/delayed_job/tree/master">Delayed Job</a> to poll Twitter every minute for changes. However, it was immediately running everything and ignoring the run_at time in the database. Or so I thought.</p>
<p>Upon inspection of the code for Delayed Job, it is polling the database time to UTC and not local time.</p>
<p><code>
<pre>
def self.db_time_now
      (ActiveRecord::Base.default_timezone == :utc) ? Time.now.utc : Time.now
end
</pre>
<p></code></p>
<p>What was<br />
<code>
<pre>Delayed::Job.enqueue PollTwitter.new(), 0, 1.minutes.from_now</pre>
<p></code></p>
<p>has now become</p>
<p><code>
<pre>Delayed::Job.enqueue PollTwitter.new(), 0, 1.minutes.from_now.getutc</pre>
<p></code></p>
<p>Four hours is a large difference.</p>
<p><strong>Note</strong>: Normally I would just run this as a cron job, but Heroku will only run cron once per hour.</p>
<img src="http://feeds.feedburner.com/~r/GregBenedict/~4/6OYDCOrnjFg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gregbenedict.com/2009/08/19/is-delayed-job-run_at-datetime-giving-you-fits/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>★ Installing Ruby Enterprise Edition and Passenger Phusion on Mac OS X Leopard</title>
		<link>http://www.gregbenedict.com/2009/04/01/installing-ruby-enterprise-edition-and-passenger-phusion-on-mac-os-x-leopard/</link>
		<comments>http://www.gregbenedict.com/2009/04/01/installing-ruby-enterprise-edition-and-passenger-phusion-on-mac-os-x-leopard/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 14:41:03 +0000</pubDate>
		<dc:creator>Greg Benedict</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://www.gregbenedict.com/?p=94</guid>
		<description><![CDATA[Memory usage is getting higher, and my patience waiting on a browser to load changes is getting much lower these days. Installing Ruby Enterprise Edition and Passenger Phusion will help with both! Here&#8217;s how we&#8217;ll do it: Download Ruby Enterprise Edition Install Ruby Enterprise Edition Install Passenger Phusion (mod_rails) Install the Passenger Preference Pane Restart [...]]]></description>
			<content:encoded><![CDATA[<p>Memory usage is getting higher, and my patience waiting on a browser to load changes is getting much lower these days. Installing Ruby Enterprise Edition and Passenger Phusion will help with both! Here&#8217;s how we&#8217;ll do it:<br />
<span id="more-94"></span></p>
<ol>
<li>Download Ruby Enterprise Edition</li>
<li>Install Ruby Enterprise Edition</li>
<li>Install Passenger Phusion (mod_rails)</li>
<li>Install the Passenger Preference Pane</li>
<li>Restart Apache</li>
<li>Install Missing Gems</li>
</ol>
<p>Ruby Enterprise Edition (REE) has the benefits of a stable 1.8.6 Ruby with the Memory recycling patches of Ruby 1.9.x. Why not just run 1.9.x you say? Well, it&#8217;s not compatible with a shitload of gems, including Rails prior to 2.3.</p>
<p><strong>Please Note: </strong>For this tutorial I am referencing REE version 1.8.6-20090201. The commands must change to reference the correct version numbers as newer versions are released.</p>
<h2>Download Ruby Enterprise Edition</h2>
<p>Go to <a href="http://www.rubyenterpriseedition.com/download.html">http://www.rubyenterpriseedition.com/download.html</a> and download the latest version of Ruby Enterprise edition. There are two ways to do this:</p>
<ol>
<li>Save the file to your downloads directory using your browser, or</li>
<li>Go command line in Terminal.</li>
</ol>
<blockquote><p>cd ~/Downloads/<br />
wget http://rubyforge.org/frs/download.php/51100/ruby-enterprise-1.8.6-20090201.tar.gz<br />
tar xzvf ruby-enterprise-1.8.6-20090201.tar.gz</p></blockquote>
<p>You can grab the download link for the wget line by right clicking on the link on the download page and copying the link location.</p>
<h2>Install Ruby Enterprise Edition</h2>
<p>Now that we&#8217;ve downloaded the files, we need to install them. Open up a Terminal window and type the following.</p>
<blockquote><p>cd ~/Downloads/<br />
sudo ./ruby-enterprise-1.8.6-20090201/installer</p></blockquote>
<p>Enter your password when prompted by the sudo command. Press Enter to continue when prompted by the install. Press enter again to choose the default directory.</p>
<p>It will now compile and install the Ruby Enterprise Edition, Passenger Phusion installer, Rake, Rails, Fast Thread, Rack, MySQL, SQLLite and Postgres libraries for your platform.</p>
<p><strong>Note:</strong> It will fail out on the Postgres libraries if you don&#8217;t have them installed. That&#8217;s ok, just hit Enter and keep going.</p>
<h2>Install Passenger Phusion (mod_rails)</h2>
<p>At the end of installing REE it will give you a command to install Passenger Phusion. It will look something like this.</p>
<p><img class="alignnone size-full wp-image-95" title="picture-4" src="http://www.gregbenedict.com/wp-content/uploads/2009/04/picture-4.jpg" alt="picture-4" width="491" height="154" /></p>
<p>Now we need to run that command in the terminal as super user. <strong>Don&#8217;t forget the sudo!</strong></p>
<blockquote><p>sudo /opt/ruby-enterprise-1.8.6-20090201/bin/passenger-install-apache2-module</p></blockquote>
<p>If prompted, enter your password for the sudo command.</p>
<p>Press Enter to continue when prompted. The installer will now compile and install the Passenger Phusion libraries. After they are installed, it will prompt you to add the following lines to your Apache configuration.</p>
<p><img class="alignnone size-full wp-image-96" title="picture-5" src="http://www.gregbenedict.com/wp-content/uploads/2009/04/picture-5.jpg" alt="picture-5" width="491" /></p>
<p>Select those three lines and copy to your clipboard. This is where I like to open a second Terminal window for safety as sometimes Command-C doesn&#8217;t work right.</p>
<blockquote><p>sudo vi /etc/apache2/httpd.conf</p></blockquote>
<p>If you aren&#8217;t comfortable with vi, you can alternatively do this with textmate.</p>
<blockquote><p>sudo mate /etc/apache2/httpd.conf</p></blockquote>
<p>Go to line 121. This should put you right after the LoadModule directives.</p>
<p>Add the following 3 lines, making sure not to line break in the middle of the LoadModule directive.</p>
<blockquote><p>LoadModule passenger_module /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/passenger-2.1.3/ext/apache2/mod_passenger.so<br />
PassengerRoot /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/passenger-2.1.3<br />
PassengerRuby /opt/ruby-enterprise-1.8.6-20090201/bin/ruby</p></blockquote>
<p><img class="alignnone size-full wp-image-98" title="picture-7" src="http://www.gregbenedict.com/wp-content/uploads/2009/04/picture-7.jpg" alt="picture-7" width="491" /></p>
<p>You&#8217;ll need to uncomment the <em>NameVirtualHost *:80</em> directive if it&#8217;s not already.</p>
<p>The <em>PassengerMaxPoolSize 4</em> directive is a personal choice. I want my rails apps to spawn up to 4 ruby instances for any application. I have a very intensive AJAX app making API calls that requires the extra instances to move quickly. The default is 3 and will suffice for most situations, so you can leave out that line.</p>
<p><strong>Bonus Tip:</strong> While you are there, <a href="http://www.gregbenedict.com/2007/10/26/enabling-php5-on-os-x-105-leopard/">enable PHP 5</a> so you can run web apps like phpmyadmin!</p>
<p>Save the file and exit back to the Terminal. You&#8217;ll need to restart Apache.</p>
<blockquote><p>sudo apachectl restart</p></blockquote>
<p>Enter your password if prompted by sudo.</p>
<h2>Install the Passenger Preference Pane</h2>
<p>Here&#8217;s where we&#8217;re going to make developing Rails apps much quicker. Go to download the <a href="http://www.fngtps.com/passenger-preference-pane">Passenger Pref Pane</a> application and save it to your Downloads folder.</p>
<blockquote><p>cd ~/Downloads<br />
wget http://www.fngtps.com/files/2/2008/12/PassengerPane-1.2.tgz<br />
tar xzvf PassengerPane-1.2.tgz<br />
open PassengerPane-1.2/Passenger.prefPane/</p></blockquote>
<p>This will then install the preference pane in System Preferences. Make sure to authorize the install with your password.</p>
<p><img class="alignnone size-full wp-image-99" title="picture-9" src="http://www.gregbenedict.com/wp-content/uploads/2009/04/picture-9.jpg" alt="picture-9" width="491" /></p>
<p>Now we need to setup your Rails or Rack based apps.</p>
<ol>
<li>Click the lock on the bottom left to make changes. Enter your password to authorize it.</li>
<li>Click the + button to add new rails projects to your computer. Be sure to select the Rails root directory, not the public directory.</li>
<li>Apply the changes.</li>
</ol>
<p><strong>Quick Tip:</strong> You can drag and drop the folder you want to host.</p>
<p>The last step you&#8217;ll need to do is restart Apache. While you can click the restart button, it rarely, if ever works for me. Let&#8217;s go back to the Terminal.</p>
<blockquote><p>sudo apachectl restart</p></blockquote>
<h2>Easy Development</h2>
<p>The beauty of the preference pane is that it automatically handles domain name resolution for you with no port 3000 crap. Just open your browser and point it at the address you specified in the pref pane, such as http://projectname.local/.</p>
<p>If you are running Rails in development mode, it will automatically pick up on changes in your code. Every once in a while you&#8217;ll need to cycle Apache to pick up new Models, but it&#8217;s quite good</p>
<blockquote><p>sudo apachectl restart</p></blockquote>
<p>Enjoy developing!</p>
<h2>Wait, it&#8217;s missing gems!</h2>
<p>If you tried to run your app and you&#8217;re getting the Big Purple Error, you&#8217;ll probably need to install the missing gems.</p>
<p><img class="alignnone size-medium wp-image-100" title="picture-10" src="http://www.gregbenedict.com/wp-content/uploads/2009/04/picture-10-300x152.jpg" alt="picture-10" width="300" height="152" /></p>
<p>Here&#8217;s how to install them under Ruby Enterprise edition. You&#8217;ll need to reference the new path to Ruby Gems for REE.</p>
<blockquote><p>sudo /opt/ruby-enterprise-1.8.6-20090201/bin/gem install rails -v=1.2.6</p></blockquote>
<p>If you have been using gem.config to make life easy, then you can do this in terminal from your Rails root directory.</p>
<blockquote><p>sudo /opt/ruby-enterprise-1.8.6-20090201/bin/rake gems:install</p></blockquote>
<h2>Update: Alias Those Commands for Ease of Use</h2>
<p>Running /opt/ruby-enterprise-1.8.6-20090201/bin/rake every time I needed to call rake (or ruby or gem for that matter) was getting to be a pain. So, I created some command line aliases to make it easier.</p>
<p>Add the following to the end of your ~/.bash_profile</p>
<blockquote><p># Ruby Enterprise Edition<br />
alias rakeEE=&#8221;/opt/ruby-enterprise-1.8.6-20090201/bin/rake&#8221;<br />
alias gemEE=&#8221;/opt/ruby-enterprise-1.8.6-20090201/bin/gem&#8221;<br />
alias rubyEE=&#8221;/opt/ruby-enterprise-1.8.6-20090201/bin/ruby&#8221;<br />
alias irbEE=&#8221;/opt/ruby-enterprise-1.8.6-20090201/bin/irb&#8221;</p></blockquote>
<p>You can now call the Enterprise Edition versions of the most popular commands as such.</p>
<blockquote><p>rakeEE db:migrate</p></blockquote>
<img src="http://feeds.feedburner.com/~r/GregBenedict/~4/Fgy6LJtW5tQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gregbenedict.com/2009/04/01/installing-ruby-enterprise-edition-and-passenger-phusion-on-mac-os-x-leopard/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>★ Indianapolis Ruby Brigade</title>
		<link>http://www.gregbenedict.com/2009/03/31/indianapolis-ruby-brigade/</link>
		<comments>http://www.gregbenedict.com/2009/03/31/indianapolis-ruby-brigade/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 12:46:47 +0000</pubDate>
		<dc:creator>Greg Benedict</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://www.gregbenedict.com/?p=84</guid>
		<description><![CDATA[A lot of effort has been going into transforming IndyRB into a valuable group of talented people. We&#8217;re at 116 members and growing! Here are a few ways you can interact with the group: We have a new website up at www.indyrb.org with all the details. We meetup the second Wednesday night of each month. [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of effort has been going into transforming IndyRB into a valuable group of talented people. We&#8217;re at 116 members and growing!</p>
<p>Here are a few ways you can interact with the group:</p>
<ul>
<li>We have a new website up at <a href="http://www.indyrb.org/">www.indyrb.org</a> with all the details.</li>
<li>We <a href="http://www.meetup.com/indyrb/">meetup</a> the second Wednesday night of each month.</li>
<li>Get updates, make suggestions and help out via <a href="http://twitter.com/indyrb">@indyrb</a> on Twitter.</li>
<li>Join the back channel IRC conversation at <a href="irc://irc.freenode.net/indyrb">irc://irc.freenode.net/indyrb</a>.</li>
<li>Scan the <a href="http://audioslave.tgfi.net/indyrb/">archives</a> of our #indyrb IRC room.</li>
</ul>
<p>Quite a few of us hang out on IRC during the day and late at night. It&#8217;s a great way to see what some of the best Ruby developers are discussing and get some help when you&#8217;re stuck.</p>
<img src="http://feeds.feedburner.com/~r/GregBenedict/~4/7eArTxidbaM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gregbenedict.com/2009/03/31/indianapolis-ruby-brigade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>★ Upgrading to the Canon 50mm F/1.4</title>
		<link>http://www.gregbenedict.com/2008/12/02/upgrading-to-the-canon-50mm-f14/</link>
		<comments>http://www.gregbenedict.com/2008/12/02/upgrading-to-the-canon-50mm-f14/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 15:38:20 +0000</pubDate>
		<dc:creator>Greg Benedict</dc:creator>
				<category><![CDATA[photography]]></category>

		<guid isPermaLink="false">http://www.gregbenedict.com/?p=77</guid>
		<description><![CDATA[One of the first recommendations from nearly every photographer I know was to buy a 50mm lens and just keep it on all the time. They said the f/1.8 was a great value, and i have to agree. It was the first lens I purchased and I paid around $85 on Amazon. While this lens [...]]]></description>
			<content:encoded><![CDATA[<p>One of the first recommendations from nearly every photographer I know was to buy a 50mm lens and just keep it on all the time. They said the f/1.8 was a great value, and i have to agree. It was the first lens I purchased and I paid around $85 on Amazon.</p>
<p><span id="more-77"></span></p>
<p>While this lens works great in most situations, I found three issues that got in my way.</p>
<ol>
<li>When shooting in low light, it hunts for focus. As it&#8217;s not a USM lens you have to flip off the auto focus to go manual. That is a pain in the ass. The switch is tough to find while looking at it, let alone feeling for it.</li>
<li>I felt like the colors were a bit subdued and needed more saturation. Yes, I could easily correct for it in the camera, but that was something else to think about instead of the image I wanted to capture.</li>
<li>The focus would be off just slightly from time to time and I caught myself grabbing multiple captures to be safe. This was much more typical to see in low light.</li>
</ol>
<p>As I&#8217;ve been consuming numerous blogs and a few podcasts (<a title="This Week in Photography" href="http://www.twipphoto.com/">TWIP</a>, <a title="Tack Sharp Photography Podcast" href="http://www.tacksharp.tv">Tack Sharp</a>), the next level of the 50mm kept coming up: the 50mm f/1.4. The &#8220;nifty-fifty&#8221; as it&#8217;s known. It&#8217;s sharper, more quiet, and allows me to free focus. I borrowed one for a few shots and fell in love.</p>
<p>Last Wednesday I picked up a Canon 50mm f/1.4, lens hood and polarizing filter from <a title="Roberts Imaging" href="http://www.robertsimaging.com/">Roberts</a>. The lens was just $325 (was $319.95 on Amazon). I&#8217;ve yet to take it off my 40D.</p>
<p><strong>Should you choose to buy this lens, </strong><strong>you must get the lens hood, and always use it.</strong> This lens can be fragile as it partially protrudes from the barrel. If you set it down wrong you&#8217;ll damage the motor and be out $125+ to fix it.</p>
<img src="http://feeds.feedburner.com/~r/GregBenedict/~4/PHbSacSLFoA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gregbenedict.com/2008/12/02/upgrading-to-the-canon-50mm-f14/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>★ Why Passenger Phusion Is a Better Hosting Solution Long Term</title>
		<link>http://www.gregbenedict.com/2008/11/27/why-passenger-phusion-is-a-better-hosting-solution-long-term/</link>
		<comments>http://www.gregbenedict.com/2008/11/27/why-passenger-phusion-is-a-better-hosting-solution-long-term/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 13:25:07 +0000</pubDate>
		<dc:creator>Greg Benedict</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[mongrel]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[thin]]></category>
		<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[passenger phusion]]></category>
		<category><![CDATA[Ruby Enterprise Edition]]></category>

		<guid isPermaLink="false">http://www.gregbenedict.com/?p=49</guid>
		<description><![CDATA[Since we started hosting Ruby on Rails applications in 2006, many of the pieces have changed. At each step, things became a bit easier and a bit faster. Here&#8217;s how things have changed. Lighttpd =&#62; FastCGI on FreeBSD We used this setup for probably 5-6 months. It crashed, we lost connections. It was a maintenance [...]]]></description>
			<content:encoded><![CDATA[<p>Since we started hosting Ruby on Rails applications in 2006, many of the pieces have changed. At each step, things became a bit easier and a bit faster. Here&#8217;s how things have changed.</p>
<p><span id="more-49"></span></p>
<p><strong><a href="http://www.lighttpd.net/">Lighttpd</a> =&gt; <a href="http://www.fastcgi.com/drupal/">FastCGI</a> on FreeBSD</strong><br />
We used this setup for probably 5-6 months. It crashed, we lost connections. It was a maintenance nightmare.</p>
<p><strong><a href="http://wiki.codemongers.com/Main">Nginx</a> =&gt; <a href="http://mongrel.rubyforge.org/">Mongrel</a></strong><br />
This was a huge step up from FCGI. I want to thank Zed Shaw for his hard work on Mongrel as it&#8217;s kept us running for quite some time. It also allow us to move over to CentOS Linux (built from Red Hat Enterprise).</p>
<p><strong>Nginx =&gt; <a title="Thin Web Server" href="http://code.macournoyer.com/thin/">Thin</a></strong><br />
This had a small increase over Mongrel, and since it used the Mongrel parser, it was an easy switch to make.</p>
<p><strong>Apache2 =&gt; Thin</strong><br />
We never used this combination in production, but we did run it on test servers. Nginx is much faster at serving static files and our load tests showed it. Nginx and Thin were still the better choice.</p>
<p><strong>Apache2 =&gt; <a href="http://www.phusion.nl/">Passenger Phusion</a> (Mod_Rails)</strong><br />
This is our current setup. <strong>We didn&#8217;t choose to switch for speed.</strong> It is equivalent to Nginx and Thin. The reason we switched is for simplified setup and management.</p>
<p>We run all of our Rails and PHP applications inside CentOS virtual machines. With the first 4 versions, we had to run several different monitoring utilities (god, nagios, monit) to make sure things stayed up and the ram usage was kept in check.</p>
<p>With Passenger Phusion, it self monitors each Rails instance it spins up. It can and will restart those instances as needed to clean up memory. With larger applications you can go away from the round robin approach of choosing a ruby server to adaptive based on load (I don&#8217;t recommend this for small sites as there is some overhead to doing so).</p>
<p>In general this cut out a LOT of the day to day headache for us. With the old applications, sometimes the monitoring apps just couldn&#8217;t get things restarted. We have not had that issue with Passenger.</p>
<p>Also, we have been testing our apps with <a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a> (also from the Passenger Phusion team), and will be using that in production. The copy on write memory management is fantastic. Garbage collection is much faster than traditional Ruby 1.8.x.</p>
<p>Here is some math to explain why it&#8217;s so great. Say we have 20 sites running 3 ruby servers each. Each of those 60 servers use 250MB of ram. That&#8217;s 15GB of ram. Ruby EE uses 30% less memory. that just saved us 5GB of ram. That&#8217;s a one time savings of $1,000, or I could use that extra memory to server 5 more virtual machines with the same equipment. That&#8217;s money in our pocket and faster site for our customer.</p>
<p>Even in a shared account at a place like Slicehost, Apache2, Passenger and Ruby EE are a great way to host your sites, keep them running and keep you under your ram limit.</p>
<p>Stopping running Mongrel and Thin for Rails apps. It just doesn&#8217;t make sense anymore.</p>
<img src="http://feeds.feedburner.com/~r/GregBenedict/~4/B48PLs1Y_ck" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gregbenedict.com/2008/11/27/why-passenger-phusion-is-a-better-hosting-solution-long-term/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>★ Looking for Ruby Developers</title>
		<link>http://www.gregbenedict.com/2008/08/20/looking-for-ruby-developers/</link>
		<comments>http://www.gregbenedict.com/2008/08/20/looking-for-ruby-developers/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 01:39:53 +0000</pubDate>
		<dc:creator>Greg Benedict</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[LAMP]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.gregbenedict.com/?p=44</guid>
		<description><![CDATA[Update: This position has been filled. Thanks! My company, TGFI, is currently looking for two full time Ruby developers with LAMP/CSS/XHTML experience in Indy. Even if it’s just a passion on the side, as long as the person has a solid web development background and is eager to learn, that will work. If you know [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update</strong>: This position has been filled. Thanks!</p>
<p>My company, <a title="TGFI - Indianpolis Web Development" href="http://www.tgfi.net/">TGFI</a>, is currently looking for two full time Ruby developers with LAMP/CSS/XHTML experience in Indy. Even if it’s just a passion on the side, as long as the person has a solid web development background and is eager to learn, that will work.</p>
<p>If you know anyone who is interested, please visit <a href="http://www.tgfi.net/2008/08/12/come-work-with-us/">http://www.tgfi.net/2008/08/12/come-work-with-us/</a>.</p>
<p>Thanks! ~Greg</p>
<img src="http://feeds.feedburner.com/~r/GregBenedict/~4/4BOraiKofQQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gregbenedict.com/2008/08/20/looking-for-ruby-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>★ WordPress 2.5 RC2 Is Out</title>
		<link>http://www.gregbenedict.com/2008/03/26/wordpress-25-rc2-is-out/</link>
		<comments>http://www.gregbenedict.com/2008/03/26/wordpress-25-rc2-is-out/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 02:06:05 +0000</pubDate>
		<dc:creator>Greg Benedict</dc:creator>
				<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.gregbenedict.com/?p=42</guid>
		<description><![CDATA[Update: WordPress 2.5 has gone final. Great work from the teams at Auttomatic &#38; Happy Cog, along with all of the contributors. The latest release candidate of WordPress, 2.5 RC2, is out. So far I haven&#8217;t noticed any major changes from RC1, just some tweaks based on feedback. Matt (WordPress co-founder) has put together a [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update</strong>: <a href="http://wordpress.org/download/">WordPress 2.5 has gone final</a>. Great work from the teams at Auttomatic &amp; Happy Cog, along with all of the contributors.</p>
<p>The latest release candidate of <a href="http://wordpress.org/wordpress-2.5-RC2.zip">WordPress, 2.5 RC2</a>, is out. So far I haven&#8217;t noticed any major changes from RC1, just some tweaks based on feedback.</p>
<p>Matt (WordPress co-founder) has put together a quick screen cast as an <a href="http://wordpress.org/development/2008/03/wordpress-25-rc2/">overview of the major changes</a> compared to earlier 2.x releases. It&#8217;s well worth the look</p>
<p>Also, if you are going to upgrade to any release of 2.5, check out the official <a href="http://codex.wordpress.org/Plugins/Plugin_Compatibility/2.5">which plugins work and which don&#8217;t</a> list before upgrading. Once you&#8217;re in the clear, go install. The admin tool is so much better.</p>
<img src="http://feeds.feedburner.com/~r/GregBenedict/~4/ubZ3L9ukgSU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gregbenedict.com/2008/03/26/wordpress-25-rc2-is-out/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic page generated in 0.551 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-04-13 16:44:16 --><!-- Compression = gzip -->

