@leverege/build-tools 2.6.6 → 2.6.8
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/lib/server/repo-init/config.tgz +0 -0
- package/package.json +2 -2
- package/src/dockreate +11 -4
- package/src/helmup +47 -0
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.8",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -79,6 +79,6 @@
|
|
|
79
79
|
"@babel/node": "^7.15.4",
|
|
80
80
|
"@leverege/babel-preset-leverege-node": "^2.0.0",
|
|
81
81
|
"@leverege/eslint-config-leverege": "^3.0.1",
|
|
82
|
-
"npm": "^7.
|
|
82
|
+
"npm": "^7.23.0"
|
|
83
83
|
}
|
|
84
84
|
}
|
package/src/dockreate
CHANGED
|
@@ -52,6 +52,7 @@ create_Dockerfile() {
|
|
|
52
52
|
local regvers="${1}"
|
|
53
53
|
local nodeimg="${2:-fermium-alpine}"
|
|
54
54
|
local apkadds="${3}"
|
|
55
|
+
|
|
55
56
|
echo "Creating the Dockerfile for node ${nodeimg}"
|
|
56
57
|
cat<<DOCKERBLD > Dockerfile
|
|
57
58
|
# Version ${regvers} @ `date`
|
|
@@ -73,11 +74,11 @@ ENV GRPC_VERBOSITY ERROR
|
|
|
73
74
|
|
|
74
75
|
# Install packages to install private repos with ssh keys
|
|
75
76
|
COPY ./.npmrc /usr/src/app/.npmrc
|
|
76
|
-
RUN apk --no-cache add
|
|
77
|
+
RUN apk --no-cache add openssh-client && \
|
|
77
78
|
apk --update add --no-cache --virtual build-dep g++ gcc libgcc \\
|
|
78
79
|
libstdc++ linux-headers make python ${apkadds} && \
|
|
79
80
|
npm install -g npm@7 && \
|
|
80
|
-
npm ci --only-production --ignore-scripts
|
|
81
|
+
npm ci --only-production --ignore-scripts ${npmlogging} && \
|
|
81
82
|
rm -f /usr/src/app/.npmrc /root/.ssh/*
|
|
82
83
|
|
|
83
84
|
# --------------------------------------------------------------
|
|
@@ -88,9 +89,11 @@ FROM node:${nodeimg}
|
|
|
88
89
|
|
|
89
90
|
# Install tini for PID 1 and replace shell with bash so we can source files
|
|
90
91
|
RUN apk update && \
|
|
91
|
-
apk add --no-cache tini
|
|
92
|
+
apk add --no-cache bash curl tini vim ${apkadds} && \
|
|
93
|
+
npm install -g npm@7 && \
|
|
92
94
|
rm /bin/sh && ln -s /bin/bash /bin/sh && \
|
|
93
|
-
mkdir -p /usr/src/app /tmp/levlog
|
|
95
|
+
mkdir -p /usr/src/app /tmp/levlog && \
|
|
96
|
+
chown node:node /usr/src/app
|
|
94
97
|
DOCKERBLD
|
|
95
98
|
|
|
96
99
|
if [ -f "${pluginFile}" ];
|
|
@@ -196,6 +199,9 @@ apkadds=$(strip_undefined "`node -p \"require('../package.json').leverege.apkadd
|
|
|
196
199
|
runuser=$(strip_undefined "`node -p \"require('../package.json').leverege.runuser\"`")
|
|
197
200
|
[ -z "${runuser}" ] && runuser='node'
|
|
198
201
|
|
|
202
|
+
npmlogging='--silent' # allow for verbose npm logs
|
|
203
|
+
[ "$VERBOSE_DOCKREATE_NPM" == "yes" ] && npmlogging='--ddd'
|
|
204
|
+
|
|
199
205
|
echo "Updating dependencies and workspace..." && npm install
|
|
200
206
|
|
|
201
207
|
container="`node -p \"require('../package.json').leverege.container\"`"
|
|
@@ -287,6 +293,7 @@ cat<<IMGINFO
|
|
|
287
293
|
Project: $(colorize 'green' "$project")
|
|
288
294
|
Container: $(colorize 'green' "$container")
|
|
289
295
|
NodeImage: $(colorize 'green' "$nodeimg")
|
|
296
|
+
NPM Logs: $(colorize 'green' "$npmlogging")
|
|
290
297
|
AddedPkgs: $(colorize 'green' "$apkadds")
|
|
291
298
|
PluggedIn: ${pluggedIn}
|
|
292
299
|
Version: $(colorize 'green' "$version") $tagstat
|
package/src/helmup
CHANGED
|
@@ -31,6 +31,7 @@ SYSTEM=(
|
|
|
31
31
|
postgres
|
|
32
32
|
timescale-db
|
|
33
33
|
monitoring
|
|
34
|
+
preemptible-killer
|
|
34
35
|
reloader
|
|
35
36
|
traefik
|
|
36
37
|
velero
|
|
@@ -236,6 +237,48 @@ function getManagedSecret() {
|
|
|
236
237
|
echo $SECRET
|
|
237
238
|
}
|
|
238
239
|
|
|
240
|
+
function getProjectIdFromK8sContext() {
|
|
241
|
+
local currContext=`kubectl config current-context`
|
|
242
|
+
|
|
243
|
+
IFS='_'
|
|
244
|
+
read -ra ADDR <<< "$currContext"
|
|
245
|
+
|
|
246
|
+
echo ${ADDR[1]} # project id is the second string split by _
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
# https://github.com/estafette/estafette-gke-preemptible-killer
|
|
250
|
+
function installPreemptibleKiller() {
|
|
251
|
+
PROJECT_ID="$(getProjectIdFromK8sContext)"
|
|
252
|
+
createNamespaceIfNeeded estafette
|
|
253
|
+
helm repo add estafette https://helm.estafette.io &>/dev/null
|
|
254
|
+
|
|
255
|
+
gcloud iam service-accounts create preemptible-killer \
|
|
256
|
+
--project=$PROJECT_ID \
|
|
257
|
+
--display-name preemptible-killer
|
|
258
|
+
|
|
259
|
+
gcloud iam roles create preemptible_killer \
|
|
260
|
+
--project $PROJECT_ID \
|
|
261
|
+
--title preemptible-killer \
|
|
262
|
+
--description "Delete compute instances" \
|
|
263
|
+
--permissions compute.instances.delete
|
|
264
|
+
|
|
265
|
+
local service_account_email=$(gcloud iam --project=$PROJECT_ID service-accounts list --filter preemptible-killer --format 'value([email])')
|
|
266
|
+
gcloud projects add-iam-policy-binding $PROJECT_ID \
|
|
267
|
+
--member=serviceAccount:${service_account_email} \
|
|
268
|
+
--role=projects/${PROJECT_ID}/roles/preemptible_killer &>/dev/null
|
|
269
|
+
|
|
270
|
+
gcloud iam service-accounts keys create \
|
|
271
|
+
--project=$PROJECT_ID \
|
|
272
|
+
--iam-account $service_account_email \
|
|
273
|
+
google_service_account.json &>/dev/null
|
|
274
|
+
|
|
275
|
+
helm upgrade --install estafette-gke-preemptible-killer \
|
|
276
|
+
estafette/estafette-gke-preemptible-killer \
|
|
277
|
+
--namespace estafette \
|
|
278
|
+
--set extraEnv.BLACKLIST_HOURS="10:00-02:00"
|
|
279
|
+
# --set extraEnv.WHITELIST_HOURS="12:30-13:30"
|
|
280
|
+
}
|
|
281
|
+
|
|
239
282
|
function installTraefik() {
|
|
240
283
|
createNamespaceIfNeeded traefik
|
|
241
284
|
|
|
@@ -498,6 +541,10 @@ function doInstall() {
|
|
|
498
541
|
helm upgrade --install postgres bitnami/postgresql -f postgres/postgres-values.yaml --version 8.9.6
|
|
499
542
|
;;
|
|
500
543
|
|
|
544
|
+
"preemptible-killer")
|
|
545
|
+
installPreemptibleKiller # the gke preemptible node spreader outer
|
|
546
|
+
;;
|
|
547
|
+
|
|
501
548
|
"redis")
|
|
502
549
|
# https://github.com/helm/charts/tree/master/stable/redis
|
|
503
550
|
[ -z "$REDIS_HELM_CHART" ] && REDIS_HELM_CHART="v9.1.5"
|