OLS + Rails

#1
Hey guys, how are you doing?

I need some help configuring rails with OpenLiteSpeed using virtualenvs...

This is my context block at the moment:

Code:
context / {
  type                    appserver
  location                /srv/app16.bffcdaf6.configr.cloud/www
  binPath                 /usr/local/rvm/rubies/ruby-2.6.5/bin/ruby
  appType                 rails
  addDefaultCharset       off
}
But when I try to access the example app, OLS returns:

2020-03-18 22:04:41.492 [STDERR] from /usr/local/lsws/fcgi-bin/RackRunner.rb:17:in `<main>'
2020-03-18 22:04:41.636 [STDERR] /usr/local/rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- lsapi (LoadError)
2020-03-18 22:04:41.636 [STDERR] from /usr/local/rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
2020-03-18 22:04:41.636 [STDERR] from /usr/local/lsws/fcgi-bin/RackRunner.rb:17:in `<main>'

Any ideas?
 
#3
Hey Cold =)

Yeah, I checked the KB, it helped a lot. Fixing the location didn't do much sadly.

When I change my binPath to use the system Ruby, everything works fine (/usr/bin/ruby2.5).

It seems when using the virtualenv binary, OLS is not loading the right gems ( cannot load such file -- lsapi (LoadError) ).

I tried to set the env location, but didn't work also:

Code:
env GEM_HOME='/usr/local/rvm/gems/ruby-2.6.5@app16.bffcdaf6.configr.cloud'
env GEM_PATH='/usr/local/rvm/gems/ruby-2.6.5@app16.bffcdaf6.configr.cloud'
 

Cold-Egg

Administrator
#4
Hi Paulo,

Great.

I am not sure about Ruby + venv . Can you take a look https://openlitespeed.org/kb/python-wsgi-applications/ django + venv case see if it works to you.

""
Environment = PYTHONHOME=/usr/local/lsws/Example/venv/
In some environments, you may need to add extra LS_PYTHONBIN=/usr/local/lsws/Example/venv/bin/python to Environment for lswsgi.
""

If still not working, you can submit a ticket to support@litespeedtech.com for further investigation

Best,
Eric
 
Top