@leverege/build-tools 2.53.5 → 2.54.0-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.53.5",
3
+ "version": "2.54.0-beta.1",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -56,7 +56,6 @@
56
56
  "license": "SEE LICENSE IN LICENSE.md",
57
57
  "dependencies": {
58
58
  "@google-cloud/artifact-registry": "^3.4.0",
59
- "@leverege/build-tools": "^2.53.2-beta.1",
60
59
  "ansi-colors": "^4.1.3",
61
60
  "chalk": "^5.3.0",
62
61
  "command-line-args": "^6.0.0",
@@ -66,20 +65,20 @@
66
65
  "execa": "^9.4.0",
67
66
  "glob": "^11.0.0",
68
67
  "handlebars": "^4.7.8",
69
- "inquirer": "^11.1.0",
68
+ "inquirer": "^12.0.0",
70
69
  "js-yaml": "^4.1.0",
71
70
  "ms": "^2.1.3",
72
- "npm-registry-fetch": "^18.0.0",
71
+ "npm-registry-fetch": "^18.0.1",
73
72
  "package-up": "^5.0.0",
74
73
  "parse-gitignore": "^2.0.0",
75
74
  "read-pkg": "^9.0.1",
76
75
  "readline-sync": "^1.4.10",
77
76
  "semver": "^7.6.3",
78
77
  "simple-git": "^3.27.0",
79
- "zx": "^8.1.8"
78
+ "zx": "^8.1.9"
80
79
  },
81
80
  "devDependencies": {
82
81
  "@leverege/eslint-config-leverege": "^4.2.0",
83
- "npm": "^10.8.3"
82
+ "npm": "^10.9.0"
84
83
  }
