Recent Changes - Search:

edit SideBar

Key/Value Store on Terra and Swarmnuc2008

On, we are running the $PTII/ptolemy/actor/lib/jjs/modules/httpServer/demo/KeyValueStoreClient/KeyValueStoreServerTerra.xml model.

We have a similar setup running on, see $PTII/org/terraswarm/accessor/demo/AugmentedRealityVideoSOHO/README.txt

On, the way the model gets started is by using pm2 in the sbuser account.

On terra, ~sbuser/runKVStore contains

# pm2 start  --interpreter=bash ~/runKVStore
$PTII/bin/ptinvoke ptolemy.moml.MoMLSimpleApplication $PTII/ptolemy/actor/lib/jjs/modules/httpServer/demo/KeyValueStoreClient/KeyValueStoreServerTerra.xml

On swarmnuc2008, ~sbuser/runKVStore contains:

# pm2 start  --interpreter=bash ~/runKVStore
$PTII/bin/ptinvoke ptolemy.moml.MoMLSimpleApplication $PTII/org/terraswarm/accessor/demo/AugmentedRealityVideoSOHO/KeyValueStoreServerSOHO.xml

PM2 Installation Instructions

  1. As the sbuser, install pm2
      mkdir node_modules
      npm   install pm2
      export PATH=~/node_modules/bin:${PATH}
    You may want to add the export line to sbuser's ~/.bashrc.
  2. As root, run the command below to set up pm2 to start up on reboot
      export PATH=/home/sbuser/src/ptII/bin:${PATH}
      export PTII=/home/sbuser/src/ptII
    ~sbuser/node_modules/.bin/pm2 startup
  3. As sbuser, create the ~sbuser/runKVStore file (see above for the contents) and make it executable:
      chmod a+x ~/runKVStore
  4. As sbuser, create ~sbuser/sbuser.cron (see above).
  5. As sbuser, have pm2 start up our script:
      pm2 start  --interpreter=bash ~/runKVStore
  6. As sbuser, run the startup command to register the sbuser account:
    sbuser@swarmnuc2008:~/.pm2/logs$ pm2 startup
    /home/sbuser/src/ptII/bin/node: Running /usr/bin/node /home/sbuser/node_modules/.bin/pm2 startup
    [PM2] Init System found: systemd
    [PM2] To setup the Startup Script, copy/paste the following command:
    sudo env PATH=$PATH:/usr/bin /home/sbuser/node_modules/pm2/bin/pm2 startup systemd -u sbuser --hp /home/sbuser
    It might not be necessary to run the above command, but it probably does not hurt.
  7. As root, run the setup command:
      sudo env PATH=$PATH:/usr/bin /home/sbuser/node_modules/pm2/bin/pm2 startup systemd -u sbuser --hp /home/sbuser
  8. As sbuser, save the current setup:
    sbuser@swarmnuc2008:~/.pm2/logs$ pm2 save
    /home/sbuser/src/ptII/bin/node: Running /usr/bin/node /home/sbuser/node_modules/.bin/pm2 save
    [PM2] Saving current process list...
    [PM2] Successfully saved in /home/sbuser/.pm2/dump.pm2


The port is currently 8099. To change the port edit the model and then update the firewall. See


We restart the model every day so as to avoid memory leaks and other failures

~sbuser/sbuser.cron contains:

1 5 * * *  cxh -c '/home/sbuser/cg/node_modules/.bin/pm2 restart runKVStore' >& /home/sbuser/runKVStore.log

To update the crontab use:

crontab ~/sbuser.cron
Edit - History - Print - Recent Changes - Search
Page last modified on January 22, 2018, at 05:24 PM