Announcement

Collapse
No announcement yet.

Valence Connect Node app in a Production Environment

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Valence Connect Node app in a Production Environment

    So I have created a little proof-of-concept using valence-connect.

    It simply runs a query using the valenceConnect.dbQuery() method and puts the resulting rows into a spreadsheet (I used the ExcelJS node package to generate the worksheet) which is then downloaded from one of our existing Valence portal apps using the Valence.util.Helper.download() method.

    This all works GREAT as long as the node app is running.

    I've been using an SSH puTTY terminal to manually start the node application.

    Now my question (and the reason for this post) is; What is "best practice" for running a node app on the IBMi in a production environment? And more importantly how the heck do you do it?

    I have been "googling" for hours trying to find a simple example of how I can programmatically start my node app but I have had no success. I did find some IBM Knowledge Center documents with some details about QP2SHELL but the examples were worthless, and my attempt at writing a simple shell script (.sh) has left me with more questions than the documents have been able to answer.

    If anyone has successfully done this, you would have my undying gratitude if you were to share your solution or point me in a direction where I might find what I'm looking for.

    Thanks,
    Tim Green

  • #2
    Tim,

    I would suggest using PM2 on your IBM i.

    "PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks."

    Example commands after you have installed PM2 and gone into your node servers root directory.
    • Start
      • pm2 start bin/www.js --name "MyApp"
    • Stop
      • pm2 stop MyApp
    • Restart
      • pm2 restart MyApp

    Comment


    • #3
      Whoa... PM2 is freak'en cool... :cool: ...thanks Johnny!

      Tim

      Comment

      Working...
      X