HUB
Sign inSign up
eoc-backup-manager logo

radiantone/eoc-backup-manager

By radiantone

•Updated 2 months ago

Image
0

5.5K

radiantone/eoc-backup-manager repository overview

⁠Backup Manager

A Velero backup manager for applications deployed by EOC.

⁠Agents / Beads

AI-assisted development is governed by AGENTS.md⁠ (and Cursor rules under .cursor/rules/). Task tracking uses Beads (bd). Project documentation lives under documentation/⁠ — including DESIGN, BACKUP, RESTORE, ADRs, and diagrams. Huma serves generated API documentation at /docs and OpenAPI at /openapi.json or /openapi.yaml.

⁠Getting Started

⁠Prerequisites
  • Go 1.27.1+
  • Kubernetes cluster with Velero installed
  • Task⁠ for build commands
⁠Installation
  1. Clone the project
git clone <repository-url>
cd backup-manager
  1. Install dependencies
go mod download
  1. Configuration Create a local env file from the committed example (under dev/):
cp dev/env.example dev/.env
# Edit dev/.env with your values

⁠Build and Deployment

All Task commands live under dev/ (no root Taskfile). List tasks with:

task -d dev
# or: task -d dev --list
⁠Common commands
task -d dev go:build       # Compile backup-manager
task -d dev go:test        # Unit tests with -race
task -d dev go:lint        # golangci-lint
task -d dev local:run      # Run backup-manager locally
task -d dev docker:image   # Build image (push only if REGISTRY is set in dev/.env)
task -d dev local:install  # Install in cluster (current context; requires Velero)
task -d dev local:uninstall # Remove backup-manager deployment only
task -d dev security:run   # SAST + dependency scans
⁠Local testing with remote cluster
# 1. Download cluster kubeconfig
# 2. Configure dev/.env with your values
# 3. Start the service
task -d dev local:run

# 4. Access Huma API documentation
# http://localhost:8080/docs
⁠Local k3d stack (RustFS + Velero + backup-manager)

Assumes an existing k3d cluster (with registry) and tools such as helm and kubectl. Configure dev/.env first (RUSTFS_*, VELERO_*, REGISTRY / REGISTRY_PUSH, VELERO_NAMESPACE=velero). VELERO_VERSION is the single version knob (Velero app image, backup-manager image tag, and binary ldflags). backup-manager is installed via the local Helm chart dev/helm/backup-manager/⁠ with values dev/helm-values/local.yaml⁠.

# Install (bottom-up)
task -d dev rustfs:install    # local S3 + backups bucket
task -d dev velero:install    # requires RustFS (re-runs rustfs:install as a dep)
task -d dev local:install     # requires Velero; builds/pushes image :$VELERO_VERSION

# Uninstall (top-down; each task removes only its own component)
task -d dev local:uninstall
task -d dev velero:uninstall  # leaves Velero CRDs
task -d dev rustfs:uninstall  # always deletes PVCs; keeps tools namespace
⁠Ops helper scripts

Manual Velero/API helpers (CLI vs API) live in dev/scripts/⁠ (backup.sh, restore.sh, velero-lib.sh). These are not product runtime.

⁠Monitoring

⁠Prometheus Metrics

The service exposes metrics at the /metrics endpoint (configurable via METRICS_PATH):

  • Backups : Number in progress, successful, failed, duration
  • Restores : Number in progress, successful, failed, duration
  • HTTP : Requests, duration, errors, success rate
⁠Metrics Configuration
# Refresh period (default: 15s)
METRICS_REFRESH_PERIOD=30s

# Metrics path (default: /metrics)
METRICS_PATH=/probes/metrics
⁠Timeout Configuration
# Pods wait timeout during restore (default: 5m)
PODS_WAIT_TIMEOUT=10m
⁠Grafana Dashboards

Importable JSON under documentation/operations/grafana/⁠:

  • Backup/Restore : backup-restore.json
  • HTTP Metrics : http-metrics.json
⁠Grafana Assistant CLI

Grafana Assistant CLI⁠ (grafana-assistant) talks to a Grafana instance via the Assistant A2A API. Use it from a terminal or from Cursor (Grafana Labs plugin / skill) to investigate metrics and dashboards for this service.

Install (binary must be on $PATH; do not rely on the agent to install it).

⁠macOS (Homebrew)

Preferred path on macOS: install the cask from the Grafana Homebrew tap⁠ (grafana/grafana). Requires Homebrew⁠.

# One-shot install from the Grafana tap (cask)
brew install grafana/grafana/grafana-assistant

# Or tap first, then install
brew tap grafana/grafana
brew install --cask grafana-assistant

# Verify the binary (not only the cask metadata)
command -v grafana-assistant
grafana-assistant --version
brew list --cask grafana-assistant
⁠macOS Gatekeeper (unsigned / unnotarized binary)

