@leverege/build-tools 2.51.0-beta.2 → 2.51.1

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.
Files changed (35) hide show
  1. package/package.json +11 -12
  2. package/registry-compass.yaml +20 -0
  3. package/src/Utils.mjs +3 -1
  4. package/src/bash-funcs +5 -1
  5. package/src/chart-compass.mjs +96 -0
  6. package/src/circleate.sh +0 -1
  7. package/src/dockreate.sh +2 -2
  8. package/src/git-tar.sh +10 -3
  9. package/src/helm-charts/api-server/values-local.yaml +6 -0
  10. package/src/helm-charts/authz-server/values-local.yaml +5 -0
  11. package/src/helm-charts/cnpg-db-psql-stack/cluster.yaml.ovh +25 -12
  12. package/src/helm-charts/cnpg-db-tsdb-basic/cluster.yaml.ovh +11 -7
  13. package/src/helm-charts/cnpg-db-tsdb-dense/cluster.yaml.ovh +5 -5
  14. package/src/helm-charts/cnpg-operator/helmup.plugin +14 -6
  15. package/src/helm-charts/elasticsearch8/helmup.plugin +3 -2
  16. package/src/helm-charts/grafana/grafana-local.yaml.ovh +1 -2
  17. package/src/helm-charts/grafana/helmup.plugin +1 -1
  18. package/src/helm-charts/postgres/helmup.plugin +6 -3
  19. package/src/helm-charts/prometheus-operator/.nohelm +0 -0
  20. package/src/helm-charts/{kube-prometheus-stack → prometheus-operator}/helmup.plugin +3 -2
  21. package/src/helm-charts/prometheus-operator/prometheus-stack.yaml +59 -0
  22. package/src/helm-charts/redis/helmup.plugin +1 -1
  23. package/src/helm-charts/redis/redis-local.yaml +10 -0
  24. package/src/helm-charts/resource-server/values-local.yaml +3 -1
  25. package/src/helm-charts/rule-engine/values-local.yaml +1 -1
  26. package/src/helm-charts/traefik/helmup.plugin +5 -1
  27. package/src/helm-charts/transponder-dh/values-local.yaml +2 -2
  28. package/src/helm-charts/transponder-tsdb/values-local.yaml +3 -0
  29. package/src/helm-charts/velero/helmup.plugin +1 -1
  30. package/src/helm-charts/velero/velero-local.yaml +2 -1
  31. package/src/helmup.sh +45 -5
  32. package/src/k8scale.sh +10 -2
  33. package/src/overwhelm.mjs +20 -6
  34. package/src/documentate.sh +0 -38
  35. /package/src/helm-charts/{kube-prometheus-stack → prometheus-operator}/old-values-local.yaml +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.51.0-beta.2",
3
+ "version": "2.51.1",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -20,7 +20,6 @@
20
20
  "decrypt-secrets": "src/decrypt-secrets.sh",
21
21
  "dirty-git": "src/dirty-git.sh",
22
22
  "dockreate": "src/dockreate.sh",
23
- "documentate" : "src/documentate.sh",
24
23
  "docker-to-registry": "src/docker-to-registry.mjs",
25
24
  "docker-to-registry.sh": "src/docker-to-registry.sh",
26
25
  "encrypt-secrets": "src/encrypt-secrets.sh",
@@ -58,27 +57,27 @@
58
57
  "@google-cloud/artifact-registry": "^3.4.0",
59
58
  "ansi-colors": "^4.1.3",
60
59
  "chalk": "^5.3.0",
61
- "command-line-args": "^5.2.1",
62
- "command-line-usage": "^7.0.1",
60
+ "command-line-args": "^6.0.0",
61
+ "command-line-usage": "^7.0.3",
63
62
  "deepmerge": "^4.3.1",
64
63
  "enquirer": "^2.4.1",
65
- "execa": "^9.1.0",
66
- "glob": "^10.3.16",
64
+ "execa": "^9.3.1",
65
+ "glob": "^11.0.0",
67
66
  "handlebars": "^4.7.8",
68
- "inquirer": "^9.2.22",
67
+ "inquirer": "^10.2.2",
69
68
  "js-yaml": "^4.1.0",
70
69
  "ms": "^2.1.3",
71
- "npm-registry-fetch": "^17.0.1",
70
+ "npm-registry-fetch": "^17.1.0",
72
71
  "package-up": "^5.0.0",
73
72
  "parse-gitignore": "^2.0.0",
74
73
  "read-pkg": "^9.0.1",
75
74
  "readline-sync": "^1.4.10",
76
- "semver": "^7.6.2",
77
- "simple-git": "^3.24.0",
78
- "zx": "^8.1.1"
75
+ "semver": "^7.6.3",
76
+ "simple-git": "^3.26.0",
77
+ "zx": "^8.1.6"
79
78
  },
80
79
  "devDependencies": {
81
80
  "@leverege/eslint-config-leverege": "^4.2.0",
82
- "npm": "^10.8.0"
81
+ "npm": "^10.8.3"
83
82
  }
84
83
  }
@@ -0,0 +1,20 @@
1
+ registry:
2
+ - root: us-docker.pkg.dev
3
+ - repositories:
4
+ - name: stack
5
+ charts:
6
+ - api-server
7
+ - authz-server
8
+ - emailer
9
+ - message-processor
10
+ - name: leverege
11
+ charts:
12
+ - pubsub-pulse
13
+ - pusher
14
+ - overdose
15
+ - name: cox-health
16
+ charts:
17
+ - actions-server
18
+ - analytics-server
19
+ - centrak-healthz
20
+ - centrak-ingestor
package/src/Utils.mjs CHANGED
@@ -7,7 +7,9 @@ import { glob } from 'glob'
7
7
  import { packageUp } from 'package-up'
