/ opencodehub / DOCKERHUB.md
Swadhin Biswas Feature/ai code reviewer (#73) Β· 8/2/2026
105a287
210 lines Β· 8.8 KB
Raw Download

OpenCodeHub

Docker Image Size
Docker Pulls
License: MIT
Documentation

The self-hosted Git platform built for speed, control, and modern software engineering workflows.

OpenCodeHub is an open-source alternative to GitHub/GitLab featuring native Graphite-style Stacked PRs, a Merge Queue with speculative builds, a GitHub Actions-compatible CI/CD engine, and multi-provider AI Code Review.


Key Features

  • πŸ₯ž Stacked PRs β€” Native stacked branch workflows in Web UI & CLI (och stack create/submit/sync)
  • 🚦 Merge Queue β€” Priority lanes, speculatively tested builds, and auto-merge controls
  • ⚑ CI/CD Pipeline Engine β€” GitHub Actions workflow runner using Docker-in-Docker execution
  • πŸ€– AI Code Review β€” Multi-provider support (OpenAI, Anthropic, Gemini, Groq, local Ollama)
  • πŸ”’ Enterprise Security β€” Secret scanning, Trivy vulnerability scans, license compliance, OIDC SSO, 2FA/TOTP, and path permissions
  • πŸ“¦ Pluggable Storage β€” Local filesystem, AWS S3, Cloudflare R2, MinIO, Ceph, Garage, and any S3-compatible backend
  • πŸ—„οΈ Multi-Database Support β€” PostgreSQL (recommended for production), SQLite, and Turso/LibSQL
  • 🧰 Developer CLI β€” opencodehub-cli (och) with interactive terminal cockpit (och focus) and stack visualization

Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        CLIENTS                              β”‚
β”‚  Browser  β”‚  Git CLI (HTTP/SSH)  β”‚  OpenCodeHub CLI (och)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    OPENCODEHUB PLATFORM                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Web UI     β”‚  β”‚  REST API   β”‚  β”‚  GraphQL Endpoint   β”‚  β”‚
β”‚  β”‚  (Astro+React)β”‚β”‚  (140+ routes)β”‚β”‚  (src/pages/api/)   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Git Server β”‚  β”‚  SSH Server β”‚  β”‚  Pipeline Runner    β”‚  β”‚
β”‚  β”‚  (HTTP RPC) β”‚  β”‚  (ssh2)     β”‚  β”‚  (Docker executor)  β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              PERSISTENCE & INFRASTRUCTURE                   β”‚
β”‚  PostgreSQL / SQLite  β”‚  Redis  β”‚  S3 / MinIO / Local       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Quick Start

1. Single Container (Quick Test)

docker run -d \
  --name opencodehub \
  -p 4321:4321 \
  -p 2222:2222 \
  -v opencodehub-data:/data \
  -e JWT_SECRET=$(openssl rand -hex 32) \
  -e SESSION_SECRET=$(openssl rand -hex 32) \
  -e INTERNAL_HOOK_SECRET=$(openssl rand -hex 32) \
  -e SITE_URL=http://localhost:4321 \
  opencodehub/opencodehub:latest

Open http://localhost:4321 in your browser to get started.


2. Production Docker Compose Stack (Recommended)

version: "3.8"

services:
  app:
    image: opencodehub/opencodehub:latest
    container_name: opencodehub-app
    restart: always
    ports:
      - "4321:4321"   # Web UI & API
      - "2222:2222"   # Git SSH Server
    environment:
      - NODE_ENV=production
      - SITE_URL=https://git.yourdomain.com
      - DATABASE_DRIVER=postgres
      - DATABASE_URL=postgresql://opencodehub:secretpass@postgres:5432/opencodehub?sslmode=disable
      - REDIS_URL=redis://redis:6379
      - JWT_SECRET=${JWT_SECRET}
      - SESSION_SECRET=${SESSION_SECRET}
      - INTERNAL_HOOK_SECRET=${INTERNAL_HOOK_SECRET}
      - RUNNER_SECRET=${RUNNER_SECRET}
      - WORKFLOW_SECRET_ENCRYPTION_KEY=${WORKFLOW_SECRET_ENCRYPTION_KEY}
    volumes:
      - app-data:/data
    depends_on:
      - postgres
      - redis

  worker:
    image: opencodehub/opencodehub-worker:latest
    container_name: opencodehub-worker
    restart: always
    environment:
      - NODE_ENV=production
      - DATABASE_DRIVER=postgres
      - DATABASE_URL=postgresql://opencodehub:secretpass@postgres:5432/opencodehub?sslmode=disable
      - REDIS_URL=redis://redis:6379
    volumes:
      - app-data:/data
    depends_on:
      - postgres
      - redis

  runner:
    image: opencodehub/opencodehub-runner:latest
    container_name: opencodehub-runner
    restart: always
    privileged: true
    environment:
      - OPENCODEHUB_URL=http://app:4321
      - RUNNER_SECRET=${RUNNER_SECRET}
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    depends_on:
      - app

  postgres:
    image: postgres:16-alpine
    container_name: opencodehub-postgres
    restart: always
    environment:
      POSTGRES_USER: opencodehub
      POSTGRES_PASSWORD: secretpass
      POSTGRES_DB: opencodehub
    volumes:
      - pg-data:/var/lib/postgresql/data

  redis:
    image: redis:7-alpine
    container_name: opencodehub-redis
    restart: always
    volumes:
      - redis-data:/data

volumes:
  app-data:
  pg-data:
  redis-data:

Start the stack:

docker compose up -d
docker compose exec app bun run scripts/seed-admin.ts

Environment Variables Reference

Variable Required Default Description
SITE_URL Yes http://localhost:4321 Base URL of your platform (e.g. https://git.company.com)
DATABASE_DRIVER No postgres Database driver (postgres, sqlite, turso)
DATABASE_URL Yes β€” Connection string (PostgreSQL/SQLite)
REDIS_URL Yes β€” Redis connection URI for sessions & locks
JWT_SECRET Yes β€” 32+ char secret for JWT token signing
SESSION_SECRET Yes β€” 32+ char secret for cookie encryption
INTERNAL_HOOK_SECRET Yes β€” Shared secret for Git hook callbacks
STORAGE_TYPE No local Storage backend (local or s3)
STORAGE_BUCKET If STORAGE_TYPE=s3 β€” S3 bucket name
STORAGE_REGION If STORAGE_TYPE=s3 us-east-1 S3 region
STORAGE_ENDPOINT Optional β€” S3-compatible custom endpoint (MinIO / R2 / Garage)
STORAGE_ACCESS_KEY_ID If STORAGE_TYPE=s3 β€” Access Key ID
STORAGE_SECRET_ACCESS_KEY If STORAGE_TYPE=s3 β€” Secret Access Key
METRICS_TOKEN Optional β€” Bearer token for GET /api/metrics

OpenCodeHub CLI (och)

Install the official CLI to manage stacks, merge queues, and reviews:

npm install -g opencodehub-cli

# Authenticate with your self-hosted instance
och auth login --url https://git.yourdomain.com

# Create stacked PR branches
och stack create feature/part-1
och stack submit

Useful Links & Community