Architecture
GAGOS is a single Go binary serving both the API and static web UI.
Project Structure
gagos/
├── cmd/gagos/ # Application entry point
│ └── main.go # HTTP server, routes, handlers
├── internal/
│ ├── auth/ # Authentication middleware
│ ├── cicd/ # CI/CD pipeline engine
│ │ ├── executor.go # Job execution
│ │ ├── pipeline.go # Pipeline parsing
│ │ └── store.go # SQLite storage
│ ├── database/ # Database clients
│ │ ├── postgres.go
│ │ ├── mysql.go
│ │ ├── redis.go
│ │ ├── elasticsearch.go
│ │ └── s3.go
│ ├── devtools/ # Developer utilities
│ ├── k8s/ # Kubernetes client
│ ├── network/ # Network diagnostic tools
│ └── terminal/ # PTY terminal
├── web/static/ # Frontend (HTML, CSS, JS)
│ ├── index.html
│ ├── css/
│ └── js/
├── deploy/
│ ├── docker/ # Dockerfile
│ └── kubernetes/ # K8s manifests
└── docs/ # Documentation
Technology Stack
Backend
- Go - Primary language
- Fiber - HTTP framework
- client-go - Kubernetes client
- creack/pty - PTY terminal
- gorilla/websocket - WebSocket support
- SQLite - CI/CD data storage
Frontend
- Vanilla JS - ES6 modules, no framework
- xterm.js - Terminal emulator
- Custom CSS - Windows 95-inspired theme
Component Overview
HTTP Server
Single Fiber application serving:
- Static files (web UI)
- REST API endpoints
- WebSocket endpoints (terminal, logs)
Authentication
- Password-based login
- Session cookies
- Middleware protection for API routes
Kubernetes Client
- In-cluster config when running in K8s
- Kubeconfig for local development
- Dynamic client for any resource type
CI/CD Engine
- Pipeline parser (YAML to struct)
- Kubernetes job executor
- SSH executor for freestyle jobs
- SQLite store for pipelines, jobs, runs
- Webhook handler
- Artifact collector
Terminal
- PTY allocation per session
- WebSocket bidirectional communication
- Resize handling
Data Flow
Browser (Web UI)
│
▼
HTTP/WebSocket
│
▼
Fiber Router
│
├── Static Files (/*)
│
├── Auth (/api/auth/*)
│
└── API (/api/v1/*)
│
├── Network Tools → Local execution
│
├── Kubernetes → client-go → K8s API
│
├── CI/CD → SQLite + K8s Jobs/SSH
│
├── Database → pg/mysql/redis clients
│
└── Terminal → PTY → Shell
Deployment
Container Image
- Multi-stage build
- Alpine base for small size
- Includes CLI tools (curl, dig, etc.)
Kubernetes
- Single pod deployment
- ServiceAccount with RBAC
- Optional PVC for CI/CD data
- NodePort or Ingress exposure