85
- }
84
+ }
package/src/Docker.mjs CHANGED
@@ -304,7 +304,6 @@ const buildContainerImage = async ( {
304
304
  ${gcloudLogs} \\
305
305
  ${gcloudTags}
306
306
  ` ) )
307
-
308
307
 
309
308
  if ( process.env.DRY_RUN === '1' ) {
310
309
  log( '\n***Exiting from DRY_RUN\n' )
@@ -0,0 +1,83 @@
1
+ #!/bin/bash
2
+
3
+ application_name=$(awk -F'"' '/\[(tool\.poetry|project)\]/{flag=1;next} flag==1 && /^name = /{ print $2; exit }' ./pyproject.toml)
4
+ application_version=$(awk -F'"' '/\[(tool\.poetry|project)\]/{flag=1;next} flag==1 && /^version = /{ print $2; exit }' ./pyproject.toml)
5
+ gcp_project_id=$(awk -F'"' '/\[tool\.docker\]/{flag=1;next} flag==1 && /^gcp-project-id = /{ print $2; exit }' ./pyproject.toml)
6
+ gcp_repository_name=$(awk -F'"' '/\[tool\.docker\]/{flag=1;next} flag==1 && /^gcp-repository-name = /{ print $2; exit }' ./pyproject.toml)
7
+ platform=$(awk -F'[][]' '/\[tool\.docker\]/{flag=1;next} flag==1 && /^platform *=/ { gsub(/"/, "", $2); print $2; exit }' ./pyproject.toml)
8
+
9
+ # Check if the platform is empty
10
+ if [ -z "$platform" ]; then
11
+ platform="linux/amd64,linux/arm64"
12
+ fi
13
+
14
+ # Check if the version contains alpha, beta, rc, or a hyphen
15
+ if [[ $application_version =~ (alpha|beta|rc|-) ]]; then
16
+ is_stable_release="false"
17
+ else
18
+ is_stable_release="true"
19
+ fi
20
+
21
+ cache_path="$HOME/docker/$application_name"
22
+
23
+ echo -e "\n\033[0;32mBuild Information:\033[0m\n"
24
+
25
+ # List application name, application version, GCP project ID, GCP repository name, platform, and if it is a stable release.
26
+ echo -e "\033[0;32mApplication Name:\033[0m $application_name"
27
+ echo -e "\033[0;32mApplication Version:\033[0m $application_version"
28
+ echo -e "\033[0;32mGCP Project ID:\033[0m $gcp_project_id"
29
+ echo -e "\033[0;32mGCP Repository Name:\033[0m $gcp_repository_name"
30
+ echo -e "\033[0;32mPlatform:\033[0m $platform"
31
+ echo -e "\033[0;32mStable Release:\033[0m $is_stable_release"
32
+
33
+ # Prompt for confirmation
34
+ echo -e "\n"
35
+ read -p "Do you wish to proceed? (y/n): " -n 1 -r
36
+ echo -e "\n"
37
+
38
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
39
+ echo -e "\033[0;31mExiting...\033[0m\n\n"
40
+ exit 1
41
+ fi
42
+
43
+
44
+ echo -e "\n\033[0;32mBuilding, creating and pushing image(s)...\033[0m\n\n"
45
+
46
+ export GCLOUD_ACCESS_TOKEN=$(gcloud auth print-access-token)
47
+
48
+ if [ "$is_stable_release" = "true" ]; then
49
+ docker buildx build \
50
+ --platform $platform \
51
+ --cache-from type=local,src=$cache_path \
52
+ --cache-to type=local,dest=$cache_path \
53
+ --build-arg APPLICATION_NAME=$application_name \
54
+ --build-arg APPLICATION_VERSION=$application_version \
55
+ --secret id=token,env=GCLOUD_ACCESS_TOKEN \
56
+ --secret="id=creds,src=$HOME/.config/gcloud/application_default_credentials.json" \
57
+ --tag us-docker.pkg.dev/$gcp_project_id/$gcp_repository_name/${application_name}:${application_version} \
58
+ --tag us-docker.pkg.dev/$gcp_project_id/$gcp_repository_name/${application_name}:latest \
59
+ --push \
60
+ .
61
+ else
62
+ docker buildx build \
63
+ --platform $platform \
64
+ --cache-from type=local,src=$cache_path \
65
+ --cache-to type=local,dest=$cache_path \
66
+ --build-arg APPLICATION_NAME=$application_name \
67
+ --build-arg APPLICATION_VERSION=$application_version \
68
+ --secret id=token,env=GCLOUD_ACCESS_TOKEN \
69
+ --secret="id=creds,src=$HOME/.config/gcloud/application_default_credentials.json" \
70
+ --tag us-docker.pkg.dev/$gcp_project_id/$gcp_repository_name/${application_name}:${application_version} \
71
+ --push \
72
+ .
73
+ fi
74
+
75
+ if [ $? -eq 0 ]; then
76
+ echo -e "\n\n\033[0;32mBuilt and pushed us-docker.pkg.dev/$gcp_project_id/$gcp_repository_name/$application_name:$application_version for $platform\033[0m"
77
+ if [ "$is_stable_release" = "true" ]; then
78
+ echo -e "\033[0;32mAlso tagged as 'latest'\033[0m"
79
+ fi
80
+ echo -e "\n\n"
81
+ else
82
+ echo -e "\n\n\033[0;31mBuild and push failed!\033[0m\n\n"
83
+ fi
@@ -33,7 +33,7 @@ for ( let n = 2; n < process.argv.length; n++ ) {
33
33
  if ( process.argv[n].startsWith( '-' ) ) {
34
34
  const str = process.argv[n].slice( 1 )
35
35
  if ( str.indexOf( '=' ) > 0 ) {
36
- const [key, value] = str.split( '=' )
36
+ const [ key, value ] = str.split( '=' )
37
37
  options[key] = value
38
38
  } else {
39
39
  options[str] = true
@@ -165,8 +165,9 @@ if ( giveGuidance ) {
165
165
  }
166
166
 
167
167
  // do chart checks too
168
+ let chart
168
169
  if ( options?.helmChecks !== 'false' ) {
169
- const chart = helmChart?.yaml['Chart.yaml']
170
+ chart = helmChart?.yaml['Chart.yaml']
170
171
  const values = helmChart?.yaml['values.yaml']
171
172
  const expectedChartRegistry = `${artifactRegistry}/images`
172
173
 
@@ -5,7 +5,7 @@
5
5
  # - node tools/UpdateESMappingV2.js
6
6
  #
7
7
  image:
8
- tag: # v5.12.3
8
+ tag: # v5.16.0
9
9
 
10
10
  config:
11
11
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
@@ -4,7 +4,7 @@
4
4
  # - npm run sequelizeRunMigrations
5
5
  #
6
6
  image:
7
- tag: # v2.1.3
7
+ tag: # v2.2.0
8
8
 
9
9
  config:
10
10
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
File without changes
File without changes
@@ -0,0 +1,106 @@
1
+ # Artifact Chart => https://artifacthub.io/packages/helm/cloudnative-pg/cloudnative-pg
2
+ # Examples Charts => https://cloudnative-pg.io/documentation/current/samples/
3
+ apiVersion: postgresql.cnpg.io/v1
4
+ kind: Cluster
5
+ metadata:
6
+ name: cnpg-db-recovery
7
+ namespace: cnpg-operands
8
+ spec:
9
+ instances: 1
10
+ logLevel: info # warning debug
11
+
12
+ monitoring:
13
+ enablePodMonitor: false # set true once monitoring is setup
14
+
15
+ description: "Leverege CNPG DB (recovered)"
16
+ imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.4-cnpg-tsdb2-rel.1
17
+ bootstrap:
18
+ recovery:
19
+ volumeSnapshots:
20
+ storage:
21
+ name: <snapshot_name>
22
+ kind: VolumeSnapshot
23
+ apiGroup: snapshot.storage.k8s.io
24
+
25
+ enableSuperuserAccess: true
26
+ superuserSecret:
27
+ name: <postgres_password> # postgres db pw
28
+
29
+ affinity:
30
+ enablePodAntiAffinity: true
31
+ topologyKey: kubernetes.io/hostname # default value
32
+ nodeAffinity:
33
+ requiredDuringSchedulingIgnoredDuringExecution:
34
+ nodeSelectorTerms:
35
+ - matchExpressions:
36
+ - key: target-env
37
+ operator: In
38
+ values:
39
+ - database
40
+ tolerations:
41
+ - key: "database"
42
+ operator: "Equal"
43
+ value: "true"
44
+ effect: "NoSchedule"
45
+
46
+ # Parameters and pg_hba configuration will be append
47
+ # to the default ones to make the cluster work
48
+ postgresql:
49
+ parameters:
50
+ # max_connections: "100"
51
+ # max_worker_processes: "60"
52
+ # max_worker_processes: "8"
53
+ # max_parallel_workers: "8"
54
+ # shared_buffers: 2GB
55
+ # effective_cache_size: 6GB
56
+ # maintenance_work_mem: 1GB
57
+ # work_mem: 20MB
58
+
59
+ # - unsupervised: automated update of the primary once all
60
+ # replicas have been upgraded (default)
61
+ # - supervised: requires manual supervision to perform
62
+ # the switchover of the primary
63
+ primaryUpdateStrategy: unsupervised
64
+
65
+ serviceAccountTemplate:
66
+ metadata:
67
+ annotations:
68
+ iam.gke.io/gcp-service-account: cnpg-operands-sa@OVH:<PROJECT_ID>.iam.gserviceaccount.com
69
+
70
+ # Require 50Gi of space per instance using ssd storage class
71
+ storage:
72
+ storageClass: premium-rwo
73
+ size: 50Gi
74
+ # walStorage:
75
+ # storageClass: premium-rwo
76
+ # size: 1Gi
77
+
78
+ backup:
79
+ retentionPolicy: 7d # don't think this does anything?
80
+ volumeSnapshot:
81
+ labels:
82
+ snapshotOf: cnpg-db-recovery
83
+ className: cnpg-snapshotclass
84
+ barmanObjectStore:
85
+ destinationPath: gs://OVH:<PROJECT_ID>-barman
86
+ googleCredentials:
87
+ gkeEnvironment: true
88
+ tags:
89
+ cnpgCluster: cnpg-db-recovery
90
+ wal:
91
+ compression: gzip
92
+ maxParallel: 8
93
+ ---
94
+ apiVersion: postgresql.cnpg.io/v1
95
+ kind: ScheduledBackup
96
+ metadata:
97
+ name: cnpg-db-recovery-backup
98
+ namespace: cnpg-operands
99
+ spec:
100
+ # https://pkg.go.dev/github.com/robfig/cron#hdr-CRON_Expression_Format
101
+ schedule: "0 0 */12 * * *"
102
+ cluster:
103
+ name: cnpg-db-recovery
104
+ method: volumeSnapshot # barmanObjectStore
105
+ backupOwnerReference: self
106
+ immediate: true
@@ -0,0 +1,2 @@
1
+ *.swp
2
+ cluster.yaml
@@ -0,0 +1,12 @@
1
+ #!/bin/bash
2
+ #
3
+ # We only want to hibernate unless the intent is to really delete EVERYTHING
4
+ # which includes PVCs and volume snapshots.
5
+ #
6
+ printf "\nHibernating the cnpg-db-recovery cluster...\n"
7
+ kubectl cnpg hibernate on -n cnpg-operands cnpg-db-recovery
8
+
9
+ # *** DANGER ***
10
+ # kubectl delete will destroy the cluster
11
+ # *** DANGER ***
12
+ # kubectl delete -f cnpg-db-recovery/cluster.yaml $K8S_WHAT
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ # ensures the PG_PASSWORD secret exists and correct
4
+ # ensureCnpgSecret PG_PASSWORD $SERVICE-postgres-pw
5
+
6
+ kubectl apply -f cnpg-db-recovery/cluster.yaml $K8S_WHAT
@@ -0,0 +1,20 @@
1
+ apiVersion: postgresql.cnpg.io/v1
2
+ kind: Pooler
3
+ metadata:
4
+ name: cnpg-db-recovery-pool-rw
5
+ namespace: cnpg-operands
6
+ spec:
7
+ cluster:
8
+ name: cnpg-db-recovery
9
+
10
+ instances: 1
11
+ type: rw
12
+ pgbouncer:
13
+ poolMode: session
14
+ parameters:
15
+ # https://www.pgbouncer.org/config.html#generic-settings
16
+ max_client_conn: "500"
17
+ default_pool_size: "10"
18
+ # https://www.pgbouncer.org/config.html#log-settings
19
+ log_connections: "0"
20
+ log_disconnections: "0"
@@ -1,5 +1,5 @@
1
1
  image:
2
- tag: # v4.2.4
2
+ tag: # v4.3.0
3
3
 
4
4
  config:
5
5
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
@@ -2,7 +2,7 @@
2
2
  #
3
3
  showInstalling "Elastic Search 8"
4
4
 
5
- [ -z "$ELASTIC_CHART_VERSION" ] && ELASTIC_CHART_VERSION="21.3.17"
5
+ [ -z "$ELASTIC_CHART_VERSION" ] && ELASTIC_CHART_VERSION="21.3.20"
6
6
 
7
7
  OCI_CHART="oci://registry-1.docker.io/bitnamicharts/elasticsearch"
8
8
 
@@ -1,5 +1,5 @@
1
1
  mage:
2
- tag: # v2.2.0
2
+ tag: # v2.4.1
3
3
 
4
4
  config:
5
5
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
@@ -1,6 +1,5 @@
1
1
  image:
2
- tag: # v1.3.5
3
- # registry: gcr.io/leverege-docker-images # deprecated
2
+ tag: # v1.6.3
4
3
  # registry: us-docker.pkg.dev/leverege-registry/leverege/images
5
4
 
6
5
  config:
@@ -1,5 +1,5 @@
1
1
  image:
2
- tag: # v2.2.1
2
+ tag: # v2.3.0
3
3
 
4
4
  config:
5
5
  CF_TRANSPORT_CONFIG: '{
@@ -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="20.1.3"
7
+ [ -z "$REDIS_CHART_VERSION" ] && REDIS_CHART_VERSION="20.1.7"
8
8
 
9
9
  helm upgrade --install redis $OCI_CHART \
10
10
  --values redis/redis-local.yaml \
@@ -4,7 +4,7 @@
4
4
  # - npm run sequelizeRunMigrations
5
5
  #
6
6
  image:
7
- tag: # v1.2.2
7
+ tag: # v1.5.1
8
8
 
9
9
  config:
10
10
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
@@ -1,5 +1,5 @@
1
1
  image:
2
- tag: # v2.3.1
2
+ tag: # v2.6.0
3
3
 
4
4
  config:
5
5
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
@@ -1,5 +1,5 @@
1
1
  image:
2
- tag: # v3.1.1
2
+ tag: # v3.1.2
3
3
 
4
4
  config:
5
5
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
@@ -1,7 +1,7 @@
1
1
  nameOverride: transponder-bq
2
2
 
3
3
  image:
4
- tag: # v5.2.2
4
+ tag: # v5.2.4
5
5
 
6
6
  config:
7
7
  TRANSPONDER_RUN_MODE: "bigQueryJson"
@@ -1,7 +1,7 @@
1
1
  nameOverride: transponder-dh
2
2
 
3
3
  image:
4
- tag: # v5.2.2
4
+ tag: # v5.2.4
5
5
 
6
6
  config:
7
7
  TRANSPONDER_RUN_MODE: "denseHistoryCombined"
@@ -1,7 +1,7 @@
1
1
  nameOverride: transponder-rt
2
2
 
3
3
  image:
4
- tag: # v5.2.2
4
+ tag: # v5.2.4
5
5
 
6
6
  config:
7
7
  TRANSPONDER_RUN_MODE: "rt"
@@ -7,7 +7,7 @@
7
7
  nameOverride: transponder-tsdb
8
8
 
9
9
  image:
10
- tag: # v5.2.2
10
+ tag: # v5.2.4
11
11
 
12
12
  config:
13
13
  TRANSPONDER_RUN_MODE: "timescale"