-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 7 Add prefix and suffix * Fix lints * Fix lints * fix lints * Adjust examples and add logo * Add workflow_dispatch * Fix lints
- Loading branch information
1 parent
a1a3b8c
commit 82d9692
Showing
13 changed files
with
180 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
# Kompozit | ||
|
||
> :construction_worker: This tool is currently in beta and still under development! | ||
![Docker Pulls](https://img.shields.io/docker/pulls/veerendra2/kompozit) ![PyPI - Status](https://img.shields.io/pypi/status/kompozit) ![PyPI - Version](https://img.shields.io/pypi/v/kompozit) [![Release](https://github.com/veerendra2/kompozit/actions/workflows/release.yml/badge.svg)](https://github.com/veerendra2/kompozit/actions/workflows/release.yml) | ||
|
||
> 🚧 This tool is currently under development! | ||
Declarative Configuration Management Tool for Docker Compose. | ||
|
||
_Like [`kustomize`](https://kustomize.io/), but for [Docker Compose](https://docs.docker.com/compose/)._ | ||
_Like [`kustomize.io`](https://kustomize.io/), but for [Docker Compose](https://docs.docker.com/compose/)._ | ||
|
||
<p align="center"> | ||
<img alt="kompozit logo", width="150" src="https://i.postimg.cc/cH1dYN6f/komposeit.png"> | ||
</p> | ||
|
||
## Features | ||
|
||
Kompozit provides flexible, declarative overlays to manage complex Docker Compose configurations with support for: | ||
Kompozit simplifies complex Docker Compose setups using declarative overlays, supporting: | ||
|
||
- **[`patchesJSON6902`](https://datatracker.ietf.org/doc/html/rfc6902)**: JSON Merge Patch for precise modifications. | ||
- **[`patchesStrategicMerge`](https://stackoverflow.com/q/71165168/2200798)**: Strategic Merge Patch for hierarchical changes. | ||
- **[`patchesJSON6902`](https://datatracker.ietf.org/doc/html/rfc6902)**: Precise modifications with JSON Merge Patch. | ||
- **[`patchesStrategicMerge`](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-api-machinery/strategic-merge-patch.md)**: Flexible hierarchical changes with Strategic Merge Patch. | ||
|
||
## But Why...? :thinking: | ||
## Resources | ||
|
||
- 📖 [Documentation](https://veerendra2.gitbook.io/kompozit) | ||
- 🛠️ [Examples](https://github.com/veerendra2/kompozit/tree/main/examples) | ||
|
||
## But Why...? 🤔 | ||
|
||
There are scenarios where you might need different Docker Compose configurations for the same application on different machines. | ||
|
||
|
@@ -21,18 +34,14 @@ Additionally, kompozit allows you to combine multiple `docker-compose.yml` files | |
|
||
- For instance, you can keep a generic `docker-compose.yml` for PostgreSQL in a central location and customize it for different stacks in other locations as needed. | ||
|
||
## Installation :computer: | ||
## Installation 💻 | ||
|
||
```bash | ||
python -m pip install kompozit | ||
``` | ||
### PyPi | ||
|
||
## Usage :gear: | ||
> [https://pypi.org/project/kompozit/](https://pypi.org/project/kompozit/) | ||
```bash | ||
git clone [email protected]:veerendra2/kompozit.git | ||
cd kompozit | ||
python -m pip install . | ||
python -m pip install kompozit | ||
|
||
kompozit --help | ||
usage: kompozit [-h] [-b BUILD_PATH] [-o OUTPUT_DIR] [-v] | ||
|
@@ -46,15 +55,32 @@ options: | |
-o, --output-dir OUTPUT_DIR | ||
Directory to save the generated Docker Compose files. (default: None) | ||
-v, --version Show kompozit version | ||
``` | ||
|
||
### Docker | ||
|
||
> [https://hub.docker.com/r/veerendra2/kompozit](https://hub.docker.com/r/veerendra2/kompozit) | ||
```bash | ||
docker pull veerendra2/kompozit | ||
``` | ||
|
||
## Usage ⚙️ | ||
|
||
```bash | ||
git clone [email protected]:veerendra2/kompozit.git | ||
cd kompozit | ||
python -m pip install . | ||
|
||
kompozit --build ./examples/overlay | ||
... | ||
|
||
# inside docker | ||
docker pull kompozit:latest | ||
docker run -it --rm -v ./examples:/examples kompozit:latest -b /examples/overlay | ||
``` | ||
|
||
## Local Development :wrench: | ||
## Local Development 🔧 | ||
|
||
```bash | ||
git clone [email protected]:veerendra2/kompozit.git | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,47 @@ | ||
# Example | ||
|
||
[Docs](https://veerendra2.gitbook.io/kompozit) | ||
|
||
```bash | ||
$ python3 -m pip install kompozit | ||
$ kompozit -b examples/overlay/ | ||
python3 -m pip install kompozit | ||
|
||
kompozit -b examples/overlay/homeserver/ | ||
--- | ||
networks: | ||
db: | ||
public: | ||
attachable: true | ||
services: | ||
postgres: | ||
container_name: postgres | ||
hostname: postgres | ||
image: postgres:14-alpine | ||
labels: | ||
- com.centurylinklabs.watchtower.enable=false | ||
- traefik.enable=false | ||
networks: | ||
- db | ||
restart: always | ||
volumes: | ||
- acme:/var/lib/postgresql/data:rw | ||
volumes: | ||
acme: null | ||
--- | ||
networks: | ||
internal: false | ||
private: | ||
attachable: true | ||
internal: true | ||
public: | ||
attachable: true | ||
internal: false | ||
volumes: | ||
acme: null | ||
services: | ||
traefik: | ||
command: | ||
- NO_COMMAND_TEST | ||
dev-traefik-test: | ||
image: traefik:v2 | ||
hostname: traefik | ||
container_name: traefik | ||
restart: unless-stopped | ||
environment: | ||
CLOUDFLARE_DNS_API_TOKEN: ${CLOUDFLARE_DNS_API_TOKEN} | ||
DUCKDNS_TOKEN: ${DUCKDNS_TOKEN} | ||
hostname: traefik | ||
image: traefik:v2 | ||
labels: | ||
- com.centurylinklabs.watchtower.enable=true | ||
- traefik.enable=true | ||
- traefik.docker.network=traefik_public | ||
- traefik.http.routers.api.tls=true | ||
- traefik.http.routers.api.entryPoints=websecure | ||
- traefik.http.routers.api.service=api@internal | ||
- traefik.http.routers.api.tls.certresolver=letsencrypt | ||
- traefik.http.routers.api.rule=Host(`${MY_DOMAIN}`) | ||
networks: | ||
- public | ||
- private | ||
CLOUDFLARE_DNS_API_TOKEN: ${CLOUDFLARE_DNS_API_TOKEN} | ||
ports: | ||
- 80:80/tcp | ||
- 443:443/tcp | ||
restart: unless-stopped | ||
networks: | ||
- public | ||
- private | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
- acme:/letsencrypt | ||
volumes: | ||
acme: null | ||
command: | ||
- --log.level=INFO | ||
- --api.insecure=false | ||
- --api.dashboard=false | ||
- --providers.docker=true | ||
- --providers.docker.exposedByDefault=false | ||
- --global.sendAnonymousUsage=false | ||
- --global.checkNewVersion=false | ||
labels: | ||
- com.centurylinklabs.watchtower.enable=true | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,50 +16,6 @@ services: | |
hostname: traefik | ||
container_name: traefik | ||
restart: unless-stopped | ||
command: | ||
- "--log.level=INFO" | ||
- "--api.insecure=false" | ||
- "--api.dashboard=false" | ||
- "--providers.docker=true" | ||
- "--providers.docker.exposedByDefault=false" | ||
- "--global.sendAnonymousUsage=false" | ||
- "--global.checkNewVersion=false" | ||
# ---------------------------------- ACME -------------------------------------------- | ||
- "--certificatesresolvers.letsencrypt.acme.dnschallenge=true" | ||
- "--certificatesresolvers.letsencrypt.acme.dnschallenge.delaybeforecheck=5" | ||
- "--certificatesresolvers.letsencrypt.acme.dnschallenge.provider=${MY_PROVIDER}" | ||
- "[email protected]" | ||
- "--certificatesresolvers.letsencrypt.acme.dnschallenge.disablePropagationCheck=true" | ||
- "--certificatesresolvers.letsencrypt.acme.dnschallenge.resolvers=1.1.1.1:53,8.8.8.8:53" | ||
- "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json" | ||
# -------------------------------- ENTRYPOINT ----------------------------------------- | ||
- "--entrypoints.web.address=:80" | ||
- "--entrypoints.web.http.redirections.entrypoint.to=websecure" | ||
- "--entrypoints.web.http.redirections.entrypoint.scheme=https" | ||
- "--entrypoints.websecure.address=:443" | ||
# -------------------------------- PROXY ----------------------------------------- | ||
- "--entryPoints.web.forwardedHeaders.trustedIPs=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7" | ||
- "--entryPoints.web.proxyProtocol.trustedIPs=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7" | ||
- "--entryPoints.websecure.forwardedHeaders.trustedIPs=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7" | ||
- "--entryPoints.websecure.proxyProtocol.trustedIPs=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7" | ||
- "--entryPoints.web.forwardedHeaders.insecure=false" | ||
- "--entryPoints.web.proxyProtocol.insecure=false" | ||
- "--entryPoints.websecure.forwardedHeaders.insecure=false" | ||
- "--entryPoints.websecure.proxyProtocol.insecure=false" | ||
# -------------------------------- PLUGINS ----------------------------------------- | ||
- --experimental.plugins.fail2ban.modulename=github.com/juitde/traefik-plugin-fail2ban | ||
- --experimental.plugins.fail2ban.version=v0.2.0 | ||
- --experimental.plugins.fail2ban.modulename=github.com/Paxxs/traefik-get-real-ip | ||
- --experimental.plugins.fail2ban.version=v1.0.2 | ||
labels: | ||
- com.centurylinklabs.watchtower.enable=true | ||
- traefik.enable=true | ||
- traefik.docker.network=traefik_public | ||
- traefik.http.routers.api.tls=true | ||
- traefik.http.routers.api.entryPoints=websecure | ||
- traefik.http.routers.api.service=api@internal | ||
- traefik.http.routers.api.tls.certresolver=letsencrypt | ||
- traefik.http.routers.api.rule=Host(`${MY_DOMAIN}`) | ||
environment: | ||
DUCKDNS_TOKEN: "${DUCKDNS_TOKEN}" | ||
CLOUDFLARE_DNS_API_TOKEN: "${CLOUDFLARE_DNS_API_TOKEN}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,3 @@ | |
resources: | ||
- docker-compose-pg.yml | ||
- docker-compose-traefik.yml | ||
namePrefix: ggg- | ||
nameSufix: -veer |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
examples/overlay/homeserver/docker-compose-traefik-patch.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
services: | ||
traefik: | ||
command: | ||
- "--log.level=INFO" | ||
- "--api.insecure=false" | ||
- "--api.dashboard=false" | ||
- "--providers.docker=true" | ||
- "--providers.docker.exposedByDefault=false" | ||
- "--global.sendAnonymousUsage=false" | ||
- "--global.checkNewVersion=false" | ||
labels: | ||
- com.centurylinklabs.watchtower.enable=true |
4 changes: 2 additions & 2 deletions
4
examples/overlay/kompozition.yaml → examples/overlay/homeserver/kompozition.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
examples/overlay/public_wordpress/docker-compose-traefik-patch.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
services: | ||
traefik: | ||
command: | ||
- "--log.level=INFO" | ||
- "--api.insecure=false" | ||
- "--api.dashboard=false" | ||
- "--providers.docker=true" | ||
- "--providers.docker.exposedByDefault=false" | ||
- "--global.sendAnonymousUsage=false" | ||
- "--global.checkNewVersion=false" | ||
# ---------------------------------- ACME -------------------------------------------- | ||
- "--certificatesresolvers.letsencrypt.acme.dnschallenge=true" | ||
- "--certificatesresolvers.letsencrypt.acme.dnschallenge.delaybeforecheck=5" | ||
- "--certificatesresolvers.letsencrypt.acme.dnschallenge.provider=${MY_PROVIDER}" | ||
- "[email protected]" | ||
- "--certificatesresolvers.letsencrypt.acme.dnschallenge.disablePropagationCheck=true" | ||
- "--certificatesresolvers.letsencrypt.acme.dnschallenge.resolvers=1.1.1.1:53,8.8.8.8:53" | ||
- "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json" | ||
# -------------------------------- ENTRYPOINT ----------------------------------------- | ||
- "--entrypoints.web.address=:80" | ||
- "--entrypoints.web.http.redirections.entrypoint.to=websecure" | ||
- "--entrypoints.web.http.redirections.entrypoint.scheme=https" | ||
- "--entrypoints.websecure.address=:443" | ||
# -------------------------------- PROXY ----------------------------------------- | ||
- "--entryPoints.web.forwardedHeaders.trustedIPs=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7" | ||
- "--entryPoints.web.proxyProtocol.trustedIPs=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7" | ||
- "--entryPoints.websecure.forwardedHeaders.trustedIPs=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7" | ||
- "--entryPoints.websecure.proxyProtocol.trustedIPs=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7" | ||
- "--entryPoints.web.forwardedHeaders.insecure=false" | ||
- "--entryPoints.web.proxyProtocol.insecure=false" | ||
- "--entryPoints.websecure.forwardedHeaders.insecure=false" | ||
- "--entryPoints.websecure.proxyProtocol.insecure=false" | ||
# -------------------------------- PLUGINS ----------------------------------------- | ||
- --experimental.plugins.fail2ban.modulename=github.com/juitde/traefik-plugin-fail2ban | ||
- --experimental.plugins.fail2ban.version=v0.2.0 | ||
- --experimental.plugins.fail2ban.modulename=github.com/Paxxs/traefik-get-real-ip | ||
- --experimental.plugins.fail2ban.version=v1.0.2 | ||
labels: | ||
- com.centurylinklabs.watchtower.enable=true | ||
- traefik.enable=true | ||
- traefik.docker.network=traefik_public | ||
- traefik.http.routers.api.tls=true | ||
- traefik.http.routers.api.entryPoints=websecure | ||
- traefik.http.routers.api.service=api@internal | ||
- traefik.http.routers.api.tls.certresolver=letsencrypt | ||
- traefik.http.routers.api.rule=Host(`${MY_DOMAIN}`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
resources: | ||
- ../../base | ||
|
||
namePrefix: dev- | ||
nameSuffix: -test | ||
|
||
patchesStrategicMerge: | ||
- path: docker-compose-traefik-patch.yml | ||
|
||
patchesJSON6902: | ||
- patch: | ||
- op: replace | ||
path: /services/traefik/image | ||
value: "traefik:v2" |
Oops, something went wrong.