I'm new to deploying rails applications and for what I read in many sites the Apache/Passenger combo was one of the simplest ones; however I have encountered that Passenger does not want to start my application and displays the following error message when entering the sudo tail -50 /var/log/apache2/error.log
command:
Could not spawn process for application /home/test/Documents/sites/depot:
An error occured while starting up the preloader.
Message from application: cannot load such file -- bundler/setup (LoadError)
/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in `require'
/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in `require'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:406:in
`activate_gem'
...
age/Cor/Req/CheckoutSession.cpp:252 ]: [Client 1-1] Cannot checkout session
because a spawning error occurred. The identifier of the error is 6ce15bbe.
Please see earlier logs for details about the error.
I suspect it has to do with my ruby installation, I used rbenv and got the 2.2.3 version but in the error message it was linking to a 2.0.0 version which I have never installed.
I also suspect that it has something to do with me using this two commands from another guide:
sudo rm /usr/bin/ruby
sudo ln -s /usr/local/bin/ruby /usr/bin/ruby
https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-apache-on-ubuntu-14-04
If anybody know how to fix this headache of a problem I'll really appreciate it.
Thanks!
You probably need to specify correct PassengerDefaultRuby in your httpd.conf file.
My recommendation is to go through the installation of passenger using their official guide:
https://www.phusionpassenger.com/library/install/apache/
After some clues left by #dimakura and #CamdenNarzt I was able to solve this in two stages.
As I suspected Passenger was using the wrong version of ruby, to fix this I modified the passenger.conf file located under /etc/apache2/mods-available/ with the output of the which ruby command:
Added the line (replace with your own which ruby output)
PassengerRuby /home/test/.rbenv/shims/ruby
Restarted apache got a "Incomplete response received from application" error message, checked the logs and noticed that the proper version of ruby was now being used but got an error message:
"Missing secret_token and secret_key_base for 'production' environment, set these values in config/secrets.yml"
Installed the Figaro gem by following the instructions on this site: https://www.twilio.com/blog/2015/02/managing-development-environment-variables-across-multiple-ruby-applications.html then generated a secret key using the command:
rake secret
Copied the output and opened the config/application.yml file where I entered:
SECRET_KEY_BASE: [output key from rake secret command]
Restarted Apache and it worked!!
Related
I downloaded and installed Ruby, Ruby gems and with it installed Jekyll. Started a test project with Jekyll. Want to deploy it on Heroku (because gh-pages don't support plugins on Jekyll).
Read docs on Heroku for ruby, downloaded and installed JDK 8 and JRuby 9.1.17.0. Installed bundler.
Logged in Heroku, and executed following commands in terminal:
heroku create
git push heroku master
heroku open
The new heroku app build succeeded but the website fails to load. It displays error like so:
This is the error displayed when I check heroku logs
I also built a Procfile in the root folder for the test project. Entered the following code:
web: puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}
I'm not sure what went wrong. Please help!
You need to figure out what's your web-server by default. As advised by Roberto, it might be puma.
By the default, when you run rails new, it always has the web-server gem (puma, passenger, unicorn or anything else).
It seems that you've copied some settings? And that's why you don't have puma in Gemfile, but trying to run it. You might share the Gemfile list to let you know what's wrong.
I need help. I can't figure out why I can't boot my Rails 5.2 app now that rjb is a dependency. I keep getting a generic error about Constants DL and Fiddle is not defined.
First, yes I have read the Documentation.
Second, yes I have set JAVA_HOME.
$ echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64
Third, I have set LD_LIBRARY_PATH (COULD THIS BE THE PROBLEM?)
$ echo $LD_LIBRARY_PATH
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64
However, whenever I try to open rails console or rails server I just get the error:
$ rails c
/home/daniel/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:84:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'fillable-pdf'.
Gem Load Error is: Constants DL and Fiddle is not defined.
Backtrace for gem load error is:
/home/daniel/.rvm/gems/ruby-2.5.1#fuel/gems/fillable-pdf-0.6/lib/fillable-pdf/itext.rb:4:in `load'
....
<redacted>
The app runs fine on OSX, on CircleCI, and on Heroku. Does someone with more experience with rjb than me spot what I'm missing here?
Thank you in advance!
After rebooting and running some updates, it seems to work now. So all of the above appears to be correct. No JVM issues when opening up rails console anymore.
I just published my rails app to Openshift and I got the error message:
We're sorry, but something went wrong.
The log file says:
Could not find rake-10.4.2 in any of the sources (Bundler::GemNotFound)
I do not know how to debug this issue. This has happened to about 3 apps I have deployed in the last couple of hours.
Hers is a link to the full ruby log file:
https://gist.github.com/kinsomicrote/e3715be509a7375758ef
Seems that you have problems with gems and passanger.
Did you run bundle install on the host? (if you have Gemfile)
If you already do, try to install puma or thin, and start webserver running bundle exec puma -b 0.0.0.0:8080 -d
to check if it working. Passanger sometimes is hard to setup.
I'm past all this now and trying to fix the problem not in quotes down below, but leaving for background information.
I am trying to get a working rails development environment on my LAMP
stack, so I've installed rbenv, the 2.1.2 version of ruby, the 4.1.4
version of Rails and the phusion mod for Apache. I'm now seeing very
strange errors when I try to stop and start my Apache service and I
think the issue is that Phusion has rebuilt the Apache installation on
the machine and Apache is now looking for configuration files in
/etc/apache2/. I'm now struggling to find out how to fix apache to
look in the LAMP directories for httpd.conf.
Here are some examples of the errors.
$ sudo service apache2 restart
* Restarting web server apache2
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
$ sudo /opt/lampp/lampp restart
Restarting XAMPP for Linux 1.8.3-4...
XAMPP: Stopping Apache...fail.
apachectl returned 1.
XAMPP: Stopping MySQL...ok.
XAMPP: Stopping ProFTPD...not running.
XAMPP: Starting Apache...already running.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...fail.
XAMPP: Another FTP daemon is already running.
Also, this is how I've modified the config file in
/opt/lampp/etc/httpd.conf. I know the module is supposed to be a .so
file but I did not see one in my directory (didn't really spend enough
time looking into this to know how to fix it, do I need to compile
something?)
LoadModule passenger_module /home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/ext/apache2/mod_passenger.c
PassengerRoot /home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45
PassengerRuby /home/moody/.rbenv/versions/2.1.2/bin/ruby
Server is running Ubuntu 14.04. Install order was LAMP (1.8.3-4), Ruby
1.9.3 (via apt-get), then rbenv, then ruby-build, then installed Ruby 2.1.2, then removed Ruby 1.9.3 via apt-get remove, then installed rails gems, then installed phusion for Apache and the ruby gem for
phusion.
Edit 1: I found out it's actually an issue with my LoadModule file
paths
I checked out the actual LAMPP script to see where the apachectl
returned 1 error was coming from and it was just running
/opt/lampp/bin/apachectl, so then I ran the same command
/opt/lampp/bin/apachectl -k stop and it gave me a very descriptive
error:
httpd: Syntax error on line 160 of /opt/lampp/etc/httpd.conf: Cannot load /home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/ext/apache2/mod_passenger.c into server: /home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/ext/apache2/mod_passenger.c: invalid ELF header
Commented out my lines-need to figure out how to get the appropriate
.so file.
Edit 2:
I ran the passenger-install-apache2-module installer and it seemed to work fine and told me the lines to add to my program (including the .so file which I was missing before)
Now I'm running into a far more confusing error that I think is related to the version of GCC that is available for ubuntu 14.04 and I can't find any resources on the internet that deal with this problem
httpd: Syntax error on line 160 of /opt/lampp/etc/httpd.conf: Cannot load /home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/buildout/apache2/mod_passenger.so into server: /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/buildout/apache2/mod_passenger.so)
Saw this in another google search to see which GCC versions are available, apparently 3.4.9 isn't one of them (go figure, that's what the error says.) Any ideas on how I can remedy this?
$ strings /opt/lampp/lib/libstdc++.so.6 | grep -i glibcxx
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_FORCE_NEW
Edit 3: It's 6 AM and I think I figured it out at last.
I did a few searches and found this post here:
/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found
And then I did a find on the root directory
find / | grep -i libstdc++.so
And used the strings command I found earlier-the libstdc++.so had GLIBCXX_3.4.9 in the directory /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19 so I backed up the old one with mv and copied the new one to the lampp directory. Restarted the server and got no errors. Supposedly I have a working rails stack now :)
Edit 4:
Welp, Phusion is working, but there's a new problem... Now when I navigate to my new virtual host (RailsEnv set to development) I get this lovely stack trace on a bunch of code I have no experience with. Seems like something's wrong with the sha1.so referencing some unknown symbol that's supposed to be in libcrypto.so.1.0.0. What the heck is link time reference?
Interestingly, if I just navigate to the application folder and do rails server, I can see the application without issue. Does the application need to be generated? (i.e. call rails generate)?
/home/moody/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-linux/digest/sha1.so: symbol SHA1_Init, version OPENSSL_1.0.0 not defined in file libcrypto.so.1.0.0 with link time reference - /home/moody/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-linux/digest/sha1.so (LoadError)
/home/moody/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/definition.rb:1:in `<top (required)>'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler.rb:153:in `definition'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler.rb:116:in `setup'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/setup.rb:17:in `<top (required)>'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/lib/phusion_passenger/loader_shared_helpers.rb:258:in `block in run_load_path_setup_code'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/lib/phusion_passenger/loader_shared_helpers.rb:361:in `running_bundler'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/lib/phusion_passenger/loader_shared_helpers.rb:256:in `run_load_path_setup_code'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/helper-scripts/rack-preloader.rb:100:in `preload_app'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/helper-scripts/rack-preloader.rb:158:in `<module:App>'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/helper-scripts/rack-preloader.rb:28:in `<main>'
The errors you are getting says that port [:80] is already in use so checking which process has that port occupied and killing that process might be the fix for you. You can do this by running
sudo kill $(sudo lsof -t -i:80)
or
sudo kill sudo lsof -t -i:9001
After the process gets terminated, try restarting the apache server.
I had a very similar error like yours which is regarding the OPENSSL version.
You can refer this post. https://groups.google.com/forum/?hl=en#!topic/phusion-passenger/6nRi0FU98_g
For my case, I resolved it by changing my apache version to 2.2.22
I'm trying to get my Rails 3.2.8 app running on justhost.com's web hosting platform and I'm having a few problems. The app works fine on WEBrick when I ssh into the server and run rails server, but passenger (the server platform provided by justhost) is having some issues:
I don't understand what this error means or have any idea on how to fix it. Could someone please point me in the right direction?
In case this information is relevant, here are the contents of my .htaccess file:
PassengerEnabled On
PassengerAppRoot /home3/webgemla/rails_apps/WebGemLabs/
SetEnv GEM_HOME /home3/webgemla/.rvm/gems/ruby-1.9.3-p194
Note: The live version of my app is at webgemlabs.com
When I visited your link I got this error message:
Error message:
no such file to load -- bundler
You probably just need to gem install bundler on your server.