Set up your local development environment.
Using Docker:
docker run -d \
--name flux-orchestrator-postgres \
-e POSTGRES_DB=flux_orchestrator \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-p 5432:5432 \
postgres:15-alpine
Or use an existing PostgreSQL installation and create the database:
CREATE DATABASE flux_orchestrator;
# Install dependencies
go mod download
# Set environment variables
export DB_HOST=localhost
export DB_PORT=5432
export DB_USER=postgres
export DB_PASSWORD=postgres
export DB_NAME=flux_orchestrator
export DB_SSLMODE=disable
export PORT=8080
# Run the backend
make backend-dev
# or
go run backend/cmd/server/main.go
The backend will:
In a new terminal:
cd frontend
# Install dependencies (first time only)
npm install
# Start development server
npm run dev
The frontend will:
Access the UI at http://localhost:3000
flux-orchestrator/
├── backend/ # Go backend
│ ├── cmd/
│ │ └── server/ # Main application
│ └── internal/
│ ├── api/ # HTTP handlers and routing
│ ├── database/ # Database connection and schema
│ ├── k8s/ # Kubernetes client
│ └── models/ # Data models
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── api.ts # API client
│ │ ├── types.ts # TypeScript types
│ │ └── App.tsx # Main app
│ └── public/ # Static files
├── deploy/ # Deployment manifests
│ └── kubernetes/
└── docs/ # Documentation
backend/go test ./...ENV=development for readable format)frontend/src/backend/internal/database/database.goCheck service health:
# Basic health check
curl http://localhost:8080/health
# Readiness (checks database and K8s client)
curl http://localhost:8080/readiness
# Liveness
curl http://localhost:8080/liveness
View Prometheus metrics:
curl http://localhost:8080/metrics
Metrics include:
Development mode (human-readable):
ENV=development go run backend/cmd/server/main.go
Production mode (JSON for log aggregation):
go run backend/cmd/server/main.go
Each log entry includes a request_id for tracing requests through the system.
You’ll need a kubeconfig for a cluster with Flux installed. You can use:
Example kubeconfig format:
apiVersion: v1
kind: Config
clusters:
- cluster:
server: https://your-cluster-api
certificate-authority-data: <base64-cert>
name: test-cluster
contexts:
- context:
cluster: test-cluster
user: test-user
name: test-context
current-context: test-context
users:
- name: test-user
user:
token: <your-token>
To test multi-cluster features:
make build
# or
go build -o bin/flux-orchestrator ./backend/cmd/server
cd frontend
npm run build
This creates optimized static files in frontend/build/
make docker-build
# or
docker build -t flux-orchestrator:latest .
The backend logs to stdout. Key log messages:
Use browser developer tools:
Connect to PostgreSQL:
psql -h localhost -U postgres -d flux_orchestrator
Useful queries:
-- List clusters
SELECT id, name, status FROM clusters;
-- List resources
SELECT cluster_id, kind, name, namespace, status FROM flux_resources;
-- Check sync status
SELECT cluster_id, COUNT(*) as resource_count
FROM flux_resources
GROUP BY cluster_id;
vite.config.tsgo fmt)