Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ backend/ @HardMax71
# Frontend
frontend/ @HardMax71

# DevOps / Helm / CI
helm/ @HardMax71
# DevOps / CI
.github/ @HardMax71
5 changes: 1 addition & 4 deletions .github/actions/e2e-ready/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'E2E Ready'
description: 'Finalize k3s, wait for infra, start compose stack, health-check, seed test users'
description: 'Finalize k3s, wait for infra, start compose stack, health-check'

inputs:
image-tag:
Expand Down Expand Up @@ -75,6 +75,3 @@ runs:
echo "Frontend ready"
fi

- name: Seed test users
shell: bash
run: docker compose exec -T backend uv run python scripts/seed_users.py
16 changes: 1 addition & 15 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ jobs:
- base
- backend
- frontend
- coordinator
- k8s-worker
- pod-monitor
- result-processor
- saga-orchestrator
- event-replay
- dlq-processor
- cert-generator
- zookeeper-certgen
steps:
Expand Down Expand Up @@ -116,13 +109,6 @@ jobs:
crane copy "$REGISTRY/$PREFIX/base:$TAG" "$REGISTRY/$PREFIX/base:latest"
crane copy "$REGISTRY/$PREFIX/backend:$TAG" "$REGISTRY/$PREFIX/backend:latest"
crane copy "$REGISTRY/$PREFIX/frontend:$TAG" "$REGISTRY/$PREFIX/frontend:latest"
crane copy "$REGISTRY/$PREFIX/coordinator:$TAG" "$REGISTRY/$PREFIX/coordinator:latest"
crane copy "$REGISTRY/$PREFIX/k8s-worker:$TAG" "$REGISTRY/$PREFIX/k8s-worker:latest"
crane copy "$REGISTRY/$PREFIX/pod-monitor:$TAG" "$REGISTRY/$PREFIX/pod-monitor:latest"
crane copy "$REGISTRY/$PREFIX/result-processor:$TAG" "$REGISTRY/$PREFIX/result-processor:latest"
crane copy "$REGISTRY/$PREFIX/saga-orchestrator:$TAG" "$REGISTRY/$PREFIX/saga-orchestrator:latest"
crane copy "$REGISTRY/$PREFIX/event-replay:$TAG" "$REGISTRY/$PREFIX/event-replay:latest"
crane copy "$REGISTRY/$PREFIX/dlq-processor:$TAG" "$REGISTRY/$PREFIX/dlq-processor:latest"
crane copy "$REGISTRY/$PREFIX/cert-generator:$TAG" "$REGISTRY/$PREFIX/cert-generator:latest"
crane copy "$REGISTRY/$PREFIX/zookeeper-certgen:$TAG" "$REGISTRY/$PREFIX/zookeeper-certgen:latest"

Expand Down Expand Up @@ -156,4 +142,4 @@ jobs:
echo "| Frontend | \`docker pull $REGISTRY/$PREFIX/frontend:latest\` |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Security Scans" >> $GITHUB_STEP_SUMMARY
echo "All 12 images scanned with Trivy (CRITICAL + HIGH, unfixed ignored)." >> $GITHUB_STEP_SUMMARY
echo "All 5 images scanned with Trivy (CRITICAL + HIGH, unfixed ignored)." >> $GITHUB_STEP_SUMMARY
24 changes: 4 additions & 20 deletions .github/workflows/stack-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,10 @@ jobs:
if: steps.base-cache.outputs.cache-hit != 'true'
run: docker save integr8scode-base:latest | zstd -T0 -3 > /tmp/base-image.tar.zst

# ── Backend + workers (depend on local base image) ───────────────
- name: Build backend and worker images
# ── Backend (depends on local base image) ───────────────
- name: Build backend image
run: |
docker build -t integr8scode-backend:latest --build-context base=docker-image://integr8scode-base:latest -f ./backend/Dockerfile ./backend
docker build -t integr8scode-coordinator:latest --build-context base=docker-image://integr8scode-base:latest -f backend/workers/Dockerfile.coordinator ./backend
docker build -t integr8scode-k8s-worker:latest --build-context base=docker-image://integr8scode-base:latest -f backend/workers/Dockerfile.k8s_worker ./backend
docker build -t integr8scode-pod-monitor:latest --build-context base=docker-image://integr8scode-base:latest -f backend/workers/Dockerfile.pod_monitor ./backend
docker build -t integr8scode-result-processor:latest --build-context base=docker-image://integr8scode-base:latest -f backend/workers/Dockerfile.result_processor ./backend
docker build -t integr8scode-saga-orchestrator:latest --build-context base=docker-image://integr8scode-base:latest -f backend/workers/Dockerfile.saga_orchestrator ./backend
docker build -t integr8scode-event-replay:latest --build-context base=docker-image://integr8scode-base:latest -f backend/workers/Dockerfile.event_replay ./backend
docker build -t integr8scode-dlq-processor:latest --build-context base=docker-image://integr8scode-base:latest -f backend/workers/Dockerfile.dlq_processor ./backend

