@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 +6 -7
- package/src/Docker.mjs +0 -1
- package/src/build-and-push.sh +83 -0
- package/src/docker-to-registry.mjs +3 -2
- package/src/helm-charts/api-server/values-local.yaml +1 -1
- package/src/helm-charts/authz-server/values-local.yaml +1 -1
- package/src/helm-charts/cnpg-db-recovery/.nohelm +0 -0
- package/src/helm-charts/cnpg-db-recovery/.nohelmdn +0 -0
- package/src/helm-charts/cnpg-db-recovery/cluster.yaml.ovh +106 -0
- package/src/helm-charts/cnpg-db-recovery/gitignore +2 -0
- package/src/helm-charts/cnpg-db-recovery/helmdn.plugin +12 -0
- package/src/helm-charts/cnpg-db-recovery/helmup.plugin +6 -0
- package/src/helm-charts/cnpg-db-recovery/pooler.yaml +20 -0
- package/src/helm-charts/db-curator/values-local.yaml +1 -1
- package/src/helm-charts/elasticsearch8/helmup.plugin +1 -1
- package/src/helm-charts/imagine/values-local.yaml +1 -1
- package/src/helm-charts/pubsub-pulse/values-local.yaml +1 -2
- package/src/helm-charts/reason/values-local.yaml +1 -1
- package/src/helm-charts/redis/helmup.plugin +1 -1
- package/src/helm-charts/resource-server/values-local.yaml +1 -1
- package/src/helm-charts/rule-engine/values-local.yaml +1 -1
- package/src/helm-charts/scheduler/values-local.yaml +1 -1
- package/src/helm-charts/transponder-bq/values-local.yaml +1 -1
- package/src/helm-charts/transponder-dh/values-local.yaml +1 -1
- package/src/helm-charts/transponder-rt/values-local.yaml +1 -1
- package/src/helm-charts/transponder-tsdb/values-local.yaml +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.
|
|
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": "^
|
|
68
|
+
"inquirer": "^12.0.0",
|
|
70
69
|
"js-yaml": "^4.1.0",
|
|
71
70
|
"ms": "^2.1.3",
|
|
72
|
-
"npm-registry-fetch": "^18.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.
|
|
78
|
+
"zx": "^8.1.9"
|
|
80
79
|
},
|
|
81
80
|
"devDependencies": {
|
|
82
81
|
"@leverege/eslint-config-leverege": "^4.2.0",
|
|
83
|
-
"npm": "^10.
|
|
82
|
+
"npm": "^10.9.0"
|
|
84
83
|
}
|
|
85
|
-
}
|
|
84
|
+
}
|
package/src/Docker.mjs
CHANGED
|
@@ -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
|
-
|
|
170
|
+
chart = helmChart?.yaml['Chart.yaml']
|
|
170
171
|
const values = helmChart?.yaml['values.yaml']
|
|
171
172
|
const expectedChartRegistry = `${artifactRegistry}/images`
|
|
172
173
|
|
|
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,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,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"
|
|
@@ -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.
|
|
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 \
|