Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

Build a simple Node.js OOD App

Basil Mohamed Gohar edited this page Mar 7, 2017 · 6 revisions

Build in development sandbox in home directory:

  1. Starting in your home directory:
mkdir -p ~/ondemand/dev/ps
cd ~/ondemand/dev/ps
vim app.js
  1. Add these contents to app.js:
// a minimal node app that displays your running processes on the OOD web host
var http = require('http');
var exec = require('child_process').exec;

var server = http.createServer(function (request, response){
    exec('ps ufx', function(error, stdout, stderr){
        response.writeHead(200, {"Content-Type": "text/html"});
        response.write("<h2>" + new Date() + "</h2>");
        response.write("<pre>" + stdout + "</pre>\n");
        response.end();
    });
});
server.listen(3000);
  1. Access the app via /pun/dev/ps URL on your OnDemand instance i.e. https://ondemand.osc.edu/pun/dev/ps or https://webdev05.hpc.osc.edu/pun/dev/ps

Deploy to production

  1. To deploy to production, first add a manifest.yml YAML file specifying the title, category, and optionally icon:
name: ps
category: Clusters
icon: fa://list
  • valid categories currently are: Files, Jobs, Clusters, Desktops, Desktop Apps
  • icons are Font Awesome icons
  1. Then copy to production. Now everyone can launch the app from the Dashboard.
cd ~/ondemand/dev/ps
sudo mkdir -p /var/www/ood/apps/sys/ps
sudo rsync -rlptvu . /var/www/ood/apps/sys/ps

Making modifications to an app

To make modifications to an app you already you may need to restart the app.

  1. Modify the app's file(s).

  2. Force restart the app by cd-ing into the app directory then running:

mkdir -p tmp
touch tmp/restart.txt