Docker Compose Deploy Control (dcDeployControl) is a microservice that parses docker-compose.yml
files and dynamically creates a webinterface for deploying and visualizing containers and networks. The main purpose of the software is to create understandable visualizations over large docker composes aswell as managing execution of subsets of the docker-compose setup. Compared to a similar tool like WeaveScope, dcDeployControl does not require any priviliges and can create the visualizations without starting any containers. It does this by parsing the chosen docker-compose project and detecting containers, networks, port-forwarding and custom labels. The information is sent to frontend, where containers and networks are converted to nodes and edges in a network graph. The backend works as a wrapper for a DinD container wherefrom the frontend can get information about live running containers aswell as start and stopping containers defined in the chosen docker-compose file. The end-product is a neat, incredibly useful tool, compatible with any docker-compose managed project.
Checkout the demo gif below!
- Download or clone the repository.
- Install docker and docker-compose.
- Open
.env
file and changePROJECT_PATH="./example"
to whichever path your docker-compose project has. - Start dcDeployControl by running
docker-compose up -d
.
Note: The PROJECT_PATH
will be volumed, meaning that changing the docker-compose file does not require a restart of dcDeployControl.
A label system has been added that can help control the visualizations and other structure of the application. Below the added docker-compose labels that will be parsed on software execution are described. NOTE: These labels must be in a list .yml format!
labels:
- "global-ignore=<network-name>" # Global ignore specific network in the visualizations.
- "global-use-defaults=<bool>" # Global turn off or on the default group option.
- "group=<group-name>" # For this container set group, this will override network group detection.
- "network=<network-name>" # For this container set network, this will override network group detection.
- "add-preset=<preset-name>" # Create preset, like default, which will be selected on button click.
- "<preset-name>=true" # Specify which presets to use for specific container.
- "protocol=https" # For this container set weblink protocol.
- "path=index.html" # For this contaienr set weblink path.
- '[{"container": "custom","networks": ["frontend"], "labels": ["default=true","controllable=false"], "ports": ["9090:9090"]}]' # Add custom container
The main features include:
- Automatic detection and visualization of Networks : Will parse docker-compose networks and automatically devide containers into appropriate groups.
- Automatic detection of external containers and Networks : The visualization will each 10 second receive information about other contaners running in the docker environment and add them to the visualization.
- Start and stop any subsets of containers : Creates a dynamic gui where containers can be easily started eighter one at a time or as a larger subset.
- Container Scaling up and down : Scale the amount of containers to run. Use deploy - replicas to set default in docker-compose.
- Create clickable links : Will add buttons on container cards to faster reach other applications.
- Label system : Uses a label system, described above to let the user manipulate the visualization.
- Build and Clear function : Build and clear functions has been added that runs the
build
anddown
command to clear up any issues with old running containers. - Import and Export functions: Docker save and load all images in system can be called. Only the volume folder can be used for import and export.
- Websocket logging link: Show live logs from backend to better track system.
- Network Access Table: A control system for giving containers temporary internet access.
- 3d graph: A 3d graph representation of system.
- Showtime: A demo mode, where nodes are random dragged, to show physics effect.
These are some general tips for users of this software:
- Use
.dockerignore
files in your repository in order to speed up build times and keep containers small. - Volumes in the target docker-compose file should be changed to absolute path of working folder for it to work correctly.
- With the new internet access feature, i recommend setting all networks to internal in order to better keep containers from unwanted internet access.
- To set default internet access use the
dcdc_internet_network
network. - Generally take a look inside
./example/docker-compose.yml
for examples.
To ensure that the project maintains a high quality code, several CI/CD github actions has been added to the project. These must pass in order to get pull requests merged into main branch.
The workflows include:
To run tests run:
./__tests__/run_locally.sh
Note: This will create several cache folders with test results in your folders.
The project is built on a multitude of libraries, the main once are listed below:
- Toastify - Creating Toast notifications in frontend.
- Awesome Fonts - Creates icons in text.
- VizJS - Creates interactive network graphs.
- PyDocker - Control docker in python.
- FastApi - Create fast API backends in python.
- Uvicorn - Webserver host in python.
- 3d-force-graph - 3d graphs in javascript.
This repository is created using MIT LICENSE
Let me know if there are any questions or issues.
@ Grebtsew 2024