Jul 17, 2008
Generic-user-small Frank 5 posts

Topic: Everyday Active Record / question about callbacks

Hi Ryan i just finished watching the first 4 episodes of everyday activerecord. I really enjoyed them and I learned a lot.

I have a question regarding the callbacks episode. Near the end of the episode you modified the callback called clear_movie_average_stars_cache to handle the case where a review is moved from one movie to another. I think I fully understand that part. But what about the reviews_count ? Does that get automatically adjusted when you move a review from one movie to another due to :counter_cache => true ? I was under the impression that :counter_cache => true only changes the count for create and destroy.

- thanks,
Francois

 
Mar 29, 2008
Generic-user-small Frank 5 posts

Topic: Deploying Rails Applications / Deployment on Amazon EC2?

I’d like to add my vote for a chapter on deploying on ec2

 
Mar 14, 2008
Generic-user-small Frank 5 posts

Topic: Deploying Rails Applications / Monit and Mongrel

I’ve been able to come up with a solution to this problem. The solution is to add the following line to /usr/local/bin/mongrel_rails

ENV[‘PATH’] = ”#{ENV[‘PATH’]}:/usr/local/bin”;

and then to have the stop/start commands in the monit config look as follows:

start program = ”/usr/local/bin/mongrel_rails cluster::start -C /home/virtual/rails/myapp/current/config/mongrel_cluster.yml—clean—only 5050”

stop program = ”/usr/local/bin/mongrel_rails cluster::stop -C /home/virtual/rails/myapp/current/config/mongrel_cluster.yml—only 5050”

This isn’t really an ideal solution as my monit monitoring will break whenever I upgrade the mongrel_cluster gem.

 
Mar 14, 2008
Generic-user-small Frank 5 posts

Topic: Deploying Rails Applications / Monit and Mongrel

I’ve tried many different ways of specifying the start and stop commands in monit. For example, I just tried this:

start program = ”/usr/bin/env PATH=/usr/local/bin:${PATH} mongrel_rails cluster::start -C /home/virtual/rails/myapp/current/config/mongrel_cluster.yml—clean—only 5050”

stop program = ”/usr/bin/env PATH=/usr/local/bin:${PATH} mongrel_rails cluster::stop -C /home/virtual/rails/myapp/current/config/mongrel_cluster.yml—only 5050”

and still the monit log file reports:

[ Mar 14 11:43:07] info : ‘mongrel_myapp_5050’ stop: /usr/bin/env
[ Mar 14 11:43:37] error : ‘mongrel_myapp_5050’ failed to stop

I am able to run those stop start commands manually from a shell in which I set the initial path to be the same one that monit sets (/bin:/usr/bin:/sbin:/usr/sbin) so I have no idea why it doesn’t work through monit.

Is there anyway to actually debug monit and see what its actually executing and see what error message it might encounter when trying to stop or start a program?

 
Mar 14, 2008
Generic-user-small Frank 5 posts

Topic: Deploying Rails Applications / Monit and Mongrel

I recently picked up the beta version of Deploying Rails Applications and I’m trying to use the information in the book to setup monit to monitor and restart my cluster of mongrels.

I can get monit to monitor my mongrels but I haven’t been able to get monit to be able to stop or start my mongrels. The problem seems to be related to the spartan path that monit provides when starting or stopping programs. That path is PATH=/bin:/usr/bin:/sbin:/usr/sbin

And on my particular FreeBSD 6.3 system I cannot run the mongrel_rails command successfully unless /usr/local/bin is part of my path. If I run mongrel_rails without /usr/local/bin in my path I am rewarded with this error:

/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27: command not found:

Anyone else encounter this? Any ideas on how to solve it?

5 posts