I have been trying to deploy my rails application on an EC2 instance. The steps which i have taken already are
Locally:
I installed all the gems by writing in
Gemfile
andbundle install
:group :development do gem 'capistrano' gem 'capistrano3-puma' gem 'capistrano-rails', require: false gem 'capistrano-bundler', require: false gem 'capistrano-chruby' end
I edited my
Capfile
to require the modulesrequire "capistrano/setup" require "capistrano/deploy" require "capistrano/scm/git" install_plugin Capistrano::SCM::Git require "capistrano/chruby" require "capistrano/bundler" require "capistrano/rails/assets" require "capistrano/rails/migrations" require "capistrano/puma" Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
I made the necessary changes in
config/deploy.rb
as well, speciallyset :chruby_ruby, 'ruby-2.3.0'
On the Server/Instance:
- Installed Ruby
Installed Chruby and included in
/etc/profile.d/chruby.sh
these:source xx/xx/xx/chruby.sh source xx/xx/xx/auto.sh
Made a folder for app and also created
database.yml
andapplication.yml
.
Having Done all this, when I run cap production deploy
, it starts fine with checking and git cloning and linking files and directories but fails on bundler:install
, giving an error like
01 /usr/local/bin/chruby-exec ruby-2.3.0 -- bundle install --path /home/deploy…
01 /bin/sh: 2: /etc/profile.d/chruby.sh:
01 source: not found
01
01 /bin/sh: 3: /etc/profile.d/chruby.sh:
01 source: not found
01
01 /bin/sh: 1:
01 chruby: not found
01
Since there are only examples with deploying Rails to AWS using either RVM or JRuby, I am not able to figure out where I am going wrong.