Skip to content

NodeOS main webservice to the outworld #309

Open

Description

@EthraZa

I'm still reading the issues to find my way in NodeOS, so please forgive me if this topic was discussed already.

I'm understanding that running an UI app within NodeOS basically means a NodeJS app running in some port that can be accessed by another machine browser or, in the future, some webview inside a NodeOS terminal, right?

But I was thinking when we got like a bunch of apps running, not websites or something independent, but system stuff, like an IDE or a Web config interface.

Because of that most people would think about a desktop like UI so you can launch and manage other running apps.
But before we can think about how gorgeous this desktop could be, we need to think of how exactly this "One app to rule then all" would do to manage all the other apps.

What I'm proposing here is some kind of NodeOS init like system!? A node Process Manager, maybe something like strong-pm. And coupled to this a NodeOS main RESTful webservice with a standardised API to manage the Process Manager, that would control all the system process. That PM would probably be something to centralize the logging system for all running apps as well, so we can populate our /var/log files.

With this infrastructure in place, any developer would be able to create their vision of Desktop/System Manager GUI for NodeOS.
Now this UI would be able to ask NodeOS to launch an app like SystemControlPanel and open it on an window/iframe or something like that. When we close the window, our desktop UI would communicate it to the PM webservice so it could verify if the SystemControlPanel terminated it's own webservice or it need to be gently put to sleep.

What you guys think about that?

