[OOD-users] Test App Install

Franz, Eric efranz at osc.edu
Fri Jun 16 12:36:33 EDT 2017


Shawn,

In case you haven’t seen it yet, the “ps” app is described here: https://github.com/OSC/Open-OnDemand/wiki/Build-a-simple-Node.js-OOD-App
Since its Passenger app, for node.js the app’s entry point is app.js. 

You can install it during development in your “developer sandbox”:

1. Install the app to $HOME/ondemand/ps/app.js
2. Access the app via URL /pun/dev/ps

If you make a modification to the file, you will likely need to restart the app to see changes. To force the app to restart, you cd to the app directory and `touch tmp/restart`. Then on the next request to the app, Passenger will reload it.

So if you want to make a new app from that as a starting point, like an app called quota:

1. copy the ps app directory to $HOME/ondemand/quota
2. Access the app via /pun/dev/quota (i.e. https://ondemand.osc.edu/pun/dev/quota)
3. If you modify the code, touch $HOME/ondemand/quota/tmp/restart.txt so when you access the app again you’ll see the change


When deploying the app to production, you’ll need to add a manifest.yml in the app directory to make it appear in the nav. That’s described in the wiki page above. You’d deploy to /var/www/ood/apps/sys/quota and access it via URL /pun/sys/quota. Let me know if you need more information.

Several gotchas we’ve run into when developing:

1. If you make edits to files in your home directory while ssh into a different node than is running OnDemand, you might be subject to NSF sync delays. So a modification and touch tmp/restart might not be immediately recognized.
2. Passenger caches the app type (Python, JavaScript, or Ruby). When you create a new app using JavaScript and access it, then replace the app in that app’s directory with a Ruby or Python app, the app will fail to load unless your Per User Nginx process is restarted. To force a PUN restart, click “Restart Web Server” in the Help dropdown on OnDemand dashboard or go directly to the URL /nginx/stop i.e. https://ondemand.osc.edu/nginx/stop which will kill the PUN process. Then make another request to your app.

Finally, the virtue of the “ps” example app is that it is a minimal example that requires no build step to install external dependencies. If you want to use Express or other dependencies to make app development easier you can use npm with a package.json file and install dependencies in the same directory as the app code. All of our apps use some type of package manager to manage dependencies. For example, apps we build in Ruby use a Gemfile to manage dependencies which we install in the same directory as the app. I don’t know the best practice for Python but a similar approach could be done using pip. 

For example, using the Ruby “Sinatra” framework, the ps app would look like this:

require 'sinatra'

get '/' do
  "<h2>#{Time.now}</h2><pre>#{`ps ufx`}</pre>"
end

run Sinatra::Application


That said, for what you’re describing, proceeding as you suggest might work great. Also, if you want a simple way to periodically auto-reload the data for your app, don’t forget the simple:

<meta http-equiv="refresh" content="60">

added to the <head> section of the HTML (reload every 60 seconds).

Thanks,
Eric

---
Eric Franz, Senior Web & Interface App Engineer
Ohio Supercomputer Center
An Ohio Technology Consortium (OH-TECH) Member
1224 Kinnear Road
Columbus, OH 43212
email: efranz at osc.edu
 

On 6/16/17, 11:04 AM, "OOD-users on behalf of Doughty, Shawn" <ood-users-bounces at lists.osc.edu on behalf of Shawn.Doughty at tufts.edu> wrote:

     I have a short script here that people use to see their homedir quota (NFS) and project quota (since the output from gpfs utility is painful to read). Putting that in a small app with a graphic bar chart (or whatever) will probably be the first thing people ask for.
    
    More to come...
    
    --
    Shawn G. Doughty
    Senior Research Technology Specialist
    Research Storage Service Owner
    Research Technology (RT)
    Tufts Technology Services (TTS)
    XSEDE Campus Champion, Student Mentor, Region 7 Team
    
    16 Dearborn Road
    Somerville, MA 02144
    617-627-5462
    http://it.tufts.edu/
    
    ________________________________________
    From: OOD-users [ood-users-bounces+shawn.doughty=tufts.edu at lists.osc.edu] on behalf of Basil Mohamed Gohar [bgohar at osc.edu]
    Sent: Friday, June 16, 2017 10:47 AM
    To: ood-users at lists.osc.edu
    Subject: Re: [OOD-users] Test App Install
    
    Shawn,
    
    Eric, my senior developer, is going to reply with some more details.  He
    created the sample PS app and wants to start the conversation with you.
    We'd also like to know more about the different kinds of "mini-apps" you
    want to write.
    
    Basil Mohamed Gohar
    Web and Interface Applications Manager
    Ohio Supercomputer Center (OSC) <https://osc.edu>
    A member of the Ohio Technology Consortium <https://oh-tech.org>
    1224 Kinnear Road, Columbus, Ohio 43212
    Office: (614) 688-0979 <tel:+16146880979> • Mobile: (614) 657-4820
    <tel:+16146574820> • Fax: (614) 292-7168 <tel:+16142927168>
    bgohar at osc.edu <mailto:bgohar at osc.edu>
    
    Learn more about OSC at https://osc.edu
    
    On 6/15/17 4:10 PM, Doughty, Shawn wrote:
    > Hi,
    >
    > I am testing OOD on our dev server here at Tufts and am wondering how to install the sample PS app. I have a couple of other mini-apps I would like to write and this looks like a good starting point.
    >
    > --
    > Shawn G. Doughty
    > Senior Research Technology Specialist
    > Research Storage Service Owner
    > Research Technology (RT)
    > Tufts Technology Services (TTS)
    > XSEDE Leadership Team, Campus Champion, Region 7 Team
    >
    > 16 Dearborn Road
    > Somerville, MA 02144
    > 617-627-5462
    > http://it.tufts.edu/
    > _______________________________________________
    > OOD-users mailing list
    > OOD-users at lists.osc.edu
    > https://lists.osu.edu/mailman/listinfo/ood-users
    
    _______________________________________________
    OOD-users mailing list
    OOD-users at lists.osc.edu
    https://lists.osu.edu/mailman/listinfo/ood-users
    _______________________________________________
    OOD-users mailing list
    OOD-users at lists.osc.edu
    https://lists.osu.edu/mailman/listinfo/ood-users
    



More information about the OOD-users mailing list