easyStack is a project I've started with the main objective to dive deeper into Go and Docker. The goal of this project is to provide a GUI (through the WebApp) which allows you to graphically create a docker-compose file and to start it.
I wanna give this project an "OpenStack" aspect.
For this, I'm working with the Docker Golang SDK.
- Back-End (Golang) :
- Accept POST requests in the aim to registrer a docker-compose file with a specific id.
- Accept GET requests to start a docker-compose configuration, that a call a "stack".
- Accepte DELETE requests to stop a stack.
- Store, save and access stack's configurations in a database (FireGo).
-
Back-End (Golang) :
- A more concise way to retrieve running stacks & containers, with the right name.
- A better correspondence between containers' IDs and their names.
-
Front-End (React) :
- Not planned yet.
If you clone
, cd stackmein/GoCompose
, and run go run main.go
, somewhat of a REST API will run on port 1997.
Will start the stack which has been registered with the given ID.
Will stop the stack which has been registered with the given ID.
Receives your docker-compose config as JSON in the body, and saves it in the FireGO database with a specific id. It's now a stack.
Example of a payload that is handled :
{
"version": "2.1",
"services": {
"debian": {
"command":"tail -f /dev/null",
"image": "debian",
"ports": ["4000:4000"],
"networks": ["main_network"]
},
"ubuntu": {
"command":"tail -f /dev/null",
"image": "ubuntu",
"ports": ["3000:3000"],
"networks": ["main_network"]
}
},
"networks": {
"main_network":""
}
}
Stacks' configurations go in the /stacks
resource.
As FireGo runs by default on port 5000, you can make a GET request to localhost:5000/stacks
to see the registered stacks.
You'll find objects like this :
{
"id":{
"containers":[],
"dockercompose": {
"networks": {"main_network":""},
"services":{
"debian":{
"command":"tail -f /dev/null","image":"debian",
"networks":["main_network"],"ports":["4000:4000"]
},
"ubuntu":{
"command":"tail -f /dev/null","image":"ubuntu",
"networks":["main_network"],"ports":["3000:3000"]
}
},
"version":"2.1"
}
}
}
git clone
the projectcd
inside of it- run
docker-compose build
&&docker-compose up