Capistrano can't find a JavaScript runtime - ruby-on-rails-3

I have a problem with Capistrano deploying to a server with RVM and gemsets
executing `deploy:assets:precompile'
* executing "cd /var/app/releases/20111229233555 && rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
*** [err ::] rake aborted!
*** [err ::] Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.
*** [deploy:update_code] rolling back
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '1.9.2#mygemset' -c 'cd /var/app/releases/20111229234715 && rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'"
This is my Capfile
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'rvm/capistrano'
set :rvm_bin_path, "$HOME/.rvm/bin"
set :rvm_ruby_string, '1.9.2#mygemset'
set :rvm_type, :user
load 'deploy/assets'
When I log in as the very same user which is used by Capistrano the failing command is executed without any problems.
It seems that Capistrano is using some other environment.
Here is my ~/.rvmrc file:
rvm_gemset_create_on_use_flag=1 rvm_trust_rvmrcs_flag=1
Is there a way how to check which ruby and gemset is used at the execution time?
node.js is and V8 are installed on the system, and all needed gems are in Gemfile:
here is my rvm info:
ruby:
interpreter: "ruby"
version: "1.9.2p290"
date: "2011-07-09"
platform: "x86_64-linux"
patchlevel: "2011-07-09 revision 32553"
full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]"
homes:
gem: "/home/capistrano/.rvm/gems/ruby-1.9.2-p290#mygemset"
ruby: "/home/capistrano/.rvm/rubies/ruby-1.9.2-p290"
binaries:
ruby: "/home/capistrano/.rvm/rubies/ruby-1.9.2-p290/bin/ruby"
irb: "/home/capistrano/.rvm/rubies/ruby-1.9.2-p290/bin/irb"
gem: "/home/capistrano/.rvm/rubies/ruby-1.9.2-p290/bin/gem"
rake: "/home/capistrano/.rvm/gems/ruby-1.9.2-p290#mygemset/bin/rake"

setting up PATH in the deploy.rb solved this issue:
default_environment['PATH'] = "/usr/local/bin:/usr/bin:/bin:/opt/bin:$PATH"
it's a Gentoo distribution and the PATH var seems to be empty when using cap deploy, so I copied the content of server PATH and now it works

This issue went away for me when I installed nodejs (using apt-get) on my server. As I stated in this Stackoverflow answer, it's the most practical choice because you don't need to include any dependencies in your Gemfile.

Related

Running into issues installing gitlab-shell

I am trying to install Gitlab CE from source and following this installation guide.
When I attempt to install the gitlab-shell using the command provided.
sudo -u git -H bundle exec rake gitlab:shell:install REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production SKIP_STORAGE_VALIDATION=true
I received the following stack trace error.
WARNING: This version of GitLab depends on gitlab-shell 4.1.1, but you're running Unknown. Please update gitlab-shell.
rake aborted!
Gitlab::TaskFailedError: Gitlab::TaskFailedError
/home/git/gitlab/lib/tasks/gitlab/task_helpers.rb:87:in `run_command!'
/home/git/gitlab/lib/tasks/gitlab/task_helpers.rb:164:in `clone_repo'
/home/git/gitlab/lib/tasks/gitlab/task_helpers.rb:157:in `checkout_or_clone_tag'
/home/git/gitlab/lib/tasks/gitlab/shell.rake:16:in `block (3 levels) in <top (required)>'
/usr/local/bin/bundle:22:in `load'
/usr/local/bin/bundle:22:in `<main>'
Tasks: TOP => gitlab:shell:install
What config file should I be modifying to fix my issue? Do I need to modify the Redis URL even though I am using the default configuration? By the way, this install is on an Ubuntu 16.04 server.
This might be caused by using a version of git that is too old.
To debug: append the --trace option to bundle exec to get more info on where this error is coming from and inspect the source.

Define Bundle Path With Capistrano

I am using the following configurations in my deploy.rb file for capistrano:
require 'bundler/capistrano'
require 'rvm/capistrano'
set :bundle_cmd, "/home/deployment/.rvm/gems/ruby-1.9.3-p194#global/bin/bundle"
set :default_environment, {
'PATH' => "/home/deployment/.rvm/gems/ruby-1.9.3-p194/bin:/home/deployment/.rvm/bin:$PATH",
'RUBY_VERSION' => 'ruby 1.9.3',
'GEM_HOME' => "/home/deployment/.rvm/gems/ruby-1.9.3-p194",
'GEM_PATH' => "/home/deployment/.rvm/gems/ruby-1.9.3-p194",
'BUNDLE_PATH' => "/home/deployment/.rvm/gems/ruby-1.9.3-p194"
}
But when I run cap deploy:update I get this:
* executing "cd /var/www/currienet/marketplace/releases/20120928140140 && /home/deployment/.rvm/gems/ruby-1.9.3-p194#global/bin/bundle install --gemfile /var/www/currienet/marketplace/releases/20120928140140/Gemfile --path /var/www/currienet/marketplace/shared/bundle --deployment --quiet --without development test"
That is, it's not setting the bundle path (the --path argument) to what I want it to be.
I've tried a number of tutorials, including the rvm capistrano tutorial but nothing seems to work. It continues to use the capistrano default.
Capistrano also creates an application with the following .bundler/config
BUNDLE_FROZEN: '1'
BUNDLE_PATH: /var/www/currienet/marketplace/shared/bundle
BUNDLE_DISABLE_SHARED_GEMS: '1'
BUNDLE_WITHOUT: development:test
Development Machine: Windows 7, bundler (1.0.22), capistrano (2.12.0), rvm-capistrano (1.2.7), rails (3.2.8), (no rvm)
Production: Debian, bundler (1.2.1) (no capistrano), (no rvm-capistrano), rails (3.2.8), rvm 1.16.5
Thanks to Joseph Holsten's blog I was able to ascertain my problem was I was not defining the bundler variables in my deploy.rb before I required 'bundler/capistrano'. I also needed to define the bundle_dir variable, to create code that looks like the following:
set :bundle_cmd, "/home/deployment/.rvm/gems/ruby-1.9.3-p194#global/bin/bundle"
set :bundle_dir, "/home/deployment/.rvm/gems/ruby-1.9.3-p194"
require 'bundler/capistrano'

How do I keep my RVM environment from losing its settings?

I installed ZSH today and RVM, I set up Ruby 1.9.3 to be my default. When I type rvm use 1.9.3 --default and then went into my rails project and ran rails s it worked fine. If I close my terminal and then come back to my rails project and try rails s I get the following error:
/Users/jeff/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
from /Users/jeff/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /Users/jeff/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1229:in `gem'
from /Users/jeff/.rvm/gems/ruby-1.9.3-p125/bin/rails:18:in `<main>'
I would then type rvm use 1.9.3 and the error would go away, I did some research and found that rvm info was losing all of my rvm environment variables, here is the output of rvm info:
system:
system:
uname: "Darwin binfalse.local 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)"
zsh: "/opt/local/bin/zsh => zsh 4.3.17 (x86_64-apple-darwin11.3.0)"
rvm:
version: "rvm 1.10.3 by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.beginrescueend.com/]"
updated: "51 minutes 38 seconds ago"
homes:
gem: "not set"
ruby: "not set"
binaries:
ruby: "/Users/jeff/.rvm/rubies/ruby-1.9.3-p125/bin/ruby"
irb: "/Users/jeff/.rvm/rubies/ruby-1.9.3-p125/bin/irb"
gem: "/Users/jeff/.rvm/rubies/ruby-1.9.3-p125/bin/gem"
rake: "/Users/jeff/.rvm/gems/ruby-1.9.3-p125/bin/rake"
environment:
PATH: "/Users/jeff/.rvm/gems/ruby-1.9.3-p125/bin:/Users/jeff/.rvm/gems/ruby-1.9.3-p125#global/bin:/Users/jeff/.rvm/rubies/ruby-1.9.3-p125/bin:/Users/jeff/.rvm/bin:/opt/local/bin:/opt/local/sbin:/Library/PostgreSQL/9.0/bin:/usr/local/mysql/bin:/usr/local/mysql:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
GEM_HOME: ""
GEM_PATH: ""
MY_RUBY_HOME: ""
IRBRC: ""
RUBYOPT: ""
gemset: ""
How do I make it so my env settings are not lost? Works just fine with bash.
This is issue with loading RVM in proper place of configuration files.
You can fix it by calling:
rvm get stable --auto # OR:
rvm get head --auto
And restart computer - this is important as it forces reload of all config files.

RVM gemset forgotten immediately

I'm having a problem very similar to this question, but rather than forgetting upon reboot, rvm doesn't appear to be aware of the gemset in the first place.
I've got several gemsets created, and those directories are indeed being created and used when I $ rvm install rails -v 3.1.1 or whatever, but $ rvm gemset list produces this:
gemsets for system (found in /Network/Servers/xxx/Volumes/ServerData/Home/yyy/.rvm/gems/system)
*
I can rvm use 1.9.2#rails311, and rvm switches to that ruby, with its associated gemset; when I run $ rvm info, I get what's pasted below, but $ bundle install throws dependency errors that make it seem as though it's not finding the gemset.
Also, I have added the user account to the rvm group, and I don't get any permissions errors upon creating the gemsets, or installing gems to them, and all gems are actually getting downloaded and stored in the proper gemsets.
ruby-1.9.2-p318#rails311:
system:
uname: "Darwin www.yyy.zzz 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)"
rvm:
version: "rvm 1.10.3 by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.beginrescueend.com/]"
updated: "1 day 2 hours 32 minutes 20 seconds ago"
ruby:
interpreter: "ruby"
version: "1.9.2p318"
date: "2012-02-14"
platform: "x86_64-darwin11.3.0"
patchlevel: "2012-02-14"
full_version: "ruby 1.9.2p318 (2012-02-14) [x86_64-darwin11.3.0]"
homes:
gem: "/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/gems/ruby-1.9.2-p318#rails311"
ruby: "/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/rubies/ruby-1.9.2-p318"
binaries:
ruby: "/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/rubies/ruby-1.9.2-p318/bin/ruby"
irb: "/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/rubies/ruby-1.9.2-p318/bin/irb"
gem: "/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/rubies/ruby-1.9.2-p318/bin/gem"
rake: "/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/gems/ruby-1.9.2-p318#rails311/bin/rake"
environment:
PATH: "/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/gems/ruby-1.9.2-p318#rails311/bin:/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/gems/ruby-1.9.2-p318#global/bin:/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/rubies/ruby-1.9.2-p318/bin:/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/bin:/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/gems/ruby-1.9.2-p318#rails303/bin:/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/gems/ruby-1.9.2-p318#rails313/bin:/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/gems/ruby-1.9.2-p318/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/opt/local/sbin:/opt/local/lib/postgresql84/bin"
GEM_HOME: "/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/gems/ruby-1.9.2-p318#rails311"
GEM_PATH: "/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/gems/ruby-1.9.2-p318#rails311:/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/gems/ruby-1.9.2-p318#global"
MY_RUBY_HOME: "/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/rubies/ruby-1.9.2-p318"
IRBRC: "/Network/Servers/www/Volumes/ServerData/Home/yyy/.rvm/rubies/ruby-1.9.2-p318/.irbrc"
RUBYOPT: ""
gemset: "rails311"
Many thanks for any insights you may have to offer.
this looks like a known RVM issue https://github.com/wayneeseguin/rvm/issues/762
I should get some time to fix it within week or two, please review the ticket and give/comment any insight you think might be important

thinking_shpinx, sphinx and MacOS X 10.6.7

After installing thinking_sphinx (http://freelancing-god.github.com/ts), and Sphinx (via brew - v.0.9.9-release (r2117) or via latest sources) and setting up ts in Rails3 (Ruby via RVM: ruby-1.9.2-p180 [ x86_64 ], rails 3.0.7) app like:
define_index do
indexes :name
end
and executing rake ts:start or rake ts:index, i permanently get:
ruby: invalid option -/ (-h will show valid options) (RuntimeError)
What the problem?