I was hired to add a few changes to a site built on Rails 3.0.3 and RefineryCMS 0.9.9 . I am new at Rails and Capistrano, so I tried to do a test deploy to the site in order to get the hang of working with the tools. I downloaded the production version of the site and I tried to re-deploy it. I changed just a few things in the config/deploy.rb file I didn't change any dependencies in the Gemfile or anything in the db. I attempted to deploy using github but I had ssh keys problems, so I deployed it using my own copy. I change all the necessary permission to the server and the deployment worked. The site though didn't. The home page was titled
Ruby (Rack) application could not be started
These are the possible causes:
There may be a syntax error in the application's code. Please check for such errors and fix them.
A required library may not installed. Please install all libraries that this application requires.
The application may not be properly configured. Please check whether all configuration files are written correctly, fix any incorrect configurations, and restart this application.
A service that the application relies on (such as the database server or the Ferret search engine server) may not have been started. Please start that service.
So, I typed 'cap deploy:rollback' to get the previous proper version. However, when logging in, where the Dashboard should appear, I get a 500.hmtl page. I seem to be logged in to the site, but no Dashboard!
The server host is a typical nginx/0.8.53 + Phusion Passenger 3.0.2 (mod_rails/mod_rack). The error logs are disabled, so I can't find anything!
What follows is the deploy.rb I used:
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
#require "rvm/capistrano" # Load RVM's capistrano plugin.
#set :rvm_ruby_string, '1.9.2' # Or whatever env you want it to run in.
#set :rvm_type, :user
#require "bundler/capistrano"
set :application, "xxxxx"
#set :repository "ssh://hg@bitbucket.org/xxxx/xxxxx"
#set :repository, "ssh://git@bitbucket.org/xxxx/xxxxx.git"
set :repository, "git@github.com:xxxx/xxxxx.git"
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :scm_username, 'xxxx'
set :scm_password, proc{Capistrano::CLI.password_prompt('git pass:')}
role :web, "www.xxxxx.gr" # Your HTTP server, Apache/etc
role :app, "www.xxxxx.gr" # This may be the same as your `Web` server
role :db, "www.xxxxx.gr", :primary => true # This is where Rails migrations will run
# If you are using Passenger mod_rails uncomment this:
# if you're still using the script/reapear helper you will need
# these http://github.com/rails/irs_process_scripts
set :deploy_to, "/var/www/#{application}"
set :deploy_via, :copy #:remote_cache #:copy
set :keep_releases, 5
set :user, "xxxx"
set :use_sudo, true
# before "deploy:bundle_install", "deploy:install_bundler"
# after "deploy:update_code", "deploy:bundle_install"
after "deploy:update_code", "deploy:remove_packaged_assets"
after "deploy:update_code", "deploy:symlink_assets"
#after "deploy:symlink", "deploy:update_crontab"
namespace :deploy do
task :start do ; end
task :stop do ; end
desc "Symlink shared folders on each release."
task :symlink_assets do
run "ln -nfs #{shared_path}/system #{release_path}/public/system"
end
desc "Remove packaged assets"
task :remove_packaged_assets, :roles => :web do
run "rm -f #{current_path}/public/javascripts/all.js"
run "rm -f #{current_path}/public/stylesheets/all.css"
end
# desc "installs Bundler if it is not already installed"
# task :install_bundler, :roles => :app do
# sudo "sh -c 'if [ -z `which bundle` ]; then echo Installing Bundler; sudo gem install bundler; fi'"
# end
#
# desc "run 'bundle install' to install Bundler's packaged gems for the current deploy"
# task :bundle_install, :roles => :app do
# run "cd #{current_path} && bundle install"
# end
desc "Update the crontab file"
task :update_crontab, :roles => :app, :except => { :no_release => true } do
run "cd #{release_path} && bundle exec whenever --update-crontab #{application}"
end
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{File.join(current_path,'tmp','restart.txt')}"
end
end