Rails 2.3.2.1 error with Litespeed 4.0.5 - ruby-on-rails

I just upgraded to Rails 2.3.2.1 running Litespeed web server 4.0.5 and get the below error. I think it has something to do with setting up the Rack preference (server = Rack::Handler::LSWS) but not sure how to do it.
Also, I'm running the lateast ruby-lsapi
[root#idev logs]# gem list ruby-lsapi
ruby-lsapi (3.5, 3.3, 3.2)
2009-07-14 20:31:55.326 [NOTICE] [208.68.173.115:57853-0#dev.halomonitor.com] [STDERR] /home/web/dev/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:22:in `__send__'
2009-07-14 20:31:55.326 [NOTICE] [208.68.173.115:57853-0#dev.halomonitor.com] [STDERR] :
2009-07-14 20:31:55.326 [NOTICE] [208.68.173.115:57853-0#dev.halomonitor.com] [STDERR] undefined method `env_table' for nil:NilClass
2009-07-14 20:31:55.326 [NOTICE] [208.68.173.115:57853-0#dev.halomonitor.com] [STDERR] (
2009-07-14 20:31:55.326 [NOTICE] [208.68.173.115:57853-0#dev.halomonitor.com] [STDERR] NoMethodError
2009-07-14 20:31:55.326 [NOTICE] [208.68.173.115:57853-0#dev.halomonitor.com] [STDERR] )
2009-07-14 20:31:55.326 [NOTICE] [208.68.173.115:57853-0#dev.halomonitor.com] [STDERR] from /home/web/dev/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:22:in `dispatch_cgi'
2009-07-14 20:31:55.326 [NOTICE] [208.68.173.115:57853-0#dev.halomonitor.com] [STDERR] from /home/web/dev/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:102:in `dispatch_cgi'
2009-07-14 20:31:55.326 [NOTICE] [208.68.173.115:57853-0#dev.halomonitor.com] [STDERR] from /home/web/dev/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:28:in `dispatch'
2009-07-14 20:31:55.326 [NOTICE] [208.68.173.115:57853-0#dev.halomonitor.com] [STDERR] from /var/lsws/fcgi-bin/RailsRunner.rb:32
2009-07-14 20:31:56.606 [INFO] [208.68.173.115:57853-0#dev.halomonitor.com] connection to [uds://tmp/lshttpd/dev.halomonitor.com:_.sock] on request #0, confirmed: 1, Connection reset by peer!
2009-07-14 20:31:56.606 [NOTICE] [208.68.173.115:57853-0#dev.halomonitor.com] [uds://tmp/lshttpd/dev.halomonitor.com:_.sock] Request in process stage, fail with 503
2009-07-14 20:31:56.606 [NOTICE] [208.68.173.115:57853-0#dev.halomonitor.com] oops! 503 Service Unavailable
2009-07-14 20:31:56.606 [NOTICE] [208.68.173.115:57853-0#dev.halomonitor.com] Content len: 0, Request line:
GET / HTTP/1.1
2009-07-14 20:31:56.606 [NOTICE] [208.68.173.115:57853-0#dev.halomonitor.com] Redirect: #2, URL: /dispatch.lsapi
$ ruby script/about
About your application's environment
Ruby version 1.8.6 (i386-mswin32)
RubyGems version 1.3.1
Rack version 1.0 bundled
Rails version 2.3.2
Active Record version 2.3.2
Action Pack version 2.3.2
Active Resource version 2.3.2
Action Mailer version 2.3.2
Active Support version 2.3.2
Edge Rails revision e47e2f3c5e23acc07918e3d34546b06c9c0c986c
Application root c:/chirag no backup/rails-2.3.2.1
Environment development
Database adapter postgresql
Database schema version 20090709140613

I thought lightspeed was considered out of the running a while back...
Go for Phusion's Passenger. Way more flexible and easier to setup/configure. Gets rid of dealing with CGI altogether. Check it out, even if you don't go with it.

From the error message undefined method env_table for nil:NilClass, it seem that the code is getting a not initialized value, and it is trying to execute the method env_table on that value.
What is the content of the line 22, in cgi_progress.rb?

I found the answer:
http://www.litespeedtech.com/support/forum/showthread.php?t=3741

Related

Bundler error when deploying Rails 6 App to Elastic Beanstalk

I've been struggling getting around the well known bundler 2.0.x error when deploying to both Heroku and AWS Elastic Beanstalk. After trying many of the suggested remedies like updating gems and installing bundler 2.0.x or bundler update --system. None of this has worked so far. I found a solution to create a file in .ebextensions like so:
files:
# Runs before \./10_bundle_install.sh`:`
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_gem_install_bundler.sh" :
mode: "000775"
owner: root
group: users
content: |
#!/usr/bin/env bash
EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
# Source the application's ruby, i.e. 2.6. Otherwise it will be 2.3, which will give this error: \bundler requires Ruby version >= 2.3.0``
. $EB_SCRIPT_DIR/use-app-ruby.sh
cd $EB_APP_STAGING_DIR
echo "Installing compatible bundler"
gem install bundler -v 2.1.0.pre.2
This is the error I'm still getting on eb deploy staging-1:
Creating application version archive "app-7b50-191111_122622".
Uploading: [##################################################] 100% Done...
2019-11-11 17:28:21 INFO Environment update is starting.
2019-11-11 17:28:28 INFO Deploying new version to instance(s).
2019-11-11 17:31:36 ERROR [Instance: i-0ba40e32901557bee] Command failed on instance. Return code: 1 Output: (TRUNCATED)...ystem, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.0.pre.2`
from /opt/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
from /opt/rubies/ruby-2.6.5/bin/bundle:23:in `<main>'.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2019-11-11 17:31:36 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2019-11-11 17:31:36 ERROR Unsuccessful command execution on instance id(s) 'i-0ba40e32901557bee'. Aborting the operation.
2019-11-11 17:31:37 ERROR Failed to deploy application.
ERROR: ServiceError - Failed to deploy application.
[12:31:40] (master) tml_portal
// ♥ eb deploy staging-1
Creating application version archive "app-7b50-191111_123229".
Uploading: [##################################################] 100% Done...
2019-11-11 17:34:45 INFO Environment update is starting.
2019-11-11 17:34:53 INFO Deploying new version to instance(s).
2019-11-11 17:37:47 ERROR [Instance: i-0ba40e32901557bee] Command failed on instance. Return code: 1 Output: (TRUNCATED)...ystem, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.0.pre.2`
from /opt/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
from /opt/rubies/ruby-2.6.5/bin/bundle:23:in `<main>'.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2019-11-11 17:37:47 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2019-11-11 17:37:47 ERROR Unsuccessful command execution on instance id(s) 'i-0ba40e32901557bee'. Aborting the operation.
2019-11-11 17:37:48 ERROR Failed to deploy application.
ERROR: ServiceError - Failed to deploy application.
Any ideas on how to get around this dreaded Bundler issue for deployment?
It still the missing bundle version error. Could you try following:
#.ebextensions/bundler_update.config
commands:
update_bundler:
command: /opt/rubies/ruby-2.6.5/bin/gem install bundler -v 2.1.0.pre.2
Ruby and Bundler version should match yours.

Can't run no one rails server after editing secrets.yml

My project worked in development good, but in production:
"Puma caught this error: Missing secret_token and secret_key_base for 'production' environment, set these values in config/secrets.yml (RuntimeError)"
Then I edited the file "secrets.yml" and now I can't run no one rails server (this and other projects).
SSL connection error
rails s (any project which used puma):
HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>
2015-11-21 18:31:21 +0200: ENV: {"rack.version"=>[1, 3], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "CONTENT_TYPE"=>"text/plain", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"2.11.1", "GATEWAY_INTERFACE"=>"CGI/1.2"}
rails s (any project which used webrick)
[2015-11-21 18:33:04] INFO WEBrick 1.3.1 [2015-11-21 18:33:04] INFO ruby 2.2.3 (2015-08-18) [x86_64-linux] [2015-11-21 18:33:04] INFO WEBrick::HTTPServer#start: pid=28129 port=3000 [2015-11-21 18:33:05] ERROR bad Request-Line `\x16\x03\x01\x00�\x01\x00\x00�\x03\x03�[\x0E\x0ERqp'. [2015-11-21 18:33:05] ERROR bad Request-Line `\x16\x03\x01\x00�\x01\x00\x00�\x03\x03a"|1�\f�I+d��J�<i]o\x1Ad�]v\x11N�wH��ҧ\x00\x00 �+�/\x00��\x14�\x13�\x15�'. [2015-11-21 18:33:05] ERROR bad Request-Line `\x16\x03\x01\x00�\x01\x00\x00�\x03\x03��Vƿ�(�p\v�"\x03�Isj�|�;��xP'�&,���\x00\x00 �+�/\x00��\x14�\x13�\x15�'. [2015-11-21 18:33:06] ERROR bad Request-Line `\x16\x03\x01\x00�\x01\x00\x00�\x03\x03\x06V���[Y�R$\x7F���c�H'. [2015-11-21 18:33:06] ERROR bad URI `�+�/\x00��\x14�\x13�\x15�'. [2015-11-21 18:33:06] ERROR bad URI `a��'. [2015-11-21 18:33:06] ERROR bad Request-Line `\x16\x03\x01\x00�\x01\x00\x00�\x03\x01�'*��[�����\x10r��t(�)�M������\x02��mG\x00\x00\x14�'. ^Z^C[2015-11-21 18:39:53] INFO going to shutdown ... [2015-11-21 18:39:53] INFO WEBrick::HTTPServer#start done.
Note: the project which i edited was cloned from github
You’re trying to connect over SSL (i.e. with HTTPS), but the server doesn’t understand it. It is trying to interpret the SSL handshake as the HTTP request, which results in the error.
Use plain HTTP: http://localhost:3000.

How to debug "Error detecting the assets:precompile task" issue on Heroku

When pushing to Heroku, we're seeing the following line in the output:
...
Error detecting the assets:precompile task
...
The app will then successfully deploy, but it won't have any assets.
This is incredibly frustrating, because no error is raised, and we don't have a clue what might be going on. The logs don't hint to anything.
Here's the tail of the terminal output for the push:
Your bundle is complete! It was installed into ./vendor/bundle
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
Error detecting the assets:precompile task
-----> Discovering process types
Procfile declares types -> (none)
Default types for Ruby/Rails -> console, rake, web, worker
-----> Compiled slug size: 54.8MB
-----> Launching... done, v15
http://myapp-1234.herokuapp.com deployed to Heroku
Here's the complete papertrail log output throughout the push:
Sep 29 09:07:32 myapp-1234 heroku/slug-compiler: Slug compilation started
Sep 29 09:07:54 myapp-1234 heroku/api: Release v15 created by me#example.com
Sep 29 09:07:56 myapp-1234 heroku/slug-compiler: Slug compilation finished
Sep 29 09:08:00 myapp-1234 heroku/web.1: Process exited with status 143
Sep 29 09:08:00 myapp-1234 heroku/web.1: Starting process with command `bin/rails server -p 18025 -e staging`
Sep 29 09:08:04 myapp-1234 app/web.1: [2013-09-29 16:08:04] INFO WEBrick 1.3.1
Sep 29 09:08:05 myapp-1234 app/web.1: [2013-09-29 16:08:04] INFO ruby 2.0.0 (2013-06-27) [x86_64-linux]
Sep 29 09:08:05 myapp-1234 app/web.1: [2013-09-29 16:08:04] INFO WEBrick::HTTPServer#start: pid=2 port=18025
Sep 29 09:08:05 myapp-1234 heroku/web.1: State changed from starting to up
Great- we learned nothing.
What can we do to debug errors during Heroku compilation?

Thin Foreman stopped working

I'm using Thin webserver with RoR on my iMac.
I start it with $ foreman start
It was working fine, but now I'm getting this in the console:
09:27:10 web.1 | => Booting Thin
09:27:10 web.1 | => Rails 3.1.3 application starting in development on http://0.0.0.0:5000
09:27:10 web.1 | => Call with -d to detach
09:27:10 web.1 | => Ctrl-C to shutdown server
09:27:10 web.1 | >> Thin web server (v1.3.1 codename Triple Espresso)
09:27:10 web.1 | >> Maximum connections set to 1024
09:27:10 web.1 | >> Listening on 0.0.0.0:5000, CTRL+C to stop
09:27:10 web.1 | Exiting
09:27:11 web.1 | process terminated
09:27:11 system | sending SIGTERM to all processes
And the $ prompt shows up - so the webserver isn't running.
Any ideas?
I just ran $ thin start
and got:
Using rack adapter
/Users/burtondav/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.22/lib/bundler/runtime.rb:31:in `block in setup': You have already activated rack 1.4.1, but your Gemfile requires rack 1.3.6. Using bundle exec may solve this. (Gem::LoadError)
What bundle exec command should I try?
Add the gem 'thin' in your application Gemfile and execute the bundle exec thin start to resolve the version conflict problem.

foreman only shows line with “started with pid #” and nothing else

When I run foreman I get the following:
> foreman start
16:47:56 web.1 | started with pid 27122
Only if I stop it (via ctrl-c) it shows me what is missing:
^CSIGINT received
16:49:26 system | sending SIGTERM to all processes
16:49:26 web.1 | => Booting Thin
16:49:26 web.1 | => Rails 3.0.0 application starting in development on http://0.0.0.0:5000
16:49:26 web.1 | => Call with -d to detach
16:49:26 web.1 | => Ctrl-C to shutdown server
16:49:26 web.1 | >> Thin web server (v1.3.1 codename Triple Espresso)
16:49:26 web.1 | >> Maximum connections set to 1024
16:49:26 web.1 | >> Listening on 0.0.0.0:5000, CTRL+C to stop
16:49:26 web.1 | >> Stopping ...
16:49:26 web.1 | Exiting
16:49:26 web.1 | >> Stopping ...
How do I fix it?
I’ve been able to resolve this issue by 2 different ways:
From https://github.com/ddollar/foreman/wiki/Missing-Output:
If you are not seeing any output from your program, there is a likely
chance that it is buffering stdout. Ruby buffers stdout by default. To
disable this behavior, add this code as early as possible in your
program:
# ruby
$stdout.sync = true
By installing foreman via the heroku toolbelt package
But I still don’t know what’s happening nor why this 2 ways above resolved the issue…
My solution was to put $stdout.sync = true at the top of config/environments/development.rb.
Then everything that loads the development environment (incluing thin) will not buffer stdout.
"Foreman will display to the terminal output anything written to stdout by the processes it launches." - ddollar See foreman-issues#57
BTW, you can use tailf into Procfile to see logs
web: bundle exec rails server thin -p $PORT
log: tail -f log/development.log
Tip: tailf doesn't exist in OSX, using tail -f -n 40 log/development.log works.
I also had the same problem but with a different solution. (ruby 1.9.2p290, rails 3.1.0, ubuntu 10.04.3)
I changed the line in my Procfile from:
web: bundle exec thin start -p $PORT
to:
web: bundle exec rails server thin -p $PORT
and it no longer gave me an issue.
I have the same problem (ruby 1.9.3-p0, rails 3.2rc2, OSX 10.7).
Resolved the issue by using foreman-0.27.0 by adding this line into my Gemfile.
gem 'foreman', '0.27.0'
If you are using Foreman to run a Python project, rather than a Ryby project, and you're having the same issue, here are some solutions for you. If you are using a Procfile to invoke the python CLI directly, then you can use the '-u' option to avoid stdout buffering:
python -u script.py
If you are using a Procfile to manage a WSGI server, such as invoking gunicorn, flask, bottle, eve, etc., then you can add a ".env" file to the root of your python project, containing the following:
PYTHONUNBUFFERED=True

Resources