๐ Blitz-Launch Operation - Use Git as a transactional and distributed state database for decentralized task execution.
D-GRID is a serverless, decentralized task execution system where:
- ๐๏ธ Git as Database - All system state (nodes, tasks, results) is tracked on GitHub as the single source of truth
- ๐ Auto-Generated Dashboard - Public, real-time status dashboard on GitHub Pages
- ๐ค Autonomous Worker Nodes - Python workers in Docker containers that self-register, execute tasks, and report results
- โ Zero Central Dependencies - No central APIs, no external databases, no orchestrators needed
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ GitHub Repository โ
โ (Single Source of Truth - Distributed State) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ nodes/ โ Active node registry โ
โ tasks/queue/ โ Pending tasks โ
โ tasks/in_progress/ โ Running tasks (atomic) โ
โ tasks/completed/ โ Successful tasks โ
โ tasks/failed/ โ Failed tasks โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ (Pull/Push via Git)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ GitHub Pages (Status Dashboard) โ
โ (Read-only, auto-updated by GitHub Actions) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ (Generated by)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ GitHub Actions (Orchestration) โ
โ โข Task submission validation โ
โ โข Dashboard generation & cleanup โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ (Triggered by)
โโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโ
โ Worker 1 โ Worker 2 โ Worker 3 โ Worker N โ
โ (Python) โ (Python) โ (Python) โ (Python) โ
โ (Docker) โ (Docker) โ (Docker) โ (Docker) โ
โโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโ
| Component | Technology | Why |
|---|---|---|
| Worker Node | Python 3.11 | Fast development, mature libraries, great community |
| Containerization | Docker Alpine | Lightweight (~150MB), secure, includes Python |
| Coordination | Git + GitHub | Single source of truth, decentralized, built-in history |
| Dashboard | GitHub Pages + HTML | Free, integrated, no extra infrastructure |
| CI/CD | GitHub Actions | Free, serverless, GitHub-native |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Worker starts (docker run) โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 1. Clone repo (or pull if exists) โ
โ 2. Self-register: nodes/{id}.json โ
โ 3. Commit and push registration โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โ
โโโโโโโโโโโโโโโโ
โ LOOP START โ
โโโโโโโโโโโโโโโโ
โ
โโโโโโโโดโโโโโโโ
โ Pull rebase โ (Always up-to-date)
โโโโโโโโฌโโโโโโโ
โ
โโโโโโโโดโโโโโโโโโโโโโโโโโโโโโ
โ Task available? โ
โโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ โ
[YES]โ โ[NO]
โ โ
โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ git mv atomic โ โ Send heartbeat โ
โ queueโin_prog โ โ Update node โ
โ (transaction!) โ โ .last_heartbeat โ
โโโโโโโโโโฌโโโโโโโโโ โโโโโโโโโโฌโโโโโโโโโโ
โ โ
โ โ
โโโโโโโโโโโโโโโโโโโ โ
โ Commit and push โ โ
โ (First to push โ โ
โ wins!) โ โ
โโโโโโโโโโฌโโโโโโโโโ โ
โ โ
โ โ
โโโโโโโโโโโโโโโโโโโ โ
โ Execute Docker โ โ
โ container โ โ
โโโโโโโโโโฌโโโโโโโโโ โ
โ โ
โ โ
โโโโโโโโโโโโโโโโโโโ โ
โ Report result โ โ
โ completed/ or โ โ
โ failed/ โ โ
โโโโโโโโโโฌโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Sleep (PULL_INTERVAL) โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโ (back to Pull)
Fork โ Create task in tasks/queue/ โ Pull Request โ
Merge (auto-validated) โ GitHub Actions scans state โ
Worker node finds it โ Execution โ Result pushed back
d-grid/
โโโ .github/
โ โโโ workflows/
โ โโโ process-task-pr.yml # Validate task submissions
โ โโโ update-gh-pages.yml # Generate dashboard & cleanup
โโโ nodes/
โ โโโ {node_id}.json # State of each node
โโโ tasks/
โ โโโ queue/ # Pending tasks
โ โโโ in_progress/ # Running tasks (atomic acquisition)
โ โโโ completed/ # Successfully completed tasks
โ โโโ failed/ # Failed tasks
โโโ worker/
โ โโโ main.py # Worker entry point
โ โโโ config.py # Configuration & validation
โ โโโ logger_config.py # Unified logging
โ โโโ git_handler.py # Git operations
โ โโโ state_manager.py # Node registration & heartbeat
โ โโโ task_runner.py # Task execution
โ โโโ web_server.py # Local worker dashboard
โ โโโ requirements.txt # Python dependencies
โโโ docs/
โ โโโ index.html # GitHub Pages dashboard
โโโ .gitignore
โโโ Dockerfile # Worker image build
โโโ docker-compose.yml # Local development setup
โโโ README.md # This file
โโโ progress.md # Development progress tracking
Submit tasks as JSON files in tasks/queue/:
{
"task_id": "task-001",
"script": "echo 'Hello, D-GRID!' && python3 --version",
"timeout_seconds": 30
}Task results are stored in tasks/completed/{node_id}-{task_id}.json:
{
"task_id": "task-001",
"node_id": "worker-001",
"exit_code": 0,
"stdout": "Hello, D-GRID!\nPython 3.11.0",
"stderr": "",
"timestamp": "2025-10-16T10:01:23Z",
"status": "success"
}- Atomic Operations: Uses
git mvfor transactional task acquisition (no race conditions) - Self-Healing: Auto-detects orphaned tasks and moves them back to queue
- Isolated Execution: Docker containers with strict security (network=none, read-only FS, limited processes)
- Real-Time Dashboard: Auto-generated, always up-to-date status view
- Zero Infrastructure: Works with free GitHub tier (no servers, no databases)
- Worker Autonomy: Nodes self-register and heartbeat without central coordination
- Full Transparency: All state visible in Git history
MVP implementation with essential security:
- โ Container isolation (network=none, read-only, user=1000:1000)
- โ Fixed base image (python:3.11-alpine, not customizable)
- โ Output limits (10KB max per task to prevent DoS)
- โ JSON validation and required fields
- โ Task submission validation via GitHub Actions
Future hardening needed:
- Task signing & verification
- Enhanced container sandboxing
- Rate limiting per worker
- Multi-signature quorum for critical operations
- GitHub account and a public repository
- Docker installed (for running workers)
- Python 3.11+ (for local development)
- Git CLI
# 1. Create a new repository on GitHub
# 2. Clone it locally
git clone https://github.com/<your-username>/d-grid.git
cd d-grid
# 3. Enable GitHub Pages
# Settings โ Pages โ Source: gh-pages branch
# 4. Enable GitHub Actions
# Settings โ Actions โ Allow all actions
# 5. Create a GitHub Personal Access Token (if needed for private repos)
# Settings โ Developer settings โ Personal access tokens
# Keep this secret!docker run -d \
--name dgrid-worker-001 \
-e NODE_ID=worker-001 \
-e DGRID_REPO_URL=https://github.com/<your-username>/d-grid.git \
-e GIT_TOKEN=ghp_your_token_here \
-e PULL_INTERVAL=10 \
-e LOG_LEVEL=INFO \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 8000:8000 \
fabriziosalmi/d-grid-worker:latestThen check the dashboard at http://localhost:8000
# Clone the repository
git clone https://github.com/<your-username>/d-grid.git
cd d-grid
# Configure environment in docker-compose.yml
# Then start:
docker-compose up -d
# Check logs:
docker-compose logs -f dgrid-workercd worker
pip install -r requirements.txt
python main.py- Fork the repository
git clone https://github.com/<your-username>/d-grid.git
cd d-grid- Create a task file
cat > tasks/queue/my-first-task.json << 'EOF'
{
"task_id": "my-first-task",
"script": "echo 'Hello from D-GRID!' && python3 --version",
"timeout_seconds": 30
}
EOF- Commit and push
git add tasks/queue/my-first-task.json
git commit -m "Add task: my-first-task"
git push origin main- Monitor execution
Visit your dashboard at: https://<your-username>.github.io/d-grid/
Results appear in tasks/completed/ or tasks/failed/ depending on outcome.
Access your real-time dashboard at: https://<your-username>.github.io/d-grid/
Dashboard shows:
- ๐ข Active nodes (with last heartbeat time)
- โณ Pending tasks in queue
- ๐ Currently executing tasks
- โ Successfully completed tasks
- โ Failed tasks
The dashboard updates every 60 seconds and regenerates every 5 minutes via GitHub Actions.
- Worker node core implementation
- State manager (node registration & heartbeat)
- Task runner with Docker execution
- Git coordination and atomic operations
- Robust error handling and recovery
- Task submission validator
- Dashboard generator
- Orphan task cleanup
- Auto-scaling recommendations
- Performance metrics collection
- Publish Docker image to registries
- Enhanced documentation
- Example tasks and templates
- Public launch
- End-to-end test suite
- Task dependency management
- Worker reputation system
- Task priority levels
- Distributed consensus for critical ops
- Web UI for task submission
Everyone can contribute! The easiest way is to launch a worker node:
docker run -e DGRID_REPO_URL=https://github.com/<repo> \
-e NODE_ID=my-worker \
-v /var/run/docker.sock:/var/run/docker.sock \
fabriziosalmi/d-grid-worker:latestYou can also:
- Submit tasks by creating JSON files in
tasks/queue/ - Improve code by forking and submitting pull requests
- Report issues on the GitHub issue tracker
- Suggest improvements in discussions
# Clone and setup
git clone https://github.com/<your-fork>/d-grid.git
cd d-grid
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
cd worker
pip install -r requirements.txt
# Run locally (requires Docker)
python main.py- Worker Configuration - All environment variables explained
- Task Format Specification - Create valid tasks
- Architecture Deep Dive - Understand how it works
- Development Progress - Track ongoing development
Worker won't start:
# Check configuration validation
LOG_LEVEL=DEBUG python worker/main.py
# Verify Docker is running
docker ps
# Check Git credentials (if private repo)
git config credential.helperTasks aren't being picked up:
# Check repository sync
cd /tmp/d-grid-repo && git log --oneline -5
# Verify task format
cat tasks/queue/*.json | python3 -m json.tool
# Check worker logs
docker logs dgrid-worker-001Dashboard not updating:
- Verify GitHub Actions is enabled in Settings
- Check Actions tab for workflow run history
- Ensure GitHub Pages is configured in Settings
- Issues: Report bugs on GitHub Issues
- Discussions: Ask questions in GitHub Discussions
- Wiki: Additional info in GitHub Wiki
MIT License - Feel free to use, experiment, and build your own D-GRID!
See LICENSE for full terms.
Built with:
- โค๏ธ Passion for decentralization
- ๐ง Python, Git, and Docker
- ๐ GitHub's free tier (Actions, Pages, API)
- ๐ Open source community
Q: Does this work without Internet? A: No, it requires connectivity to GitHub. It's designed for cloud/internet deployments.
Q: Can I use this for production workloads? A: Currently MVP. For production, add the security hardening listed in the Security section.
Q: How many workers can I run? A: Unlimited! Each worker is independent and only needs the repo URL.
Q: What happens if GitHub is down? A: Workers will retry until connectivity is restored. No data is lost since Git stores everything.
Q: Can I run on Kubernetes? A: Yes! Deploy workers as Kubernetes jobs that pull tasks from the Git repo.
Q: How do I scale this? A: Simply run more worker containers. They auto-coordinate via Git atomic operations.
Mission Status: ๐ BLITZ-LAUNCH OPERATION IN PROGRESS
Decentralization starts here.