Cannot get Ruby on Rails application (Redmine) to run after installation

Operating System & Version
CENTOS 7.8
cPanel & WHM Version
86.0.21

benryves

Registered
Jun 11, 2020
3
1
3
United Kingdom
cPanel Access Level
Root Administrator
Hello!

I've set up a blank installation of Redmine using the instructions at this URL: https://documentation.cpanel.net/display/CKB/How+to+Install+a+Redmine+Web+Application

The installation on the command-line seemed to go without a hitch, no error messages were reported, the database migration went well, the load of default data all ran without any error messages etc. I did all of it logged in as the "redmine" user with the exception of the parts that needed to be carried out as "root".

The application is installed in a directory "redmine" for the user "redmine", so the path is /home/redmine/redmine

After installation I went to cPanel's Application Manager and set it up as follows:

Application Name:
Redmine

Deployment Domain:
redmine.example.com

Base Application URL:
redmine.example.com/

Application Path:
/redmine

Deployment Environment:
Production

Now, if I restart Apache and point my browser at redmine.example.com/ I just get the web server's "Proudly powered by LiteSpeed Web Server" message and not the Redmine application. I tried changing the Base Application URL to redmine.example.com/test (in case it absolutely needed to be installed under a specific path like that) but attempting to access it produced a 404 instead.

The Application Path seems to be correct, too, if I put in the full /home/redmine/redmine path it corrects it to /redmine and if I change it to something deliberately wrong the "Ensure dependencies" button disappears from the application manager list.

The only other indication I get of something being amiss is if I click "Ensure dependencies" in the Application Manager I get an error:

gem: The process failed. Run the following command from the command line:
cd /home/redmine/redmine && scl enable ea-ruby24 'bundle install'

Now, I can run that command as the "redmine" user and it works (and I had already run it as part of the installation), so I'm not sure what the issue is there. I do note that ruby and gem are not available to the root user, is that normal/OK?

Thanks in advance for any pointers in the right direction!
 

benryves

Registered
Jun 11, 2020
3
1
3
United Kingdom
cPanel Access Level
Root Administrator
LiteSpeed seems to be the culprit in all this, I found an option in WHM to switch between LiteSpeed and Apache and after switching to Apache Redmine suddenly started working beautifully.

According to Ruby LSAPI Overview - LiteSpeed Technologies LiteSpeed should be able to run Ruby applications however I can't access its control panel (attempting to launch it navigates to :7080 which times out) so haven't figured that part of the puzzle out yet.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,252
313
Houston
I'm glad at least you got the issued identified. When attempting to access their panel do you have the port open in your firewall? It's not something that's normally opened.
 

benryves

Registered
Jun 11, 2020
3
1
3
United Kingdom
cPanel Access Level
Root Administrator
I'm glad at least you got the issued identified. When attempting to access their panel do you have the port open in your firewall? It's not something that's normally opened.
Hi Lauren,

Thank you for getting back to me, our hosting provider opened port 7080 and sent over the admin password for LiteSpeed so I was able to log in to its admin panel but was still unable to get the application to run (it still produced a 404 error) so I gave up and reverted to Apache. It was then pointed out that we were paying extra for LiteSpeed so I needed to get it working... :)

In case it helps, this is how I got it working (there seems to be a lot of outdated or misleading information out there, so hopefully I'm not adding to that pile...)

After restarting the LiteSpeed server it would display a message about the Ruby Path being undefined, so I first determined the correct Ruby path from the terminal:
Code:
[email protected] [~]# which ruby
/opt/cpanel/ea-ruby24/root/usr/bin/ruby
I then copied /opt/cpanel/ea-ruby24/root/usr/bin/ruby into the "Ruby Path" field in Server→App Server→Rack/Rails Default Settings of the LiteSpeed admin panel and restarted the server. After this attempting to access the Ruby application produced a 503 error instead of a 404 error, which seemed to be a good indication that at least it was trying (albeit failing) to run the application. I looked in the Apache error log:
Code:
[email protected] [~]# tail /usr/local/apache/logs/stderr.log
2020-06-23 00:46:02.525 [STDERR] /opt/cpanel/ea-ruby24/root/usr/bin/ruby: error while loading shared libraries: libruby.so.2.4: cannot open shared object file: No such file or directory
2020-06-23 00:46:03.036 [STDERR] /opt/cpanel/ea-ruby24/root/usr/bin/ruby: error while loading shared libraries: libruby.so.2.4: cannot open shared object file: No such file or directory
2020-06-23 00:46:04.039 [STDERR] /opt/cpanel/ea-ruby24/root/usr/bin/ruby: error while loading shared libraries: libruby.so.2.4: cannot open shared object file: No such file or directory
As far as I can see this can be caused by a missing/incorrect LD_LIBRARY_PATH environment variable, so I found the value from the terminal:
Code:
[email protected] [~]# echo $LD_LIBRARY_PATH
/opt/cpanel/ea-ruby24/root/usr/bin/../local/bin:/opt/cpanel/ea-ruby24/root/usr/lib64:/opt/cpanel/ea-openssl/lib64
...and then appended this to the "Environment" field under Server→App Server→Rack/Rails Default Settings in the LiteSpeed settings, which in my case made it this:
Code:
LSAPI_MAX_REQS=1000
LSAPI_MAX_IDLE=60
LD_LIBRARY_PATH=/opt/cpanel/ea-ruby24/root/usr/bin/../local/bin:/opt/cpanel/ea-ruby24/root/usr/lib64:/opt/cpanel/ea-openssl/lib64
After restarting the server the Ruby on Rails application could be accessed and there were no more errors appearing in the logs, so fingers crossed this is what it took! There is information out there for LiteSpeed about configuring Virtual Hosts or Virtual Host Templates to determine the appropriate application paths which I didn't touch so I can only assume it's pulling the requisite information from the application configuration set up in cPanel. Other places mention a file called ~/.ls_rails_config that needs to be set up to configure the application, I did briefly have this set up too but it didn't seem to do anything and after deleting the file (and restarting the server several times) the application is still running fine so I don't think that's necessary either.

As an aside, when setting up the cron job in cPanel to handle incoming emails to the application I ran into similar path issues but was able to resolve that by configuring the cron job to run with bash:
Code:
/bin/bash -l -c 'cd ~/redmine && rake --silent redmine:email:receive_imap RAILS_ENV="production" host=<host> username=<username> password=<password>'
Hopefully this might help someone in future if they're also having difficulty with Ruby on Rails and LiteSpeed. (At least until a new version comes out that completely changes how everything is set up, of course)!
 
  • Like
Reactions: cPanelLauren