confsmanager is a light and portable solution to deploy plain and templated files.
It targets Docker and Podman.
Features:
- Docker build copy plain files and template files to an input directory,
- Docker run copy plain files and execute template files to an output directory.
It only updates output files that have changed, making it efficient for development workflows.
Applications can consume configuration files from a Docker volume.
It aims to fill the gap with Kubernetes configmap for Docker and Podman.
-
Clone the repository:
git clone https://gitlab.com/ddeh84/confsmanager.git
-
Copy confsmanager to the Docker project:
rsync -av --cvs-exclude confsmanager/ myproject/confsmanager/
Or update it:
rsync -av --cvs-exclude --exclude='input/*' --delete confsmanager/ myproject/confsmanager/ -
Create a
inputdirectory for your configuration files:mkdir -p input
-
Place your plain configuration files and template scripts (
.shfiles) in theinputdirectory.confsmanager/ └── input/ # Your configuration files ├── app.conf # Plain file → copied as-is ├── database.yml # Plain file → copied as-is └── nginx.conf.sh # Template → executed, output saved as nginx.conf -
With a Docker Registry, build & push the Docker image:
docker build -t myregistry:5000/myproject-confsmanager:latest myproject/confsmanager docker image push myregistry:5000/myproject-confsmanager:latest
confsmanager processes files from an input directory and outputs them to a mounted volume. It handles two types of files:
Plain Files: Any file that is not a .sh script is copied directly to the output directory.
Just write plain files as it is.
Template Files: Files with .sh extension are executed as shell scripts, and their stdout output is saved to the output directory (without the .sh extension).
For example, create a template file input/app.conf.sh:
#!/bin/sh
# Template that generates app.conf
cat <<EOF
server_name = ${HOSTNAME:-localhost}
port = ${PORT:-8080}
debug = ${DEBUG:-false}
EOFAfter starting confsmanager, the output volume will contain app.conf with the rendered content.
Check out heredoc.
The processed configuration files are available in the Docker volume confsmanager_output at /var/lib/confsmanager/output.
To use these files in another container, mount the same volume:
services:
myapp:
image: myapp:latest
volumes:
- confsmanager_output:/etc/myapp/config:ro-
Without a Docker Registry, copy the whole Docker project directory to the server.
With a Docker Registry, update
docker-compose-registry.ymlwith the Docker Registry and the Docker Image:--- services: confsmanager: images: "myregistry:5000/myproject-confsmanager"
-
Without a Docker Registry, build and run Docker project using Docker Compose:
docker compose \ -f myproject/confsmanager/docker-compose-build.yml \ -f myproject/docker-compose.yml \ -p myproject up -d
With a Docker Registry, run Docker project using Docker Compose:
docker compose \ -f myproject/confsmanager/docker-compose.yml \ -f myproject/docker-compose.yml \ -p myproject up -d
-
Update files in
inputdirectory.confsmanager/ └── input/ # Your configuration files ├── app.conf # Plain file → copied as-is ├── database.yml # Plain file → copied as-is └── nginx.conf.sh # Template → executed, output saved as nginx.conf -
Rebuild the
confsmanagerimage and push to the Docker Registry.docker build -t myregistry:5000/myproject-confsmanager:latest . docker image push myregistry:5000/myproject-confsmanager:latest -
Without a Docker Registry, remove old Docker image on the server:
docker rmi localhost/myproject_confsmanager:latest
-
Without a Docker Registry, rebuild the
confsmanagerimage and run it:docker compose \ -f myproject/confsmanager/docker-compose-build.yml \ -f myproject/docker-compose.yml \ -p myproject up -d
With a Docker Registry, pull the new Docker image and run it with Docker compose on the server:
docker compose \
-f confsmanager/docker-compose.yml \
-f myproject/docker-compose.yml \
-p myproject up -dFor support, please open an issue on the GitLab issue tracker.
- Support for additional templating engines (envsubst, Jinja2)
- Validation hooks for generated configurations
- Multi-stage template processing
- Reload triggers for updated configurations
- Handle secrets
Contributions are welcome! Please follow these steps:
- Fork the repository on GitLab
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Merge Request
Please ensure your changes are well-tested and follow the existing code style.
This project was created by ddeh84.
Special thanks to all contributors who have helped improve this project.
This project is actively maintained in early stage. New features and bug fixes are released regularly.