@leverege/build-tools 2.61.7 → 2.62.0-alpha.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 +13 -8
- package/src/Docker.mjs +18 -44
- package/src/DockerPy.mjs +257 -0
- package/src/Utils.mjs +0 -6
- package/src/bash-funcs +0 -4
- package/src/docker-to-registry-py.mjs +291 -0
- package/src/docker-to-registry.mjs +1 -3
- package/src/docker-to-registry.sh +1 -1
- package/src/helm-charts/cnpg-db-pgbench/cluster.yaml.ovh +3 -2
- package/src/helm-charts/cnpg-db-psql-stack/cluster.yaml.ovh +3 -2
- package/src/helm-charts/cnpg-db-recovery/cluster.yaml.ovh +3 -2
- package/src/helm-charts/cnpg-db-tsdb-basic/cluster.yaml.ovh +3 -2
- package/src/helm-charts/cnpg-db-tsdb-dense/cluster.yaml.ovh +3 -2
- package/src/helm-charts/prom-operator/helmup.plugin +1 -4
- package/src/hook-and-release/Config.mjs +0 -9
- package/src/templates/bashrcTemplatePy.hbs +1 -0
- package/src/templates/dockerfileTemplate.hbs +6 -6
- package/src/templates/dockerfileTemplatePy.hbs +75 -0
- package/src/build-cnpg-image.mjs +0 -176
- package/src/chart-compass.mjs +0 -97
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/*
|
|
3
|
+
* docker-to-registry-py will...
|
|
4
|
+
*/
|
|
5
|
+
import fs from 'node:fs'
|
|
6
|
+
import toml from 'toml'
|
|
7
|
+
import chalk from 'chalk'
|
|
8
|
+
import semver from 'semver'
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
debug, log,
|
|
12
|
+
errorExit,
|
|
13
|
+
getGitBranchAndUpstream,
|
|
14
|
+
gitRepoIsDirty,
|
|
15
|
+
parseHelmChart,
|
|
16
|
+
proceed,
|
|
17
|
+
shellCmd } from './Utils.mjs'
|
|
18
|
+
|
|
19
|
+
import Docker from './DockerPy.mjs'
|
|
20
|
+
import { version } from 'node:os'
|
|
21
|
+
|
|
22
|
+
// refresh-npm-token does not throw so no need to try, but it emits in debug
|
|
23
|
+
const refreshErr = await shellCmd( 'refresh-npm-token' )
|
|
24
|
+
if ( refreshErr && !process.env.BUILD_TOOLS_DEBUG ) {
|
|
25
|
+
log( refreshErr ) // most likely the token refreshed message
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const options = {}
|
|
29
|
+
let imageVersion = null
|
|
30
|
+
// Expected to be invoked like docker-to-registry-py v1.2.3
|
|
31
|
+
for ( let n = 2; n < process.argv.length; n++ ) {
|
|
32
|
+
if ( process.argv[n].startsWith( '-' ) ) {
|
|
33
|
+
const str = process.argv[n].slice( 1 )
|
|
34
|
+
if ( str.indexOf( '=' ) > 0 ) {
|
|
35
|
+
const [ key, value ] = str.split( '=' )
|
|
36
|
+
options[key] = value
|
|
37
|
+
} else {
|
|
38
|
+
options[str] = true
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
imageVersion = process.argv[n]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if ( !imageVersion ) {
|
|
45
|
+
errorExit( '***Error: docker-to-registry-py requires an image version' )
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// may use guide-me or guideme to ask for update guidance
|
|
49
|
+
const giveGuidance = imageVersion.match( /^guide-*me$/ ) !== null
|
|
50
|
+
|
|
51
|
+
const willGitTag = imageVersion.match( /^v\d+\.\d+\.\d+$/ )
|
|
52
|
+
const tagInfo = willGitTag ?
|
|
53
|
+
chalk.yellow.bold( 'will be git tagged' ) :
|
|
54
|
+
chalk.red( 'BETA RELEASE WILL NOT BE GIT TAGGED' )
|
|
55
|
+
|
|
56
|
+
const repoIsDirty = await gitRepoIsDirty()
|
|
57
|
+
|
|
58
|
+
if ( willGitTag && repoIsDirty ) {
|
|
59
|
+
log( `
|
|
60
|
+
${chalk.red.bold( '***ERROR: attempting to tag a non-beta dirty git repository' )}
|
|
61
|
+
|
|
62
|
+
You are attempting to create a tagged release image for pushing to the
|
|
63
|
+
artifact registry, but there are locally modified files. This is not
|
|
64
|
+
allowed since the applied tag will not be relevant to the image version
|
|
65
|
+
due to the pending commits.
|
|
66
|
+
|
|
67
|
+
Available options for proceeding:
|
|
68
|
+
|
|
69
|
+
${chalk.green.bold( '1) cleanly commit all local mods assuming relevance' )}
|
|
70
|
+
${chalk.yellow( '2) eliminate unwanted local modifications' )}
|
|
71
|
+
${chalk.red( '3) stash anything that is irrelevant to this release' )}
|
|
72
|
+
|
|
73
|
+
` )
|
|
74
|
+
process.exit( 1 )
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if ( !fs.existsSync( './helm' ) ) {
|
|
78
|
+
log( `
|
|
79
|
+
${chalk.red.bold( '***Error: docker-to-registry-py requires a helm chart directory' )}
|
|
80
|
+
|
|
81
|
+
The docker-to-registry-py script expects to run in the root directory of a k8s
|
|
82
|
+
service, which requires a helm chart directory. It also expects a docker
|
|
83
|
+
directory but will build that if it does not exist.
|
|
84
|
+
|
|
85
|
+
` )
|
|
86
|
+
process.exit( 1 )
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const tomlStr = fs.readFileSync( './pyproject.toml' )
|
|
90
|
+
const pyproject = toml.parse( tomlStr )
|
|
91
|
+
const repoDescr = {
|
|
92
|
+
artifactProject : pyproject.leverege.project || 'leverege-registry',
|
|
93
|
+
containerName : pyproject.project.name,
|
|
94
|
+
packageVersion : pyproject.project.version,
|
|
95
|
+
artifactRegistry : pyproject.leverege.registry || 'us-docker.pkg.dev/leverege-registry/stack',
|
|
96
|
+
registryFolder : `${pyproject.leverege.registryFolder}/images/${pyproject.project.name}`,
|
|
97
|
+
imageBase : pyproject.leverege.imageBase,
|
|
98
|
+
helmChart : await parseHelmChart(),
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
debug( { repoDescr }, '<==The Repo Description' )
|
|
102
|
+
|
|
103
|
+
const dockerInfo = await Docker.generateDockerfile( {
|
|
104
|
+
regvers : repoDescr.packageVersion,
|
|
105
|
+
imageBase : repoDescr.imageBase,
|
|
106
|
+
} )
|
|
107
|
+
|
|
108
|
+
debug( { dockerInfo }, '<==The Docker Info' )
|
|
109
|
+
|
|
110
|
+
const {
|
|
111
|
+
artifactProject,
|
|
112
|
+
artifactRegistry,
|
|
113
|
+
packageVersion,
|
|
114
|
+
containerName,
|
|
115
|
+
helmChart,
|
|
116
|
+
} = repoDescr
|
|
117
|
+
|
|
118
|
+
if ( giveGuidance ) {
|
|
119
|
+
await Docker.validateCloudBuildBucket( artifactProject )
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const registryFolder = `${artifactRegistry}/images/${containerName}`
|
|
123
|
+
|
|
124
|
+
// Update the dependencies...
|
|
125
|
+
log( chalk.green.bold( 'Updating dependencies and workspace...' ) )
|
|
126
|
+
await shellCmd( 'npm install', { stdio : 'inherit' } )
|
|
127
|
+
|
|
128
|
+
if ( giveGuidance ) {
|
|
129
|
+
await Docker.repoCleanup() // adjusts gitignore files and removes cruft
|
|
130
|
+
log( `
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
${chalk.green.bold( '-------------------- Potential Helm Chart Mods --------------------' )}
|
|
135
|
+
|
|
136
|
+
Moving to the new artifact-registry for docker image storage may also require
|
|
137
|
+
helm chart changes depending on how old the current charts are. Charts that
|
|
138
|
+
contain helm/values.yaml files resembling this:
|
|
139
|
+
|
|
140
|
+
${chalk.yellow.bold( `serviceConfig:
|
|
141
|
+
VERSION: v1.2.3
|
|
142
|
+
PREEMPTIBLE: true` )}
|
|
143
|
+
|
|
144
|
+
are pre-ignition era charts and should be replaced with the latest helm chart
|
|
145
|
+
templates available from ignition. Either dive in or ask devops for a hand
|
|
146
|
+
when converting these legacy / deprecated charts.
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
More recently updated helm charts that have already started the migration to
|
|
150
|
+
the new approach may already have registry entries like this:
|
|
151
|
+
|
|
152
|
+
${chalk.yellow.bold( `image:
|
|
153
|
+
registry: gcr.io/leverege-docker-images
|
|
154
|
+
tag: ""` )}
|
|
155
|
+
|
|
156
|
+
The above registry statement references the deprecated container registry and
|
|
157
|
+
must be adjusted accordingly to resemble:
|
|
158
|
+
|
|
159
|
+
${chalk.green.bold( 'registry: us-docker.pkg.dev/leverege-registry/<registry folder>/images' )}
|
|
160
|
+
|
|
161
|
+
There may also be a corresponding modification needed in the helm template
|
|
162
|
+
deployment.yaml file in the container image spec:
|
|
163
|
+
|
|
164
|
+
${chalk.green.bold( 'image: {{ .Values.image.registry }}/{{ .Chart.Name }}:{{ default .Chart.AppVersion .Values.image.tag }}' )}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
${chalk.magenta.bold( `Upgrading all service charts to the latest ignition template chart structure
|
|
168
|
+
is the preferred approach to making the transition to the artifact registry.` )}
|
|
169
|
+
|
|
170
|
+
` )
|
|
171
|
+
log( chalk.green.bold( '*** docker-to-registry-py guidance complete - ready for dockerization ***' ) )
|
|
172
|
+
process.exit( 0 )
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// do chart checks too
|
|
176
|
+
let chart
|
|
177
|
+
if ( options?.helmChecks !== 'false' ) {
|
|
178
|
+
chart = helmChart?.yaml['Chart.yaml']
|
|
179
|
+
const values = helmChart?.yaml['values.yaml']
|
|
180
|
+
const expectedChartRegistry = `${artifactRegistry}/images`
|
|
181
|
+
|
|
182
|
+
if ( expectedChartRegistry !== values.image?.registry ) {
|
|
183
|
+
log( `
|
|
184
|
+
${chalk.red.bold( '***Error: mismatched package.json registry and helm/values.yaml' )}
|
|
185
|
+
|
|
186
|
+
The registry specified in the package.json leverege stanza does not line up
|
|
187
|
+
with the image registry in helm/values.yaml. The naming convention expects
|
|
188
|
+
the '/images' suffix to be added to the package.json registry string and then
|
|
189
|
+
stored as the image.registry in the helm/values.yaml file.
|
|
190
|
+
|
|
191
|
+
Current settings:
|
|
192
|
+
package.json registry => ${chalk.yellow.bold( artifactRegistry )}
|
|
193
|
+
values.yaml registry => ${chalk.red.bold( values.image?.registry )}
|
|
194
|
+
|
|
195
|
+
Expected settings:
|
|
196
|
+
values.yaml registry => ${chalk.green.bold( expectedChartRegistry )}
|
|
197
|
+
` )
|
|
198
|
+
|
|
199
|
+
if ( !values.image ) {
|
|
200
|
+
log( `
|
|
201
|
+
${chalk.yellow.bold( '***DEPRECATED: legacy helm charts detected' )}
|
|
202
|
+
|
|
203
|
+
The helm chart structure appears to be based on the pre-ignition helm chart
|
|
204
|
+
layouts. The charts must be upgraded before docker-to-registry-py can complete
|
|
205
|
+
its job.
|
|
206
|
+
|
|
207
|
+
` )
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
process.exit( 1 )
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Give the summary and the user a chance to proceed or not
|
|
215
|
+
log( `
|
|
216
|
+
${chalk.green.bold( 'Build Information:' )}
|
|
217
|
+
Container: ${chalk.green.bold( containerName )}
|
|
218
|
+
Version: ${chalk.green.bold( imageVersion )} ${tagInfo}
|
|
219
|
+
Registry: ${chalk.green.bold( artifactRegistry )}
|
|
220
|
+
Image Folder: ${chalk.yellow.bold( registryFolder )}
|
|
221
|
+
|
|
222
|
+
${chalk.green.bold( 'Docker Information:' )}
|
|
223
|
+
NodeImage: ${chalk.green.bold( dockerInfo.imageBase || `node:${dockerInfo.nodeimage}` )}
|
|
224
|
+
Docker Env: ${chalk.green.bold( dockerInfo.buildEnv || 'alpine' )}
|
|
225
|
+
AddedPkgs: ${chalk.green.bold( dockerInfo.apkadds )}
|
|
226
|
+
Run User: ${chalk.green.bold( dockerInfo.runuser )}
|
|
227
|
+
Previous: ${chalk.yellow.bold( dockerInfo.previousBuild )}
|
|
228
|
+
DateStamp: ${chalk.green.bold( dockerInfo.date )}
|
|
229
|
+
NPM Logs: ${chalk.green.bold( dockerInfo.npmlogging )}
|
|
230
|
+
NPM Version: ${chalk.green.bold( dockerInfo.npmVersion )}
|
|
231
|
+
` )
|
|
232
|
+
|
|
233
|
+
if ( imageVersion !== packageVersion ) {
|
|
234
|
+
log( `
|
|
235
|
+
${chalk.yellow.bold( '***WARNING: specified version does not match project version' )}
|
|
236
|
+
pyproject.toml => ${chalk.green.bold( packageVersion )}
|
|
237
|
+
specified => ${chalk.red.bold( imageVersion )}
|
|
238
|
+
` )
|
|
239
|
+
|
|
240
|
+
if ( willGitTag ) {
|
|
241
|
+
log( chalk.red.bold( '... and you are attempting to release so NOPE!\n' ) )
|
|
242
|
+
process.exit( 1 )
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const repoInfo = await getGitBranchAndUpstream()
|
|
247
|
+
|
|
248
|
+
if ( willGitTag && !repoInfo.upstream ) {
|
|
249
|
+
log( `
|
|
250
|
+
${chalk.red.bold( '***ERROR: the current branch must have an upstream' )}
|
|
251
|
+
|
|
252
|
+
You are attempting to create a tagged release image for pushing to the
|
|
253
|
+
container registry, but the current branch does not have an upstream to
|
|
254
|
+
push to. This is not allowed since the applied tag will be stranded here
|
|
255
|
+
in your local repository, which is what we are trying to avoid.
|
|
256
|
+
|
|
257
|
+
Available options for proceeding:` )
|
|
258
|
+
log( chalk.green.bold( `
|
|
259
|
+
1) set an upstream for this branch via:
|
|
260
|
+
git push --set-upstream origin ${repoInfo.branch}` ) )
|
|
261
|
+
log( chalk.yellow.bold( `
|
|
262
|
+
2) rebase, squash and merge onto a branch with an upstream` ) )
|
|
263
|
+
|
|
264
|
+
process.exit( 1 )
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if ( willGitTag ) {
|
|
268
|
+
if ( chart.appVersion !== imageVersion ) {
|
|
269
|
+
log( `
|
|
270
|
+
${chalk.yellow.bold( '***WARNING: the helm/Chart.yaml appVersion does not align with the build version' )}
|
|
271
|
+
chart appVersion => ${chalk.yellow.bold( chart.appVersion )}
|
|
272
|
+
build version => ${chalk.green.bold( imageVersion )}
|
|
273
|
+
` )
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
await proceed()
|
|
278
|
+
|
|
279
|
+
log( chalk.green.bold( 'Building the Docker Image...' ) )
|
|
280
|
+
await Docker.buildContainerImage( { ...repoDescr, options, imageVersion } )
|
|
281
|
+
log( chalk.blue.bold( 'Done Building the Docker Image...' ) )
|
|
282
|
+
|
|
283
|
+
if ( willGitTag ) {
|
|
284
|
+
const tagDescription = `docker_${imageVersion}`
|
|
285
|
+
const fullImageTag = repoDescr.isMonoRepo ? `${repoDescr.containerName}/${imageVersion}` : imageVersion
|
|
286
|
+
log( chalk.green.bold( `Tagging and Pushing ${fullImageTag}\n` ) )
|
|
287
|
+
await shellCmd( `git tag -f ${fullImageTag} -m ${tagDescription}` )
|
|
288
|
+
await shellCmd( 'git push --follow-tags' )
|
|
289
|
+
} else {
|
|
290
|
+
log( chalk.yellow.bold( '\n*** Skipped git tagging - beta release' ) )
|
|
291
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# Artifact Chart => https://artifacthub.io/packages/helm/cloudnative-pg/cloudnative-pg
|
|
2
|
+
# Examples Charts => https://cloudnative-pg.io/documentation/current/samples/
|
|
1
3
|
apiVersion: postgresql.cnpg.io/v1
|
|
2
4
|
kind: Cluster
|
|
3
5
|
metadata:
|
|
@@ -8,7 +10,7 @@ spec:
|
|
|
8
10
|
logLevel: info # warning debug
|
|
9
11
|
|
|
10
12
|
description: "Leverege PG Bench Timescale DB"
|
|
11
|
-
imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:
|
|
13
|
+
imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.1-cnpg-tsdb2-beta.6
|
|
12
14
|
bootstrap:
|
|
13
15
|
initdb:
|
|
14
16
|
postInitTemplateSQL:
|
|
@@ -58,7 +60,6 @@ spec:
|
|
|
58
60
|
# - supervised: requires manual supervision to perform
|
|
59
61
|
# the switchover of the primary
|
|
60
62
|
primaryUpdateStrategy: unsupervised
|
|
61
|
-
primaryUpdateMethod: switchover
|
|
62
63
|
|
|
63
64
|
serviceAccountTemplate:
|
|
64
65
|
metadata:
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# Artifact Chart => https://artifacthub.io/packages/helm/cloudnative-pg/cloudnative-pg
|
|
2
|
+
# Examples Charts => https://cloudnative-pg.io/documentation/current/samples/
|
|
1
3
|
apiVersion: postgresql.cnpg.io/v1
|
|
2
4
|
kind: Cluster
|
|
3
5
|
metadata:
|
|
@@ -11,7 +13,7 @@ spec:
|
|
|
11
13
|
enablePodMonitor: false # set true once monitoring is setup
|
|
12
14
|
|
|
13
15
|
description: "Leverege Stack PostgreSQL DB"
|
|
14
|
-
imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:
|
|
16
|
+
imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.4-cnpg-tsdb2-rel.1
|
|
15
17
|
bootstrap:
|
|
16
18
|
initdb:
|
|
17
19
|
# database: models # do not set - let it default to cnpg app db
|
|
@@ -64,7 +66,6 @@ spec:
|
|
|
64
66
|
# - supervised: requires manual supervision to perform
|
|
65
67
|
# the switchover of the primary
|
|
66
68
|
primaryUpdateStrategy: unsupervised
|
|
67
|
-
primaryUpdateMethod: switchover
|
|
68
69
|
|
|
69
70
|
serviceAccountTemplate:
|
|
70
71
|
metadata:
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# Artifact Chart => https://artifacthub.io/packages/helm/cloudnative-pg/cloudnative-pg
|
|
2
|
+
# Examples Charts => https://cloudnative-pg.io/documentation/current/samples/
|
|
1
3
|
apiVersion: postgresql.cnpg.io/v1
|
|
2
4
|
kind: Cluster
|
|
3
5
|
metadata:
|
|
@@ -11,7 +13,7 @@ spec:
|
|
|
11
13
|
enablePodMonitor: false # set true once monitoring is setup
|
|
12
14
|
|
|
13
15
|
description: "Leverege CNPG DB (recovered)"
|
|
14
|
-
imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:
|
|
16
|
+
imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.4-cnpg-tsdb2-rel.1
|
|
15
17
|
bootstrap:
|
|
16
18
|
recovery:
|
|
17
19
|
volumeSnapshots:
|
|
@@ -59,7 +61,6 @@ spec:
|
|
|
59
61
|
# - supervised: requires manual supervision to perform
|
|
60
62
|
# the switchover of the primary
|
|
61
63
|
primaryUpdateStrategy: unsupervised
|
|
62
|
-
primaryUpdateMethod: switchover
|
|
63
64
|
|
|
64
65
|
serviceAccountTemplate:
|
|
65
66
|
metadata:
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# Artifact Chart => https://artifacthub.io/packages/helm/cloudnative-pg/cloudnative-pg
|
|
2
|
+
# Examples Charts => https://cloudnative-pg.io/documentation/current/samples/
|
|
1
3
|
apiVersion: postgresql.cnpg.io/v1
|
|
2
4
|
kind: Cluster
|
|
3
5
|
metadata:
|
|
@@ -11,7 +13,7 @@ spec:
|
|
|
11
13
|
enablePodMonitor: false # set true once monitoring is setup
|
|
12
14
|
|
|
13
15
|
description: "Leverege Plain Timescale DB"
|
|
14
|
-
imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:
|
|
16
|
+
imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.4-cnpg-tsdb2-rel.1
|
|
15
17
|
bootstrap:
|
|
16
18
|
initdb:
|
|
17
19
|
# database: imagine # let it default to cnpg app db
|
|
@@ -72,7 +74,6 @@ spec:
|
|
|
72
74
|
# - supervised: requires manual supervision to perform
|
|
73
75
|
# the switchover of the primary
|
|
74
76
|
primaryUpdateStrategy: unsupervised
|
|
75
|
-
primaryUpdateMethod: switchover
|
|
76
77
|
|
|
77
78
|
serviceAccountTemplate:
|
|
78
79
|
metadata:
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# Artifact Chart => https://artifacthub.io/packages/helm/cloudnative-pg/cloudnative-pg
|
|
2
|
+
# Examples Charts => https://cloudnative-pg.io/documentation/current/samples/
|
|
1
3
|
apiVersion: postgresql.cnpg.io/v1
|
|
2
4
|
kind: Cluster
|
|
3
5
|
metadata:
|
|
@@ -11,7 +13,7 @@ spec:
|
|
|
11
13
|
enablePodMonitor: false # set true once monitoring is setup
|
|
12
14
|
|
|
13
15
|
description: "Leverege Dense Timescale DB"
|
|
14
|
-
imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:
|
|
16
|
+
imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.4-cnpg-tsdb2-rel.1
|
|
15
17
|
bootstrap:
|
|
16
18
|
initdb:
|
|
17
19
|
postInitTemplateSQL:
|
|
@@ -67,7 +69,6 @@ spec:
|
|
|
67
69
|
# - supervised: requires manual supervision to perform
|
|
68
70
|
# the switchover of the primary
|
|
69
71
|
primaryUpdateStrategy: unsupervised
|
|
70
|
-
primaryUpdateMethod: switchover
|
|
71
72
|
|
|
72
73
|
serviceAccountTemplate:
|
|
73
74
|
metadata:
|
|
@@ -4,23 +4,20 @@ showInstalling "The Prometheus Operator and Components"
|
|
|
4
4
|
addHelmRepo prometheus-community https://prometheus-community.github.io/helm-charts
|
|
5
5
|
|
|
6
6
|
showInstalling "The Prometheus Operator (kube-prometheus-stack)"
|
|
7
|
-
[ -z "$PROMETHEUS_STACK_CHART_VERSION" ] && PROMETHEUS_STACK_CHART_VERSION="
|
|
7
|
+
[ -z "$PROMETHEUS_STACK_CHART_VERSION" ] && PROMETHEUS_STACK_CHART_VERSION="67"
|
|
8
8
|
|
|
9
9
|
NS="--namespace prometheus"
|
|
10
10
|
|
|
11
|
-
# https://artifacthub.io/packages/helm/prometheus-community/kube-prometheus-stack
|
|
12
11
|
helm upgrade $NS --install prometheus-stack prometheus-community/kube-prometheus-stack \
|
|
13
12
|
--values prom-operator/prometheus-stack.yaml \
|
|
14
13
|
--version $PROMETHEUS_STACK_CHART_VERSION $HELM_WHAT
|
|
15
14
|
|
|
16
|
-
# https://artifacthub.io/packages/helm/prometheus-community/prometheus-elasticsearch-exporter
|
|
17
15
|
showInstalling "The Elasticsearch Exporter (prom-operator)"
|
|
18
16
|
[ -z "$ELASTICSEARCH_EXPORTER_CHART_VERSION" ] && ELASTICSEARCH_EXPORTER_CHART_VERSION="6"
|
|
19
17
|
helm upgrade $NS --install elasticsearch8-exporter prometheus-community/prometheus-elasticsearch-exporter \
|
|
20
18
|
--values prom-operator/elasticsearch-exporter.yaml \
|
|
21
19
|
--version $ELASTICSEARCH_EXPORTER_CHART_VERSION $HELM_WHAT
|
|
22
20
|
|
|
23
|
-
# https://artifacthub.io/packages/helm/prometheus-community/prometheus-stackdriver-exporter
|
|
24
21
|
showInstalling "The Stackdriver Exporter (prom-operator)"
|
|
25
22
|
[ -z "$STACKDRIVER_EXPORTER_CHART_VERSION" ] && STACKDRIVER_EXPORTER_CHART_VERSION="4"
|
|
26
23
|
helm upgrade $NS --install stackdriver-exporter prometheus-community/prometheus-stackdriver-exporter \
|
|
@@ -128,15 +128,6 @@ export default class Config {
|
|
|
128
128
|
|
|
129
129
|
async bootstrapHookAndRelease() {
|
|
130
130
|
const repoDescr = await getRepositoryDescr()
|
|
131
|
-
if ( !repoDescr.isGitRepo ) {
|
|
132
|
-
const notGitRepo = `
|
|
133
|
-
The hook-and-release script only works with git repositories. Try running:
|
|
134
|
-
|
|
135
|
-
git init && hook-and-release --init
|
|
136
|
-
|
|
137
|
-
to initialize git and hook-and-release.`
|
|
138
|
-
errorExit( notGitRepo )
|
|
139
|
-
}
|
|
140
131
|
this.gitRoot = repoDescr.gitRoot
|
|
141
132
|
this.gitBranch = repoDescr.gitBranch
|
|
142
133
|
this.gitHooksPath = repoDescr.gitHooksPath
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export PYTHONPYCACHEPREFIX=/tmp/pycache
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Version {{regvers}} @ {{date}}
|
|
1
|
+
# Version {{regvers}} @ {{date}}
|
|
2
2
|
|
|
3
3
|
# The FROM directive sets the Base Image for subsequent instructions
|
|
4
4
|
FROM {{image}} as intermediate
|
|
@@ -25,11 +25,11 @@ COPY ./.npmrc ${NPM_CONFIG_USERCONFIG}
|
|
|
25
25
|
RUN if [ "${BUILD_ENV}" = "debian" ]; then \
|
|
26
26
|
apt-get update && \
|
|
27
27
|
apt-get install -y wget openssh-client build-essential && \
|
|
28
|
-
npm install -g
|
|
28
|
+
npm install -g npm@10; \
|
|
29
29
|
else \
|
|
30
30
|
apk --no-cache add openssh-client && \
|
|
31
31
|
apk --update add --no-cache --virtual build-dep g++ gcc libgcc libstdc++ linux-headers make {{apkadds}} && \
|
|
32
|
-
npm install -g
|
|
32
|
+
npm install -g npm@10; \
|
|
33
33
|
fi
|
|
34
34
|
|
|
35
35
|
# Use SKIP_PREPARE to disable hook-and-release from running
|
|
@@ -58,13 +58,13 @@ COPY ./.npmrc ${NPM_CONFIG_USERCONFIG}
|
|
|
58
58
|
RUN if [ "$BUILD_ENV" = "debian" ]; then \
|
|
59
59
|
apt-get update && \
|
|
60
60
|
apt-get install -y tini bash curl vim {{apkadds}} && \
|
|
61
|
-
npm install -g
|
|
61
|
+
npm install -g npm@10 && \
|
|
62
62
|
rm /bin/sh && ln -s /bin/bash /bin/sh && \
|
|
63
63
|
mkdir -p /usr/src/app /tmp/levlog && chown node:node /usr/src/app; \
|
|
64
64
|
else \
|
|
65
65
|
apk update && \
|
|
66
66
|
apk add --no-cache bash curl tini vim {{apkadds}} && \
|
|
67
|
-
npm install -g
|
|
67
|
+
npm install -g npm@10 && \
|
|
68
68
|
rm /bin/sh && ln -s /bin/bash /bin/sh && \
|
|
69
69
|
mkdir -p /usr/src/app /tmp/levlog && chown node:node /usr/src/app; \
|
|
70
70
|
fi
|
|
@@ -83,4 +83,4 @@ COPY --chown=node:node --from=intermediate /usr/src/app /usr/src/app
|
|
|
83
83
|
|
|
84
84
|
USER {{runuser}}
|
|
85
85
|
COPY ./bashrc /home/node/.bashrc
|
|
86
|
-
CMD [ "/bin/bash", "-c", "source /home/node/.bashrc && node index.js" ]
|
|
86
|
+
CMD [ "/bin/bash", "-c", "source /home/node/.bashrc && node index.js" ]
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Version {{regvers}} @ {{date}}
|
|
2
|
+
|
|
3
|
+
# The FROM directive sets the Base Image for subsequent instructions
|
|
4
|
+
FROM {{image}} as intermediate
|
|
5
|
+
|
|
6
|
+
ARG BUILD_ENV="{{buildEnv}}"
|
|
7
|
+
|
|
8
|
+
RUN apt-get update && apt-get install -y \
|
|
9
|
+
wget
|
|
10
|
+
# gcc \
|
|
11
|
+
# git \
|
|
12
|
+
# libgl1 \
|
|
13
|
+
# libglib2.0-0 \
|
|
14
|
+
# && rm -rf /var/lib/apt/lists/*
|
|
15
|
+
|
|
16
|
+
# Copy uv binary from the official distroless Docker image.
|
|
17
|
+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
|
|
18
|
+
|
|
19
|
+
# Define the working directory.
|
|
20
|
+
WORKDIR /usr/src/app
|
|
21
|
+
|
|
22
|
+
#ENV NODE_ENV production
|
|
23
|
+
#ENV NPM_CONFIG_USERCONFIG /usr/src/app/.npmrc
|
|
24
|
+
|
|
25
|
+
RUN mkdir -p /usr/src/app
|
|
26
|
+
WORKDIR /usr/src/app
|
|
27
|
+
|
|
28
|
+
# Install app dependencies
|
|
29
|
+
COPY ./workspace/ /usr/src/app/
|
|
30
|
+
ENV GRPC_VERBOSITY ERROR
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Setup pip.conf for Google Artifact Registry.
|
|
34
|
+
RUN mkdir -p ~/.config/pip
|
|
35
|
+
RUN echo "[global]" >> ~/.config/pip/pip.conf && \
|
|
36
|
+
echo "break-system-packages = true" >> ~/.config/pip/pip.conf
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# Set up the virtual environment.
|
|
40
|
+
RUN uv venv
|
|
41
|
+
ENV VIRTUAL_ENV=/usr/src/app/.venv
|
|
42
|
+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
|
43
|
+
|
|
44
|
+
# Setup keyring for Google Artifact Registry.
|
|
45
|
+
RUN uv pip install keyring
|
|
46
|
+
RUN uv pip install keyrings.google-artifactregistry-auth
|
|
47
|
+
|
|
48
|
+
RUN echo "extra-index-url = https://oauth2accesstoken@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple" >> ~/.config/pip/pip.conf
|
|
49
|
+
|
|
50
|
+
ENV UV_EXTRA_INDEX_URL "https://oauth2accesstoken@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
{{preInstallPluginfile}}
|
|
54
|
+
|
|
55
|
+
RUN cat
|
|
56
|
+
|
|
57
|
+
RUN ls -al
|
|
58
|
+
# Install uv
|
|
59
|
+
RUN uv sync --keyring-provider subprocess --extra-index-url https://oauth2accesstoken@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# Pull in the Dockerfile.plugin file here
|
|
63
|
+
{{pluginfile}}
|
|
64
|
+
|
|
65
|
+
# Eliminate the sensitive info from the final stage image
|
|
66
|
+
#RUN rm -f ${NPM_CONFIG_USERCONFIG}
|
|
67
|
+
|
|
68
|
+
# ENTRYPOINT [ "tini", "--" ]
|
|
69
|
+
#WORKDIR /usr/src/app
|
|
70
|
+
|
|
71
|
+
#COPY --chown=node:node --from=intermediate /usr/src/app /usr/src/app
|
|
72
|
+
|
|
73
|
+
USER {{runuser}}
|
|
74
|
+
COPY ./bashrc /home/{{runuser}}/.bashrc
|
|
75
|
+
CMD [ "/bin/bash", "-c", "source /home/{{runuser}}/.bashrc && python scripts/server.py" ]
|