The first run often triggers a system dialog (“Apple could not verify …” / « Élément grafana-assistant non ouvert »). Choosing Move to Trash / Placer dans la corbeille deletes the binary and leaves a broken symlink under /opt/homebrew/Caskroom/grafana-assistant/... — later runs then look like killed or command not found.

Do this instead:

  1. Click Done / Terminé (do not move to Trash).
  2. Open System Settings → Privacy & Security, find the blocked grafana-assistant message, click Open Anyway, confirm.
  3. Or clear the quarantine flag, then retry:
xattr -d com.apple.quarantine "$(brew --prefix)/bin/grafana-assistant"
# if the symlink target still exists:
xattr -dr com.apple.quarantine "$(brew --caskroom)/grafana-assistant"
grafana-assistant --version

If the binary was already trashed / missing from the Caskroom, reinstall then allow it as above (do not Trash it again):

brew reinstall --cask grafana/grafana/grafana-assistant
grafana-assistant --version

Upgrade later with:

brew update
brew upgrade --cask grafana-assistant

Official Homebrew notes: Use Grafana Assistant CLI⁠ (Install with Homebrew).

⁠Other platforms
  1. Follow the upstream install instructions and grab a pre-built release from github.com/grafana/assistant-cli⁠.
  2. Alternatively, use the published container image: github.com/grafana/assistant-cli/pkgs⁠.

Quick configure and auth (replace URL with your Grafana stack):

grafana-assistant config set-instance mystack --url https://mystack.grafana.net
grafana-assistant config use-instance mystack
grafana-assistant auth                    # browser PKCE; needs Assistant CLI User (or Editor+)
grafana-assistant config add-project backup-manager "$(pwd)"
grafana-assistant prompt "List dashboards related to backup-manager metrics"

Config file resolution (first match wins): GRAFANA_ASSISTANT_CONFIG, ./grafana-assistant.yaml (--local), or ~/.config/grafana-assistant/config.yaml. Overrides: GRAFANA_URL / GRAFANA_SA_TOKEN.

Official docs and references

ResourceURL
CLI install (incl. Homebrew)grafana.com/docs/.../assistant/platform/cli⁠
CLI source, install, releasesgithub.com/grafana/assistant-cli⁠
Grafana Homebrew tapgithub.com/grafana/homebrew-grafana⁠
CLI Docker / GHCR packagesgithub.com/grafana/assistant-cli/pkgs⁠
Grafana Assistant (product docs)grafana.com/docs/grafana-cloud/machine-learning/assistant⁠
This repo’s dashboardsdocumentation/operations/grafana/⁠

⁠Configuration

⁠Main environment variables
# Kubernetes
KUBECONFIG=/path/to/kubeconfig.yaml
VELERO_NAMESPACE=velero

# Application
ENVIRONMENT=rli-ops10-dev01
APPLICATION=ida
VERSION=3.0.0

# ArgoCD (optional)
ARGOCD_DNS=argocd.example.com
ARGOCD_ADMIN_PWD=password

Local applications fixture: dev/config/applications.json (set via APPLICATIONS_CONFIG).

⁠Supported applications
  • ida → Identity Analytics
  • ido → Identity Observability
  • iddm → Identity Data Management

⁠API Reference

⁠Main endpoints
  • GET /api/version - Get the Velero server version
  • GET /api/backups - List backups
  • POST /api/backups - Create a backup from a schedule
  • POST /api/backups/{name} - Create a named backup
  • GET /api/backups/{name} - Get backup status
  • GET /api/backups/{name}/details - Get backup details
  • GET /api/backups/{name}/logs - Get backup logs
  • DELETE /api/backups/{name} - Delete a backup
  • POST /api/backups/cleanup - Clean up matching backups
  • GET /api/restores - List restores
  • POST /api/restores - Create a restore
  • GET /api/restores/{name} - Get restore status
  • GET /api/restores/{name}/details - Get restore details
  • GET /api/restores/{name}/logs - Get restore logs
  • DELETE /api/restores/{name} - Delete a restore
  • POST /api/restores/cleanup - Clean up matching restores
⁠Complete documentation

Access Huma API documentation⁠ or download /openapi.json⁠.

⁠Troubleshooting

⁠Common issues
⁠Service won't start
# Check configuration
cat dev/.env

# Check Kubernetes access
kubectl get pods -n velero
⁠Metrics not visible
# Check endpoint
curl http://localhost:8080/metrics

# Check Prometheus configuration
⁠Backup errors
# Check Velero logs
kubectl logs -n velero -l app=velero

# Check schedules
kubectl get schedules -n velero

⁠Technical Documentation

⁠Contributing

See CONTRIBUTING.md⁠. Summary: branch from develop, run task -d dev go:test|lint|vet|fmt and security:run, update CHANGELOG.md, open a PR. Agents never git push.

⁠License

This project is licensed under [LICENSE].

Tag summary

Content type

Image

Digest

sha256:809b72b03…

Size

20.1 MB

Last updated

2 months ago

docker pull radiantone/eoc-backup-manager