circle-chevron-rightIntroduction

Kompozit is a tool inspired by Kustomizearrow-up-right. While Kustomize simplifies Kubernetes configurations, Kompozit does the same for docker-compose. It enables you to customize and patch docker-compose.yaml files efficiently, reducing redundancy and improving maintainability.

Why Kompozit? πŸ€”

Managing multiple docker-compose configurations can be cumbersome. For instance:

β€’ You have a docker-compose-traefik.yaml for a Traefik reverse proxy.

β€’ You need different setups for:

  1. A simple home server (docker-compose-traefik-simple.yaml).

  2. A public website with additional security (docker-compose-traefik-secured.yaml).

These configurations share most content, but a few details differ. This leads to duplication and makes updates tedious. πŸ˜΅β€πŸ’«

Enter Kompozit! πŸŽ‰

Kompozit lets you:

1. πŸ“‚ Store your base configurations in a reusable β€œbase” folder.

2. ✏️ Define overlays for different setups (e.g., β€œhome server” or β€œpublic website”).

3. πŸ”„ Apply patches to the base configuration without modifying it directly.

Example Use Case πŸ’‘

Base Configuration πŸ—οΈ

Start with a base folder containing your generic docker-compose setup.

β€’ docker-compose-traefik.yml: The base Traefik configuration. πŸ›³οΈ

β€’ kompozition.yml: Declares resources for Kompozit to process. πŸ“œ

kompozition.yml:

docker-compose-traefik.yml:

This setup is the reusable core of your configuration. πŸ”§

Overlay Customization πŸ–οΈ

Now, create overlays for specific use cases. πŸ—‚οΈ

Each overlay:

1. References the base configuration. πŸ—ΊοΈ

2. Applies patches specific to the use case. πŸ› οΈ

overlay/homeserver/kompozition.yaml:

overlay/homeserver/docker-compose-traefik-patch.yml:

Run Kompozit πŸƒβ€β™‚οΈ

Use Kompozit to generate the final patched configuration. 🧩

Deploy the Final Configuration 🚒

Redirect the output to a file and deploy it using Docker Compose. 🎯

Last updated