@zigordev/stack 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -85,13 +85,13 @@ The three mounts let the agent read the machine's numbers. It runs as a user tha
85
85
 
86
86
  ### Dashboards and alert rules
87
87
 
88
- `zigordev-stack up` ends by pushing seven files to the local Grafana, with gcx: one folder, two dashboards and four alert rules. A second push changes nothing.
88
+ `zigordev-stack up` ends by pushing nine files to the local Grafana, with gcx: one folder, two dashboards and six alert rules. A second push changes nothing.
89
89
 
90
- | In Grafana | What it shows |
91
- | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
92
- | Dashboards, folder `zigordev`, App | One app, picked from a list: whether it reports, its version, its requests, the share that fail, its response times, its events and its errors |
93
- | Dashboards, folder `zigordev`, Platform | The machine's processor, memory and disks, the requests at the ingress, and who is reporting |
94
- | Alerting, four rules | [The runbooks](../docs/runbooks/README.md) list them. On the laptop they show in Grafana and notify nobody |
90
+ | In Grafana | What it shows |
91
+ | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
92
+ | Dashboards, folder `zigordev`, App | One app, picked from a list: whether it reports, its version, its requests, the share that fail, its response times, its events and its errors |
93
+ | Dashboards, folder `zigordev`, Platform | The machine's processor, memory and disks, the requests at the ingress, who is reporting, and how old each product's newest dump and last good restore test are |
94
+ | Alerting, six rules | [The runbooks](../docs/runbooks/README.md) list them. On the laptop they show in Grafana and notify nobody |
95
95
 
96
96
  A new app needs no entry anywhere. It appears in the list of the App dashboard with its first request, and every rule covers it.
97
97
 
@@ -145,6 +145,7 @@ The host starts `compose.yaml` with `compose.production.yaml`, through the deplo
145
145
  | How an app outside a container reports | To `127.0.0.1:4318`, the agent's port published on the laptop itself | Every app runs in a container, so the port is not published |
146
146
  | Where the agent sends | To `lgtm`, with a made-up name and password that nothing checks | To Grafana Cloud, with the secrets that `.env.production.example` names. Traces and metrics go to `${GRAFANA_OTLP_URL}/otlp`, and logs to `${GRAFANA_LOKI_URL}/loki/api/v1/push`, because the stored addresses carry no path |
147
147
  | Each container's memory | No file, so the agent reads none | The host's file `/var/lib/platform/metrics/containers.prom`, which a timer writes every minute |
148
+ | The backups' results | No file, so the agent reads none | The host's files `/var/lib/platform/metrics/backup-dump.prom` and `backup-restore-test.prom`, which the backup script writes after each run |
148
149
  | Grafana and the mail catcher | `lgtm` and `mailpit` | Grafana Cloud and Amazon SES |
149
150
  | The ingress's own pages | At `traefik.localhost` | Off |
150
151
  | The proxy's group | 0, which owns the socket on Docker Desktop | The group that owns the socket on the host, which the deploy passes as `DOCKER_SOCKET_GROUP` |
package/compose.yaml CHANGED
@@ -214,7 +214,7 @@ services:
214
214
 
215
215
  rule {
216
216
  source_labels = ["__name__", "mode", "fstype"]
217
- regex = "alloy_build_info;;|node_cpu_seconds_total;idle;|node_memory_(MemTotal|MemAvailable)_bytes;;|node_filesystem_(size|avail)_bytes;;(ext4|xfs)|container_(memory_working_set|spec_memory_limit)_bytes;;"
217
+ regex = "alloy_build_info;;|node_cpu_seconds_total;idle;|node_memory_(MemTotal|MemAvailable)_bytes;;|node_filesystem_(size|avail)_bytes;;(ext4|xfs)|container_(memory_working_set|spec_memory_limit)_bytes;;|platform_backup_(last_success_timestamp_seconds|size_bytes);;|platform_restore_test_(last_success_timestamp_seconds|tables);;"
218
218
  action = "keep"
219
219
  }
220
220
 
