• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Ruby On Rails: how to execute through SSH rake or rails in the same way as provided CLI?

Alban Staehli

Regular Pleskian
Hi,

I have installed a Ruby on Rails app within Plesk Onyx 17.5.3 (on CentOS 7) - successful, thanks to the Plesk Ruby extension.
When I'm into Plesk admin UI, I can execute the rake task within the selected env. and version of Ruby. This works pretty well.

Nevertheless, I wish to run some commandes through SSH (for bash purpose, executed by crontab).
Therefore I went into the app folder and tried to execute rake:
Code:
 cd /path/to/AppRootFolder/
bundle exec rake -T
>> Could not find rake-12.3.2 in any of the sources
>> Run `bundle install` to install missing gems.
rake -T
>> Could not find rake-12.3.2 in any of the sources
>> Run `bundle install` to install missing gems.

So I tried to run bundle install (already done through the Plesk UI):
Code:
 bundle install
>> The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
>> Fetching gem metadata from https://rubygems.org/.........
>> i18n-1.6.0 requires ruby version >= 2.3.0, which is incompatible with the current version, ruby 2.0.0p648

Obviously, running these command from SSH shows that it is not within the same env. setup as the CLI from the UI, as the Ruby version in Plesk CLI is 2.4.4p296, and not 2.0.0p648.

So how to run command from SSH within the app root folder within the same env. setup as for the CLI available in Plesk UI? I want to execute commands directly from SSH in the same way I do it from the CLI in Plesk UI.

Thank you.
 
Back
Top