I have the following Capistrano snippet:
namespace :bundle do
task :install do
run "gem list && bundle -v"
end
end
When I run
cap bundle:install
I get the following output:
** [out :: ....compute-1.amazonaws.com]
** [out :: ....compute-1.amazonaws.com] *** LOCAL GEMS ***
** [out :: ....compute-1.amazonaws.com]
** [out :: ....compute-1.amazonaws.com]
** [out :: ....compute-1.amazonaws.com] bundler (1.3.4)
** [out :: ....compute-1.amazonaws.com] rake (10.0.3)
** [out :: ....compute-1.amazonaws.com] rubygems-bundler (1.1.1)
** [out :: ....compute-1.amazonaws.com] rvm (1.11.3.6)
** [out :: ....compute-1.amazonaws.com]
** [out :: ....compute-1.amazonaws.com] ERROR: Gem bundler is not installed, run `gem install bundler` first.
gem is showing bundler is installed, but when I try to run bundle -v, I get a contradicting error saying it's not? I don't understand why?
The other thing I tried was to login to the server via terminal, when I run bundle -v there, it works fine?
Any ideas what's wrong?
do you use rvm-capistrano gem? It will load RVM for you.
I managed to get my script working by adding some environment variables:
set :default_environment, {
:PATH => "/home/ubuntu/.rvm/gems/ruby-1.9.2-p320#my_gemset/bin:" +
"/home/ubuntu/.rvm/gems/ruby-1.9.2-p320#global/bin:" +
"/home/ubuntu/.rvm/rubies/ruby-1.9.2-p320/bin:" +
"/home/ubuntu/.rvm/bin:" +
"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
:RUBY_VERSION => 'ruby-1.9.2-p320',
:GEM_HOME => '/home/ubuntu/.rvm/gems/ruby-1.9.2-p320#my_gemset',
:GEM_PATH => '/home/ubuntu/.rvm/gems/ruby-1.9.2-p320#my_gemset:/home/ubuntu/.rvm/gems/ruby-1.9.2-p320#global'
}
Related
Heroku deploy fails. So I tried doing it locally same issue.
$ NODE_ENV=production RAILS_ENV=production rails assets:precompile --trace
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke yarn:install (first_time)
** Execute yarn:install
yarn install v1.13.0
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning " > webpack-dev-server#3.3.1" has unmet peer dependency "webpack#^4.0.0".
warning "webpack-dev-server > webpack-dev-middleware#3.6.2" has unmet peer dependency "webpack#^4.0.0".
[4/4] 🔨 Building fresh packages...
✨ Done in 7.99s.
** Execute assets:precompile
I, [2019-04-16T12:10:11.016887 #96897] INFO -- : Writing /private/tmp/template-a32b218/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css
I, [2019-04-16T12:10:11.017485 #96897] INFO -- : Writing /private/tmp/template-a32b218/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css.gz
** Invoke webpacker:compile (first_time)
** Invoke webpacker:verify_install (first_time)
** Invoke webpacker:check_node (first_time)
** Execute webpacker:check_node
** Invoke webpacker:check_yarn (first_time)
** Execute webpacker:check_yarn
** Invoke webpacker:check_binstubs (first_time)
** Execute webpacker:check_binstubs
** Execute webpacker:verify_install
** Invoke environment
** Execute webpacker:compile
Compiling…
Compilation failed:
$ echo $?
1
Webpacker can silently hang if you forgot to do a "yarn add " before actually using a package in your application.
Found the answer to my own question.
In config/webpacker.yml, there's a boolean option to make the output more verbose. And it told me there's was a typo in one of my include statements.
I am setting up Capistrano in a rails project for first time. When I run "cap production deploy:check" it goes OK. But when I run "cap prodution deploy" it gives back the following error...
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy#mysite.com: bundle exit status: 127
bundle stdout: Nothing written
bundle stderr: /usr/bin/env: bundle: No such file or directory
SSHKit::Command::Failed: bundle exit status: 127
bundle stdout: Nothing written
bundle stderr: /usr/bin/env: bundle: No such file or directory
Tasks: TOP => deploy:updated => bundler:install
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy#mysite.com: bundle exit status: 127
bundle stdout: Nothing written
bundle stderr: /usr/bin/env: bundle: No such file or directory
I am using rails 4.2.3. Ruby 2.2.2(with RVM). I have the following gems added for capistrano on Gemfile...
gem 'capistrano', '~> 3.4.0'
gem 'capistrano-rvm', '~> 0.1.2'
gem 'capistrano-bundler', '~> 1.1.4'
gem 'capistrano-rails', '~> 1.1.3'
gem 'capistrano3-unicorn', '~> 0.2.1'
You don't have the bundler gem installed on the server. The lines that look like this indicate that:
bundle stderr: /usr/bin/env: bundle: No such file or directory
You need to install the bundler gem on the server in order for capistrano to do it's thing.
Capistrano is erroring out on this command
* executing "cd -- /home/root/apps/case/releases/20130221234114 && bundle exec
rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile && cp --
/home/root/apps/case/shared/assets/manifest.yml
/home/root/apps/case/releases/20130221234114/assets_manifest.yml"
and I get this response after it
** [out :: 108.60.137.195] ruby
** [out :: 108.60.137.195] :
** [out :: 108.60.137.195] no -I allowed while running setgid
** [out :: 108.60.137.195] (
** [out :: 108.60.137.195] SecurityError
** [out :: 108.60.137.195] )
Can't seem to find anything related except for a couple of issues with Ruby compiling on macports. I'm using rbenv with Ruby 1.9.3-p385 on Debian 6.
Is it a shared (system-wide) install of rbenv? Old instructions (deleted from wiki as of now, but can be accessed at https://github.com/sstephenson/rbenv/wiki/Shared-install-of-rbenv/a86ef2e6b12254eeb7cecfd3bd878cf7382d1b4a) suggests setting SGID permission bit on Ruby interpreter, which triggers security warnings (and with a good reason).
Current rbenv documentation suggests installing a project-local installation (https://github.com/sstephenson/rbenv/wiki/Deploying-with-rbenv). Alternatively, it could use a system-wide installation without SGID, and using --deployment flag for bundler so that it doesn't try to write to system-wide directories.
My deployment set up is to have Heroku precompile assets. I want them precompiled so I can send them to a CDN (via asset_sync) and I want that done on Heroku so I don't have any compiled assets in my repo. I set that up using Heroku's guide and that had been working great. I added turbo-sprockets-rails3 for a speed boost. It had all been working fine and then stopped; I can't figure out why.
Now when I deploy (without public/assets) the assets:precompile Rake task times out on Heroku. To see how long it's really taking, I went into a shell (heroku run bash):
~ $ time bundle exec rake assets:precompile
AssetSync: YAML file found /app/config/asset_sync.yml settings will be merged into the configuration
AssetSync: Syncing.
Using: Directory Search of /app/public/assets
AssetSync: Done.
real 19m29.575s
user 17m43.690s
sys 0m28.480s
Twenty minutes! But when I run it locally (2011 iMac), it's only only a few minutes:
$ env RAILS_ENV=production time bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
~/.rbenv/versions/1.9.3-p327-perf/bin/ruby ~/.rbenv/versions/1.9.3-p327-perf/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Invoke assets:cache:clean (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
AssetSync: YAML file found ~/Code/Ruby/myproject-rails/config/asset_sync.yml settings will be merged into the configuration
** Execute assets:cache:clean
** Execute assets:precompile:all
AssetSync: Syncing.
Using: Directory Search of ~/Code/Ruby/myproject-rails/public/assets
Uploading: assets/application-3a6de939348195e9610f1321df27837a.js
Uploading: assets/application-3a6de939348195e9610f1321df27837a.js.gz
Uploading: assets/jquery.min-959a5819c76e1508f5a8655c289c0de8.map
Uploading: assets/jquery.min.map
Uploading: assets/rails_admin/rails_admin-76cfbf31a605916a55eee29464ca3e6d.js
Uploading: assets/rails_admin/rails_admin-76cfbf31a605916a55eee29464ca3e6d.js.gz
AssetSync: Done.
179.92 real 19.29 user 3.98 sys
I wrote Heroku support over a week ago and after some days they said they'd escalate it to their Ruby buildback team, but I still haven't heard anything. Do any of the smart people on Stack Overflow have possible solutions?
The solution was to use tell Heroku to use Ruby 1.9.3, like my local machine. Apparently 1.9.3 is much faster at assets compilation than 1.9.2 which Heroku defaults to.
To fix it, make sure your Gemfile starts:
source "https://rubygems.org"
ruby "1.9.3"
# ...
More at Heroku docs on Ruby versions.
I recently installed the gem rvm-capistrano in order to deploy in my server. First, I tried to run cap deploy:setup. It seems that installed RVM, but for some reasons (permissions or something else), it couldn't install REE:
Warning:
*** [err :: myserver.com] Failed to create the file ruby-enterprise-1.8.7-2012.02.tar.gz
[...]
There was an error, please check /usr/local/rvm/log//*.log. Next we'll try to fetch via http.
** [out :: myserver.com] Trying ftp:// URL instead.
I didn't include more because is irrelevant.
Obviously in deploy.rb sudo options is set as 'root'.
adduser #{user} rvm
Fixed it for me. Where #{user} is the name of your cap deploy user.