Skip to content
LukasParkePublic

About

No description or website provided.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🐝 Hive

Self-hosted deployment platform for Docker Swarm

Go React PostgreSQL License

Documentation · Releases · Issues


What is Hive?

Hive is an open-source, self-hosted platform for deploying applications, databases, and services on Docker Swarm. It gives you the ease of a cloud PaaS with the control of your own infrastructure.

  • Deploy anything — Git repos (Dockerfile builds), Docker images, or Compose stacks
  • Automatic HTTPS — Traefik handles certificates via Let's Encrypt
  • Preview deployments — Every pull request gets its own URL, with cleanup on close
  • Built-in CI/CD — BuildKit builds from Dockerfiles, pushed to your own registry
  • Self-updating — Update the platform itself from the UI with zero downtime
  • Team-ready — Organizations, RBAC, invitations, and API keys out of the box
  • mTLS everywhere — Control plane ↔ agent traffic is mutually authenticated TLS by default

No vendor lock-in. All configurations live on your servers. If you stop using Hive, your services keep running.


🚀 Quick Start

One-line Install

curl -fsSL https://raw.githubusercontent.com/LukasParke/hive/refs/heads/main/hivectl | bash -s install

Or clone the repo and run locally:

git clone https://github.com/LukasParke/hive.git && cd hive
export HIVE_DOMAIN=hive.example.com
export [email protected]
./hivectl install

After install, open https://hive.example.com and create your admin account.

The installer also leaves a reusable hivectl CLI on the host. It installs to /usr/local/bin/hivectl when writable or available through passwordless sudo, and falls back to ~/.local/bin/hivectl. Override the destination with HIVE_CLI_PATH=/path/to/hivectl, or disable persistence with HIVE_INSTALL_CLI=false.

hivectl status
hivectl update
hivectl host-management enable

Update

./hivectl update          # Update to latest nightly
./hivectl update nightly  # Update to specific tag

Updates and re-runs of ./hivectl install are designed to be durable: they use docker stack deploy, keep PostgreSQL/registry volumes, preserve secrets, and pin stateful services to their existing Swarm node when possible. Keep the same HIVE_STACK_NAME and do not delete/prune hive_pgdata unless you intentionally want a fresh install.

Host management

Host management is intentionally off by default because it lets Hive run node-level maintenance actions such as package update checks, package upgrades, and reboot scheduling through the global agent.

./hivectl host-management status
./hivectl host-management enable     # persistent across future hivectl updates
./hivectl host-management disable

# Equivalent one-shot deploy/update form:
HIVE_HOST_MGMT=true ./hivectl update latest

After enabling, open Runtime / Nodes → a node to check packages or run maintenance.

Uninstall

./hivectl uninstall        # Remove stack (preserves data)
./hivectl uninstall --purge  # Remove everything including volumes

✨ Features

Feature Description
🐳 Swarm-Native Built for Docker Swarm with replicated control-plane, global agents, and rolling updates
🔒 Automatic HTTPS Traefik with Let's Encrypt — zero config TLS for every domain
🔐 mTLS Agents Internal CA with per-node agent certificates, TLS 1.3, 72h certs, auto-renewal
🏗️ Git & Image Deploys Deploy from Git repos (Dockerfile builds via BuildKit, with webhooks) or push Docker images directly; Compose stack deploys with preview diff
🧪 Preview Deployments Auto-deploy PRs with cleanup on merge/close
🛡️ Security Rules IP allowlists, header security, and rate limiting via Traefik middleware (blocklists and country block require an external plugin/WAF — see docs/security.md)
🔑 Encrypted Secrets AES-256-GCM secrets stored in PostgreSQL with HKDF key derivation from a master key
👥 Team Management Organizations, member roles (owner/admin/member), email invitations, API keys
📊 Monitoring Real-time metrics, build logs, container logs, and WebSocket event streams
🔄 Self-Updating Check for GitHub releases and trigger zero-downtime Swarm rolling updates from the UI or hivectl update; downgrades are not supported (upgrade guide)
🗄️ Database Services One-click Postgres, MySQL, MariaDB, MongoDB, Redis with backups and restore
⏰ Scheduled Jobs Cron-based backups, cert renewal, and cleanup via the River queue (leader-elected)
🌐 Multi-Node Scale across multiple Swarm nodes with label-based service placement (production guide)

Not yet built (tracked in the roadmap): nixpacks/buildpacks build strategies, country-based blocking, hosted interactive API spec.


🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│                        Docker Swarm                          │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────┐  │
│  │  Traefik    │  │ Control     │  │ Agent (global)      │  │
│  │  (global)   │  │ Plane (x3)  │  │ One per node        │  │
│  │  :80 :443   │  │ :3000       │  │ :9090 :9091         │  │
│  └─────────────┘  └─────────────┘  └─────────────────────┘  │
│         │                │                  │                │
│  ┌──────┴──────┐  ┌─────┴──────┐  ┌────────┴────────┐       │
│  │  PostgreSQL │  │  Buildkit  │  │  OCI Registry   │       │
│  │  + PgBouncer│  │  (builder) │  │  (registry)     │       │
│  └─────────────┘  └────────────┘  └─────────────────┘       │
└─────────────────────────────────────────────────────────────┘
Component Technology Purpose
Control Plane Go 1.25 + Chi + pgx API server, orchestration, job scheduling
Agent Go 1.25 + ConnectRPC Per-node operations, metrics, log streaming
Queue River (PostgreSQL) Reliable background job processing
Database PostgreSQL 16 + sqlc Migrations, typed queries, LISTEN/NOTIFY
Proxy Traefik v3.2 Swarm-aware routing with automatic TLS
Build Moby Buildkit Distributed image builds
Registry Distribution v2 Private OCI image storage
UI React 19 + Vite Dark-themed dashboard with real-time updates

📁 Repository Layout

hive/
├── api/                    # OpenAPI 3.1 contract (source of truth)
├── control-plane/          # Go API server & orchestration runtime
│   ├── cmd/control-plane/  # Main entrypoint
│   ├── internal/api/       # HTTP handlers (one per domain)
│   ├── internal/db/        # sqlc queries & migrations
│   ├── internal/deploy/    # Swarm service management
│   ├── internal/jobs/      # River workers (build, preview, cleanup)
│   ├── internal/updater/   # Self-update engine
│   └── internal/version/   # Build-time version injection
├── agent/                  # Go per-node agent
│   ├── cmd/agent/          # Main entrypoint
│   └── internal/           # Docker client, metrics, host ops
├── proto/                  # ConnectRPC protobuf definitions
├── ui/                     # React frontend
│   ├── src/pages/          # Dashboard & auth pages
│   ├── src/components/     # Shared UI components
│   └── src/theme.css       # Design system
├── deploy/                 # Stack files & bootstrap scripts
│   ├── hive-stack.yml      # Main Swarm stack
│   ├── hive-stack.ci.yml   # CI overlay (reduced replicas)
│   ├── monitoring-stack.yml
│   └── patroni-stack.yml
├── tests/
│   ├── e2e/                # Playwright E2E tests
│   └── integration/        # Swarm dind integration tests
├── docs/                   # ADRs, architecture, operations
└── hivectl                 # Install / update / uninstall script

🛠️ Development

Prerequisites

  • Go 1.25+
  • Node.js 22+
  • PostgreSQL 16
  • Docker & Docker Swarm

Run Locally

# 1. Start PostgreSQL
export DATABASE_URL="postgres://postgres:postgres@localhost:5432/hive?sslmode=disable"

# 2. Run control-plane
cd control-plane
go run ./cmd/control-plane

# 3. In another terminal, run the UI
cd ui
npm install
npm run dev

# 4. Open http://localhost:5173

Build Images

make images VERSION=v0.1.0

Run Tests

make test                          # All Go tests
cd ui && npm run typecheck         # TypeScript type checking
cd tests/e2e && npx playwright test # E2E tests

📖 Documentation

Topic Location
Architecture Overview docs/architecture/overview.md
Deployment Quickstart docs/deployment/quickstart.md
Production Deployment docs/deployment/production.md
Patroni HA Overlay docs/deployment/patroni-ha.md
External Services docs/deployment/external-services.md
Cloud Provider Notes docs/deployment/cloud.md
API Reference docs/api.md
Security Guide docs/security.md
Operations Runbook docs/operations/runbook.md
Upgrade Guide docs/operations/upgrade.md
Storage Model docs/operations/storage.md
ADRs docs/adr/

🔧 hivectl Commands

./hivectl install              # Initial installation
./hivectl update [version]     # Update to latest or specific version
./hivectl status               # Show stack status
./hivectl logs [service]       # Tail service logs
./hivectl uninstall [--purge]  # Remove stack

🔄 Nightly Releases

Every push to main triggers a nightly release:

Note: GHCR packages are created private on first publish. For Swarm nodes to pull anonymously, set both packages to public once under GitHub → Packages → package settings → Change visibility, or run docker login ghcr.io on every node before installing.


🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feat/amazing-feature)
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

All PRs must pass:

  • Go Build and Test
  • Integration (Swarm dind)

Set both as required checks in branch protection for main.


📜 License

Hive is released under the MIT License.


⬆ Back to Top

Built with 🐝 by the Hive team

About

No description or website provided.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages