Ruby on Rail running apache show index of when accessing the site - ruby

I have recently updated to Apache 2.4, and I am using Ruby on Rail to run my application. Following the upgrade, the site shows a content as seen in the image below, and the error on the log file shows this error message. I have tried using the 'Bundle Install' and checked the permission but that hasn't helped. Any advice would be greatly appreciated. Thanks
[ 2022-02-07 07:47:24.5559 8104/7efc89c8f700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /home/adminuser/hroot: An error occured while starting up the preloader.
Error ID: ba7e6074
Error details saved to: /tmp/passenger-error-RA01E9.html
Message from application: libmysqlclient.so.18: cannot open shared object file: No such file or directory - /usr/local/rvm/gems/ruby-2.0.0-p353#hroot/gems/mysql2-0.3.14/lib/mysql2/mysql2.so (LoadError)
PassengerRuby /usr/local/rvm/gems/ruby-2.0.0-p353#hroot/wrappers/ruby
SetEnv GEM_HOME /root/.gem/ruby/1.9.1

This error shows a problem with the shared objects. You probably updated MySQL/MariaDB libraries with Apache and new libraries are incompatible with your mysql2 gem build. The solution is simple:
First, ensure you are using the ruby-2.0.0-p353#hroot RVM environment.
Then, execute the following command:
gem install mysql2 --version 0.3.14
This should rebuild your mysql2 gem for the new MySQL/MariaDB client libraries on your system.

this isn't the answer anyway but another method to run ruby (in my case Windows 10 ; if you use another OS try to find out how to modify inside index.php the ruby starter)
i post here an alternative method to use apache + php +... and ruby
https://stackoverflow.com/a/71733656/5781320

Related

electron-forge --template=typescript-webpack cannot compile sqlite3

Using a package that leverages sqlite3. It looks like sqlite3 is not being recompiled properly. searched around and saw people recommending better-sqlite3. This would require me to have to port the sqlite3 code (no db.serialize equivalent). Is there another way to get sqlite3 working?
❯ yarn start
...
App threw an error during load
Error: Cannot open [redacted]/node_modules/sqlite3/lib/binding/node-v83-darwin-x64/node_sqlite3.node: Error: The module '[redacted]/node_modules/sqlite3/lib/binding/node-v83-darwin-x64/node_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 80. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
...
ERROR in ./node_modules/node-pre-gyp/lib/node-pre-gyp.js
Module not found: Error: Can't resolve './' in '[redacted]/node_modules/node-pre-gyp/lib'
# ./node_modules/node-pre-gyp/lib/node-pre-gyp.js 52:13-32 184:38-57
# ./node_modules/sqlite3/lib/sqlite3-binding.js
# ./node_modules/sqlite3/lib/sqlite3.js
# ./node_modules/chrome-cookies-secure/index.js
Not a great answer but electron-react-boilerplate supports it by adding sqlite into the /app/package.json.

Issue getting wkhtmltoimage working on Amazon Linux / Ruby on Rails

It works fine on my development environment (osx), but I can't get it to work on the server.
in my gemfile
gem 'imgkit'
gem 'wkhtmltoimage-binary'
When I run:
kit = IMGKit.new(html, quality: 100)
img_binary = kit.to_img
I get this error
IMGKit::CommandFailedError: Command failed:
/var/www/myapp/shared/bundle/ruby/2.3.0/bin/wkhtmltoimage --height 0 --quality 100 --format jpg - -:
/var/www/myapp/shared/bundle/ruby/2.3.0/gems/wkhtmltoimage-binary-0.12.5/libexec/wkhtmltoimage-amd64:
error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory
I've searched online and tried installing some more packages, but no success. Anyone able to help? Thanks.
Using 'wkhtmltoimage-binary', '~> 0.11.0.1.1' in the Gemfile fixed the issue for me. Found the solution here.

Unicorn+Sinatra+Nginx | FATAL error adding listener

I have a Sinatra application hosted using Nginx and Unicorn. it went down when I upgraded the operating system (Ubuntu 14.04.5 LTS) on the server, and I was able to bring them all back up except this one, the lone Rack-based application. When I try to launch Unicorn (unicorn -c unicorn.rb -D), I get the following error:
I, [2017-08-06T15:39:54.426004 #6505] INFO -- : unlinking existing socket=/tmp/unicorn.wheels-within-wheels.sock
F, [2017-08-06T15:39:54.427777 #6505] FATAL -- : error adding listener addr=/tmp/unicorn.wheels-within-wheels.sock
/home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/socket_helper.rb:113:in `unlink': Operation not permitted # unlink_internal - /tmp/unicorn.wheels-within-wheels.sock (Errno::EPERM)
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/socket_helper.rb:113:in `$
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/socket_helper.rb:107:in `$
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:231:in `li$
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:808:in `bl$
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:808:in `ea$
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:808:in `bi$
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:130:in `st$
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/bin/unicorn:126:in `<top (required)>'
from /home/deployer/.rbenv/versions/2.2.3/bin/unicorn:23:in `load'
from /home/deployer/.rbenv/versions/2.2.3/bin/unicorn:23:in `<main>'
Anyone have an idea on how to fix this? Thanks.
It's fixed after I performed the following two steps:
As described in this Server Fault answer, I changed the group of the application owner, 'deployer', from 'deployer' to 'staff'.
I changed the owner of the socket file to deployer:staff (sudo chown deployer:staff /tmp/unicorn.wheels-within-wheels.sock).
Then I ran bundle update to update the gems, and finally Unicorn ran successfully and the application was live again.
The following link said that kind of problem is occured upgrading MacOSX to El Capitan. if you can follow the same path, maybe you could resolve the problem.
ERROR: While executing gem ... (Errno::EPERM) Operation not permitted

Error -60005 when install Cocos2d-iPhone v3 RC4

When I try to install Cocos2d-iphone 3.0.0 RC4, I got an error: (run without sudo)
Error -60005 occurred while executing script with privileges.
So, I try to show its package content and use terminal to do: cd ...Cocos2D Installer 3.0.0.app/Contents/MacOS
I try this command: (with sudo)
sudo ./Cocos2D\ Installer\ 3.0.0
It works but I got log with some errors:
[1m>>> Installing Cocos2D-v3.0.0 files (B[m
[1m>>> Installing Cocos2D-v3.0.0 templates (B[m
[4m[1mCocos2D Template Installer (Cocos2D-v3.0.0)(B[m
Error: [31m✖︎(B[m Script cannot be executed as root.
In order for it to work properly, please execute the script again without 'sudo'.
If you want to know more about how to use this script execute '/Users/viethung/Downloads/Cocos2D-v3.0.0/install.sh --help'.
[1m>>> Building/Installing Cocos2D-v3.0.0 documentation, this may take a minute.... (B[m
appledoc version: 2.2 (build 963)
Generation step 4/5 failed: GBDocSetInstallGenerator failed generating output, aborting!
Documentation set was installed, but couldn't reload documentation within Xcode.
Xcode got an error: No documentation set present at specified path.
[1m>>> Cocos2D-v3.0.0 installation complete! (B[m
Are there any way is better than this way?
I have same problem.
I think you installed old cocos2d-iphone and it caused this problem.
You should remove old cocos2d-iphone first. I removed:
~/Library/Developer/Xcode/cocos2d v3.x
And install again. It works for me.
Hope it works for you :)

Web application could not be started Passenger Error (Apache2) - Referencing Non-Existing Ruby Patch

I have been having problems after updating from p247 to the latest patch for Ruby 2.0.0 (P353) using the latest version of RVM. Here is the link to my original question where I was experiencing a missing RVN environment file for the old patch which was no longer in my system. RVM was corrected and that problem disappeared.
ERROR: Missing RVM environment file After Doing rvm upgrade command - Passenger 4.0.23
I went ahead and installed the latest version of Passenger 4.0.29 using the gem file in my Passenger Enterprise account. I was able to install the passenger-install-apache2-module. However I'm getting another error when I try to launch my applications.
An error occurred while starting up the preloader. It exited before signaling successful startup back to Phusion Passenger. Please read this article for more information about this problem.
Raw process output:
/Users/server1/.rvm/gems/ruby-2.0.0-p353#LightBeCorp_Rails4Ruby2/gems/json-1.8.1/lib/json/ext/parser.bundle: [BUG] Segmentation fault
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
It looks like there is still a problem with referencing p247 when it is no longer in my system. P247 only shows up on the Passenger error page in the statement I posted above. Every other reference is for p353. My guess is that it may be in the parser.bundle file. However I do not know what editor to use to open it. I tried Xcode but got nowhere.
Here are my Passenger statements in the config file:
LoadModule passenger_module /Users/myusername/.rvm/gems/ruby-2.0.0-p353#mygemset/gems/passenger-enterprise-server-4.0.29/buildout/apache2/mod_passenger.so
PassengerRoot /Users/myusername/.rvm/gems/ruby-2.0.0-p353#mygemset/gems/passenger-enterprise-server-4.0.29
PassengerDefaultRuby /Users/myusername/.rvm/wrappers/ruby-2.0.0-p353#mygemset/ruby
PassengerDebugLogFile /var/log/apache2/passenger_error_log
Here is a sample of my virtual hosts that I'm using for all my Rails applications.
<VirtualHost *:80>
ServerName www.myrailsdomain.com
ServerAlias myrailsdomain.com
DocumentRoot /Users/myusername/Sites/myrailsapp/public
PassengerAppRoot /Users/myusername/Sites/myrailsapp/
PassengerRuby /Users/myusername/.rvm/wrappers/ruby-2.0.0-p353#mygemset/ruby
<Directory /Users/myusername/Sites/myrailsapp/public>
Allow from all
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
Here is the output from passenger-status:
Version : 4.0.29
Date : 2013-12-22 11:58:13 -0600
Instance: 330
----------- General information -----------
Max pool size : 6
Processes : 0
Requests in top-level queue : 0
----------- Application groups -----------
/Users/myusername/Sites/myrailsapp1/#default:
App root: /Users/server1/Sites/myrailsapp1/
Requests in queue: 0
/Users/myusername/Sites/myrailsapp2/#default:
App root: /Users/server1/Sites/myrailsapp2/
Requests in queue: 0
/Users/myusername/Sites/myrailsapp3/#default:
App root: /Users/server1/Sites/myrailsapp3/
Requests in queue: 0
After looking at the config files that I referenced in my previous post and what I have looked at here so far I cannot find anything that references patch p247. I do know where this is coming from. I have not found anything online regarding a problem with two different Ruby patches being referenced when one does not exist in the system.
Any help would be appreciated.
Start with:
cd /Users/myusername/Sites/myrailsapp
rvm use ruby-2.0.0-p353#LightBeCorp_Rails4Ruby2
Now try to clean gems:
rvm gemset pristine
If this does not work run:
rvm gemset empty
bundle install
After that you might need to install any extra gems that were part of this gemset (ex. passenger)

Resources