Skip to content

About

GitOps deployment engine in Go — watches Git, builds Docker images, deploys to K8s / Cloud Run / ECS / VMs via one provider interface. OPA policy-as-code, preview envs, SSE dashboard.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

DeployMate

ci Go License: MIT

A lightweight GitOps deployment engine that watches Git repos, builds Docker images, and deploys to multiple target types (ECS, Cloud Run, K8s, VMs) via a unified provider interface.

Features

  • Multi-Cloud Deployments — Cloud Run, ECS Fargate, Kubernetes, VMs
  • Policy-as-Code — OPA Rego policies with bundle signing
  • Preview Environments — PR-triggered, auto-destroy on close
  • Real-Time Dashboard — SSE event streaming, dark mode UI
  • Instant Rollback — One-click or automatic with 3/hr guardrails
  • Edge Agents — Zero-trust policy enforcement at the edge

Architecture

┌─────────────────────────────────────────────────────────┐
│  DeployMate Engine (Go)                                 │
│  ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌──────────┐ │
│  │ Chi API │  │ Redis   │  │ Postgres │  │ OPA      │ │
│  └────┬────┘  └────┬────┘  └────┬────┘  └────┬─────┘ │
│       └────────────┼────────────┼─────────────┘       │
└────────────────────┼────────────┼─────────────────────┘
                     │            │
    ┌────────────────┼────────────┼────────────────┐
    │                │            │                │
    ▼                ▼            ▼                ▼
┌────────┐    ┌──────────┐  ┌──────────┐    ┌──────────┐
│ K8s    │    │ Cloud    │  │ ECS      │    │ VM       │
│ Agent  │    │ Run      │  │ Fargate  │    │ SSH      │
└────────┘    └──────────┘  └──────────┘    └──────────┘

Quick Start (One Command)

# Start everything (PostgreSQL + Redis + Engine API)
docker-compose up --build

Engine runs at http://localhost:8080. Test it:

# Health check
curl http://localhost:8080/healthz

# Get desired state (requires OIDC token in production)
curl http://localhost:8080/api/v1/deployments/test-1/desired-state

Dashboard (Optional)

cd apps/dashboard
npm install
npm run dev

Dashboard runs at http://localhost:3000.

K8s Agent (Optional)

# Build agent
go build -o agent ./cmd/agent

# Run locally (needs kubeconfig)
ENGINE_URL=http://localhost:8080 ./agent

Prerequisites (for local dev without Docker)

  • Go 1.23+
  • PostgreSQL 15+
  • Redis 7+
  • Node.js 18+ (for dashboard)

Project Structure

deploymate/
├── cmd/
│   ├── engine/          # Main API server
│   └── agent/           # K8s edge agent
├── internal/
│   ├── agent/           # Agent reconciler
│   ├── auth/            # OIDC authentication
│   ├── cache/           # Redis cache layer
│   ├── config/          # Configuration
│   ├── handler/         # HTTP handlers
│   ├── model/           # Domain models
│   ├── policy/          # OPA policy engine
│   ├── preview/         # Preview environments
│   ├── provider/        # Deployer implementations
│   └── store/           # PostgreSQL store
├── apps/dashboard/      # Next.js dashboard
├── migrations/          # Database migrations
├── docs/                # Documentation
├── Dockerfile.engine    # Engine container
└── Dockerfile.agent     # Agent container

API Endpoints

Method Path Auth Description
GET /healthz No Health check
GET /api/v1/deployments/{id}/desired-state OIDC Get desired state
POST /api/v1/deployments/{id}/rollback OIDC Trigger rollback
GET /api/v1/events No SSE event stream
POST /api/v1/webhooks/github HMAC GitHub webhook

Configuration

Environment variables:

# Server
SERVER_HOST=0.0.0.0
SERVER_PORT=8080

# Database
DB_HOST=localhost
DB_PORT=5432
DB_USER=deploymate
DB_PASSWORD=deploymate
DB_NAME=deploymate

# Redis
REDIS_HOST=localhost
REDIS_PORT=6379

# OIDC
OIDC_ISSUER=https://token.actions.githubusercontent.com
OIDC_AUDIENCE=deploymate

Testing

# Run all tests
go test ./internal/... -v

# Run with coverage
go test ./internal/... -cover

# Run specific package
go test ./internal/policy/... -v

Deployment

Docker

# Build engine
docker build -f Dockerfile.engine -t deploymate/engine .

# Build agent
docker build -f Dockerfile.agent -t deploymate/agent .

Kubernetes

apiVersion: apps/v1
kind: Deployment
metadata:
  name: deploymate-engine
spec:
  replicas: 2
  selector:
    matchLabels:
      app: deploymate-engine
  template:
    metadata:
      labels:
        app: deploymate-engine
    spec:
      containers:
      - name: engine
        image: deploymate/engine:latest
        ports:
        - containerPort: 8080

Architecture Decisions

See docs/PRD.md for full architecture decisions (18 total).

Key decisions:

  • Hybrid Push/Pull — Engine pushes, agents pull for resilience
  • Dual OPA Eval — Central + edge policy enforcement
  • Sigstore Signing — Keyless bundle verification
  • SSE over WebSockets — Simpler, asymmetrical data flow

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License

MIT

About

GitOps deployment engine in Go — watches Git, builds Docker images, deploys to K8s / Cloud Run / ECS / VMs via one provider interface. OPA policy-as-code, preview envs, SSE dashboard.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages