Add containerized service for syncing Windmill workspaces to Git repositories. Features: - Flask webhook server for triggering syncs from Windmill - wmill CLI integration for pulling workspace content - Automated Git commits and push to remote repository - Network-isolated (only accessible within Docker network) - Designed to integrate with existing Windmill docker-compose files Key components: - Docker container with Python 3.11, wmill CLI, Git, and Flask - Sync engine with error handling and logging - External volume support for persistent workspace data - Comprehensive documentation (README.md and CLAUDE.md)
3.0 KiB
Windmill Git Sync
A containerized service for syncing Windmill workspaces to Git repositories via webhook triggers.
Overview
This service provides automated backup of Windmill workspaces to Git. It runs a lightweight Flask web server that responds to webhook requests from Windmill, syncing the workspace content using the wmill CLI and pushing changes to a remote Git repository.
Features
- Webhook-triggered sync: Windmill can trigger backups via HTTP POST requests
- Dockerized: Runs as a container in the same network as Windmill
- Git integration: Automatic commits and pushes to remote repository
- Authentication: Supports Personal Access Token (PAT) authentication for Git
- Health checks: Built-in health endpoint for monitoring
Quick Start
This service is designed to be added to your existing Windmill docker-compose file.
-
Copy the example environment file:
cp .env.example .env -
Edit
.envwith your configuration:- Set
WINDMILL_TOKENto your Windmill API token - Set
GIT_REMOTE_URLto your Git repository URL - Set
GIT_TOKENto your Git Personal Access Token - Set
WORKSPACE_VOLUMEto an external Docker volume name
- Set
-
Create the external volume:
docker volume create windmill-workspace-data -
Add the
windmill-git-syncservice block fromdocker-compose.ymlto your existing Windmill docker-compose file. -
Build and start the service:
docker-compose up -d windmill-git-sync -
Trigger a sync from Windmill (see Integration section below) or test from another container:
docker-compose exec windmill_server curl -X POST http://windmill-git-sync:8080/sync
Configuration
All configuration is done via environment variables in .env:
| Variable | Required | Description |
|---|---|---|
WINDMILL_BASE_URL |
Yes | URL of Windmill instance (e.g., http://windmill:8000) |
WINDMILL_TOKEN |
Yes | Windmill API token for authentication |
WINDMILL_WORKSPACE |
No | Workspace name (default: default) |
WORKSPACE_VOLUME |
Yes | External Docker volume name for workspace data |
GIT_REMOTE_URL |
Yes | HTTPS Git repository URL |
GIT_TOKEN |
Yes | Git Personal Access Token |
GIT_BRANCH |
No | Branch to push to (default: main) |
GIT_USER_NAME |
No | Git commit author name |
GIT_USER_EMAIL |
No | Git commit author email |
API Endpoints
This service is only accessible within the Docker network (not exposed to the host).
GET /health- Health check endpointPOST /sync- Trigger a workspace sync to Git
Integration with Windmill
Create a scheduled flow or script in Windmill to trigger backups:
export async function main() {
const response = await fetch('http://windmill-git-sync:8080/sync', {
method: 'POST'
});
return await response.json();
}
Development
See CLAUDE.md for development instructions and architecture details.
License
MIT