BigTablet.com Blog

June 17, 2009

Install Passenger on OSX but getting 403 Permissions Error?

Filed under: Ruby & Rails — ciddennis @ 3:31 pm

I installed Passenger on my macintosh and found that I keep getting a 403 error. So after some digging I found a few things.

  • Make sure all directories in your rails app are owned by the same user and have permission of 755.
  • Add PassengerDefaultUser to your httpd.conf file and set its value to your user name.
  • You may need to put a directory area in that look like this

<Directory “<<path to rails app public dir>>”>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

</Directory>

  • Add RailsEnv development in your httpd.conf/

Hope this helps save you time…

Redirect Stdout and Stderr to Log in Passenger

Filed under: Ruby & Rails — ciddennis @ 2:40 pm

I recently moved my server to use passenger and found that while doing development I lost my standard out and error. After some work I found if I add this to the top of my environments.rb file all my standard out and error are put in file in the rails root / logs directory….


if ENV["TMPDIR"] && ENV["TMPDIR"].index("passenger")
std_out = File.new(RAILS_ROOT + "/log/stdout.log","a")
std_err = File.new(RAILS_ROOT + "/log/stderr.log","a")
$stdout.reopen(std_out)
$stderr.reopen(std_err)
end

May 18, 2009

Rails 2.3 and Memcache Server Hashes

Filed under: Ruby & Rails — Tags: — ciddennis @ 3:39 pm

So at another project I have situation where I have to share some information in memcache with a java client.   We use a cluster of about 5 memcachd servers to do this data sharing.    This has worked fine for a number of months but when I recently upgraded to rails 2.3 I found it would no longer find right servers.   When I looked in to it more I found that the memcache_client library changed its servers selection algorithm to use something called consistent hashing.  Anyway now the default Rails.cache.fetch does not work.  So while I look for a java client that uses the same server selection algorithm I just did this:


def get_memcach_token(mem_cache_id)
Rails.cache.addresses.each { |address|
value = MemCache.new([address]).get(mem_cache_id,{:raw => true})
return value if value
}
nil
end

The other option is to go back to memcache_client 1.5.  But then you are going to be stuck there forever.

Blog at WordPress.com.