@leverege/build-tools 2.83.2 → 2.83.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.83.2",
3
+ "version": "2.83.4",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -75,13 +75,13 @@
75
75
  "glob": "^11.0.3",
76
76
  "handlebars": "^4.7.8",
77
77
  "ignore": "^7.0.5",
78
- "inquirer": "^12.9.3",
78
+ "inquirer": "^12.9.4",
79
79
  "js-yaml": "^4.1.0",
80
80
  "jsdoc": "^4.0.4",
81
81
  "ms": "^2.1.3",
82
82
  "npm-registry-fetch": "^19.0.0",
83
83
  "ora": "^8.2.0",
84
- "p-limit": "^7.1.0",
84
+ "p-limit": "^7.1.1",
85
85
  "package-up": "^5.0.0",
86
86
  "readline-sync": "^1.4.10",
87
87
  "semver": "^7.7.2",
@@ -93,6 +93,6 @@
93
93
  },
94
94
  "devDependencies": {
95
95
  "@leverege/eslint-config-leverege": "^5.0.1",
96
- "npm": "^11.5.2"
96
+ "npm": "^11.6.0"
97
97
  }
98
98
  }
package/src/bash-funcs CHANGED
@@ -61,7 +61,8 @@ ERREXIT
61
61
  }
62
62
 
63
63
  function exitOnError() {
64
- [ $1 -ne 0 ] && errorExit "$2"
64
+ (( $1 )) && errorExit "$2"
65
+ return 0 # reset that pesky $?
65
66
  }
66
67
 