@@ -0,0 +1,60 @@
1
+ {
2
+ "apiVersion": "rules.alerting.grafana.app/v1beta1",
3
+ "kind": "AlertRule",
4
+ "metadata": {
5
+ "name": "backup-is-too-old",
6
+ "annotations": {
7
+ "grafana.app/folder": "zigordev"
8
+ }
9
+ },
10
+ "spec": {
11
+ "title": "A backup is too old",
12
+ "trigger": {
13
+ "interval": "1m"
14
+ },
15
+ "for": "5m",
16
+ "noDataState": "Ok",
17
+ "execErrState": "Error",
18
+ "labels": {
19
+ "severity": "email"
20
+ },
21
+ "annotations": {
22
+ "summary": "The newest dump of {{ $labels.compose_project }} is more than 2 hours old, so more than an hour of its data could be lost",
23
+ "runbook_url": "https://github.com/zigordev/platform/blob/main/docs/runbooks/backup-is-too-old.md",
24
+ "__dashboardUid__": "platform",
25
+ "__panelId__": "12"
26
+ },
27
+ "expressions": {
28
+ "A": {
29
+ "datasourceUID": "prometheus",
30
+ "relativeTimeRange": {
31
+ "from": "10m",
32
+ "to": "0s"
33
+ },
34
+ "model": {
35
+ "refId": "A",
36
+ "expr": "(time() - max by (compose_project) (platform_backup_last_success_timestamp_seconds)) > 7200",
37
+ "instant": true
38
+ }
39
+ },
40
+ "B": {
41
+ "source": true,
42
+ "model": {
43
+ "refId": "B",
44
+ "type": "threshold",
45
+ "expression": "A",
46
+ "conditions": [
47
+ {
48
+ "evaluator": {
49
+ "type": "gt",
50
+ "params": [
51
+ 0
52
+ ]
53
+ }
54
+ }
55
+ ]
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "apiVersion": "rules.alerting.grafana.app/v1beta1",
3
+ "kind": "AlertRule",
4
+ "metadata": {
5
+ "name": "restore-test-is-too-old",
6
+ "annotations": {
7
+ "grafana.app/folder": "zigordev"
8
+ }
9
+ },
10
+ "spec": {
11
+ "title": "A restore test is too old",
12
+ "trigger": {
13
+ "interval": "1m"
14
+ },
15
+ "for": "0s",
16
+ "noDataState": "Ok",
17
+ "execErrState": "Error",
18
+ "labels": {
19
+ "severity": "email"
20
+ },
21
+ "annotations": {
22
+ "summary": "The last good restore test of {{ $labels.compose_project }} is more than 35 days old, so nobody knows whether its dumps restore",
23
+ "runbook_url": "https://github.com/zigordev/platform/blob/main/docs/runbooks/restore-test-is-too-old.md",
24
+ "__dashboardUid__": "platform",
25
+ "__panelId__": "13"
26
+ },
27
+ "expressions": {
28
+ "A": {
29
+ "datasourceUID": "prometheus",
30
+ "relativeTimeRange": {
31
+ "from": "10m",
32
+ "to": "0s"
33
+ },
34
+ "model": {
35
+ "refId": "A",
36
+ "expr": "(time() - max by (compose_project) (platform_restore_test_last_success_timestamp_seconds)) > 3024000",
37
+ "instant": true
38
+ }
39
+ },
40
+ "B": {
41
+ "source": true,
42
+ "model": {
43
+ "refId": "B",
44
+ "type": "threshold",
45
+ "expression": "A",
46
+ "conditions": [
47
+ {
48
+ "evaluator": {
49
+ "type": "gt",
50
+ "params": [
51
+ 0
52
+ ]
53
+ }
54
+ }
55
+ ]
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
@@ -546,6 +546,105 @@
546
546
  "refId": "A"
547
547
  }
548
548
  ]
549
+ },
550
+ {
551
+ "type": "row",
552
+ "collapsed": false,
553
+ "id": 0,
554
+ "panels": [],
555
+ "title": "Backups",
556
+ "gridPos": {
557
+ "x": 0,
558
+ "y": 39,
559
+ "h": 1,
560
+ "w": 24
561
+ }
562
+ },
563
+ {
564
+ "type": "timeseries",
565
+ "transparent": false,
566
+ "repeatDirection": "h",
567
+ "options": {
568
+ "legend": {
569
+ "displayMode": "list",
570
+ "placement": "bottom",
571
+ "showLegend": false,
572
+ "calcs": []
573
+ },
574
+ "tooltip": {
575
+ "mode": "single",
576
+ "sort": "asc"
577
+ }
578
+ },
579
+ "fieldConfig": {
580
+ "defaults": {
581
+ "custom": {},
582
+ "unit": "s"
583
+ },
584
+ "overrides": []
585
+ },
586
+ "id": 12,
587
+ "title": "Age of the newest dump, by product",
588
+ "datasource": {
589
+ "type": "prometheus",
590
+ "uid": "prometheus"
591
+ },
592
+ "gridPos": {
593
+ "h": 8,
594
+ "w": 12,
595
+ "x": 0,
596
+ "y": 40
597
+ },
598
+ "targets": [
599
+ {
600
+ "expr": "time() - max by (compose_project) (platform_backup_last_success_timestamp_seconds)",
601
+ "legendFormat": "{{compose_project}}",
602
+ "refId": "A"
603
+ }
604
+ ]
605
+ },
606
+ {
607
+ "type": "timeseries",
608
+ "transparent": false,
609
+ "repeatDirection": "h",
610
+ "options": {
611
+ "legend": {
612
+ "displayMode": "list",
613
+ "placement": "bottom",
614
+ "showLegend": false,
615
+ "calcs": []
616
+ },
617
+ "tooltip": {
618
+ "mode": "single",
619
+ "sort": "asc"
620
+ }
621
+ },
622
+ "fieldConfig": {
623
+ "defaults": {
624
+ "custom": {},
625
+ "unit": "s"
626
+ },
627
+ "overrides": []
628
+ },
629
+ "id": 13,
630
+ "title": "Age of the last good restore test, by product",
631
+ "datasource": {
632
+ "type": "prometheus",
633
+ "uid": "prometheus"
634
+ },
635
+ "gridPos": {
636
+ "h": 8,
637
+ "w": 12,
638
+ "x": 12,
639
+ "y": 40
640
+ },
641
+ "targets": [
642
+ {
643
+ "expr": "time() - max by (compose_project) (platform_restore_test_last_success_timestamp_seconds)",
644
+ "legendFormat": "{{compose_project}}",
645
+ "refId": "A"
646
+ }
647
+ ]
549
648
  }
550
649
  ]
551
650
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zigordev/stack",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "The shared services of the zigordev platform for a laptop: the ingress, the telemetry agent, a local Grafana and a mail catcher, as compose files with one command that starts them",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",