TripleParity / docks-api

RESTful API Server for Docks
https://tripleparity.github.io/docks-api/stack-api-spec.html
GNU General Public License v3.0
0 stars 0 forks source link

Generate docker-compose file using Docker API #61

Closed egeldenhuys closed 6 years ago

egeldenhuys commented 6 years ago

Given a stack name it should be possible to generate a working docker-compose.yml file.

This may require first discovering all services that are part of the given stack, and reverse each one of them individually. I think Swarmpit already does this, so we can have a look at how they are doing it.

If we can reverse a service into a model we can also use this in the UI for populating forms.

We do not need to convert from stack file to the model, since we will give the stack file directly to the Docker API.

I made this a separate issue as it is probably the most complex part of the system so far

egeldenhuys commented 6 years ago

Most relevant files from Swarmpit that I could find. @devosray are you familiar with Clojure?

Basically they map Docker inspect output to an intermediate model

egeldenhuys commented 6 years ago

Some useful tools:

Note that I have not done any further work on this issue

egeldenhuys commented 6 years ago

I found a python version that works for containers: https://github.com/Red5d/docker-autocompose

EDIT: only works for v1 compose files

devosray commented 6 years ago

Could you maybe explain the relevance of fury-cli? Could you maybe explain how it helps with this task?

egeldenhuys commented 6 years ago

Fury converts the swagger.yml to a blueprint.apib which contains JSON Schemas. The Schema can then be converted into a TypeScript interface (and probably a relevant structure for JavaScript). I guess this is more relevant to TypeScript since in JavaScript we welcome run time errors

egeldenhuys commented 6 years ago

npm package that might be of interest:

I think it will be better to fork this project (if we need to modify it) than to create our own package

egeldenhuys commented 6 years ago

The npm package repo: https://github.com/TripleParity/docker-api-to-compose

egeldenhuys commented 6 years ago

Implemented by https://github.com/TripleParity/docker-api-to-compose.

Open related issues on that repo