Reputation: 12187
Am following a nice tutorial here and it's really helped wrap my head around some things. Rails apache and rvm all work nicely together. I'm almost finished but am getting stuck on the final part.
Basically I have the deploy file similar to what he has but cant seem to debug what he's 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 attempt to deploy the application with capistrano with cap deploy: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've tinkered with it a bit. Rails webrick has no problems starting the rails application so it must be something to do with me deploying to apache. One thing to note is that the application name "app" (because test is reserved in rails) and the domain name is "test".
This mismatch could be causing problems but I have little to no experience so I'm not sure.
Can anyone point me where to debug or what it might be?
Upvotes: 3
Views: 1665
Reputation: 2509
Role web, app and db need to be the URL or IP of the server that you're deploying to. Something like this:
task :staging do
set :rails_env, 'staging'
role :app, "example.com"
role :web, "example.com"
role :db, "example.com", :primary => true
end
Upvotes: 6