# ── Utility images (GHA-cached, independent of base) ────────────
- name: Build cert-generator image
Expand Down Expand Up @@ -232,23 +225,14 @@ jobs:
# Tag all images for GHCR
docker tag integr8scode-base:latest "$IMG/base:$TAG"
docker tag integr8scode-backend:latest "$IMG/backend:$TAG"
docker tag integr8scode-coordinator:latest "$IMG/coordinator:$TAG"
docker tag integr8scode-k8s-worker:latest "$IMG/k8s-worker:$TAG"
docker tag integr8scode-pod-monitor:latest "$IMG/pod-monitor:$TAG"
docker tag integr8scode-result-processor:latest "$IMG/result-processor:$TAG"
docker tag integr8scode-saga-orchestrator:latest "$IMG/saga-orchestrator:$TAG"
docker tag integr8scode-event-replay:latest "$IMG/event-replay:$TAG"
docker tag integr8scode-dlq-processor:latest "$IMG/dlq-processor:$TAG"
docker tag integr8scode-cert-generator:latest "$IMG/cert-generator:$TAG"
docker tag integr8scode-zookeeper-certgen:latest "$IMG/zookeeper-certgen:$TAG"
docker tag integr8scode-frontend:latest "$IMG/frontend-dev:$TAG"
docker tag integr8scode-frontend-prod:latest "$IMG/frontend:$TAG"

# Push all 13 images in parallel, tracking each PID
# Push all 6 images in parallel, tracking each PID
declare -A PIDS
for name in base backend coordinator k8s-worker pod-monitor \
result-processor saga-orchestrator event-replay \
dlq-processor cert-generator zookeeper-certgen \
for name in base backend cert-generator zookeeper-certgen \
frontend-dev frontend; do
docker push "$IMG/$name:$TAG" &
PIDS[$name]=$!
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,3 @@ frontend/coverage/
frontend/playwright-report/
frontend/test-results/

# Helm
helm/*/charts/*.tgz
helm/*/Chart.lock
8 changes: 0 additions & 8 deletions backend/workers/Dockerfile.coordinator

This file was deleted.

8 changes: 0 additions & 8 deletions backend/workers/Dockerfile.dlq_processor

This file was deleted.

8 changes: 0 additions & 8 deletions backend/workers/Dockerfile.event_replay

This file was deleted.

8 changes: 0 additions & 8 deletions backend/workers/Dockerfile.k8s_worker

This file was deleted.

8 changes: 0 additions & 8 deletions backend/workers/Dockerfile.pod_monitor

This file was deleted.

8 changes: 0 additions & 8 deletions backend/workers/Dockerfile.result_processor

This file was deleted.

8 changes: 0 additions & 8 deletions backend/workers/Dockerfile.saga_orchestrator

This file was deleted.

152 changes: 1 addition & 151 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
#!/bin/bash
# =============================================================================
# Integr8sCode Unified Deployment Script
# Integr8sCode Deployment Script (Docker Compose)
# =============================================================================
#
# Usage:
# ./deploy.sh dev # Start local development (docker-compose)
# ./deploy.sh dev --build # Rebuild and start local development
# ./deploy.sh down # Stop local development
# ./deploy.sh prod # Deploy to K8s (builds images locally)
# ./deploy.sh prod --prod # Deploy with production values (uses registry)
# ./deploy.sh prod --dry-run # Test Helm deployment without applying
# ./deploy.sh check # Run local quality checks (lint, type, security)
# ./deploy.sh test # Run full test suite locally
# ./deploy.sh logs [service] # View logs (dev mode)
Expand All @@ -31,11 +28,6 @@ YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'

# Helm configuration
NAMESPACE="integr8scode"
RELEASE_NAME="integr8scode"
CHART_PATH="./helm/integr8scode"

print_header() {
echo -e "${BLUE}"
echo "==========================================================================="
Expand Down Expand Up @@ -66,7 +58,6 @@ show_help() {
echo " --wait Wait for services to be healthy"
echo " --timeout <secs> Health check timeout (default: 120)"
echo " down Stop all services"
echo " prod [options] Deploy to Kubernetes with Helm"
echo " check Run quality checks (ruff, mypy, bandit)"
echo " test Run full test suite"
echo " logs [service] View logs (defaults to all services)"
Expand All @@ -75,12 +66,6 @@ show_help() {
echo " types Generate TypeScript types for frontend from OpenAPI spec"
echo " help Show this help message"
echo ""
echo "Prod options:"
echo " --dry-run Validate templates without applying"
echo " --prod Use production values (ghcr.io images, no local build)"
echo " --local Force local build even with --prod values"
echo " --set key=value Override Helm values"
echo ""
echo "Configuration:"
echo " All settings come from backend/config.toml (single source of truth)"
echo " For CI/tests: cp backend/config.test.toml backend/config.toml"
Expand All @@ -89,7 +74,6 @@ show_help() {
echo " ./deploy.sh dev # Start dev environment"
echo " ./deploy.sh dev --build # Rebuild and start"
echo " ./deploy.sh dev --wait # Start and wait for healthy"
echo " ./deploy.sh prod # Deploy with local images"
echo " ./deploy.sh logs backend # View backend logs"
}

Expand Down Expand Up @@ -214,10 +198,6 @@ cmd_status() {
echo ""
echo "Docker Compose Services:"
docker compose ps 2>/dev/null || echo " No docker-compose services running"

echo ""
echo "Kubernetes Pods (if deployed):"
kubectl get pods -n "$NAMESPACE" 2>/dev/null || echo " No Kubernetes deployment found"
}

# =============================================================================
Expand Down Expand Up @@ -281,132 +261,6 @@ cmd_test() {
exit $TEST_RESULT
}

# =============================================================================
# KUBERNETES DEPLOYMENT (Helm)
# =============================================================================
build_and_import_images() {
print_info "Building Docker images..."

docker build -t base:latest -f ./backend/Dockerfile.base ./backend
docker build -t integr8scode-backend:latest -f ./backend/Dockerfile ./backend

if [[ -f ./frontend/Dockerfile.prod ]]; then
docker build -t integr8scode-frontend:latest -f ./frontend/Dockerfile.prod ./frontend
else
docker build -t integr8scode-frontend:latest -f ./frontend/Dockerfile ./frontend
fi

print_success "Images built"

if command -v k3s &> /dev/null; then
print_info "Importing images to K3s..."
docker save base:latest | sudo k3s ctr images import -
docker save integr8scode-backend:latest | sudo k3s ctr images import -
docker save integr8scode-frontend:latest | sudo k3s ctr images import -
print_success "Images imported to K3s"
else
print_warning "K3s not found - skipping image import"
fi
}

cmd_prod() {
print_header "Deploying to Kubernetes"

local DRY_RUN=""
local VALUES_FILE="values.yaml"
local EXTRA_ARGS=""
local USE_REGISTRY=false
local FORCE_LOCAL=false

# Parse arguments
while [[ $# -gt 0 ]]; do
case "$1" in
--dry-run)
DRY_RUN="--dry-run"
print_warning "DRY RUN MODE - No changes will be applied"
;;
--prod)
VALUES_FILE="values-prod.yaml"
USE_REGISTRY=true
print_info "Using production values (ghcr.io images)"
;;
--local)
FORCE_LOCAL=true
print_info "Forcing local image build"
;;
--set)
shift
EXTRA_ARGS="$EXTRA_ARGS --set $1"
;;
*)
print_error "Unknown option: $1"
exit 1
;;
esac
shift
done

deploy_helm "$VALUES_FILE" "$DRY_RUN" "$EXTRA_ARGS" "$USE_REGISTRY" "$FORCE_LOCAL"
}

deploy_helm() {
local VALUES_FILE="$1"
local DRY_RUN="$2"
local EXTRA_ARGS="$3"
local USE_REGISTRY="$4"
local FORCE_LOCAL="$5"

# Build images if:
# - Not dry-run AND
# - Not using registry OR force local build
if [[ -z "$DRY_RUN" ]]; then
if [[ "$USE_REGISTRY" != "true" ]] || [[ "$FORCE_LOCAL" == "true" ]]; then
build_and_import_images
else
print_info "Using pre-built images from ghcr.io (skipping local build)"
fi
fi

print_info "Updating Helm dependencies..."
helm dependency update "$CHART_PATH"

print_info "Creating namespace..."
if [[ -z "$DRY_RUN" ]]; then
kubectl create namespace "$NAMESPACE" --dry-run=client -o yaml | kubectl apply -f -
fi

print_info "Deploying with Helm..."
helm upgrade --install "$RELEASE_NAME" "$CHART_PATH" \
--namespace "$NAMESPACE" \
--values "$CHART_PATH/$VALUES_FILE" \
--wait \
--timeout 10m \
$DRY_RUN \
$EXTRA_ARGS

if [[ -z "$DRY_RUN" ]]; then
echo ""
print_success "Deployment complete!"
echo ""
echo "Pods:"
kubectl get pods -n "$NAMESPACE"
echo ""
echo "Services:"
kubectl get services -n "$NAMESPACE"
echo ""
if [[ "$VALUES_FILE" == "values-prod.yaml" ]]; then
echo "Note: Passwords must be set via --set flags for production"
else
echo "Default credentials: user/user123, admin/admin123"
fi
echo ""
echo "Commands:"
echo " kubectl logs -n $NAMESPACE -l app.kubernetes.io/component=backend"
echo " kubectl port-forward -n $NAMESPACE svc/$RELEASE_NAME-backend 8443:443"
echo " helm uninstall $RELEASE_NAME -n $NAMESPACE"
fi
}

# =============================================================================
# OPENAPI SPEC GENERATION
# =============================================================================
Expand Down Expand Up @@ -477,10 +331,6 @@ case "${1:-help}" in
test)
cmd_test
;;
prod)
shift
cmd_prod "$@"
;;
openapi)
cmd_openapi "$2"
;;
Expand Down
Loading
Loading