mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 22:21:10 +02:00
feat(infra): add deploy tracking with PostgreSQL, Pushgateway & Grafana dashboard
Instrument the CD pipeline to record per-deploy and per-service metrics (build time, image size, startup time, health status) into PostgreSQL and push gauges to Pushgateway. Adds a Grafana dashboard with 13 panels covering deploy frequency, build performance, service health, and history. New files: - scripts/mac-mini/init-deploy-tracking.sql (idempotent DDL) - scripts/deploy-metrics.sh (bash library for CI) - docker/grafana/provisioning/datasources/deploy-tracking.yml - docker/grafana/dashboards/deploy-tracking.json Modified: - docker/prometheus/prometheus.yml (pushgateway scrape job) - .github/workflows/cd-macmini.yml (build/health instrumentation) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a5940abfc2
commit
3f91c4656a
6 changed files with 933 additions and 38 deletions
40
scripts/mac-mini/init-deploy-tracking.sql
Normal file
40
scripts/mac-mini/init-deploy-tracking.sql
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
-- Deploy Tracking Schema
|
||||
-- Run once: docker exec -i mana-infra-postgres psql -U postgres -d mana < scripts/mac-mini/init-deploy-tracking.sql
|
||||
-- All statements are idempotent (IF NOT EXISTS).
|
||||
|
||||
CREATE SCHEMA IF NOT EXISTS deploy_tracking;
|
||||
|
||||
-- One row per CI/CD run
|
||||
CREATE TABLE IF NOT EXISTS deploy_tracking.deployments (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
run_id BIGINT NOT NULL,
|
||||
run_attempt INTEGER NOT NULL DEFAULT 1,
|
||||
commit_sha VARCHAR(40) NOT NULL,
|
||||
commit_message TEXT,
|
||||
branch VARCHAR(255) NOT NULL DEFAULT 'main',
|
||||
trigger VARCHAR(20) NOT NULL,
|
||||
deployer VARCHAR(255),
|
||||
services TEXT[],
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'running',
|
||||
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
finished_at TIMESTAMPTZ,
|
||||
duration_s NUMERIC(10,2)
|
||||
);
|
||||
|
||||
-- One row per service per deploy
|
||||
CREATE TABLE IF NOT EXISTS deploy_tracking.deploy_services (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
deployment_id BIGINT NOT NULL REFERENCES deploy_tracking.deployments(id) ON DELETE CASCADE,
|
||||
service_name VARCHAR(100) NOT NULL,
|
||||
build_duration_s NUMERIC(10,2),
|
||||
image_size_mb NUMERIC(10,2),
|
||||
startup_time_s NUMERIC(10,2),
|
||||
health_status VARCHAR(10),
|
||||
health_http_code INTEGER
|
||||
);
|
||||
|
||||
-- Indexes
|
||||
CREATE INDEX IF NOT EXISTS idx_deployments_started_at ON deploy_tracking.deployments (started_at DESC);
|
||||
CREATE INDEX IF NOT EXISTS idx_deployments_status ON deploy_tracking.deployments (status);
|
||||
CREATE INDEX IF NOT EXISTS idx_deploy_services_deployment_id ON deploy_tracking.deploy_services (deployment_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_deploy_services_service_name ON deploy_tracking.deploy_services (service_name);
|
||||
Loading…
Add table
Add a link
Reference in a new issue