precompile error while deploying using capistrano 3 - ruby-on-rails

I am getting the following error while deploying using capistrano 3
INFO [5d0ddb5f] Running ~/.rvm/bin/rvm default do bundle exec rake assets:precompile on 162.243.253.220
DEBUG [5d0ddb5f] Command: cd /home/deployer/apps/nabthat/releases/20131227083740 && ( RAILS_ENV=staging ~/.rvm/bin/rvm default do bundle exec rake assets:precompile )
DEBUG [5d0ddb5f] /home/deployer/.rvm/rubies/ruby-2.0.0-p353/bin/ruby /home/deployer/apps/nabthat/shared/bundle/ruby/2.0.0/bin/rake assets:precompile:all RAILS_ENV=staging RAILS_GROUPS=assets
DEBUG [5d0ddb5f]
DEBUG [5d0ddb5f] rake aborted!
DEBUG [5d0ddb5f]
DEBUG [5d0ddb5f] database configuration does not specify adapter
DEBUG [5d0ddb5f]
DEBUG [5d0ddb5f] /home/deployer/apps/nabthat/shared/bundle/ruby/2.0.0/gems/activerecord- 3.2.14/lib/active_record/connection_adapters/abstract/connection_specification.rb:47:in `resolve_hash_connection
I deploy using the command
bundle exec staging deploy
but error shows RAILS_ENV=staging, how to change it to production
i tried
bundle exec staging deploy RAILS_ENV="production"
still same error

Related

Why can't access rails application on production environment?

When run the development mode, it works well:
$ rails s
But when the production mode:
$ RAILS_ENV=production rails s
And try to access it:
$ curl http://0.0.0.0:3000
Then message is:
Access denied.
There isn't any error log. Can't find what's the reason.
Make sure that you completed these steps before you ran rails s -e production.
bundle exec rake db:create RAILS_ENV=production
bundle exec rake db:migrate RAILS_ENV=production
bundle exec rake assets:precompile RAILS_ENV=production
then you can run: bundle exec rails s -e production

deploying a rails app with capistrano

when executing: cap production deploy:initial
I get an error message:
** Execute deploy:assets:precompile
00:08 deploy:assets:precompile
/usr/local/rvm/bin/rvm default do bundle exec rake assets:precompile
rake aborted!
LoadError: cannot load such file -- single_test/tasks
/home/deploy/apps/A_W_Creamery/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:i…
It seems like, you previously have installed Single test gem and now you remove it, but you forgot to remove command:
require 'single_test/tasks'
from your Rakefile.

capistrano not running migrations in staging

I am using capistrano 3 and I run cap staging deploy. After various commands, it then runs rake db:migrate, which looks like this:
INFO [f67aeefb] Running /usr/local/rvm/bin/rvm ruby-2.1.2#core do
bundle exec rake db:migrate as deploy#10.10.4.131 DEBUG [f67aeefb]
Command: cd /var/www/mysite_staging/releases/20150617233945 && (
RAILS_ENV=staging /usr/local/rvm/bin/rvm ruby-2.1.2#core do bundle
exec rake db:migrate ) DEBUG [f67aeefb] "Env => staging"
The problem is the migration appears to have run in production, not in staging.
How can I ensure capistrano runs the migrations in staging when I specify staging during the deploy?
I'm not sure which of it did it, but by adding the following to staging.rb:
set :rails_env, 'staging'
set :database_name, 'core_staging'
And then in my apache virtual host adding:
RailsEnv staging
It seems to now recognize the staging database.

Capistrano deploy fails on rake assets:precompile

When executing cap production deploy I get the error:
[25307399] Command: RAILS_ENV=production bundle exec rake assets:precompile
cap aborted!
SSHKit::Command::Failed: RAILS_ENV=production bundle exec rake assets:precompile stdout: Nothing written
RAILS_ENV=production bundle exec rake assets:precompile stderr: rake aborted!
LoadError: cannot load such file -- sass/script/node
/Users/me/rails/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support /dependencies.rb:229:in `require'
Checking similar questions got me to try and debug by running bundle exec rake assets:precompile on my local machine and it fails with the same error:
rake aborted!
LoadError: cannot load such file -- sass/script/node
/Users/evan/rails/do-indie/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support /dependencies.rb:229:in `require'
There are hints that it's an issue with the sass gem, so I uninstalled all my sass gems and reinstalled them. Same error. Then I did some more digging and saw this might be an issue with sass 3.3.0, so I installed v 3.2.13 but I'm still getting the cannot load such file -- sass/script/node and not sure how to keep trouble shooting this.

RAILS_ENV=production rake assets:precompile not working through capistrano

I have a task in capistrano set up to execute a precompile and a db:migrate. For some reason when I run these tasks manually on the server they work perfectly fine, but when they're run through a rake task they give me errors.
Here are the capistrano tasks:
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
execute "cd #{current_path}; RAILS_ENV=production bundle exec rake assets:precompile"
execute "cd '#{current_path}'; RAILS_ENV=production bundle exec rake db:migrate"
end
end
Here are the errors:
INFO [96002080] Running cd /var/www/html/FingertipRails/current; RAILS_ENV=production bundle exec rake assets:precompile on 50.112.106.148
DEBUG [96002080] Command: cd /var/www/html/FingertipRails/current; RAILS_ENV=production bundle exec rake assets:precompile
DEBUG [96002080] bash: bundle: command not found
I've tried dropping the bundle exec part of the tasks, but then I get errors saying that gems were not installed (when I clearly ran bundle install before)
Any ideas?

Resources