-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add middleware layer to support HTTP/OSC/Sockets/... #18
Comments
So a couple of thoughts:
AuthenticationI think we should have some type of Authentication. Basic user/pass seems fine in my opinion. Also, utilizing Json Web tokens. Authentication should also be optional, but highly encouraged. And to note, not sure how to add authentication to OSC. Simply using well-defined or crazy addresses might help. Need to look into this more. packages: Authentication CLIWith that, I think we need a layer of User CRUD and Authentication.
Main Functions of the server:Status
startApps stopApps downloadContent fullCycle Suggested config at the moment...
Current file structure from proof of concept:index.js so the idea is that the server Core interacts directly with Launched. Each Api, interacts with the core server rather than LP itself. That way each API does the same thing and for example, "downloadContent" doesnt act differently in each API. other thoughts and questions?? |
This is great, thanks for putting so much thought toward this. A few initial reactions below:
Makes sense to me. The package name should be
Are you referring to the launchpad monorepo or the Github project for tasks/issues? Either way, my answer would be yes for both unless you have concerns.
All of this makes sense to me. Eventually it might be nice to actually do that using a web-UI (similar to how VS code and other apps will open a browser link and then return back to the app using its own protocol like Do you have any ideas for that? How do node apps typically do that on Windows for credentials? FWIW I've also been thinking of switching to a proper HTTP cache library to wrap into our
This is great and lines up with #10. Could you post a draft JSON for what that might look like? Could you keep the naming consistent with all the existing commands, though?
Could the # of logs be configurable in the launchpad config? I think 10-20 might be a better default here. For the following commands, I think all of those should still go through the We should also plan for a
A full cycle is what download content should probably do by default (and did in the legacy version), since we wouldn't want to change any files while the apps are running (could lead to locked files or apps crashing). It might still be good to have a nuclear
A few thoughts on the config:
Here's a revised config: "server": {
"enabled": true,
"auth": {
"enabled": true
},
"protocols": {
"http:": {
"enabled": true,
"port": 8080
},
"websockets": {
"enabled": true,
"port": 3000
}
}
}
Could you stick to the existing
This makes sense to me. It's important that these all just feed directly to the One thing to consider: How can the server tie into Launchpad's startup/shutdown sequences? The core
Sorry for the many scattered thoughts and thanks again for digging into this! |
Ben thanks! this is exactly the feedback I needed. Most things are a yes/agree, but heres a few responses:
I'm referring to the monorepo. At first, in my head the server was a wrapper to Launchpad, and was more optional. As far as adding it to the code base now, I agree. Now, I'm a little more unsure how it is integrated. Should it be run, based on config, when you just run
I'm not entirely sure other than mongodb. That seems a little heavy handed for what we might need. I'm thinking we have a handful of users and a few other things. For the proof of concept, I am just encrypting the password, then saving it to a json file. We may be able to entirely encrypt the file. I was going to ask in another ticket, how we should save the "last download time". So the idea of having some type of local store makes sense.
Yea - of course, I've been making them inconsistent because I've had questions... Also, one of the things I'm curious about for content, What about Live updates?
Totally agree, but I'd love for you to show me exactly what your doing. Not sure I understand whats going on with the command class.
Not necessarily, websockets can use the http server. I think this makes sense, rather than 2 servers running. OSC though seems to need its own port.
For what its worth, Winston names its logger plugins "transports". But it think Protocols. makes sense.
As always, I struggle with naming... good to get your feedback on it all.
I think this might be good to have an in person discussion. I'd love to hear your thoughts on how you built out core. Diving through the code, was intense. Also, do we have the coding standard written down somewhere? All this is great to start adapting the proof of concept though and a few investigations |
https://www.npmjs.com/package/lowdb - seems to be a simple solution, but it is simply writing a json file. |
That's what I had hoped for. If we can keep it lightweight enough, it feels like it's going to be a central part to launchpad moving forward. We can leave plugins/extensions in the future to add more functionality (#15 ).
Yeah I go back and forth too. I've seen sqlite used a lot for this kind of thing too. I'd say a few parameters to look for in options would be:
Anything else that comes to mind?
Let's cross that bridge later. I think this might have to depend on each use-case, or we need some sort of "don't pull the rug from under our feet" option when updating :) My instinct says that this also requires a decent amount of front-end architecting for whatever app we're running, so I'm not sure if it would have to go through launchpad (i.e. app talks directly to CMS).
For sure, let's chat tomorrow. TLDR is it's a central pub system (without the sub component as of yet), which serializes event execution and allows for pre/post-execution hooks to be added (e.g.
Ah interesting regarding web sockets. Just thinking of portability, maybe let's plan for each protocol allowing for its own port. Maybe some protocols, like WebSockets, can default to the HTTP server port.
Ah I'm going back and forth on Transports vs Protocols. Per Wikipedia:
I was originally sure on Protocols, but now leaning towards Transports. What do you think? |
All sounds good... Agreed with your points on the DB, I think my question is do we want to go with something as robust as an actual database like mongoDB? or something very lightweight. The lowdb package I mentioned, I'm pretty sure is just read/write json file(s). We get no perks of a real Database. The stuff I'm seeing at the moment, that seems fine, but do you think we'll need something more robust in the future? if not I'd lean towards lowdb.
Pretty sure this is up to us, no matter what we use. But I've been using bcryptjs so far.
Ok - now I'm nerd-ing out a bit because I use these words and really have no clue what they mean. If I get it correctly, they are are all protocols... Cause thats really the most generic term. But they are part of the Transport layer. So they are Transport Protocols, right? so "transport" seems more defined. Now this is also making me question the name httpApi. Is that an accurate name? A couple of other links: (https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview#apis_based_on_http) |
bcryptjs sounds great! So we'd just be storing the hash/salt and not the password? Let's go with Transports! As you said, that's what Winston uses too and it feels applicable here since we're adding various inputs/outputs for existing data/signals. |
Oh and for now let's go with one of the json file options for storing session info. Any thoughts on what that file could be named? What are people using out there? |
Yes, in the proof of concept the salt or Token Key is saved in a .env file... So, we might want to look at that. We might be able to add that to the credentials file if we want to reduce dependencies. Transports it is!!
I'm not sure how lowdb handles it... so we may not need to worry about it until we start working on it. We probably name the Database, but I don't know where/how it stores the files. I'm going to try and work on integrating the server UNDER launchpad and see how that goes. |
Ok sounds good. Might be nice to have some way to auto-generate a local salt. I was also wondering if it would make sense to switch up our credentials format to work with whatever we're building here. E.g. putting API keys and sensitive info in the I'll make a new ticket for that one, so don't worry about it for now 😆 |
New branch covering this... |
@benjaminbojko Koa is implemented now on this branch |
Update video on slack: https://bluecadet.slack.com/archives/C03RY7MRA4V/p1662649473942579 |
No description provided.
The text was updated successfully, but these errors were encountered: