Phusion Passenger

Phusion Passenger is what OCIO Web Hosting uses to provide support for web-based apps based on Python, Ruby, or Node.js.

We recommend you start with Phusion’s basic tutorial here.

Directories

An account configured for Phusion Passenger will contain the following directories when accessed via SFTP:

/logs

Contains symlinks to the various logs generated by the account.  Updated nightly.  To access logs more recent than that type cdlog from a shell.

/python | /ruby | /nodejs

These directories are where the application code should go.  They will be named according to the language chosen and each will contain both a public files directory (for HTML, images, Javascript, etc.) and a symlink to the temp directory.

/tmp

This is the temporary directory that the application should use.  Please be sure to reconfigure the application to use it if necessary.  Do not use the server’s top-level /tmp or you will have issues due to the load-balanced nature of the Web Hosting architecture .

/htdocs

This is just a symlink to the ‘public’ directory inside of your application directory.  It is where your static asset files should go. (html, jpg, css, js, …)

Languages

Currently Web Hosting supports Python, Ruby, and Node.js via Phusion Passenger.  Each has a slightly different setup.

Python

Passenger utilizes the WSGI architecture standard to host Python applications. You will 1st need to install the app and all dependencies under the /python directory.  You then create an additional file in that directory called passenger_wsgi.py to instantiates and execute your code.  An example launcher could contain the following:

from hello import HelloWorld as application

This would reference a file called hello.py which defines a function named HelloWorld.  As per WSGI standard, this function should accept the environment and HTTP request as parameters and return the headers and page content.

def HelloWorld(environ, start_response):
   start_response('200 OK', [('Content-Type', 'text/plain')])
   yield 'Hello, World\n'

Ruby

Ruby apps go under the /ruby directory and you will probably need shell access to maintain them.  To add Passenger support, add the following to your Gemfile:

gem "passenger", ">= 5.0.25", require: "phusion_passenger/rack_handler"

And the re-run bundle install to download and integrate it.

Node.js

No launcher or modifications are required for a Node.js website.  Install the application into the /nodejs directory, run npm install to download and build its dependencies, and then create a symlink called app.js to its primary script.  For example, if you would normally run the app via:

node run.js

Then you would create a symlink to it as such:

ln -s run.js app.js

All I/O usually handled through the standard localhost-based URL is instead routed to the outside via Passenger and Apache.  The port the app binds to is irrelevant – Passenger intercepts the I/O from all of them.

Restarting the Server

Once your application has been loaded into memory it will remain there until the site has been inactive for a sufficient period of time.  During development, however, you won’t want to wait this long between deployments.  A file called restart.txt exists in the /tmp directory and modifying its timestamp in any way will trigger a manual restart.

[myapp@whadmprd01 ~]$ cdweb
[myapp@whadmprd01 myapp]$ cd tmp
[myapp@whadmprd01 tmp]$ touch restart.txt

You can also overwrite the file via an SFTP upload and accomplish the same thing without needing to use a shell.


Need More Information?

Is OSU Web Hosting right for you? Check your eligibility.

More questions? Check the support section or contact us.

Ready to get started? Request hosting now!