Querying Status of Custom App from Node-Red.

Home Forums Conduit: AEP Model Querying Status of Custom App from Node-Red.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #18933
    Ajay K
    Participant

    I have installed a custom App and it shows up in the Apps section in the Conduit Admin ui screen. There is a button there to Start & Stop the custom App. I was hoping to do the same from the node-red application. How can I query the status of the custom application (in terms of running/stopped) and mimic the same behavior of the button on the App.html web page.

    I am just asking in the interest of saving time and not re-inventing the wheel on trying to implement the same functionality from node-red?

    Thanks,
    Ajay

    #18937
    Jeff Hatch
    Keymaster

    Ajay,

    Details on the status of a custom application integrated with the Custom Application Management in Conduit can be found here:

    http://www.multitech.net/developer/software/aep/creating-a-custom-application/application-status/

    The status.json file is what is being read by the Web UI for the status information.

    You can start and stop your application you can use app-manager:

    app-manager –command start –appId

    Or you could execute the Start script directly from your application.

    Jeff

    #18938
    Ajay K
    Participant

    Thanks Jeff for your response. I was hoping the start/stop was being executed via one of the AEP Web API Command endpoints. So currently the Web UI uses the app-manager to start and stop the application?

    Thanks,
    Ajay

    #18939
    Jeff Hatch
    Keymaster

    Ajay,

    There is an API entry point at api/customApps in the Web UI. Here is an example of stopping an app:

    admin@mtcdt:/var/config# curl -X POST -H ‘Content-Type: application/json’ -d ‘{}’ 127.0.0.1/api/customApps/58a4d0d85b1b015a89000006/stop
    {
    “code” : 200,
    “status” : “success”
    }

    The trick will be to get the appId -> 58a4d0d85b1b015a89000006. You can get that from the output of:

    curl -s 127.0.0.1/api/customApps

    which will return something like this:

    {
    “code” : 200,
    “result” : [
    {
    “_id” : “58a4d0d85b1b015a89000006”,
    “description” : “Basic web server running on port 3000. Firewall is opened on install. node_modules is included in the tarball. Utilizes all custom app functionality including environment variables, custom status file, config file, and install scripts.”,
    “info” : “Listening on port 3000 as of Mon May 01 2017 18:09:18 GMT+0000 (UTC)”,
    “name” : “express-hello-world”,
    “status” : “STOPPED”,
    “version” : “1.4”,
    “versionNotes” : “Implement restart and reload in the Start script”
    }
    ],
    “status” : “success”
    }

    Jeff

    #18940
    Ajay K
    Participant

    Hi Jeff,

    Thanks so much for taking the time to respond and write out a detailed way to start/stop the custom app. I did try to get the custom App Id based of the suggestion above. I am not sure why though the appId is written out as “LOCAL“. Is that correct? The custom app was installed on the conduit flash.

    Thanks,
    Ajay.

    #18941
    Jeff Hatch
    Keymaster

    Ajay,

    The LOCAL appID should work to start and stop your application. Since you did a local install, and not from DeviceHQ, your app was assigned the appId of LOCAL. Currently, the way app-manager works, it was intended to only manage one LOCAL app at a time, so if you install a second, you may not get the behavior you want.

    In my example, the application was installed by downloading it from DeviceHQ.

    Jeff

    #18942
    Ajay K
    Participant

    Jeff,

    I was able to both start/stop the application from node-red based of the URL you had mentioned earlier and I used the http request node. Also the LOCAL id worked perfectly well.

    Thanks once again for your timely responses.

    Thanks,
    Ajay

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.