<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>Sean&#039;s Blog &#187; production</title>
	<atom:link href="http://seanbehan.com/tag/production/feed/" rel="self" type="application/rss+xml" />
	<link>http://seanbehan.com</link>
	<description>Web Programming, Ruby on Rails, Wordpress, PHP from Burlington, Vermont</description>
	<lastBuildDate>Wed, 18 Jan 2012 21:44:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Rails Send_File in Production Delivers an Empty File</title>
		<link>http://seanbehan.com/ruby-on-rails/rails-send_file-in-production-delivers-an-empty-file/</link>
		<comments>http://seanbehan.com/ruby-on-rails/rails-send_file-in-production-delivers-an-empty-file/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 15:54:06 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[gotchas]]></category>
		<category><![CDATA[mishaps]]></category>
		<category><![CDATA[production]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[send_file]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1370</guid>
		<description><![CDATA[If you&#8217;re running Rails in production it will by default be configured to let apache or nginx send files for you. If you&#8217;re handling file downloads yourself with send_file send_file(&#34;path/to/file.txt&#34;) you will notice that the downloaded files are empty. To get around this just comment out the following in your config/environments/production.rb file. # comment out [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby-on-rails%2Frails-send_file-in-production-delivers-an-empty-file%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Rails Send_File in Production Delivers an Empty File" data-url="http://seanbehan.com/ruby-on-rails/rails-send_file-in-production-delivers-an-empty-file/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>If you&#8217;re running Rails in production it will by default be configured to let apache or nginx send files for you. If you&#8217;re handling file downloads yourself with send_file</p>
<pre class="wp-code-highlight prettyprint">
send_file(&quot;path/to/file.txt&quot;)
</pre>
<p>you will notice that the downloaded files are empty. To get around this just comment out the following in your config/environments/production.rb file.</p>
<pre class="wp-code-highlight prettyprint">
  # comment out for production because apache/nginx are not doing this for us
  #config.action_dispatch.x_sendfile_header = &quot;X-Sendfile&quot;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-on-rails/rails-send_file-in-production-delivers-an-empty-file/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ruby Enterprise Edition and Passenger ./script/console production fails and instead returns Loading production environment (Rails 2.3.5) Rails requires RubyGems &gt;= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org</title>
		<link>http://seanbehan.com/linux/ruby-enterprise-edition-and-passenger-scriptconsole-production-fails-and-instead-returns-loading-production-environment-rails-2-3-5-rails-requires-rubygems-1-3-2-please-install-rubygems-and-t/</link>
		<comments>http://seanbehan.com/linux/ruby-enterprise-edition-and-passenger-scriptconsole-production-fails-and-instead-returns-loading-production-environment-rails-2-3-5-rails-requires-rubygems-1-3-2-please-install-rubygems-and-t/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 14:00:21 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[irb]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[production]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby enterprise edition]]></category>
		<category><![CDATA[rubygems]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1211</guid>
		<description><![CDATA[After installing Ruby Enterprise Edition, REE, and Passenger on Ubuntu you may see this error message when you run script/console for the first time ./script/console production # =&#62; Loading production environment (Rails 2.3.5) Rails requires RubyGems &#62;= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org You then scratch your head and run which gem which [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Flinux%2Fruby-enterprise-edition-and-passenger-scriptconsole-production-fails-and-instead-returns-loading-production-environment-rails-2-3-5-rails-requires-rubygems-1-3-2-please-install-rubygems-and-t%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Ruby Enterprise Edition and Passenger ./script/console production fails and instead returns Loading production environment (Rails 2.3.5) Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org" data-url="http://seanbehan.com/linux/ruby-enterprise-edition-and-passenger-scriptconsole-production-fails-and-instead-returns-loading-production-environment-rails-2-3-5-rails-requires-rubygems-1-3-2-please-install-rubygems-and-t/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>After installing Ruby Enterprise Edition, REE, and Passenger on Ubuntu you may see this error message when you run script/console for the first time</p>
<pre class="wp-code-highlight prettyprint">
./script/console production
# =&gt;
Loading production environment (Rails 2.3.5)
Rails requires RubyGems &gt;= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org
</pre>
<p>You then scratch your head and run </p>
<pre class="wp-code-highlight prettyprint">
which gem
which ruby
which rails
</pre>
<p>to find that all appears to be in order. You have rubygems installed , ruby is installed and so is rails. You also find that each are pointing to the correct location, which is something like /usr/bin/gem -> /opt/ruby-enterprise-x.x.x.x/bin/gem, where x.x.x.x is the version of REE. </p>
<p>The problem isn&#8217;t however, with any of the above. The issue is with the location of irb. If you installed (like me) irb with apt-get install irb, then irb isn&#8217;t aware of your shiny new REE and ruby gems. It&#8217;s a simple fix however, unlink irb and symlink the /usr/bin/irb to REE&#8217;s irb like so&#8230;  </p>
<pre class="wp-code-highlight prettyprint">
rm /usr/bin/irb
</pre>
<p>And symlink it to the irb that REE has in bin </p>
<pre class="wp-code-highlight prettyprint">
ln -s /opt/ruby-enterprise-x.x.x.x/bin/irb /usr/bin/irb
</pre>
<p>Now cd into your rails app and run </p>
<pre class="wp-code-highlight prettyprint">
./script/console production
</pre>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/linux/ruby-enterprise-edition-and-passenger-scriptconsole-production-fails-and-instead-returns-loading-production-environment-rails-2-3-5-rails-requires-rubygems-1-3-2-please-install-rubygems-and-t/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Defining Application Constants for Ruby on Rails Application</title>
		<link>http://seanbehan.com/ruby-on-rails/defining-application-constants-for-ruby-on-rails-application/</link>
		<comments>http://seanbehan.com/ruby-on-rails/defining-application-constants-for-ruby-on-rails-application/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 16:20:30 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[constants]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[localhost]]></category>
		<category><![CDATA[production]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=879</guid>
		<description><![CDATA[The best place to keep application constants which are environment specific is in config/environments directory. For instance&#8230; # in RAILS_ROOT/config/environments/development.rb APP_DOMAIN = &#34;localhost&#34; # in RAILS_ROOT/config/environments/production.rb APP_DOMAIN = &#34;real-domain.com&#34; &#8230;will set the APP_DOMAIN constant to either &#8220;localhost&#8221; or &#8220;real-domain.com&#8221; depending on which environment Rails boots up.]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby-on-rails%2Fdefining-application-constants-for-ruby-on-rails-application%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Defining Application Constants for Ruby on Rails Application" data-url="http://seanbehan.com/ruby-on-rails/defining-application-constants-for-ruby-on-rails-application/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>The best place to keep application constants which are environment specific is in config/environments directory. For instance&#8230;</p>
<pre class="wp-code-highlight prettyprint">
# in RAILS_ROOT/config/environments/development.rb
APP_DOMAIN = &quot;localhost&quot;
# in RAILS_ROOT/config/environments/production.rb
APP_DOMAIN = &quot;real-domain.com&quot;
</pre>
<p>&#8230;will set the APP_DOMAIN constant to either &#8220;localhost&#8221; or &#8220;real-domain.com&#8221; depending on which environment Rails boots up.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-on-rails/defining-application-constants-for-ruby-on-rails-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails: Expiring a cached page with namespaces and sweepers</title>
		<link>http://seanbehan.com/ruby-on-rails/rails-expiring-a-cached-page-with-namespaces-and-sweepers/</link>
		<comments>http://seanbehan.com/ruby-on-rails/rails-expiring-a-cached-page-with-namespaces-and-sweepers/#comments</comments>
		<pubDate>Sun, 31 May 2009 18:55:35 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[production]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Scaling]]></category>
		<category><![CDATA[sweeper]]></category>

		<guid isPermaLink="false">http://bseanvt.wordpress.com/?p=239</guid>
		<description><![CDATA[I&#8217;ve got some pages that are cached using their permalinks on the filesystem, such as http://example.com/about-us.html which will need to map to RAILS_ROOT/public/about-us.html &#8230; The issue I have is that I use a namespace for the admin area and the controllers in the namespace are responsible for expiring the cached pages, i.e., when the resources [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby-on-rails%2Frails-expiring-a-cached-page-with-namespaces-and-sweepers%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Rails: Expiring a cached page with namespaces and sweepers" data-url="http://seanbehan.com/ruby-on-rails/rails-expiring-a-cached-page-with-namespaces-and-sweepers/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>I&#8217;ve got some pages that are cached using their permalinks on the filesystem, such as http://example.com/about-us.html which will need to map to RAILS_ROOT/public/about-us.html &#8230; The issue I have is that I use a namespace for the admin area and the controllers in the namespace are responsible for expiring the cached pages, i.e., when the resources are updated by an admin.</p>
<p>Check out Rails Envy for a great tutorial for getting page caching set up: http://www.railsenvy.com/2007/2/28/rails-caching-tutorial</p>
<p>So what I want to do is expire the pages from inside my namespace. To accomplish this I need to use the pages route in my sweeper class.</p>
<pre class="wp-code-highlight prettyprint">
class PageSweeper &lt; ActionController::Caching::Sweeper
  #... after_save, after_destroy... we'll exprire the cache
  def expire_cache_for(record)
    #permalink rather than record id like /213.html
    expire_page(pages_path(record.permalink))
  end
end
</pre>
<p>Since I&#8217;m using a permalink to cache the page, I need to expire it with the permalink too.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-on-rails/rails-expiring-a-cached-page-with-namespaces-and-sweepers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sample Rails Database Config  for MySQL</title>
		<link>http://seanbehan.com/ruby-on-rails/sample-rails-database-config-for-mysql/</link>
		<comments>http://seanbehan.com/ruby-on-rails/sample-rails-database-config-for-mysql/#comments</comments>
		<pubDate>Fri, 01 May 2009 20:29:11 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[production]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[yml]]></category>

		<guid isPermaLink="false">http://bseanvt.wordpress.com/?p=209</guid>
		<description><![CDATA[Sample Ruby on Rails database config file for connecting to mysql. production: adapter: mysql encoding: utf8 reconnect: false database: db_production pool: 5 username: db_user password: db_password #socket: /tmp/mysql.sock #this may vary]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby-on-rails%2Fsample-rails-database-config-for-mysql%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Sample Rails Database Config  for MySQL" data-url="http://seanbehan.com/ruby-on-rails/sample-rails-database-config-for-mysql/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>Sample Ruby on Rails database config file for connecting to mysql.</p>
<pre class="wp-code-highlight prettyprint">
production:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: db_production
  pool: 5
  username: db_user
  password: db_password
  #socket: /tmp/mysql.sock #this may vary
</pre>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-on-rails/sample-rails-database-config-for-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>upgrading to latest phusion passenger 2.1.2</title>
		<link>http://seanbehan.com/programming/upgrading-to-latest-phusion-passenger-212/</link>
		<comments>http://seanbehan.com/programming/upgrading-to-latest-phusion-passenger-212/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 04:08:43 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[phusion passenger]]></category>
		<category><![CDATA[production]]></category>

		<guid isPermaLink="false">http://bseanvt.wordpress.com/?p=31</guid>
		<description><![CDATA[super easy gem install passenger passenger-install-apache2-module will walk you through the install and remember to copy paths to your apache config file. for passenger i kept it in mods-available/passenger.conf and then linked it to mods-enabled ln -s /etc/apache2/mods-available/passenger.conf /etc/apache2/mods-enabled/passenger.conf then just restart apache more info and official docs at http://blog.phusion.nl/2009/03/13/phusion-passenger-212-final-released/]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fprogramming%2Fupgrading-to-latest-phusion-passenger-212%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="upgrading to latest phusion passenger 2.1.2" data-url="http://seanbehan.com/programming/upgrading-to-latest-phusion-passenger-212/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>super easy</p>
<pre class="wp-code-highlight prettyprint">
gem install passenger
passenger-install-apache2-module
</pre>
<p>will walk you through the install and remember to copy paths to your apache config file. for passenger i kept it in<br />
mods-available/passenger.conf and then linked it to mods-enabled</p>
<pre class="wp-code-highlight prettyprint">
ln -s /etc/apache2/mods-available/passenger.conf /etc/apache2/mods-enabled/passenger.conf
</pre>
<p>then just restart apache</p>
<p>more info and official docs at http://blog.phusion.nl/2009/03/13/phusion-passenger-212-final-released/</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/programming/upgrading-to-latest-phusion-passenger-212/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

