views:

69

answers:

4

I'm thinking to something really similar on what you can do with mod_php: drop an application in some way inside Apache and making it run with Passenger, without adding anything inside httpd.conf (no vhost, nothing except the basic Passenger configuration). It's something very similar to Wordpress or many other frameworks: just unzip/svn checkout it inside a folder and run it.

I know that it's possible with CGI and FCGI, but I'm wondering if it's also possible to tap in the speed of Passenger.

I've tried fiddling with the Rack instructions on the official website trying to find a specific .htaccess and config.ru configuration, but nothing so far.

I know it's not common, but... is it even possible?

A: 

It all depends on what is already in your httpd.conf

You can't even run a PHP app without modifying your apache config files on many default apache installs.

DBruns
Of course. I'll try to be more clear. :)I mean configured just with the basic Passenger configuration details, nothing app-specific in the configuration file.So, I mean, just the three lines specified in the passenger-install-apache2-module installation script to load the library and the obvious AllowOverrides. :)
Folletto
A: 

Maybe dropping config.ru to some directory would do it?

Vojto
+1  A: 

It's not possible without configuring a virtual host.

Rails applications are not like PHP files; files on the filesystem do not correspond with URLs. PHP files are placed within the DocumentRoot, whereas Rails/Rack apps live outside the DocumentRoot.

It is therefore not possible for Passenger to detect your application's location. You either need to tell it where it is located in the first place, or you need to point your virtual host's DocumentRoot to your application's /public directory. In that case Passenger will detect that it is a Rails/Rack app and you don't need additional Passenger configuration, but you do need a virtual host for each application.

Update: The Passenger docs mention that RailsBaseURI is allowed within a .htaccess file. Adding this in your document root and creating a symlink from a subdirectory (e.g. /docroot/yourapp) to the /public dir of your application might then be just what you need.

molf
Thanks. Just to be completely clear: so I suppose that it isn't possible to do the required configuration inside the .htaccess, right?
Folletto
I was confident that it wasn't, but specifying the base URI seems actually possible from an `.htaccess` file; see update.
molf
Thanks, I'll try! :)
Folletto
<IfModule mod_passenger.c> PassengerAppRoot /path/to/app/root RailsEnv staging RailsBaseURI /path/to/app/root/public</IfModule>Works. :)
Folletto
In fact it seems that "PassengerAppRoot /path/to/app/root" in the .htaccess inside the "public" subfolder is enough. I'll do more testing
Folletto
A: 

It is almost possible. If the configuration is done right and apache+mod_rails knows where your application ist you need to change the last modified date of the /path/to/your/app/tmp/restart.txt. With ssh access you can do this like this

touch /path/to/your/app/tmp/restart.txt

more information can be found here: http://www.modrails.com/documentation/Users%20guide.html#_redeploying_restarting_the_ruby_on_rails_application

Update:

Or you can create the /path/to/your/app/tmp/always_restart.txt

more information about this can be found here: http://www.modrails.com/documentation/Users%20guide.html#_making_the_application_restart_after_each_request

jigfox
How does restarting an existing application relate to deploying a new one?
molf
you can deploy it with the file, and passenger autoloads the new files **UPD:** a ruby application must be restarted after every file change, if you use (F)CGI for your ruby app, it starts a new app server with each request, so it restarts for every request. Passenger spawns 1 or more instances for your app, but doesn't restart for eachh request, it reuses already started processes of your app
jigfox