small medium large xlarge

Generic-user-small
23 Apr 2009, 13:57
Bharat Ruparel (148 posts)

I am following the Passenger/Capistrano/Git deployment process outlined in Chapter 28. Everything seems to work well except being able to restart my application. I am on Ubuntu 8.10. Here is my configuration info:

  1. httpd.conf file in /etc/apache2 is as follows:
LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.1/ext/apache2/mod_passenger.so
PassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.1
PassengerRuby /opt/ruby-enterprise/bin/ruby

<VirtualHost *:80>
   ServerName localhost
   DocumentRoot /home/bruparel/r_work/insurance/current/public/
   <Directory /home/bruparel/r_work/insurance/current/public>
      Order allow,deny
      Allow from all
   </Directory>
</VirtualHost>
  1. Here is the Capistrano deploy.rb file:
set :application, "insurance"
set :user, "bruparel"
set :admin_runner, "bruparel"
set :domain, '192.168.1.105'

role :app, domain
role :web, domain
role :db,  domain, :primary => true

default_run_options[:pty] = true
set :repository, "#{user}@#{domain}:git/#{application}.git"
set :deploy_to, "/home/#{user}/r_work/#{application}"

set :scm, "git"
set :branch, "master"
set :deploy_via, :remote_cache
set :scm_verbose, true
set :use_sudo, false

namespace :deploy do
  desc "Restart Application"
  task :restart do
    run "touch #{current_path}/tmp/restart.txt"
  end
end

When I run cap deploy:restart, I can see the restart.txt file is being “touched” correctly by Capistrano since the timestamp changes. However, Passenger fails to restart my application, I have to manually restart Apache for my app to pick up redeployed changes.

Any help would be appreciated.

Thanks.

Bharat

Generic-user-small
23 Apr 2009, 20:02
Bharat Ruparel (148 posts)

Following up on my own post, the restart process is working. However, I have several other follow up questions:

  1. When I deploy from a client machine to a laptop connected via home network, the following statement creates a problem i the Capistrano deploy script:

set :deploy_via, :remote_cache

I commented it out and then the deploy process worked again. I have looked up the function of setting deploy_via to remote cache and found that a remote copy is cached by using this command and Capistrano does a net change and picks up only the changes from the repository and uses remote_cache to speed up the deployment process. It does not seem to work for me.

  1. This is driving me crazy and shows my lack of linux network skills. I have two Ubuntu laptops connected via a home wireless network and they work fine. However, the DHCP allocates a different IP to my “server” laptop thereby causing ssh to think that I have a man in the middle attack going on when I try to connect to it using the “client” laptop. I was trying to find an easy way to assign them a local proxy DNS name which stays constant when I restart them, but cannot find a good answer. Does anyone know?

Thanks.

Bharat

You must be logged in to comment