I have ruby and the gems installed within /home/insane-36/.rvm directory. I installed the passenger gem and created passenger.load and passenger.conf files within apache mod-available and enabled the mod for apache. The content of these files are as;
passenger.load
LoadModule passenger_module /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/ext/apache2/mod_passenger.so
passenger.conf
PassengerRoot /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12
PassengerRuby /home/insane-36/.rvm/wrappers/ruby-1.9.3-p194/ruby
Then, I created a symlink for the application at location /home/insane-36/www/testing to /var/www/testing. I also created a file to enable the site as;
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName testing
DocumentRoot /var/www/testing/public/
<Directory /var/www/testing/public/>
Options Indexes +ExecCGI FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Then enabled the site and restarted the server but it gives me error saying ruby (rack) application could not be started. I kept on searching the internet and found some solutions but none work to me. I think this is permission issue. I dont know what the permission should be set. I guess the files should be made available to the apache user. And tried modifying the permission but instead have the same error. The detailed log is as;
A source file that the application requires, is missing.
It is possible that you didn't upload your application files correctly. Please check whether all your application files are uploaded.
A required library may not installed. Please install all libraries that this application requires.
Further information about the error may have been written to the application's log file. Please check it in order to analyse the problem.
Error message:
cannot load such file -- rubygems/path_support
Exception class:
LoadError
Application root:
/var/www/testing
Backtrace:
# File Line Location
0 /home/insane-36/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems.rb 395 in `paths'
1 /home/insane-36/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems.rb 416 in `path'
2 /home/insane-36/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb 382 in `dirs'
3 /home/insane-36/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb 267 in `_all'
4 /home/insane-36/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb 410 in `each'
5 /home/insane-36/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb 442 in `find'
6 /home/insane-36/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb 442 in `find_by_path'
7 /home/insane-36/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems.rb 206 in `try_activate'
8 /home/insane-36/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb 59 in `rescue in require'
9 /home/insane-36/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb 35 in `require'
10 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/utils.rb 241 in `prepare_app_process'
11 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb 156 in `block in initialize_server'
12 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/utils.rb 572 in `report_app_init_status'
13 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb 154 in `initialize_server'
14 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb 204 in `start_synchronously'
15 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb 180 in `start'
16 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb 129 in `start'
17 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb 253 in `block (2 levels) in spawn_rack_application'
18 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb 132 in `lookup_or_add'
19 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb 246 in `block in spawn_rack_application'
20 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb 82 in `block in synchronize'
21 prelude> 10:in `synchronize'
22 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb 79 in `synchronize'
23 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb 244 in `spawn_rack_application'
24 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb 137 in `spawn_application'
25 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb 275 in `handle_spawn_application'
26 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb 357 in `server_main_loop'
27 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb 206 in `start_synchronously'
28 /home/insane-36/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/helper-scripts/passenger-spawn-server 99 in `'
Any help would be appreciated.
This is how I deployed the application locally.
/etc/apache2/mods-available/passenger.load
/etc/apache2/mods-available/passenger.conf
Now, enabled the mod-passenger for apache as;
Created a rails application inside /home/insane-36/www/
rails new testing -T -D mysql
Created a symlink to the application in the /var/www/ folder as;
Created a file in /etc/apache2/sites-available/testing
Enabled the site using,
Added the ServerName chosen for and Created a file in /etc/apache2/sites-available/testingthe site to the /etc/hosts file;
NOTE:
Be sure to enable the permission 755 to the current user directory.
I still have a problem here. I have managed to make the application work. But, everytime I make changes to the application, I need to reload the server. Is there some ways to deal with this so that server automatically tracks the files being changes then reload the server or combine the changes.
Some notes suggested if I added empty file tmp/restart.txt should work for restarting the app and bring the changes but doesnot work for me.