How do I get OLS to maintain my environment config?

#1
  • I'm using the LightSpeed with Rails image and have developed a Rails app for Ruby 3.3.4 / Rails 7.1. I am baffled how to configure the server so that it can run. I've
  • used rbenv to install 3.3.4
  • deployed the app with a user deploy to /home/deploy/my_app/current
  • sudo set /usr/local/lsws/my_app -> /home/deploy/my_app/current
  • in the control panel, set up the my_app Virtual Host
    • Virtual Host Root = my_app/
    • Config File = conf/vhosts/my_app/vhconf.conf
    • External App Set UID Mode = DocRoot UID
    • under Context:
      • URI = /
      • Location = $VH_ROOT/
      • Binary Path = /home/deploy/.rbenv/versions/3.3.4/bin/ruby
      • Application Type = Rails
      • Startup File = config.ru
      • Environment =
        GEM_PATH=/home/deploy/my_app/shared/bundle/ruby/3.3.0:
        GEM_HOME=/home/deploy/my_app/current/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0:/home/deploy/.local/share/gem/ruby/3.3.0
        PATH=/home/deploy/my_app/shared/bundle/ruby/3.3.0/bin:/home/deploy/.rbenv/versions/3.3.4/bin:/opt/.rbenv/libexec:/home/deploy/.rbenv/plugins/ruby-build/bin:/home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:$PATH

It appears that localworkerconfig.cpp LocalWorkerConfig::config (or maybe httpserver.cpp HttpServerImpl::configLsrecaptchaWorker) isn't getting my environment variables and setting PATH=/bin:/usr/bin when it runs getEnv().

In the server logs I see what seems to be the correct code (uid and gid are as expected)

Code:
 [LocalWorker::workerExec] Config[Rack:my_app:/]: suExec uid 1001 gid 1002 cmd /home/deploy/.rbenv/versions/3.3.4/bin/ruby /usr/local/lsws/fcgi-bin/RackRunner.rb, final uid 1001 gid 1002
At the very top, RackRunner.rb has both the correctly set environment variables and then the wrong ones

Code:
GEM_PATH: /home/deploy/my_app/shared/bundle/ruby/3.3.0:
GEM_HOME: /home/deploy/my_app/current/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0:/home/deploy/.local/share/gem/ruby/3.3.0
PATH: /home/deploy/my_app/shared/bundle/ruby/3.3.0/bin:/home/deploy/.rbenv/versions/3.3.4/bin:/opt/.rbenv/libexec:/home/deploy/.rbenv/plugins/ruby-build/bin:/home/deploy/.rbenv/shims:
/home/deploy/.rbenv/bin:$PATH
RAILS_ROOT: /usr/local/lsws/my_app/
RAILS_ENV: production
RUBYOPT: rubygems
HOME: /usr/local/lsws/my_app/
LSAPI_CHILDREN: 2
LSAPI_KEEP_LISTEN: 2
LSAPI_MAX_IDLE: 300
LSAPI_PGRP_MAX_IDLE: 300
LSAPI_PADDING: leave_some_room_to_avoid_overwrite_important_env
LSAPI_MAX_IDLE: 60 
PATH: /bin:/usr/bin
LSAPI_PPID_NO_CHECK: 1
LSAPI_PGRP_MAX_IDLE: 300
LSAPI_KEEP_LISTEN: 2
The second PATH variable is understandably screwing up the configuration once RackRunner hits require "bundler/setup"
 

Cold-Egg

Administrator
#3
The second PATH variable means "/home/deploy/.rbenv/versions/3.3.4/bin"? I'm not quite sure what the issue is after hitting the "require "bundler/setup".
 
Top