This repository has been archived by the owner on Apr 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Build a simple Node.js OOD App
Basil Mohamed Gohar edited this page Mar 7, 2017
·
6 revisions
- Starting in your home directory:
mkdir -p ~/ondemand/dev/ps
cd ~/ondemand/dev/ps
vim app.js
- 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);
- 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
- 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
- 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
To make modifications to an app you already you may need to restart the app.
-
Modify the app's file(s).
-
Force restart the app by cd-ing into the app directory then running:
mkdir -p tmp
touch tmp/restart.txt