Content
[Debian][nginx] Installation - how to
Added by Iancul 1981 over 10 years ago
Edit 29.06.2014: solved my problem, edited the title and added the solutions for others to see
Hello,
So after trying to install openproject on my own server (debian squeeze) and running into a whole lot of problems that led me to study the documentation for ruby, rvm and phusion passenger and updating my system from squeeze to wheezy I finally got it working. I will post my notes here so others can use them if they are interested.
Base guides and other useful doc:
- Installation OpenProject 3 0
- Debian Stable with MySQL in production
- RVM
- The basics of RVM
- Examples of using RVM
- Phusion Passenger users guide, Nginx version
Installation:
Environment, database, rvm, ruby, bundler, openproject (+plugins), testing
- Just followed the debian guide all the way to the apache part but with a few differences:
- at step 1 instead of openproject, I think a better name would be rubyuser or rvmuser, since this local user could be used to deploy other ruby apps besides openproject - from my understanding it is needed for the installation and execution of rvm and not necessarily openproject
- at step 5 after the command
bundle exec rake db:create:all
**** I actually ran
bundle exec rake db:migrate db:seed RAILS_ENV=production bundle exec rake generate_secret_token RAILS_ENV="production" bundle exec rake assets:precompile bundle exec rails server RAILS_ENV=production
**** This should start the ruby integrated webserver, allowing to test the installation so far (webbrowser, http://serverip:3000 —> if it shows a stripped down version of the login it works; if you want it full you must edit ../openproject/config/environments/production.rb and edit config.serve_static_assets from false to true
**** Don’t forget to stop the server before continuing (ctrl+c)
Phusion passenger and nginx
- Install Passenger: https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#install_on_debian_ubuntu
- now passenger is installed but we need to tell nginx to use the rvm ruby, not the generic one your system has (if any)
- Nginx virtual host:
- first log with the user that was used for the install of rvm, then check what you need for the nginx vhost entry:
root@homesrvr:~# su rvmuser -c "bash -l" rvmuser@homesrvr:/root$ rvm info ruby-2.1.2: system: uname: "Linux homesrvr 3.2.0-4-686-pae #1 SMP Debian 3.2.57-3 i686 GNU/Linux" system: "debian/7/i386" bash: "/bin/bash => GNU bash, version 4.2.37(1)-release (i486-pc-linux-gnu)" zsh: " => not installed" rvm: version: "rvm 1.25.27 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]" updated: "6 hours 56 minutes 17 seconds ago" path: "/home/rvmuser/.rvm" ruby: interpreter: "ruby" version: "2.1.2p95" date: "2014-05-08" platform: "i686-linux" patchlevel: "2014-05-08 revision 45877" full_version: "ruby 2.1.2p95 (2014-05-08 revision 45877) [i686-linux]" homes: gem: "/home/rvmuser/.rvm/gems/ruby-2.1.2" ruby: "/home/rvmuser/.rvm/rubies/ruby-2.1.2" binaries: ruby: "/home/rvmuser/.rvm/rubies/ruby-2.1.2/bin/ruby" irb: "/home/rvmuser/.rvm/rubies/ruby-2.1.2/bin/irb" gem: "/home/rvmuser/.rvm/rubies/ruby-2.1.2/bin/gem" rake: "/home/rvmuser/.rvm/rubies/ruby-2.1.2/bin/rake" environment: PATH: "/home/rvmuser/.rvm/gems/ruby-2.1.2/bin:/home/rvmuser/.rvm/gems/ruby-2.1.2@global/bin:/home/rvmuser/.rvm/rubies/ruby-2.1.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/rvmuser/.rvm/bin" GEM_HOME: "/home/rvmuser/.rvm/gems/ruby-2.1.2" GEM_PATH: "/home/rvmuser/.rvm/gems/ruby-2.1.2:/home/rvmuser/.rvm/gems/ruby-2.1.2@global" MY_RUBY_HOME: "/home/rvmuser/.rvm/rubies/ruby-2.1.2" IRBRC: "/home/rvmuser/.rvm/rubies/ruby-2.1.2/.irbrc" RUBYOPT: "" gemset: "" rvmuser@homesrvr:/root$ which passenger-config /home/rvmuser/.rvm/gems/ruby-2.1.2/bin/passenger-config rvmuser@homesrvr:/root$ /home/rvmuser/.rvm/gems/ruby-2.1.2/bin/passenger-config --ruby-command passenger-config was invoked through the following Ruby interpreter: Command: /home/rvmuser/.rvm/gems/ruby-2.1.2/wrappers/ruby Version: ruby 2.1.2p95 (2014-05-08 revision 45877) [i686-linux] To use in Apache: PassengerRuby /home/rvmuser/.rvm/gems/ruby-2.1.2/wrappers/ruby To use in Nginx : passenger_ruby /home/rvmuser/.rvm/gems/ruby-2.1.2/wrappers/ruby To use with Standalone: /home/rvmuser/.rvm/gems/ruby-2.1.2/wrappers/ruby /home/rvmuser/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.45/bin/passenger start ## Notes for RVM users Do you want to know which command to use for a different Ruby interpreter? 'rvm use' that Ruby interpreter, then re-run 'passenger-config --ruby-command'.
- Actual nginx vhost:
server { server_name server.name; root /home/rvmuser/openproject/public; access_log /var/log/nginx/openproject/openproject.access.log; error_log /var/log/nginx/openproject/openproject.error.log; passenger_ruby /home/rvmuser/.rvm/gems/ruby-2.1.2/wrappers/ruby; passenger_enabled on; }
Conclusion
*That’s it. That’s how I made it work. Maybe if someone could build an official guide from this it would be easier to deploy this wonderful app and save people the trouble I went through to get it to work.
Thanks for this app!
Initial post:
Hello,
I have discovered this software and am excited to install it on my own server. Unfortunately I can’t really install it correctly all the way.
I followed this guide https://www.openproject.org/projects/openproject/wiki/Debian_Stable_with_MySQL_in_production up to almost the final stages, meaning here:
“6. INSTALL APACHE WITH PASSENGER TO AUTOSTART OPENPROJECT WITH OS AND LOADBALANCE TRAFFIC”. After this step I only went this far: “chmod o+x ”/home/openproject" " since I have nginx as my web server.
I followed the instructions here for installing phusion passenger: https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#install_on_debian_ubuntu
and all seems well.
I created this entry in my nginx vhost .conf file:
server {
listen 80;
server_name myserver.com;
root /home/openproject/openproject/public;
passenger_enabled on;
}
but when I try to access in my browser it I get a passenger error page that says
“We’re sorry, but something went wrong.
We’ve been notified about this issue and we’ll take a look at it shortly.The Phusion Passenger application server encountered an error while starting your web application. Because you are running this web application in staging or production mode, the details of the error have been omitted from this web page for security reasons.
Please read the web server error log to find the details of the error. If you don’t know where the web server error log is, read the troubleshooting documentation below.
Alternatively, you can turn on the ”friendly error pages" feature (see below), which will make Phusion Passenger show many details about the error right in the browser."
My web server log says:
“[ 2014-06-27 13:59:22.5251 1993/b5affb70 Pool2/Implementation.cpp:883 ]: Could not spawn process for group /home/openproject/openproject#default: An error occured while starting up the preloader.
in ‘void Passenger::ApplicationPool2::SmartSpawner::handleErrorResponse(Passenger::ApplicationPool2::SmartSpawner::StartupDetails&)’ (SmartSpawner.h:451)
in ‘std::string Passenger::ApplicationPool2::SmartSpawner::negotiatePreloaderStartup(Passenger::ApplicationPool2::SmartSpawner::StartupDetails&)’ (SmartSpawner.h:562)
in ‘void Passenger::ApplicationPool2::SmartSpawner::startPreloader()’ (SmartSpawner.h:202)
in ‘virtual Passenger::ApplicationPool2::ProcessPtr Passenger::ApplicationPool2::SmartSpawner::spawn(const Passenger::ApplicationPool2::Options&)’ (SmartSpawner.h:746)
in ‘void Passenger::ApplicationPool2::Group::spawnThreadRealMain(const Passenger::ApplicationPool2::SpawnerPtr&, const Passenger::ApplicationPool2::Options&, unsigned int)’ (Implementation.cpp:804)
[ 2014-06-27 13:59:22.5255 1993/b62ffb70 agents/HelperAgent/RequestHandler.h:2262 ]: [Client 20] Cannot checkout session.
Error page:
no such file to load — bundler/setup (LoadError)
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require’
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:258:in `run_load_path_setup_code’
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:361:in `running_bundler’
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:256:in `run_load_path_setup_code’
/usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app’
/usr/share/passenger/helper-scripts/rack-preloader.rb:158”
Could anyone please offer some insight into what I might be doing wrong?
Thank you in advance,
Iancul1981
Replies (1)
no ideas?