8
8
  import YAML from 'js-yaml'
9
9
 
10
- const debugEnabled = process.env.BUILD_TOOLS_DEBUG === '1'
10
+ let debugEnabled = process.env.BUILD_TOOLS_DEBUG === '1'
11
+
12
+ export const disableDebug = () => debugEnabled = false
11
13
 
12
14
  /* eslint-disable no-console */
13
15
  export const err = console.error
package/src/bash-funcs CHANGED
@@ -29,8 +29,12 @@ RED_ERROR=`color r '***ERROR:'`
29
29
  YELO_WARN="`color y '***WARNING:'`"
30
30
  GREEN_INFO=`color g '***INFO:'`
31
31
 
32
+ function clearScreen() {
33
+ [ "$BUILD_TOOLS_DEBUG" != "1" ] && clear
34
+ }
35
+
32
36
  function clearlyWarn() {
33
- [ -z "$1" ] && clear
37
+ clearScreen
34
38
  cat<<CLEARWARN
35
39
 
36
40
  `color y '*** WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***'`
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env node
2
+ /*
3
+ * chart-to-registry will...
4
+ */
5
+ import fs from 'node:fs'
6
+
7
+ import chalk from 'chalk'
8
+ import commandLineArgs from 'command-line-args'
9
+ import commandLineUsage from 'command-line-usage'
10
+ import { lt as semverLt } from 'semver'
11
+ import YAML from 'js-yaml'
12
+
13
+ import {
14
+ condir,
15
+ debug,
16
+ errorExit,
17
+ log,
18
+ warning,
19
+ getGitRootDirectory,
20
+ parsePackageJson,
21
+ parseHelmChart,
22
+ shellCmd } from './Utils.mjs'
23
+
24
+ const commandLineOptions = [ // Use commandLineOptions to tie into the Usage statements
25
+ /* eslint-disable max-len */
26
+ {
27
+ name : 'location',
28
+ type : String,
29
+ description : '{green the location of the artifact registry the chart will be pushed to (default us-docker.pkg.dev)}',
30
+ },
31
+ {
32
+ name : 'project',
33
+ type : String,
34
+ description : '{green the name of the google project containing the npmrc and slack config secrets (default leverege-registry)}',
35
+ },
36
+ {
37
+ name : 'repository',
38
+ type : String,
39
+ description : '{green the target repository to receive the pushed chart}',
40
+ },
41
+ {
42
+ name : 'dry-run',
43
+ type : Boolean,
44
+ description : '{yellow perform everything except the actual chart push}',
45
+ },
46
+ {
47
+ name : 'help',
48
+ type : Boolean,
49
+ description : '{green display this help screen}',
50
+ },
51
+ /* eslint-enable max-len */
52
+ ]
53
+
54
+ const sections = [
55
+ {
56
+ header : 'Leverege Helm Chart Compass (for helmup)',
57
+ content : `{green This tool helps helmup navigate the helm charts stored in the
58
+ artifact-registries.}`
59
+ },
60
+ { header : 'Options',
61
+ optionList : commandLineOptions,
62
+ },
63
+ ]
64
+
65
+ const args = commandLineArgs( commandLineOptions, { camelCase : true, partial : true } )
66
+ const usage = commandLineUsage( sections )
67
+
68
+ if ( args.help ) {
69
+ log( usage )
70
+ process.exit( 0 )
71
+ }
72
+
73
+ /* eslint-disable no-underscore-dangle */
74
+ if ( args._unknown ) {
75
+ log( usage )
76
+ log( `\nUnrecognized argument [${chalk.bold.red( args._unknown )}]\n` )
77
+ process.exit( 1 )
78
+ }
79
+ /* eslint-enable no-underscore-dangle */
80
+
81
+ const minNodejsVersion = '18.0.0'
82
+ if ( semverLt( process.version, minNodejsVersion ) ) {
83
+ errorExit( `\n***ERROR: must be running at least node ${minNodejsVersion}\n` )
84
+ }
85
+
86
+ // First of all, fail if we are not in a git repository
87
+ let gitRoot
88
+ try {
89
+ gitRoot = await getGitRootDirectory()
90
+ } catch ( error ) {
91
+ errorExit( chalk.red.bold( error ), { errorCode : 5 } )
92
+ }
93
+
94
+ const chartCompass = YAML.load( fs.readFileSync( './registry-compass.yaml', 'utf8' ) )
95
+
96
+ condir( { chartCompass }, '<==Navigation' )
package/src/circleate.sh CHANGED
@@ -10,7 +10,6 @@ if [ "$1" != "server" ] && [ "$1" != "ui" ] && [ "$1" != "lib" ]; then
10
10
  fi
11
11
 
12
12
  repo_type=$1
13
- NODE_VERSION="hydrogen"
14
13
  CIRCLE_NODE_IMG="cimg/node:lts"
15
14
 
16
15
  check_circle_config(){
package/src/dockreate.sh CHANGED
@@ -98,7 +98,7 @@ DOCKERPLUGIN
98
98
  # $3 = additional packages to install (htop redis-cli etc)
99
99
  create_Dockerfile() {
100
100
  local regvers="${1}"
101
- local nodeimg="${2:-hydrogen-alpine}"
101
+ local nodeimg="${2:-iron-alpine}"
102
102
  local apkadds="${3}"
103
103
 
104
104
  create_DockerfilePlugin
@@ -236,7 +236,7 @@ fi
236
236
 
237
237
  # TODO: these should be combined into one require
238
238
  nodeimg=$(packageJson '.leverege.nodeimg')
239
- nodeimg="${nodeimg:-hydrogen-alpine}"
239
+ nodeimg="${nodeimg:-iron-alpine}"
240
240
  apkadds=$(packageJson '.leverege.apkadds')
241
241
  runuser=$(packageJson '.leverege.runuser')
242
242
  [ -z "${runuser}" ] && runuser='node'
package/src/git-tar.sh CHANGED
@@ -1,5 +1,8 @@
1
1
  #!/bin/bash
2
2
 
3
+ # Load the standard helper functions
4
+ . `build-tools --bashfun`
5
+
3
6
  # If it isn't already set use the default ~/work/.gitar
4
7
  #
5
8
  [ -z $GITAR ] && GITAR="${HOME}/.gitar"
@@ -65,12 +68,13 @@ REPO=`basename ${GTOP}`
65
68
  #
66
69
  DTS="`date +\"%Y%m%d-%H%M%S\"`"
67
70
 
68
- TARB=${GITAR}/${REPO}/${DTS}.tar # Craft the target tarball name.
71
+ TARS=${GITAR}/${REPO}
72
+ TARB=${TARS}/${DTS}.tar # Craft the target tarball name.
69
73
 
70
74
  # Now do the work
71
75
  #
72
76
  cd ${GTOP}/..
73
- printf "\n*** Tarring $TARB\n"
77
+ printf "\n*** Tarring `color g $TARB`\n"
74
78
  tar cf $TARB -X $TARX $REPO
75
79
  chmod 0640 $TARB
76
80
 
@@ -84,6 +88,9 @@ then
84
88
  FIZ=xz
85
89
  fi
86
90
 
87
- printf "*** Compressing $TARB.$FIZ (background)\n\n"
91
+ printf "\n*** Compressing `color y $TARB.$FIZ` (background)\n"
88
92
  $ZIPPER $TARB &
93
+
94
+ printf "\n*** Tarballs in `color g ${TARS}`\n\n"
95
+ ls -lh ${TARS}
89
96
  cd - 2>&1 >/dev/null
@@ -1,3 +1,9 @@
1
+ # migrations
2
+ # v5.11.0+
3
+ # - k8x api-server pod
4
+ # - node tools/UpdateESComponentTemplateV2.js
5
+ # - node tools/UpdateESMappingV2.js
6
+ #
1
7
  image:
2
8
  tag: # v5.12.3
3
9
 
@@ -1,3 +1,8 @@
1
+ # migrations
2
+ # v2.1.0+
3
+ # - k8x authz-server
4
+ # - npm run sequelizeRunMigrations
5
+ #
1
6
  image:
2
7
  tag: # v2.1.3
3
8
 
@@ -7,30 +7,41 @@ metadata:
7
7
  namespace: cnpg-operands
8
8
  spec:
9
9
  instances: 1
10
- # logLevel: debug
10
+ logLevel: info # warning debug
11
+
12
+ monitoring:
13
+ enablePodMonitor: false # set true once monitoring is setup
11
14
 
12
15
  description: "Leverege Stack PostgreSQL DB"
13
- imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.2-cnpg-tsdb2-beta.4
16
+ imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.4-cnpg-tsdb2-rel.1
14
17
  bootstrap:
15
18
  initdb:
16
- database: models
19
+ # database: models # do not set - let it default to cnpg app db
17
20
  postInitSQL:
21
+ # - CREATE DATABASE app; # operator expects this
22
+ # - CREATE ROLE app; # and this to exist on restore
23
+ # create the stack databases
18
24
  - CREATE DATABASE authz;
19
25
  - CREATE DATABASE fota;
20
26
  - CREATE DATABASE geotile;
21
27
  - CREATE DATABASE models;
22
28
  - CREATE DATABASE scheduler;
23
- owner: imagine
24
- secret:
25
- name: cnpg-db-psql-stack-imagine-pw # imagine db pw
26
29
 
27
30
  enableSuperuserAccess: true
28
31
  superuserSecret:
29
32
  name: cnpg-db-psql-stack-postgres-pw # postgres db pw
30
33
 
31
34
  affinity:
32
- # enablePodAntiAffinity: true
33
- # topologyKey: kubernetes.io/hostname # default value
35
+ enablePodAntiAffinity: true
36
+ topologyKey: kubernetes.io/hostname # default value
37
+ nodeAffinity:
38
+ requiredDuringSchedulingIgnoredDuringExecution:
39
+ nodeSelectorTerms:
40
+ - matchExpressions:
41
+ - key: target-env
42
+ operator: In
43
+ values:
44
+ - database
34
45
  tolerations:
35
46
  - key: "database"
36
47
  operator: "Equal"
@@ -41,7 +52,7 @@ spec:
41
52
  # to the default ones to make the cluster work
42
53
  postgresql:
43
54
  parameters:
44
- max_connections: "123"
55
+ # max_connections: "100"
45
56
  # max_worker_processes: "60"
46
57
  # max_worker_processes: "8"
47
58
  # max_parallel_workers: "8"
@@ -70,7 +81,7 @@ spec:
70
81
  # size: 1Gi
71
82
 
72
83
  backup:
73
- retentionPolicy: 30d
84
+ retentionPolicy: 7d # don't think this does anything?
74
85
  volumeSnapshot:
75
86
  labels:
76
87
  snapshotOf: cnpg-db-psql-stack
@@ -83,6 +94,7 @@ spec:
83
94
  cnpgCluster: cnpg-db-psql-stack
84
95
  wal:
85
96
  compression: gzip
97
+ maxParallel: 4
86
98
  ---
87
99
  apiVersion: postgresql.cnpg.io/v1
88
100
  kind: ScheduledBackup
@@ -91,8 +103,9 @@ metadata:
91
103
  namespace: cnpg-operands
92
104
  spec:
93
105
  # https://pkg.go.dev/github.com/robfig/cron#hdr-CRON_Expression_Format
94
- schedule: "0 0 * * * *"
106
+ schedule: "0 0 */12 * * *"
95
107
  cluster:
96
- method: volumeSnapshot
108
+ name: cnpg-db-psql-stack
109
+ method: volumeSnapshot # barmanObjectStore
97
110
  backupOwnerReference: self
98
111
  immediate: true
@@ -13,16 +13,19 @@ spec:
13
13
  enablePodMonitor: false # set true once monitoring is setup
14
14
 
15
15
  description: "Leverege Plain Timescale DB"
16
- imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.2-cnpg-tsdb2-beta.4
16
+ imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.3-cnpg-tsdb2-beta.2
17
17
  bootstrap:
18
18
  initdb:
19
+ # database: imagine # let it default to cnpg app db
19
20
  postInitTemplateSQL:
20
21
  - CREATE EXTENSION timescaledb;
21
22
  - CREATE EXTENSION jsquery;
22
- database: imagine
23
- owner: imagine
24
- secret:
25
- name: cnpg-db-tsdb-basic-imagine-pw # imagine db pw
23
+ - CREATE DATABASE imagine
24
+ # - CREATE DATABASE app; # for the operator restores
25
+ # - CREATE ROLE app; # same
26
+ # owner: imagine
27
+ # secret:
28
+ # name: cnpg-db-tsdb-basic-imagine-pw # imagine db pw
26
29
 
27
30
  enableSuperuserAccess: true
28
31
  superuserSecret:
@@ -52,7 +55,7 @@ spec:
52
55
  - timescaledb
53
56
  - jsquery
54
57
  parameters:
55
- max_connections: "123"
58
+ # max_connections: "100"
56
59
  # max_worker_processes: "60"
57
60
  # max_worker_processes: "8"
58
61
  # max_parallel_workers: "8"
@@ -94,6 +97,7 @@ spec:
94
97
  cnpgCluster: cnpg-db-tsdb-basic
95
98
  wal:
96
99
  compression: gzip
100
+ maxParallel: 4
97
101
  ---
98
102
  apiVersion: postgresql.cnpg.io/v1
99
103
  kind: ScheduledBackup
@@ -105,6 +109,6 @@ spec:
105
109
  schedule: "0 0 */12 * * *"
106
110
  cluster:
107
111
  name: cnpg-db-tsdb-basic
108
- method: volumeSnapshot
112
+ method: volumeSnapshot # barmanObjectStore
109
113
  backupOwnerReference: self
110
114
  immediate: true
@@ -13,16 +13,15 @@ spec:
13
13
  enablePodMonitor: false # set true once monitoring is setup
14
14
 
15
15
  description: "Leverege Dense Timescale DB"
16
- imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.2-cnpg-tsdb2-beta.4
16
+ imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.3-cnpg-tsdb2-beta.2
17
17
  bootstrap:
18
18
  initdb:
19
19
  postInitTemplateSQL:
20
20
  - CREATE EXTENSION timescaledb;
21
21
  - CREATE EXTENSION jsquery;
22
- database: imagine
23
- owner: imagine
24
- secret:
25
- name: cnpg-db-tsdb-dense-imagine-pw # imagine db pw
22
+ - CREATE DATABASE imagine; # leverege tsdb db
23
+ # secret:
24
+ # name: cnpg-db-tsdb-dense-imagine-pw # imagine db pw
26
25
 
27
26
  enableSuperuserAccess: true
28
27
  superuserSecret:
@@ -93,6 +92,7 @@ spec:
93
92
  cnpgCluster: cnpg-db-tsdb-dense
94
93
  wal:
95
94
  compression: gzip
95
+ maxParallel: 4
96
96
  ---
97
97
  apiVersion: postgresql.cnpg.io/v1
98
98
  kind: ScheduledBackup
@@ -1,10 +1,18 @@
1
1
  #!/bin/bash
2
2
  #
3
- # See => https://github.com/cloudnative-pg/charts
4
- addHelmRepo cnpg https://cloudnative-pg.github.io/charts
3
+ # See => https://cloudnative-pg.io/documentation/current/installation_upgrade/
5
4
 
6
- helm upgrade --install cnpg cnpg/cloudnative-pg \
7
- --namespace cnpg-system --create-namespace \
8
- --set webhook.port="10250" $HELM_WHAT
5
+ OPVER="1.24.0"
9
6
 
10
- removeHelmRepo cnpg
7
+ kubectl apply --server-side -f \
8
+ https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-${OPVER%.*}/releases/cnpg-${OPVER}.yaml $K8S_WHAT
9
+
10
+ # Old approach used the helm chart.
11
+ #
12
+ #addHelmRepo cnpg https://cloudnative-pg.github.io/charts
13
+ #
14
+ #helm upgrade --install cnpg cnpg/cloudnative-pg \
15
+ # --namespace cnpg-system --create-namespace \
16
+ # --set webhook.port="10250" $HELM_WHAT
17
+ #
18
+ #removeHelmRepo cnpg
@@ -2,13 +2,14 @@
2
2
  #
3
3
  showInstalling "Elastic Search 8"
4
4
 
5
+ [ -z "$ELASTIC_CHART_VERSION" ] && ELASTIC_CHART_VERSION="21.3.10"
6
+
5
7
  OCI_CHART="oci://registry-1.docker.io/bitnamicharts/elasticsearch"
6
8
 
7
9
  LOCAL_ES_VALUES="elasticsearch8/elasticsearch-local-dev.yaml"
8
10
  #LOCAL_ES_VALUES="elasticsearch8/elasticsearch-local-prd.yaml"
9
11
  [ ! -f "$LOCAL_ES_VALUES" ] && exitOnError 1 "Missing the local ES config file => `color y $LOCAL_ES_VALUES`"
10
12
 
11
- [ -z "$ELASTIC_CHART_VERSION" ] && ELASTIC_CHART_VERSION="19.21.2"
12
13
  helm upgrade --install elasticsearch8 $OCI_CHART \
13
14
  --namespace elastic --create-namespace \
14
15
  --values $LOCAL_ES_VALUES \
@@ -18,7 +19,7 @@ helm upgrade --install elasticsearch8 $OCI_CHART \
18
19
  addHelmRepo prometheus-community https://prometheus-community.github.io/helm-charts
19
20
  helm upgrade --install elasticsearch8-exporter prometheus-community/prometheus-elasticsearch-exporter \
20
21
  --namespace monitoring --create-namespace \
21
- --version 5 \
22
+ --version 6 \
22
23
  -f - <<ELASTIC8_EXPORTER_CHART_MOD
23
24
  fullnameOverride: elasticsearch8-exporter
24
25
 
@@ -1,6 +1,5 @@
1
1
  # ONLY EDIT grafana-local.yaml.ovh / grafana-local.yaml is git ignored
2
2
  service:
3
- type: "NodePort"
4
3
  port: "9000"
5
4
 
6
5
  datasources:
@@ -39,7 +38,7 @@ tolerations:
39
38
  effect: "NoSchedule"
40
39
 
41
40
  extraObjects:
42
- - apiVersion: traefik.containo.us/v1alpha1
41
+ - apiVersion: traefik.io/v1alpha1
43
42
  kind: IngressRoute
44
43
  metadata:
45
44
  name: grafana
@@ -4,7 +4,7 @@ showInstalling "Grafana"
4
4
 
5
5
  addHelmRepo grafana https://grafana.github.io/helm-charts
6
6
 
7
- [ -z "$GRAFANA_CHART_VERSION" ] && GRAFANA_CHART_VERSION="7"
7
+ [ -z "$GRAFANA_CHART_VERSION" ] && GRAFANA_CHART_VERSION="8"
8
8
  helm upgrade --install grafana grafana/grafana \
9
9
  --namespace monitoring --create-namespace \
10
10
  --values grafana/grafana-local.yaml \
@@ -4,10 +4,13 @@ showInstalling "PostgreSQL Database"
4
4
 
5
5
  errorIfMissingSecret authz-postgres
6
6
 
7
- addBitnamiRepo # latest
7
+ # addBitnamiRepo # latest
8
8
 
9
- [ -z "$POSTGRESQL_CHART_VERSION" ] && POSTGRESQL_CHART_VERSION="10"
10
- helm upgrade --install postgres bitnami/postgresql \
9
+ OCI_CHART="oci://registry-1.docker.io/bitnamicharts/postgresql"
10
+
11
+ [ -z "$POSTGRESQL_CHART_VERSION" ] && POSTGRESQL_CHART_VERSION="15.5.22"
12
+
13
+ helm upgrade --install postgres $OCI_CHART \
11
14
  --values postgres/postgres-local.yaml \
12
15
  --version $POSTGRESQL_CHART_VERSION $HELM_WHAT
13
16
 
File without changes
@@ -1,13 +1,14 @@
1
1
  #!/bin/bash
2
2
  #
3
- showInstalling "The Prometheus Kube Stack"
3
+ showInstalling "The Prometheus Operator (kube-prometheus-stack)"
4
4
 
5
5
  addHelmRepo prometheus-community https://prometheus-community.github.io/helm-charts
6
6
 
7
- [ -z "$PROMETHEUS_STACK_CHART_VERSION" ] && PROMETHEUS_STACK_CHART_VERSION="57"
7
+ [ -z "$PROMETHEUS_STACK_CHART_VERSION" ] && PROMETHEUS_STACK_CHART_VERSION="62"
8
8
 
9
9
  helm upgrade --install prometheus-stack prometheus-community/kube-prometheus-stack \
10
10
  --namespace prometheus --create-namespace \
11
+ --values prometheus-operator/prometheus-stack.yaml \
11
12
  --version $PROMETHEUS_STACK_CHART_VERSION $HELM_WHAT
12
13
 
13
14
  removeHelmRepo prometheus-community
@@ -0,0 +1,59 @@
1
+ # Bootstrapped from the cnpg monitoring setup
2
+ enabled: true
3
+ kubeControllerManager:
4
+ enabled: false
5
+ nodeExporter:
6
+ enabled: false
7
+ defaultRules:
8
+ create: true
9
+ rules:
10
+ alertmanager: false
11
+ etcd: false
12
+ configReloaders: false
13
+ general: false
14
+ k8s: true
15
+ kubeApiserver: false
16
+ kubeApiserverAvailability: false
17
+ kubeApiserverSlos: false
18
+ kubelet: true
19
+ kubeProxy: false
20
+ kubePrometheusGeneral: false
21
+ kubePrometheusNodeRecording: false
22
+ kubernetesApps: false
23
+ kubernetesResources: false
24
+ kubernetesStorage: false
25
+ kubernetesSystem: false
26
+ kubeScheduler: false
27
+ kubeStateMetrics: false
28
+ network: false
29
+ node: true
30
+ nodeExporterAlerting: false
31
+ nodeExporterRecording: true
32
+ prometheus: false
33
+ prometheusOperator: false
34
+
35
+ #nodeSelector:
36
+ #workload: monitor
37
+ prometheus:
38
+ prometheusSpec:
39
+ podMonitorSelectorNilUsesHelmValues: false
40
+ ruleSelectorNilUsesHelmValues: false
41
+ serviceMonitorSelectorNilUsesHelmValues: false
42
+ probeSelectorNilUsesHelmValues: false
43
+ #nodeSelector:
44
+ #workload: monitor
45
+ grafana:
46
+ enabled: true
47
+ # -- the grafana admin password
48
+ adminPassword: prom-operator
49
+ defaultDashboardsEnabled: false
50
+ sidecar:
51
+ dashboards:
52
+ enabled: true
53
+ #nodeSelector:
54
+ #workload: monitor
55
+ alertmanager:
56
+ enabled: true
57
+ #alertManagerSpec:
58
+ #nodeSelector:
59
+ #workload: monitor
@@ -4,7 +4,7 @@ showInstalling "Redis"
4
4
 
5
5
  OCI_CHART="oci://registry-1.docker.io/bitnamicharts/redis"
6
6
 
7
- [ -z "$REDIS_CHART_VERSION" ] && REDIS_CHART_VERSION="19.5.0"
7
+ [ -z "$REDIS_CHART_VERSION" ] && REDIS_CHART_VERSION="20.0.5"
8
8
 
9
9
  helm upgrade --install redis $OCI_CHART \
10
10
  --values redis/redis-local.yaml \
@@ -25,6 +25,11 @@ master:
25
25
  persistence:
26
26
  size: 8Gi # 8Gi is default
27
27
 
28
+ resources:
29
+ requests:
30
+ cpu: 250m
31
+ memory: 500Mi
32
+
28
33
  replica:
29
34
  affinity:
30
35
  nodeAffinity:
@@ -45,6 +50,11 @@ replica:
45
50
  persistence:
46
51
  size: 8Gi # 8Gi is default
47
52
 
53
+ resources:
54
+ requests:
55
+ cpu: 250m
56
+ memory: 500Mi
57
+
48
58
  architecture: replication
49
59
 
50
60
  sentinel:
@@ -1,5 +1,7 @@
1
1
  # migrations
2
- # v1.2+ run => npm run sequelizeRunMigrations
2
+ # v1.2+
3
+ # - k8x resource-server
4
+ # - npm run sequelizeRunMigrations
3
5
  #
4
6
  image:
5
7
  tag: # v1.2.2
@@ -1,5 +1,5 @@
1
1
  image:
2
- tag: # v2.3.0
2
+ tag: # v2.3.1
3
3
 
4
4
  config:
5
5
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
@@ -5,7 +5,11 @@
5
5
  # ***REMEMBER*** the instructions provided on the internet typically assume
6
6
  # the default namespace not traefik
7
7
  #
8
- # ***DO NOT FORGET*** the -n traefik for kubectl commands
8
+ # ***DO NOT FORGET*** the -n traefik for kubectl commands - so in order to
9
+ # move beyond v20 of the chart run the kubectl command below before upgrading
10
+ #
11
+ # kubectl apply --namespace traefik --server-side \
12
+ # --force-conflicts -k https://github.com/traefik/traefik-helm-chart/traefik/crds/\?ref\=v27
9
13
  #
10
14
  showInstalling "Traefik Load Balancer / Router"
11
15
 
@@ -10,8 +10,8 @@ config:
10
10
  DENSE_HISTORY_TDB_CACHE_KEY_PREFIX: "timescale-dh"
11
11
  DENSE_HISTORY_MIGRATE_PAGE_SIZE_LIMIT: "50"
12
12
 
13
- # PG_HOST: "cnpg-db-tsdb-dense-rw"
14
- PG_HOST: "cnpg-db-tsdb-dense-pool-rw.cnpg-operands"
13
+ PG_HOST: "cnpg-db-tsdb-dense-rw.cnpg-operands"
14
+ # PG_HOST: "cnpg-db-tsdb-dense-pool-rw.cnpg-operands"
15
15
 
16
16
  # password from secret
17
17
  PG_PASSWORD_SECRET: "cnpg-db-tsdb-dense-postgres-pw"
@@ -15,6 +15,9 @@ config:
15
15
 
16
16
  # CNPG override
17
17
  # PG_HOST: "cnpg-db-tsdb-basic-rw.cnpg-operands"
18
+ #
19
+ # PG_PASSWORD_SECRET: "cnpg-db-tsdb-basic-postgres-pw"
20
+ # PG_PASSWORD_KEY: "password"
18
21
 
19
22
  TRANSPORT_CONFIG: '{
20
23
  "type": "pubsub",
@@ -4,7 +4,7 @@ showInstalling "Velero Backup System"
4
4
 
5
5
  addHelmRepo vmware-tanzu https://vmware-tanzu.github.io/helm-charts
6
6
 
7
- [ -z "$VELERO_CHART_VERSION" ] && VELERO_CHART_VERSION="6"
7
+ [ -z "$VELERO_CHART_VERSION" ] && VELERO_CHART_VERSION="7"
8
8
  #
9
9
  # Build the bucket, region and SA email variables and use --set to mod the
10
10
  # chart values as opposed to using an OVH:<label> approach. This eliminates
@@ -99,9 +99,10 @@ nodeSelector: {}
99
99
 
100
100
  # Init containers to add to the Velero deployment's pod spec. At least one plugin provider image is required.
101
101
  # If the value is a string then it is evaluated as a template.
102
+ # See => https://github.com/vmware-tanzu/velero-plugin-for-gcp
102
103
  initContainers:
103
104
  - name: velero-plugin-for-gcp
104
- image: velero/velero-plugin-for-gcp:v1.5.0
105
+ image: velero/velero-plugin-for-gcp:v1.10.0
105
106
  volumeMounts:
106
107
  - mountPath: /target
107
108
  name: plugins
package/src/helmup.sh CHANGED
@@ -47,13 +47,26 @@ AUXILIARY=(
47
47
  vin-decoder-server
48
48
  )
49
49
 
50
- # zombie-killer disabled 20231228
50
+ # zombie-killer re-enabled 20240801
51
51
  SYSTEM=(
52
+ elasticsearch8
53
+ redis
54
+ cnpg-operator
55
+ preemptible-killer
56
+ zombie-killer
57
+ reflector
58
+ reloader
59
+ traefik
60
+ velero
61
+ )
62
+
63
+ SYSTEM_LEGACY=(
52
64
  elasticsearch8
53
65
  redis
54
66
  postgres
55
67
  timescale-db
56
68
  preemptible-killer
69
+ zombie-killer
57
70
  reflector
58
71
  reloader
59
72
  traefik
@@ -63,7 +76,7 @@ SYSTEM=(
63
76
 
64
77
  function isLeveregeService() {
65
78
  local answer=0
66
- [[ ${PLATFORM[@]} =~ $1 || ${AUXILIARY[@]} =~ $1 || ${SYSTEM[@]} =~ $1 ]] && answer=1
79
+ [[ ${PLATFORM[@]} =~ $1 || ${AUXILIARY[@]} =~ $1 || ${SYSTEM_LEGACY[@]}} =~ 1 || ${SYSTEM[@]} =~ $1 ]] && answer=1
67
80
  echo $answer
68
81
  }
69
82
 
@@ -666,7 +679,7 @@ function installVeleroEnvironment() {
666
679
  gcloud config set project $GCP_PROJECT_ID
667
680
 
668
681
  ## The major chart version will determine the bucket suffix
669
- [ -z "$VELERO_HELM_CHART" ] && VELERO_HELM_CHART="6"
682
+ [ -z "$VELERO_HELM_CHART" ] && VELERO_HELM_CHART="7"
670
683
 
671
684
  ## Create a bucket
672
685
  BUCKET="$GCP_PROJECT_ID-velero-$VELERO_HELM_CHART"
@@ -696,6 +709,7 @@ function installVeleroEnvironment() {
696
709
  compute.disks.get
697
710
  compute.disks.create
698
711
  compute.disks.createSnapshot
712
+ compute.projects.get
699
713
  compute.snapshots.get
700
714
  compute.snapshots.create
701
715
  compute.snapshots.useReadOnly
@@ -787,7 +801,27 @@ DEPRECATED_CHART
787
801
  fi
788
802
  }
789
803
 
790
- doHelmup() {
804
+ function checkUpgradeNotes() {
805
+ UPNOTES="$1/helmup.upgrade"
806
+
807
+ [ ! -f "$UPNOTES" ] && return
808
+
809
+ cat<<UPGRADE_NOTES
810
+
811
+ `color g "*** $SERVICE upgrade instructions before moving forward ***"`
812
+
813
+ UPGRADE_NOTES
814
+ cat $UPNOTES
815
+ yesToContinue
816
+ cat<<UPGRADES_DONE
817
+
818
+ `color y "*** Remember to remove $UPNOTES once the steps are performed ***"`
819
+
820
+ UPGRADES_DONE
821
+ sleep 3
822
+ }
823
+
824
+ function doHelmup() {
791
825
  local helmup="$@"
792
826
  local doing="Helming => `color g \"$helmup\"`"
793
827
  local from=
@@ -859,6 +893,10 @@ CATBACKUP
859
893
  doInstall "${PLATFORM[@]}"
860
894
  ;;
861
895
 
896
+ "system-legacy")
897
+ doInstall "${SYSTEM_LEGACY[@]}"
898
+ ;;
899
+
862
900
  "system")
863
901
  doInstall "${SYSTEM[@]}"
864
902
  ;;
@@ -946,7 +984,7 @@ CATBACKUP
946
984
  bootstrapLocalSetup $SERVICE
947
985
  ;;
948
986
 
949
- "prometheus")
987
+ "prometheus"|"prometheus-operator")
950
988
  bootstrapLocalSetup $SERVICE
951
989
  ;;
952
990
 
@@ -1036,6 +1074,8 @@ NO_SERVICE_MAN
1036
1074
  fi
1037
1075
  service-man --from-helmup --create-service $SERVICE
1038
1076
 
1077
+ checkUpgradeNotes $SERVICE
1078
+
1039
1079
  # By default the museum chart name will be the same as the service, but
1040
1080
  # we have the flexibility to override the naming when the charts are
1041
1081
  # reference by the downstream repositories via the .helmup-charmuseum file.
package/src/k8scale.sh CHANGED
@@ -19,8 +19,11 @@ case $DIRECTION in
19
19
  REPLICAS=0
20
20
  DIRECTION=down
21
21
  ;;
22
+ roll)
23
+ DIRECTION=roll
24
+ ;;
22
25
  *)
23
- printf "Usage: `color g 'k8scale <up|dn|down> [deployment-list]'`\n\n" && exit 1
26
+ printf "Usage: `color g 'k8scale <up|dn|down|roll> [deployment-list]'`\n\n" && exit 1
24
27
  esac
25
28
 
26
29
  printf " scaled => `color g $DIRECTION`\n\n"
@@ -28,7 +31,12 @@ for DEPLOYMENT in "$@";
28
31
  do
29
32
  IFS="/" read SERVICE <<< "$DEPLOYMENT" # strip trailing /
30
33
  RESULTS="`color g SUCCESS`"
31
- kubectl scale --replicas=$REPLICAS deployment $SERVICE &>/dev/null
34
+ if [ "$DIRECTION" == "roll" ];
35
+ then
36
+ kubectl rollout restart deployment $SERVICE &> $DEVNULL
37
+ else
38
+ kubectl scale --replicas=$REPLICAS deployment $SERVICE &> $DEVNULL
39
+ fi
32
40
  [ $? -eq 1 ] && RESULTS="`color r FAILURE`"
33
41
  printf " $RESULTS => $SERVICE\n"
34
42
  sendToSlack "k8scale $DIRECTION $SERVICE"
package/src/overwhelm.mjs CHANGED
@@ -15,7 +15,7 @@ import parse from 'parse-gitignore'
15
15
  import ask from 'readline-sync'
16
16
  import YAML from 'js-yaml'
17
17
 
18
- import { debug, err, log, shellCmd } from './Utils.mjs'
18
+ import { debug, disableDebug, err, log, shellCmd } from './Utils.mjs'
19
19
 
20
20
  const optionsDefinitions = [
21
21
  /* eslint-disable no-multi-spaces */
@@ -33,6 +33,9 @@ const optionsDefinitions = [
33
33
  ]
34
34
  const args = cliArgs( optionsDefinitions )
35
35
 
36
+ // when using --key we only want the key contents w/o debug info
37
+ if ( args.key ) { disableDebug() }
38
+
36
39
  // See if we are in a monorepo, which changes some of the rules.
37
40
  const gitTop = await shellCmd( 'git rev-parse --show-toplevel' )
38
41
 
@@ -61,13 +64,24 @@ if ( !fs.existsSync( 'overwhelm.yaml' ) ) {
61
64
  process.exit( 1 )
62
65
  }
63
66
 
64
- if ( fs.existsSync( 'values-default.yaml' ) ) {
67
+ if ( !args.key && fs.existsSync( 'values-default.yaml' ) ) {
65
68
  log( chalk.red.bold( `
66
69
 
67
- ***ERROR overwhelm => values-default.yaml is no longer used/supported
68
- all defaults should be set in default-configs.yaml.ovh
70
+ ***ERROR overwhelm => values-default.yaml is no longer used/supported and will
71
+ be ignored - all defaults should be set in default-configs.yaml.ovh
69
72
  ` ) )
70
- process.exit( 1 )
73
+
74
+ const ans = ask.question( `Enter "${chalk.bold.red( 'skip' )}" if you wish to ignore and continue => ` )
75
+ if ( ans !== 'skip' ) {
76
+ process.exit( 1 )
77
+ }
78
+ }
79
+
80
+ // Avoid race condition when running overwhelm for the first time on a new
81
+ // cluster and the default-configs.yaml file has yet to be created.
82
+ const defaultConfigs = 'default-configs.yaml'
83
+ if ( !fs.existsSync( defaultConfigs ) ) {
84
+ fs.closeSync( fs.openSync( defaultConfigs, 'w' ) ) // same as unix touch
71
85
  }
72
86
 
73
87
  // Load the default values and then overlay with the project specific yaml
@@ -197,7 +211,7 @@ const doReplacements = ( yamls, replacements ) => {
197
211
 
198
212
  // Collect all of the yaml from the yams...
199
213
  const buildYaml = ( yamls, replacements ) => {
200
- const always = [ 'default-configs.yaml' ]
214
+ const always = [ defaultConfigs ]
201
215
  const values = [ ...always, ...yamls ]
202
216
  const loaded = []
203
217
  let allYamls = ''
@@ -1,38 +0,0 @@
1
- #!/bin/bash
2
-
3
- . `build-tools --bashfun`
4
-
5
- cwd=$(pwd)
6
- library=`basename $cwd`
7
- version=$(node -p "require('$cwd/package.json').version")
8
-
9
- echo $library
10
- echo $version
11
-
12
- bucket_name="leverege-registry-jsdocs"
13
-
14
- echo "deploying version $version docs to google cloud storage"
15
-
16
- echo "Check if build exists in root directory (current ver)"
17
-
18
- exists=`gsutil ls -b gs://$bucket_name/$library/$version`
19
- if [[ $exists == gs://* ]]; then
20
- echo "documentation already exists"
21
- exit
22
- fi
23
-
24
- npm run cleanDocs &> $DEVNULL
25
- errorExit $?
26
- npm run docs &> $DEVNULL
27
- errorExit $?
28
-
29
- TARGET_BUCKET="gs://$bucket_name/$library/$version"
30
- BUCKET_COPY="gsutil -m cp -r $cwd/docs/** $TARGET_BUCKET"
31
-
32
- cat<<LOG_COPYING
33
-
34
- Copying docs to bucket => `color g "$BUCKET_COPY"`
35
-
36
- LOG_COPYING
37
-
38
- $(BUCKET_COPY)