I've been following this railscast here on deploying to a VPS http://railscasts.com/episodes/335-deploying-to-a-vps and I seem to be stuck on on deploying. When I type in cap deploy, I get this.
cap aborted!
cannot load such file -- deploy/assets
/files/rails/Capfile:2:in `load'
/files/rails/Capfile:2:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.1/lib/capistrano/application.rb:22:in `load_rakefile'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.1/lib/capistrano/application.rb:12:in `run'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.1/bin/cap:3:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `load'
/usr/local/rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `<main>'
(See full trace by running task with --trace)
My deploy.rb
require "bundler/capistrano"
server "(removed)", :web, :app, :db, primary: true
set :application, "Fooddiscovery"
set :user, "(removed)"
set :deploy_to, "/home/rails"
set :deploy_via, :remote_cache
set :use_sudo, false
set :scm, "git"
set :repository, "(removed)"
set :branch, "master"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
after "deploy", "deploy:cleanup" # keep only the last 5 releases
namespace :deploy do
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command, roles: :app, except: {no_release: true} do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
task :setup_config, roles: :app do
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
run "mkdir -p #{shared_path}/config"
put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
puts "Now edit the config files in #{shared_path}."
end
after "deploy:setup", "deploy:setup_config"
task :symlink_config, roles: :app do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
after "deploy:finalize_update", "deploy:symlink_config"
desc "Make sure local git is in sync with remote."
task :check_revision, roles: :web do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
before "deploy", "deploy:check_revision"
end
My capfile
load 'deploy' if respond_to?(:namespace)
load 'deploy/assets'
load 'config/deploy'
I read other questions and answers that said to add
if respond_to?(:namespace)
which did actually help with the first error where instead of deploy/assets, it use to show errors for just deploy ( cannot load such file -- deploy ). Putting in if respond_to?(:namespace) for all three links does not solve the issue. In fact a new error shows if I do that telling me undefined local variable or method `tasks_without_stage_dependency'.
Thanks!
#Michael's correct that you're using Capistrano 2 syntax with Capistrano 3, but you could just make sure you're using Capistrano 2 in your Gemfile for a quick fix.
gem 'capistrano', '2.15.5'
But if you're interested in using Capistrano 3, here is a pretty good upgrade guide that worked for me.
Looks like you are using Capistrano 2 syntax in your Capfile, and you have upgraded to the Capistrano 3 gem.
Capistrano 3 looks more like the following in the Capfile
require 'capistrano/rails'
Related
I am using this_link for deploying, but I didnt created new user rather I am continuing with root user. I am using unicorn, nginx, capistrano for this.
On running cap deploy:cold, I am getting error bash: bundle: command not found.
deploy.rb
set :stages, %w(production) #various environments
require "bundler/capistrano"
require "rvm/capistrano"
server "xxx.xxx.xxx.xx", :web, :app, :db, primary: true
set :application, "xyz"
set :stage, "production"
set :user, "root"
set :port, 22
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
set :default_shell, :bash
# set :scm, "git"
set :repository, "git#bitbucket.org:xyz_app/xyz.git"
set :branch, "master"
# set :rvm_ruby_string, :local # use the same ruby as used locally for deployment
set :rvm_autolibs_flag, "read-only" # more info: rvm help autolibs
before 'deploy:setup', 'rvm:install_rvm' # install/update RVM
# before 'deploy:setup', 'rvm:install_ruby'
# before 'deploy:setup', 'rvm:install_ruby' # install Ruby and create gemset,
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
after "deploy", "deploy:cleanup" # keep only the last 5 releases
namespace :deploy do
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command, roles: :app, except: {no_release: true} do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
task :setup_config, roles: :app do
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
run "mkdir -p #{shared_path}/config"
put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
puts "Now edit the config files in #{shared_path}."
end
after "deploy:setup", "deploy:setup_config"
task :symlink_config, roles: :app do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
after "deploy:finalize_update", "deploy:symlink_config"
desc "Make sure local git is in sync with remote."
task :check_revision, roles: :web do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
before "deploy", "deploy:check_revision"
end
cap shell output
cap> echo $PATH
[establishing connection(s) to xxx.xxx.xxx.xx]
** [out :: xxx.xxx.xxx.xx] /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/root/.rvm/bin
** [out :: xxx.xxx.xxx.xx]
cap> id
** [out :: xxx.xxx.xxx.xx] uid=0(root) gid=0(root) groups=0(root)
** [out :: xxx.xxx.xxx.xx]
cap> exit
cap deploy:check
You appear to have all necessary dependencies installed
Error code
* 2015-09-10 01:49:10 executing `bundle:install'
* executing "cd /home/root/apps/xyz/releases/20150909201909 && bundle install --gemfile /home/root/apps/xyz/releases/20150909201909/Gemfile --path /home/root/apps/xyz/shared/bundle --deployment --quiet --without development test"
servers: ["xxx.xxx.xxx.xx"]
[xxx.xxx.xxx.xx] executing command
** [out :: xxx.xxx.xxx.xx] bash: bundle: command not found
** [out :: xxx.xxx.xxx.xx]
command finished in 338ms
*** [deploy:update_code] rolling back
Please help me out from this issue. Thanks in advance
You need bundler. http://bundler.io/
gem install bundler
This gave it away: bash: bundle: command not found
I spent hours on this railscast, http://railscasts.com/episodes/335-deploying-to-a-vps and this tutorial, https://coderwall.com/p/yz8cha(which is based on the railscast)
I am getting this when I do cap deploy:setup or bundle exec cap deploy:setup
I am not quite familiar with the scripts used on the railscast, mainly copy and paste/augment path (insert username/projectname) on the root path. I suspect that I configured the scripts incorrectly?
cap deploy:setup
triggering load callbacks
* 2013-09-06 01:21:56 executing `deploy:setup'
* executing "mkdir -p /home/deployer2/apps/lintong /home/deployer2/apps/lintong/releases /home/deployer2/apps/lintong/shared /home/deployer2/apps/lintong/shared/system /home/deployer2/apps/lintong/shared/log /home/deployer2/apps/lintong/shared/pids"
servers: ["192.241.241.204"]
[192.241.241.204] executing command
** [out :: 192.241.241.204] bash: /home/deployer2/.rvm/bin/rvm-shell: No such file or directory
command finished in 9ms
failed: "rvm_path=$HOME/.rvm $HOME/.rvm/bin/rvm-shell 'default' -c 'mkdir -p /home/deployer2/apps/lintong /home/deployer2/apps/lintong/releases /home/deployer2/apps/lintong/shared /home/deployer2/apps/lintong/shared/system /home/deployer2/apps/lintong/shared/log /home/deployer2/apps/lintong/shared/pids'" on 192.241.241.204
here is my deploy.rb file
require "bundler/capistrano"
require "rvm/capistrano"
server "192.241.241.204", :web, :app, :db, primary: true
set :application, "lintong"
set :user, "deployer2"
set :port, 7000
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
set :scm, "git"
set :repository, "git#github.com:Jngai/#{application}.git"
set :branch, "master"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
after "deploy", "deploy:cleanup" # keep only the last 5 releases
namespace :deploy do
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command, roles: :app, except: {no_release: true} do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
task :setup_config, roles: :app do
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
run "mkdir -p #{shared_path}/config"
put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
puts "Now edit the config files in #{shared_path}."
end
after "deploy:setup", "deploy:setup_config"
task :symlink_config, roles: :app do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
after "deploy:finalize_update", "deploy:symlink_config"
desc "Make sure local git is in sync with remote."
task :check_revision, roles: :web do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
before "deploy", "deploy:check_revision"
end
its looking for rvm in the wrong place? its living in usr/local. is anyone familiar with deployment using Capistrano ?
I was lacking this in my deploy.rb
set :rvm_ruby_string, :local # use the same ruby as used locally for deployment
before 'deploy:setup', 'rvm:install_rvm' # install/update RVM
before 'deploy:setup', 'rvm:install_ruby' # install Ruby and create gemset, OR:
I'm running a rails 3 application hosted on a Ubuntu 12.04 VPS. I'm using Capistrano for the deployment and nginx + unicorn for the server.
My problem is that if I did a "cap deploy", my website displays the old code until I reboot my VPS. I check the current code on the server and it is the right one. I have already tried to restart nginx, but it doesn't work.
My deploy file (I followed the Railscast):
# deploy.rb
require "bundler/capistrano"
require 'new_relic/recipes'
server "188.165.145.167", :web, :app, :db, primary: true
set :application, "neurones"
set :user, "neurones"
set :deploy_to, "/home/neurones/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
set :shared_children, shared_children + %w{public/uploads}
set :scm, "git"
set :repository, "git#github.com:khcr/neurones.git"
set :branch, "master"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
after "deploy", "deploy:cleanup" # keep only the last 5 releases
after "deploy:update", "newrelic:notice_deployment" # update new relic
namespace :deploy do
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command, roles: :app, except: {no_release: true} do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
task :setup_config, roles: :app do
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
run "mkdir -p #{shared_path}/config"
put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
puts "Now edit the config files in #{shared_path}."
end
after "deploy:setup", "deploy:setup_config"
task :symlink_config, roles: :app do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
after "deploy:finalize_update", "deploy:symlink_config"
desc "Make sure local git is in sync with remote."
task :check_revision, roles: :web do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
before "deploy", "deploy:check_revision"
end
I resolved the problem.
Looking in the unicorn log (thanks Domon for the idea), I saw the error:
error reloading config_file=/home/neurones/apps/neurones/current/config/unicorn.rb: Application has been already initialized. (RuntimeError)
I changed unicorn_init.sh from:
restart|reload)
sig HUP && echo reloaded OK && exit 0
echo >&2 "Couldn't reload, starting '$CMD' instead"
run "$CMD"
;;
to
restart|reload)
sig USR2 && echo reloaded OK && exit 0
echo >&2 "Couldn't reload, starting '$CMD' instead"
run "$CMD"
;;
I'm trying to deploy some changes to an existing ROR application using capistrano. I'm running MAC OSX and the server is Ubuntu 12.0.4. I'm new to ROR and capistrano, so here's an overview of what I've done so far. I cloned our github repo to a local folder, made my code changes, updated the github repo, installed capistrano using: gem install capistrano, opened terminal, changed directory into the local folder where my ROR app is located, and tried cap deploy:check. Note, I did not capify the project because there is an existing Deploy and Cap file in the project. When I run cap deploy:check I get the following output:
/Users/ben/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- delayed/recipes (LoadError)
from /Users/ben/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:152:in `require'
from ./config/deploy.rb:2:in `load'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:93:in `load'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:172:in `load_from_file'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:89:in `load'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:86:in `block in load'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:86:in `each'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:86:in `load'
from Capfile:4:in `load'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:93:in `load'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:172:in `load_from_file'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:89:in `load'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:86:in `block in load'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:86:in `each'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:86:in `load'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:65:in `block in load_recipes'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:65:in `each'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:65:in `load_recipes'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:31:in `execute!'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:14:in `execute'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/gems/capistrano-2.15.4/bin/cap:4:in `<top (required)>'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/bin/cap:19:in `load'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/bin/cap:19:in `<main>'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/ben/.rvm/gems/ruby-1.9.3-p194#myapp/bin/ruby_noexec_wrapper:14:in `<main>'
Here is a sample of my deploy.rb file (with edits to user names, server name, etc.)
require "bundler/capistrano"
require "delayed/recipes"
set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"") # Read from local system
require 'rvm/capistrano'
set :rails_env, "production" #added for delayed job
server "myservername", :web, :app, :db, primary: true
set :application, "myapp"
set :user, "deploy"
set :deploy_to, "/home/#{user}/apps/#{application}"
#set :deploy_via, :remote_cache
set :use_sudo, false
set :shared_children, shared_children + %w{public/uploads}
set :scm, "git"
set :scm_passphrase, "mypassword"
set :repository, "git#github.com:myusername/#{application}.git"
set :branch, "master"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
after "deploy", "deploy:cleanup" # keep only the last 5 releases
after "deploy:stop", "delayed_job:stop"
after "deploy:start", "delayed_job:start"
after "deploy:restart", "delayed_job:restart"
namespace :deploy do
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command, roles: :app, except: {no_release: true} do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
task :setup_config, roles: :app do
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
run "mkdir -p #{shared_path}/config"
put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
puts "Now edit the config files in #{shared_path}."
end
after "deploy:setup", "deploy:setup_config"
task :symlink_config, roles: :app do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
after "deploy:finalize_update", "deploy:symlink_config"
desc "Make sure local git is in sync with remote."
task :check_revision, roles: :web do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
before "deploy", "deploy:check_revision"
end
namespace :mailman do
desc "Mailman::Start"
task :start, :roles => [:app] do
run "cd #{current_path};RAILS_ENV=#{rack_env} bundle exec script/mailman_daemon start"
end
desc "Mailman::Stop"
task :stop, :roles => [:app] do
run "cd #{current_path};RAILS_ENV=#{rack_env} bundle exec script/mailman_daemon stop"
end
desc "Mailman::Restart"
task :restart, :roles => [:app] do
mailman.stop
mailman.start
end
end
And here is a copy of the cap file:
load 'deploy'
# Uncomment if you are using Rails' asset pipeline
load 'deploy/assets'
load 'config/deploy' # remove this line to skip loading any of the default tasks
I would really appreciate some help with this. I just need to deploy a few changes to the production environment, but I'm kind of at a stand still right now. Hopefully, I've provided enough info. However, being really new to cap and ruby, I might be overlooking something really obvious. Thanks in advance!
Looks like a pathing issue. What path is your 'delayed/recipes' a part of? Please keep in mind that require will load files from the $LOAD_PATH .
on cap deploy:cold ro cap deploy, is triggered an error
[out :: xxx.xxx.xxx.xxx] Killed
command finished in 9020ms
*** [deploy:update_code] rolling back
* executing [#<Capistrano::Command::Tree::ElseBranch:0x00000100dc5478 #condition="else", #command="rm -rf /home/yasinishyn/apps/mkv/releases/20130506084016; true", #callback=#<Proc:0x00000100dd5da0#/usr/local/rvm/gems/ruby-2.0.0-p0/gems/capistrano-2.15.3/lib/capistrano/configuration/actions/invocation.rb:13>, #options={}, #skip=false>]
servers: ["xxx.xxx.xxx.xxx"]
[xxx.xxx.xxx.xxx] executing command
command finished in 386ms
failed: "sh -c 'cd -- /home/yasinishyn/apps/mkv/releases/20130506084016 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on xxx.xxx.xxx.xxx
I have tryed many advises from stack, but nosing works for me.
my deploy.rb
deploy.rb:
require "bundler/capistrano"
server "xxx.xxx.xxx.xxx", :web, :app, :db, primary: true
set :application, "app"
set :user, "user"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
set :scm, "git"
set :repository, "git#github.com:git_user/#{application}.git"
set :branch, "master"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
after "deploy", "deploy:cleanup" # keep only the last 5 releases
namespace :deploy do
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command, roles: :app, except: {no_release: true} do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
task :setup_config, roles: :app do
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
run "mkdir -p #{shared_path}/config"
put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
puts "Now edit the config files in #{shared_path}."
end
after "deploy:setup", "deploy:setup_config"
task :symlink_config, roles: :app do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
after "deploy:finalize_update", "deploy:symlink_config"
desc "Make sure local git is in sync with remote."
task :check_revision, roles: :web do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
before "deploy", "deploy:check_revision"
#rake seed task
desc "Seed the database on already deployed code"
task :seed, :only => {:primary => true}, :except => { :no_release => true } do
run "cd #{current_path}; RAILS_ENV=#{rails_env} bundle exec rake db:seed"
end
desc "Seed the database on already deployed code"
task :drop, :only => {:primary => true}, :except => { :no_release => true } do
run "cd #{current_path}; RAILS_ENV=#{rails_env} bundle exec rake db:drop:all"
run "cd #{current_path}; RAILS_ENV=#{rails_env} bundle exec rake db:create:all"
run "cd #{current_path}; RAILS_ENV=#{rails_env} bundle exec rake db:migrate"
end
end
in my production.rb I have
config.assets.compress = true
and my capfile
load 'deploy'
# Uncomment if you are using Rails' asset pipeline
load 'deploy/assets'
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
local precompile with "bundle exec rake assets:precompile RAILS_ENV=production --trace" executes without any errors.
Where is my mistake? Hot to debug it? Or maybe somewhere is some log file for capistano in which a can look for more details?
I find an answer by my own
delete "load 'deploy/assets'" from capfile, and run
cap deploy:cold
this will work without an error, but only on initial deploy. Then as usual "sudo service nginx restart" on server, and add back deleted snippet.
And BAMM!! It works :)
You are out of RAM by the sounds of it, this question and answer helped me out - I increased the swap on digital ocean server and everything worked fine: deploy with capistrano failing
For anyone who face the same problem and Andrey answer don't work stop the server "sudo service nginx stop" then cap deploy and then start the server again "sudo service nginx start". It worked for me.