Activity

  1. piranna commented on Oct 15, 2016

    @piranna
    Member

    I'm understanding that running an UI app within NodeOS basically means a NodeJS app running in some port that can be accessed by another machine browser or, in the future, some webview inside a NodeOS terminal, right?

    Right :-) But they can also be too a pure web apps without a backend server using client-side APIs provided by the browser, or a web app using a simple web server to give access to the low-level APIs that the browser is not able to provide.

    But before we can think about how gorgeous this desktop could be, we need to think of how exactly this "One app to rule then all" would do to manage all the other apps.

    It's easier to think on a common protocol instead of about an app to manage the other ones, lefting the implementation details to each one. I think there was some discussion related to that at #215.

    What I'm proposing here is some kind of NodeOS init like system!? A node Process Manager, maybe something like strong-pm. And coupled to this a NodeOS main RESTful webservice with a standardised API to manage the Process Manager, that would control all the system process. That PM would probably be something to centralize the logging system for all running apps as well, so we can populate our /var/log files.

    Seems to be too much complex and centralized and using its own non-standard protocol, just against the design rules of NodeOS... Davius is some kind of exception because it's simple and small, designed to use as few resources as possible (it's not running when nobody is using it), uses a standard protocol (WebDAV) and it could be heavily used by all the applications, not only to serve the apps themselves but also the apps can be able to use it in a transparent way (due to the standard protocol) to access to the users files, unrelated to the GUI. That's the reason why being so useful with so minimal footprint and in a standard way why it's included by default (and also at the users filesystem level, not globally), if we can find something similar for the process management we could consider to include it too.

    With this infrastructure in place, any developer would be able to create their vision of Desktop/System Manager GUI for NodeOS.

    As I said it before, it's better to desing a protocol that to implement the system, so anyone can implement the way the see it fits.

    Now this UI would be able to ask NodeOS to launch an app like SystemControlPanel and open it on an window/iframe or something like that. When we close the window, our desktop UI would communicate it to the PM webservice so it could verify if the SystemControlPanel terminated it's own webservice or it need to be gently put to sleep.

    I think most of these things should be task of the Windows Manager or more globally the Desktop Environment, but I like the idea of a per-user central repositoro of apps, until now I was thinking about using globally installed npm modules and identify them with some field on the package.json file, but having a register and start them by using Web Intents specifcation is not a bad idea...

  2. EthraZa commented on Oct 16, 2016

    @EthraZa
    Author

    Humm I see, I was thinking in RESTful webservice, but I saw you mentioned JSON-RPC what looks very cool.
    But using JSON-RPC calls over HTTP or Websockets or using Webintents calls would still require an always running NodeOS service to listen to then right? (I was forgot about Webintents, but I really like it)
    And if this service is about launch/redirect to other services, it would not benefit of some kind of Node Process Manager? Or you think that a launch and forget aprouch would be better so each service takes care of it self?

  3. piranna commented on Oct 16, 2016

    @piranna
    Member

    But using JSON-RPC calls over HTTP or Websockets or using Webintents
    calls would still require an always running NodeOS service to listen to
    then right? (I was forgot about Webintents, but I really like it)

    There's in fact an always running server, nodeos-reverse-proxy. It listen
    for incomming HTTP and WebSocket request and start the per-user servers on
    demand. It's also able to listen for random ports and domains if the
    servers use the nodeos-reverse-proxy-register module, that automatically
    monkeypatch the build-in net module to register the servers transparently.

    And if this service is about launch/redirect to other services, it would
    not benefit of some kind of Node Process Manager? Or you think that a
    launch and forget aprouch would be better so each service takes care of it
    self?

    nodeos-reverse-proxy listen to the child process to know when it finished
    to de-register itself, so there's no need for more complex process
    management. Unix KISS principle at its fullest :-)

  4. EthraZa commented on Oct 17, 2016

    @EthraZa
    Author

    Oh, so the thing is there already! o.O

    How it works
    Communications with nodeos-reverse-proxy are done using POST requests to the urls http://127.0.0.1/_register and http://127.0.0.1/_unregister, that later are filtered by it to only allow requests from the own machine.

    So before continuing to try to reinvent the wheel, I guess I need to take a look at how this works to know if it's possible to not restrict it to localhost or if it would be possible to warp it in some kind of a thin layer to expose it to the outside world.
    I'm not sure yet it is how it works, but I'm imagine I making a webintent call to _register MyCoolApp and that would launch MyCoolApp server side (if needed) and respond where I can reach it.

    In resume what I would like to see happening, is I'm calling, from a client browser:

    • NodeOS, I'm user1/pass123... (get back a welcome)
    • NodeOS, give me a list of all Apps I can access... (get back a json or something)
    • NodeOS, give me MyCoolApp1... (get back an URL to it)
    • NodeOS, give me MyCoolApp2... (get back an URL to it)

    Just that! :P

  5. piranna commented on Oct 17, 2016

    @piranna
    Member

    That's already with nodeos-reverse-proxy and Davius: auth is done using HTTP Auth and your NodeOS user account credentials, list the apps is just a matter of doing a request to /lib/node_modules, access to the apps files is done the same way, and you can start your apps backend by doing requests to /[MyCoolApp1] :-) I don't remember if I have this documented somewhere, but you are more than welcome to provide a pull-request with it :-D

  6. EthraZa commented on Oct 17, 2016

    @EthraZa
    Author

    I'm feeling like that kids that invented something super cool, and their parent just tell they are not gonna get millionaire because the thing already exists. :-P

  7. piranna commented on Oct 17, 2016

    @piranna
    Member

    Well, you can always help to improve it :-)

  8. EthraZa commented on Oct 17, 2016

    @EthraZa
    Author

    Well, navigating to

    http://localhost:50080/lib/node_modules/
    

    really listed it, but

    http://localhost:50080/lib/node_modules/[ifconfig]
    

    give errors since the folder "[ifconfig]" does no exist.
    I took a look at Davius code and saw nothing that suggests it would work. Dindn't find it on webdav definition too. What am I missing?

  9. piranna commented on Oct 18, 2016

    @piranna
    Member

    I told you '/[ifconfig]', from the root. The code that does so it's on
    nodeos-reverse-proxy. Anyway, ifconfig is not a gui app...

    El 18/10/2016 12:42 AM, "Allan Brazute" notifications@github.com escribió:

    Well, navigating to

    http://localhost:50080/lib/node_modules/

    really listed it, but

    http://localhost:50080/lib/node_modules/[ifconfig]

    give errors since the folder "[ifconfig]" does no exist.
    I took a look at Davius code and saw nothing that suggests it would work.
    Dindn't find it on webdav definition too. What am I missing?

    —
    You are receiving this because you commented.
    Reply to this email directly, view it on GitHub
    #309 (comment), or mute
    the thread
    https://github.com/notifications/unsubscribe-auth/AAgfvkF8FtMaDc5jSi-iXG4ACb7qIsjeks5q0_nkgaJpZM4KXVTO
    .

  10. EthraZa commented on Oct 18, 2016

    @EthraZa
    Author

    Oh, ok, thx. Gonna try to hold up noob questions. :)

  11. piranna commented on Oct 18, 2016

    @piranna
    Member

    Don't worry, but it would be good if you start a FAQ with them, sometimes the ones that are mostly involved in a project and know how it works can't be able to think what questions would have a newcommer :-)

  12. piranna commented on Oct 18, 2016

    @piranna
    Member

    Why don't you open a pull-requests on nodeos-reverse-project with them? :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions