I followed this guide to deploy my rails app: https://gorails.com/deploy/ubuntu/20.04#ruby Everything works fine except i would like to use rails console on the server i deployed my app, and i can't because of this message :
Your Ruby version is 2.7.0, but your Gemfile specified 3.0.0
If i ruby -v
with my deploy user, here is the answer ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux
But if i sudo ruby -v
, here is the answer ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
. So i guess, that's where it comes from (as said in Your Ruby version is 2.7.0, but your Gemfile specified 2.7.1)...
Has anyone an idea of how i could do ?
Edit : here is my deployment script, as deploy user
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
git clone https://github.com/rbenv/rbenv-vars.git ~/.rbenv/plugins/rbenv-vars
exec $SHELL
rbenv install 3.0.0
rbenv global 3.0.0
gem install bundler