67
68
  function yesOrSkipToContinue() {
@@ -153,7 +154,8 @@ REPOADD
153
154
  # *** DEPRECATED *** REMOVE AFTER BITNAMI ERADICATED ***
154
155
  # *** DEPRECATED *** REMOVE AFTER BITNAMI ERADICATED ***
155
156
  #
156
- function addBitnamiRepoDEPRECATED() {
157
+ function addBitnamiRepo() {
158
+ warning '*** the addBitnamiRepo function should be removed - DEPRECATED ***'
157
159
  if [ ! -z "$BITNAMI_LATEST" ] || [ "$1" == "latest" ];
158
160
  then
159
161
  BITNAMI_URL="https://charts.bitnami.com/bitnami"
@@ -92,8 +92,18 @@ USER root
92
92
 
93
93
  RUN set -xe; \\
94
94
  apt-get update; \\
95
+ apt-get install -y --no-install-recommends ca-certificates gnupg wget; \\
96
+ . /etc/os-release; \
97
+ install -d /usr/share/keyrings; \
98
+ wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc \\
99
+ | gpg --dearmor -o /usr/share/keyrings/postgresql.gpg; \\
100
+ echo "deb [signed-by=/usr/share/keyrings/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt \${VERSION_CODENAME}-pgdg main" \\
101
+ > /etc/apt/sources.list.d/pgdg.list; \\
102
+ apt-get update; \\
95
103
  apt-get install -y --no-install-recommends \\
96
- "postgresql-\${PG_MAJOR}-jsquery"; \\
104
+ "postgresql-\${PG_MAJOR}-jsquery" \\
105
+ "postgresql-\${PG_MAJOR}-repack"; \\
106
+ ln -s /usr/lib/postgresql/\${PG_MAJOR}/bin/pg_repack /usr/local/bin/pg_repack || true; \\
97
107
  rm -fr /tmp/*; \\
98
108
  rm -rf /var/lib/apt/lists/*;
99
109
 
@@ -16,6 +16,7 @@ import {
16
16
  errorExit,
17
17
  log,
18
18
  mkdirSafe,
19
+ proceed,
19
20
  shellCmd,
20
21
  warning,
21
22
  } from './Utils.mjs'
@@ -295,6 +296,8 @@ const main = async () => {
295
296
 
296
297
  if ( dryRun ) {
297
298
  warning( 'Dry run enabled — no gcloud commands will run.' )
299
+ } else {
300
+ await proceed( `\n\n***NOTE => Your k8s context ${chalk.red( 'MUST NOT BE CHANGED WHILE THIS RUNS!!!!' )}` )
298
301
  }
299
302
 
300
303
  // STEP 1: Resolve volume handle from k8s VolumeSnapshotContent
@@ -383,12 +386,6 @@ const main = async () => {
383
386
  ] )
384
387
 
385
388
  await emitCloningArtifacts()
386
-
387
- log( `
388
- ✅ Done. Snapshot: ${chalk.cyan( destSnapshot )}
389
- Recovery YAMLs written to: ${chalk.cyan( emitYamlDir )}
390
- Run '${chalk.yellow( './apply-volumesnapshots.sh' )}' to prep the cluster for recovery.
391
- ` )
392
389
  }
393
390
 
394
391
  const cleanupResources = async () => {
@@ -448,4 +445,11 @@ if ( cleanup ) {
448
445
  await cleanupResources()
449
446
  }
450
447
 
451
- log( chalk.green( ` [✓] Cloning complete - recovery image name is => ${chalk.bold.yellow( k8sSnapshotName )}\n` ) )
448
+ const emitYamlCommand = `${emitYamlDir}/apply-volumesnapshots.sh`
449
+ log( `
450
+ ✅ Cloning Operation Complete!
451
+
452
+ Move recovery YAML dir ${chalk.cyan( emitYamlDir )} to the target project branch
453
+ From the target, run ${chalk.yellow( emitYamlCommand )} to prep the cluster for recovery
454
+ CNPG recovery image name is => ${chalk.bold.yellow( k8sSnapshotName )}
455
+ ` )
@@ -16,6 +16,14 @@ spec:
16
16
  annotations:
17
17
  summary: "Velero schedule {{ $labels.schedule }} backup failed to execute properly"
18
18
  description: "It has been over 30 hours since the last successful backup"
19
+ - alert: VeleroBackupEmpty
20
+ expr: velero_backup_items_total{schedule=~"velero-.*"} == 0
21
+ for: 25h # 5m for testing
22
+ labels:
23
+ severity: warning
24
+ annotations:
25
+ summary: "Velero schedule {{ $labels.schedule }} backed up 0 items - check PVC labels"
26
+ description: "The backup schedule {{ $labels.schedule }} is misconfigured"
19
27
  - alert: NoVeleroBackups
20
28
  expr: velero_backup_success_total{schedule!=""} == 0
21
29
  for: 30h
@@ -6,6 +6,14 @@ config:
6
6
 
7
7
  # CNPG override
8
8
  MODELS_SEQUELIZE_HOST: "cnpg-db-psql-stack-rw.cnpg-operands" # vs postgres-postgresql
9
+ # MODELS_SEQUELIZE_HOST: "cnpg-db-psql-stack-pool-rw.cnpg-operands" # cnpg pooled (pgbouncer)
10
+
11
+ # Limit the SQL connections from the defaults of 10
12
+ MODELS_SEQUELIZE_POOL_CONNECTION_LIMIT: "1" # max connection prob
13
+ MODELS_SEQUELIZE_POOL_MAX_CONNECTIONS: "1" # max connection prob
14
+
15
+ SQL_POOL_CONNECTION_LIMIT: "1" # max connection prob
16
+ SQL_POOL_MAX_CONNECTION: "1" # max connection prob
9
17
 
10
18
  serviceMonitor:
11
19
  enabled: true
@@ -32,18 +32,42 @@ metrics:
32
32
  interval: 30s
33
33
  namespace: prometheus
34
34
 
35
+ # To enable the trafik dashboard uncomment the --api-secure switch, uncomment
36
+ # the ports statment and the first block that defines the traefik port at 9000.
37
+ # Redploy traefik and once it is stable port-forward:
38
+ # kubectl port-forward -n traefik deployment/traefik 9000:9000
39
+ # and open the dashboard on a browser:
40
+ # http://localhost:9000/dashboard/
41
+ # For more info:
42
+ # https://doc.traefik.io/traefik/operations/api/
43
+ #
35
44
  additionalArguments:
36
- # this will enable the dashboard on port 8080 in v3 - https://doc.traefik.io/traefik/operations/api/
37
- - "--api.insecure=true"
45
+ # - "--api.insecure=true" # uncomment for dashboard
46
+
47
+ # enable read response timeouts
38
48
  # - "--entrypoints.web.transport.respondingTimeouts.readTimeout=300"
39
49
 
40
- # Custom entry points may be added here - the first two are port definitions
50
+ # Custom entry points may be added here - the first one is for the traefik
51
+ # dashboard (see comment above)two are port definitions
41
52
  # for both unsecured and secured MQTT ports used by connect. Note that the
42
53
  # mqtts port has TLS termination performed by traefik and both ports are then
43
54
  # forwarded to one open port (1883) on the target service. The vernemq service
44
55
  # chart provides the IngressRouteTCP chart to make this happen.
45
56
  #
46
57
  #ports:
58
+ # traefik: # dashboard access!
59
+ # port: 9000
60
+ # expose:
61
+ # default: true
62
+ # eposedPort: 9000
63
+ # protocol: TCP
64
+ #
65
+ # These port definitions are for both unsecured and secured MQTT ports used by
66
+ # connect. Note that the mqtts port has TLS termination performed by traefik
67
+ # and both ports are then forwarded to one open port (1883) on the target
68
+ # service. The vernemq service chart provides the IngressRouteTCP chart to make
69
+ # this happen.
70
+ #
47
71
  # websecure:
48
72
  # forwardedHeaders:
49
73
  # insecure: true # enables true source IP of request
@@ -55,6 +55,7 @@ cat<<DONE_VELERO
55
55
  `color y 'Wait at least 1 minute before kicking off the following backups:'`
56
56
 
57
57
  `color g 'velero backup create --from-schedule velero-full'`
58
+ `color g 'velero backup create --from-schedule velero-es8'`
58
59
  `color g 'velero backup create --from-schedule velero-psql'`
59
60
  `color g 'velero backup create --from-schedule velero-tsdb'`
60
61
 
@@ -65,6 +66,8 @@ cat<<DONE_VELERO
65
66
 
66
67
  `color g 'overwhelm && velero get backups'`
67
68
 
69
+ `color y 'prom-operator metrics are enabled by default (serviceMonitor)'`
70
+
68
71
  DONE_VELERO
69
72
 
70
73
  removeHelmRepo vmware-tanzu
@@ -2,7 +2,40 @@
2
2
  # Backup schedules to create.
3
3
  #
4
4
  schedules:
5
- psql:
5
+ cnpg-psql:
6
+ disabled: true
7
+ schedule: "0 7 * * *"
8
+ template:
9
+ ttl: "720h"
10
+ snapshotVolumes: true
11
+ labelSelector:
12
+ matchLabels:
13
+ cnpg.io/cluster: "cnpg-db-psql-stack"
14
+ cnpg.io/instanceRole: "primary"
15
+
16
+ cnpg-tsdb:
17
+ disabled: true
18
+ schedule: "0 7 * * *"
19
+ template:
20
+ ttl: "720h"
21
+ snapshotVolumes: true
22
+ labelSelector:
23
+ matchLabels:
24
+ cnpg.io/cluster: "cnpg-db-tsdb-basic"
25
+ cnpg.io/instanceRole: "primary"
26
+
27
+ cnpg-dense:
28
+ disabled: true
29
+ schedule: "0 7 * * *"
30
+ template:
31
+ ttl: "720h"
32
+ snapshotVolumes: true
33
+ labelSelector:
34
+ matchLabels:
35
+ cnpg.io/cluster: "cnpg-db-tsdb-dense"
36
+ cnpg.io/instanceRole: "primary"
37
+
38
+ psql: # legacy non-cnpg
6
39
  disabled: false
7
40
  schedule: "0 7 * * *"
8
41
  template:
@@ -10,10 +43,23 @@ schedules:
10
43
  snapshotVolumes: true
11
44
  labelSelector:
12
45
  matchLabels:
13
- release: "postgres"
14
- app: "postgresql"
46
+ app.kubernetes.io/instance: "postgres"
47
+ app.kubernetes.io/name: "postgresql"
48
+ role: "primary"
15
49
 
16
- elasticsearch:
50
+ psql-scheduler: # legacy non-cnpg
51
+ disabled: true # enable on recovr
52
+ schedule: "0 7 * * *"
53
+ template:
54
+ ttl: "720h"
55
+ snapshotVolumes: true
56
+ labelSelector:
57
+ matchLabels:
58
+ app.kubernetes.io/instance: scheduler-psql
59
+ app.kubernetes.io/name: postgresql
60
+ role: primary
61
+
62
+ es8:
17
63
  disabled: false
18
64
  schedule: "0 6 * * *"
19
65
  template:
@@ -23,7 +69,7 @@ schedules:
23
69
  matchLabels:
24
70
  app.kubernetes.io/name: elasticsearch
25
71
 
26
- tsdb:
72
+ tsdb: # legacy non-cnpg
27
73
  disabled: false
28
74
  schedule: "0 8 * * *"
29
75
  template:
@@ -40,17 +86,6 @@ schedules:
40
86
  template:
41
87
  ttl: "168h"
42
88
 
43
- mysql:
44
- disabled: true
45
- schedule: "0 4 * * *"
46
- template:
47
- ttl: "720h"
48
- snapshotVolumes: true
49
- labelSelector:
50
- matchLabels:
51
- release: "mysql"
52
- app: "mysql"
53
-
54
89
  redis:
55
90
  disabled: true
56
91
  schedule: "*/30 * * * *"