tehbilly / node-red-contrib-docker

I thought Node-RED should be able to use Docker events as an input.
6 stars 4 forks source link

Manipulation commands #1

Open vicary opened 7 years ago

vicary commented 7 years ago

I could really use docker.run() and container.start() in dockerode, what is your thoughts on grouping their functions into nodes?

I'll see what I can do in a fork when the plan is clear.

tehbilly commented 7 years ago

That would be a fantastic addition! Honestly, I haven't done much with this recently, but would love to flesh it out and make it more useful. I'll try to take time this afternoon to look it over. If you'd like, in the meantime, feel free to suggest how you think those interfaces should look and/or see about working on it if you've got the itch!

vicary commented 7 years ago

I could start something in the coming weekend.

Basically I was thinking a node for each entity, list methods like mongodb2.

screen shot 2017-03-28 at 01 18 05

sidenotes

  1. Need a config node for auth secrets in docker.pull() and endpoint in new Docker().
  2. msg.topic || this.name be the name of container, service, volume, network ... etc.
  3. Output from promise/callbacks like http request, or catch from the current event node?
tehbilly commented 7 years ago

I didn't mean to lose track of this, oi. East coast, weather has been awful (and distracting).

That said, I think your idea is a good one. I'll update dockerode and do an initial POC this weekend (no kids! no chores!) when time comes around, and set up node-red to give it a whirl. By the way, I'm giving you contributor so that you can work on this directly if you'd like.

vicary commented 7 years ago

Thanks! I'll do most of the planning here for clarity.

tehbilly commented 7 years ago

Pushed up some changes I made today, along with a bit of cleaning up (still some to do, but time is rather limited). I'll keep poking at this as I have time! Contributions and criticism welcome.

vicary commented 7 years ago

Docker Cloud CLI uses $DOCKER_HOST env var, shall we follow it by renaming docker-engine to docker-host?

i.e. Where shall we put docker.listContainers()?

  1. Put into container node, that conflicts with the current idea that it requires container id from msg.container.
  2. Put into a new docker node, which follows exactly the way dockerode does.

If we choose 1, it doesn't really matters; Otherwise the new node will become the best candidate for the name docker-engine.

tehbilly commented 7 years ago

I'd debated over that, but didn't want to conflate an instance of the daemon with the machine hosting the daemon. I've had multiple running, for instance, at the same addressable endpoint. Was leaning towards the terminology the docker project seems to be using.

I'm pretty ambivalent about the wording, though! I've been trying to think of a way to structure things logically within red, and it's kind of eluding me. Need to throw it all up on a whiteboard or something.

Have you gotten a chance to try out the changes so far? I've been able to start/stop containers with the changes I've pushed up to the dev branch without issue, would like someone else to have a stab at it.

vicary commented 7 years ago

Yep the changes are working nicely.

I have been tinkering on the config node, adding tls-config for remote machines, kinda stuck for a few days. Taking a breathe tbh.