yb-docker-composer
is Python-based CLI for generating docker-compose.yaml files dynamically based on the arguments specified at the CLI.
Git repo: https://github.com/hiimivantang/yb-docker-composer
Motivation
I always find the notion of running docker containers from declarative config files a more elegant solution as opposed to just running them via docker run
commands. With docker-compose, I can easily set up and tear down different combination of services for testing or demo purposes.
But wait. Thereโs already yb-docker-ctl
and that allows anyone to easily run YugabyteDB as containers while allowing customization such as the ability to specify replication factor or yb-master / yb-tserver flags. However, I realised that in order to set environment
attribute or to add linux capabilities via cap-add
, I probably have to hardcode them somewhere within yb-docker-ctl code.
Instead of copying, pasting and editing existing docker-compose.yaml
files and ending up with a truckload of them, you can use yb-docker-composer
to dynamically generate docker-compose.yaml
on the fly based on arguments you supply when running yb-docker-composer
CLI.
How does it work?
Simply run python yb-docker-composer.py
and it will generate a docker-compose.yaml for running a YugabyteDB cluster with RF=3 (i.e. 3 x YB-Master and 3 x YB-TServer containers)
python yb-docker-composer.py
Specifying --prometheus
option will generate service definitions for both Prometheus and Grafana for monitoring your YugabyteDB cluster. Grafana dashboard included.
python yb-docker-composer.py --prometheus
The python script will take in your CLI arguments and render the respective service definitions based on Jinja templates that can be found in https://github.com/hiimivantang/yb-docker-composer/tree/master/templates.
What's next?
I'm planning to include templates for Kafka brokers and connect workers, sqlpad, and some accompanying apps. Appreciate and welcome any thoughts and comments.
Top comments (0)