Deployment issues in capistrano

Follow a good tutorial here and it really helped me get my head around some stuff. Rails apache and rvm work well. I'm almost done, but I'm stuck with the final part.

Basically I have a deployment file similar to what it has but cannot debug what it is looking for. The deploy.rb file looks like this:

#RVM Bootstrap
$:.unshift(File.expand_path('./lib',ENV['rvm_path']))

require 'rvm/capistrano'
set :rvm_ruby_string, '1.9.2-p318'


#bundler bootstrap
require 'bundler/capistrano'

#main details
set :application , "test"
role :web, "test"
role :app, "test"
role :db, "test", :primary => true

#server Details
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
set :deploy_to, "/var/www/test/"
set :deploy_via, :remote_cache
set :user, "passenger"
set :use_sudo, false


# repo details
set :scm, :git
set :scm_username, "passenger"
set :repository, "git@gitserver:test.git"
set :branch, "master"
set :git_enable_submodules, 1

# tasks
namespace :deploy do
  task :start, :roles => :app do
    run "touch #{current_path}/tmp/restart.txt"
  end

  task :stop, :roles => :app do
    # Do nothing.
  end
  desc "Restart Application"
  task :restart, :roles => :app do
    run "touch #{current_path}/tmp/restart.txt"
  end
end

      

When I try to deploy a capistrano app with cap deployment: setup I get the following error:

  * executing `deploy:setup'
  * executing "mkdir -p /var/www/test/ /var/www/test/releases /var/www/test/shared /var/www/test/shared/system /var/www/test/shared/log /var/www/test/shared/pids"
    servers: ["test"]
connection failed for: test (SocketError: getaddrinfo: Name or service not known)

      

I did a little work. Rails webrick has no problem running the rails app, so it must be related to the fact that I am deploying apache. It should be noted that the application name is "application" (since the test is reserved in rails) and the domain name is "test".

This inconsistency can cause problems, but I have little experience so I'm not sure.

Can anyone point me to where to debug or what it might be?

+3


source to share


1 answer


The web, app and db role should be the URL or IP of the server you are deploying to. Something like that:



task :staging do
  set :rails_env, 'staging'
  role :app, "example.com"
  role :web, "example.com"
  role :db,  "example.com", :primary => true
end

      

+6


source







All Articles