@leverege/build-tools 2.0.4 → 2.0.6
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 +2 -2
- package/src/circleate +26 -49
- package/src/helmup +1 -1
- package/lib/server/circleate +0 -570
- package/lib/server/decrypt-secrets +0 -108
- package/lib/server/dockreate +0 -353
- package/lib/server/encrypt-secrets +0 -49
- package/lib/server/getfbcfg +0 -23
- package/lib/server/getjson +0 -48
- package/lib/server/git-tar +0 -89
- package/lib/server/helmdn +0 -111
- package/lib/server/helmify +0 -283
- package/lib/server/helmup +0 -349
- package/lib/server/overwhelm +0 -320
- package/lib/server/pkgck +0 -136
- package/lib/server/pkglint +0 -35
- package/lib/server/test.json +0 -4
- package/src/dnsify/CloudflareAPI.js +0 -99
- package/src/dnsify/accounts.json.enc +0 -0
- package/src/dnsify/index.js +0 -82
- package/src/packleate/Packleator.js +0 -281
- package/src/packleate/index.js +0 -86
- package/src/packleate/logo-ansi.js +0 -16
- package/src/test.json +0 -4
package/lib/server/helmdn
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Simple ANSI color coded string generator.
|
|
4
|
-
color() {
|
|
5
|
-
local color=
|
|
6
|
-
case "$1" in
|
|
7
|
-
'g') color="92m" ;; # green
|
|
8
|
-
'c') color="96m" ;; # lt blue
|
|
9
|
-
'y') color="93m" ;; # yellow
|
|
10
|
-
'r') color="91m" ;; # red
|
|
11
|
-
'toast') color="1;3;7;91;103;5m" ;;
|
|
12
|
-
esac
|
|
13
|
-
printf "\e[$color$2\e[0m"
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
clearlyWarn() {
|
|
17
|
-
clear
|
|
18
|
-
cat<<CLEARWARN
|
|
19
|
-
|
|
20
|
-
`color toast '*** WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***'`
|
|
21
|
-
|
|
22
|
-
CLEARWARN
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
clearlyWarn
|
|
26
|
-
cat<<ABOUT2NUKE
|
|
27
|
-
You are about to start nuking deployments, as in delete with --purge. Are
|
|
28
|
-
you certain this is what you want to do?
|
|
29
|
-
|
|
30
|
-
Enter "yes" if that is in fact the case.
|
|
31
|
-
|
|
32
|
-
ABOUT2NUKE
|
|
33
|
-
|
|
34
|
-
read ANS && [ "$ANS" != "yes" ] && exit 1
|
|
35
|
-
|
|
36
|
-
#
|
|
37
|
-
# This script is used to ease the pain of transition testing to chart museum
|
|
38
|
-
# prior to setting up keel for new clusters / installs.
|
|
39
|
-
#
|
|
40
|
-
PLATFORM=(
|
|
41
|
-
api-server
|
|
42
|
-
db-curator
|
|
43
|
-
emailer
|
|
44
|
-
imagine
|
|
45
|
-
message-processor
|
|
46
|
-
messenger
|
|
47
|
-
reason
|
|
48
|
-
scheduler
|
|
49
|
-
transponder-bq
|
|
50
|
-
transponder-fb
|
|
51
|
-
transponder-postgres
|
|
52
|
-
# transponder-sql
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
SYSTEM=(
|
|
56
|
-
elastic
|
|
57
|
-
monitoring
|
|
58
|
-
polaris
|
|
59
|
-
redis
|
|
60
|
-
velero
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
GITTOP=`git rev-parse --show-toplevel`
|
|
64
|
-
cd $GITTOP
|
|
65
|
-
|
|
66
|
-
npm run ahoy
|
|
67
|
-
[ $? -ne 0 ] && printf "\n\n***Aborting helmup...\n\n" && exit 1
|
|
68
|
-
|
|
69
|
-
helm repo update && helm search chartmuseum
|
|
70
|
-
|
|
71
|
-
function doNuking() {
|
|
72
|
-
|
|
73
|
-
for PARAM in "$@";
|
|
74
|
-
do
|
|
75
|
-
SERVICE=${PARAM%/} # strip trailing / if it's there
|
|
76
|
-
|
|
77
|
-
if [ "$SERVICE" == "platform" ];
|
|
78
|
-
then
|
|
79
|
-
doNuking "${PLATFORM[@]}" && exit $?
|
|
80
|
-
fi
|
|
81
|
-
|
|
82
|
-
if [ "$SERVICE" == "system" ];
|
|
83
|
-
then
|
|
84
|
-
doNuking "${SYSTEM[@]}" && exit $?
|
|
85
|
-
fi
|
|
86
|
-
|
|
87
|
-
if [ "$SERVICE" == "ingress" ];
|
|
88
|
-
then
|
|
89
|
-
clearlyWarn
|
|
90
|
-
cat<<NOGRESS
|
|
91
|
-
|
|
92
|
-
Deleting the ingress is probably the most costly deployment to nuke since
|
|
93
|
-
it takes so long to rebuild and stabilize. Therefore, if you REALLY want
|
|
94
|
-
to do that then you can copy and paste these commands by hand and do it
|
|
95
|
-
yourself:
|
|
96
|
-
|
|
97
|
-
npm run ahoy; helm delete --purge $SERVICE
|
|
98
|
-
|
|
99
|
-
NOGRESS
|
|
100
|
-
continue
|
|
101
|
-
fi
|
|
102
|
-
|
|
103
|
-
[ "$SERVICE" == "elastic" ] && doNuking elasticsearch && continue
|
|
104
|
-
|
|
105
|
-
helm delete --purge $SERVICE
|
|
106
|
-
done
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
doNuking $@
|
|
110
|
-
printf "\nDoing => helm ls\n\n" && helm ls
|
|
111
|
-
cd - &> /dev/null
|
package/lib/server/helmify
DELETED
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Check if Helm is installed first
|
|
4
|
-
if ! [ -x "$(command -v helm)" ]; then
|
|
5
|
-
echo 'Error: helm is not installed.'
|
|
6
|
-
echo 'To install: brew install kubernetes-helm'
|
|
7
|
-
exit 1
|
|
8
|
-
fi
|
|
9
|
-
|
|
10
|
-
# Check if Chart Museum is installed
|
|
11
|
-
if ! [ -x "$(command -v chartmuseum)" ]; then
|
|
12
|
-
echo 'Error: chartmuseum is not installed.'
|
|
13
|
-
echo 'To install: see instructions at https://leverege.atlassian.net/wiki/spaces/PLAT/pages/679542800/Helm+Charts+via+ChartMuseum'
|
|
14
|
-
exit 1
|
|
15
|
-
fi
|
|
16
|
-
|
|
17
|
-
# Check if Chart Museum is running
|
|
18
|
-
url='http://localhost:8080/'
|
|
19
|
-
status_code=$(curl --write-out %{http_code} --silent --output /dev/null ${url})
|
|
20
|
-
|
|
21
|
-
if [[ "$status_code" -ne 200 ]] ; then
|
|
22
|
-
echo 'Error: Chart Museum is not running'
|
|
23
|
-
echo 'To run: chartmuseum --debug --port=8080 --storage="google" --storage-google-bucket="leverege-helm-charts" --storage-google-prefix=""'
|
|
24
|
-
exit 1
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
# Bootstrap Helm charts
|
|
28
|
-
chartname=${PWD##*/}
|
|
29
|
-
chartname_go=${chartname//-/_}
|
|
30
|
-
|
|
31
|
-
if [ -d helm ];
|
|
32
|
-
then
|
|
33
|
-
printf "\nThere is an existing Helm repo, do you want to override?\n\n"
|
|
34
|
-
printf "Hit return to continue or ^C to exit\n\n"; read ANS
|
|
35
|
-
rm -rf helm
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
createService() {
|
|
39
|
-
cat<<SVC_YAML > service.yaml
|
|
40
|
-
kind: Service
|
|
41
|
-
apiVersion: v1
|
|
42
|
-
metadata:
|
|
43
|
-
name: $chartname
|
|
44
|
-
spec:
|
|
45
|
-
type: NodePort
|
|
46
|
-
selector:
|
|
47
|
-
app: $chartname
|
|
48
|
-
ports:
|
|
49
|
-
- name: $chartname-input
|
|
50
|
-
protocol: TCP
|
|
51
|
-
port: {{ .Values.$chartname_go.SERVER_PORT }}
|
|
52
|
-
targetPort: api
|
|
53
|
-
SVC_YAML
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
# Make chart directory
|
|
57
|
-
mkdir helm
|
|
58
|
-
mkdir helm/templates
|
|
59
|
-
|
|
60
|
-
# Make Chart.yaml
|
|
61
|
-
cd helm
|
|
62
|
-
|
|
63
|
-
PACKAGE_VERSION=$(node -p "require('../package.json').version")
|
|
64
|
-
|
|
65
|
-
cat<<CHARTYAML > Chart.yaml
|
|
66
|
-
name: $chartname
|
|
67
|
-
version: 1.0.0 # version of the Helm Chart
|
|
68
|
-
appVersion: $PACKAGE_VERSION # minimum version of your application that is compatible with this chart
|
|
69
|
-
|
|
70
|
-
CHARTYAML
|
|
71
|
-
|
|
72
|
-
# Bootstrap values.yaml
|
|
73
|
-
cat<<VALUESYAML > values.yaml
|
|
74
|
-
### These are default env variable values for your application
|
|
75
|
-
### It is not actually used in production, but listed here for others as reference for what types of env variables are required.
|
|
76
|
-
### Overwrite these values in values-local or respective values files in platform-k8s
|
|
77
|
-
|
|
78
|
-
# List your env variables here
|
|
79
|
-
$chartname_go:
|
|
80
|
-
VERSION: vX.Y.Z
|
|
81
|
-
SERVER_PORT: 8080
|
|
82
|
-
IMAGE: gcr.io/leverege-docker-images/$chartname
|
|
83
|
-
|
|
84
|
-
default:
|
|
85
|
-
MAX_CHILD_PROCESSES: "1"
|
|
86
|
-
|
|
87
|
-
MODEL_FIREBASE_SERVICE_ACCOUNT: /var/config/keys/model-data
|
|
88
|
-
MODEL_FIREBASE_DATABASE_URL: https://OVH:<PROJECT_NAME>.firebaseio.com
|
|
89
|
-
MODEL_FIREBASE_CONFIG: /var/config/keys/model-data-config
|
|
90
|
-
|
|
91
|
-
SECRET_KEY: key.json
|
|
92
|
-
|
|
93
|
-
PUBSUB_SERVICE_ACCOUNT: /var/config/keys/pubsub
|
|
94
|
-
|
|
95
|
-
TRANSPORT_CONFIG: "{
|
|
96
|
-
\"type\": \"pubsub\",
|
|
97
|
-
\"projectId\": \"OVH:<PROJECT_NAME>\",
|
|
98
|
-
\"keyFilename\": \"/var/config/keys/pubsub/key.json\" ,
|
|
99
|
-
\"publisher\": {
|
|
100
|
-
\"batching\": {
|
|
101
|
-
\"maxMilliseconds\": 0,
|
|
102
|
-
\"maxMessages\": 999
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}"
|
|
106
|
-
LOG_CONFIG: "{
|
|
107
|
-
\"type\": \"bunyan\",
|
|
108
|
-
\"name\": \"${logName}\",
|
|
109
|
-
\"level\": \"info\",
|
|
110
|
-
\"streams\": [
|
|
111
|
-
{
|
|
112
|
-
\"type\": \"stackdriver\",
|
|
113
|
-
\"logName\": \"${logName}\"
|
|
114
|
-
}
|
|
115
|
-
]
|
|
116
|
-
}"
|
|
117
|
-
CACHE_CONFIG: "{
|
|
118
|
-
\"type\": \"redis\",
|
|
119
|
-
\"connection\": {
|
|
120
|
-
\"host\": \"redis-master\",
|
|
121
|
-
\"port\": \"6379\"
|
|
122
|
-
}
|
|
123
|
-
}"
|
|
124
|
-
LIMIT_CONFIG: "{
|
|
125
|
-
\"type\":\"redis\",
|
|
126
|
-
\"connection\":{
|
|
127
|
-
\"host\":\"redis-master\",
|
|
128
|
-
\"port\":6379
|
|
129
|
-
},
|
|
130
|
-
\"limitOptions\":{
|
|
131
|
-
\"frequency\":30,
|
|
132
|
-
\"period\":60000,
|
|
133
|
-
\"duration\":600000
|
|
134
|
-
}
|
|
135
|
-
}"
|
|
136
|
-
NODE_ENVIRONMENT: production
|
|
137
|
-
|
|
138
|
-
VALUESYAML
|
|
139
|
-
|
|
140
|
-
# Bootstrap templates
|
|
141
|
-
cd templates
|
|
142
|
-
cat<<DEPLOYMENT_YAML > deployment.yaml
|
|
143
|
-
apiVersion: apps/v1beta1
|
|
144
|
-
kind: Deployment
|
|
145
|
-
metadata:
|
|
146
|
-
name: {{ .Chart.Name }}
|
|
147
|
-
spec:
|
|
148
|
-
template:
|
|
149
|
-
metadata:
|
|
150
|
-
labels:
|
|
151
|
-
app: {{ .Chart.Name }}
|
|
152
|
-
chart/version: {{ .Chart.Version }}
|
|
153
|
-
chart/appVersion: {{ .Chart.AppVersion }}
|
|
154
|
-
annotations:
|
|
155
|
-
prometheus.io/port: '5111'
|
|
156
|
-
prometheus.io/scrape: 'true'
|
|
157
|
-
spec:
|
|
158
|
-
volumes:
|
|
159
|
-
- name: model-firebase-key
|
|
160
|
-
secret:
|
|
161
|
-
secretName: model-data
|
|
162
|
-
- name: tmpfs
|
|
163
|
-
emptyDir: {}
|
|
164
|
-
- name: pubsub-key
|
|
165
|
-
secret:
|
|
166
|
-
secretName: pubsub
|
|
167
|
-
{{- if (.Values.$chartname_go.PREEMPTIBLE) and eq .Values.$chartname_go.PREEMPTIBLE "true" }}
|
|
168
|
-
tolerations:
|
|
169
|
-
- key: "preemptible"
|
|
170
|
-
operator: "Equal"
|
|
171
|
-
value: "true"
|
|
172
|
-
effect: "NoSchedule"
|
|
173
|
-
affinity:
|
|
174
|
-
podAntiAffinity:
|
|
175
|
-
preferredDuringSchedulingIgnoredDuringExecution:
|
|
176
|
-
- weight: 100
|
|
177
|
-
podAffinityTerm:
|
|
178
|
-
labelSelector:
|
|
179
|
-
matchExpressions:
|
|
180
|
-
- key: app
|
|
181
|
-
operator: In
|
|
182
|
-
values:
|
|
183
|
-
- {{ .Chart.Name }}
|
|
184
|
-
topologyKey: kubernetes.io/hostname
|
|
185
|
-
nodeAffinity:
|
|
186
|
-
preferredDuringSchedulingIgnoredDuringExecution:
|
|
187
|
-
- preference:
|
|
188
|
-
matchExpressions:
|
|
189
|
-
- key: cloud.google.com/gke-preemptible
|
|
190
|
-
operator: Exists
|
|
191
|
-
weight: 50
|
|
192
|
-
{{- end }}
|
|
193
|
-
containers:
|
|
194
|
-
- name: {{ .Chart.Name }}
|
|
195
|
-
image: {{ .Values.$chartname_go.IMAGE }}:{{ .Values.$chartname_go.VERSION }}
|
|
196
|
-
imagePullPolicy: Always
|
|
197
|
-
securityContext:
|
|
198
|
-
readOnlyRootFilesystem: true
|
|
199
|
-
runAsNonRoot: true
|
|
200
|
-
runAsUser: 1000
|
|
201
|
-
allowPrivilegeEscalation: false
|
|
202
|
-
readinessProbe:
|
|
203
|
-
httpGet:
|
|
204
|
-
path: /
|
|
205
|
-
port: node-metrics
|
|
206
|
-
initialDelaySeconds: 10
|
|
207
|
-
{{- if (.Values.$chartname_go.LIVENESS_PROBE) and eq .Values.$chartname_go.LIVENESS_PROBE "true" }}
|
|
208
|
-
livenessProbe:
|
|
209
|
-
httpGet:
|
|
210
|
-
path: /livenessProbe
|
|
211
|
-
port: api
|
|
212
|
-
initialDelaySeconds: 15
|
|
213
|
-
periodSeconds: 60
|
|
214
|
-
{{- end }}
|
|
215
|
-
resources:
|
|
216
|
-
requests:
|
|
217
|
-
cpu: "50m"
|
|
218
|
-
memory: "256Mi"
|
|
219
|
-
limits:
|
|
220
|
-
cpu: "100m"
|
|
221
|
-
memory: "512Mi"
|
|
222
|
-
ports:
|
|
223
|
-
{{- if .Values.$chartname_go.SERVER_PORT }}
|
|
224
|
-
- name: api
|
|
225
|
-
containerPort: {{ .Values.$chartname_go.SERVER_PORT }}
|
|
226
|
-
{{- end }}
|
|
227
|
-
- name: node-metrics
|
|
228
|
-
containerPort: 5111
|
|
229
|
-
volumeMounts:
|
|
230
|
-
- name: model-firebase-key
|
|
231
|
-
mountPath: {{ .Values.default.MODEL_FIREBASE_SERVICE_ACCOUNT | quote }}
|
|
232
|
-
- name: tmpfs
|
|
233
|
-
mountPath: "/tmp"
|
|
234
|
-
- name: pubsub-key
|
|
235
|
-
mountPath: {{ .Values.default.PUBSUB_SERVICE_ACCOUNT | quote }}
|
|
236
|
-
env:
|
|
237
|
-
- name: NODE_ENV
|
|
238
|
-
value: {{ .Values.default.NODE_ENVIRONMENT }}
|
|
239
|
-
- name: CACHE_CONFIG
|
|
240
|
-
value: {{ required "Cache config required" .Values.default.CACHE_CONFIG | quote }}
|
|
241
|
-
- name: LIMIT_CONFIG
|
|
242
|
-
value: {{ required "Limit config required" .Values.default.LIMIT_CONFIG | quote }}
|
|
243
|
-
- name: TRANSPORT_CONFIG
|
|
244
|
-
value: {{ required "Transport config required" .Values.default.TRANSPORT_CONFIG | quote }}
|
|
245
|
-
- name: LOG_CONFIG
|
|
246
|
-
value: {{ required "Log config required" .Values.default.LOG_CONFIG | quote }}
|
|
247
|
-
- name: MAX_CHILD_PROCESSES
|
|
248
|
-
value: {{ .Values.default.MAX_CHILD_PROCESSES | default 1 | quote }}
|
|
249
|
-
- name: MODEL_FIREBASE_SERVICE_ACCOUNT
|
|
250
|
-
value: {{ .Values.default.MODEL_FIREBASE_SERVICE_ACCOUNT }}/{{ .Values.default.SECRET_KEY }}
|
|
251
|
-
- name: MODEL_FIREBASE_DATABASE_URL
|
|
252
|
-
value: {{ .Values.default.MODEL_FIREBASE_DATABASE_URL | quote }}
|
|
253
|
-
DEPLOYMENT_YAML
|
|
254
|
-
|
|
255
|
-
read -p "Does your server need an open port to the Internet (i.e. ingress or service)? [Y or N] " -n 1 -r
|
|
256
|
-
echo # (optional) move to a new line
|
|
257
|
-
if [[ $REPLY =~ ^[Yy]$ ]]
|
|
258
|
-
then
|
|
259
|
-
echo
|
|
260
|
-
echo '**********************************'
|
|
261
|
-
echo ' CREATING SERVICE TEMPLATES '
|
|
262
|
-
echo '**********************************'
|
|
263
|
-
createService
|
|
264
|
-
|
|
265
|
-
fi
|
|
266
|
-
|
|
267
|
-
# Print out some hints
|
|
268
|
-
cat<<HINTS
|
|
269
|
-
|
|
270
|
-
*** IMPORTANT ***
|
|
271
|
-
|
|
272
|
-
1. You will need to add in additional env variables to both templates/*.yaml and values.yaml
|
|
273
|
-
2. You may not need all the default env variables so feel free to remove them as well
|
|
274
|
-
3. Adjust limit/request cpu and memory values as needed
|
|
275
|
-
4. To use ingress, you need to reserve static ip then add to ingress templates in platform-k8s
|
|
276
|
-
|
|
277
|
-
Further instructions here: https://github.com/kelseyhightower/ingress-with-static-ip
|
|
278
|
-
|
|
279
|
-
5. Finally, follow chart museum directions to add your chart ors
|
|
280
|
-
|
|
281
|
-
helm push helm/ chartmuseum
|
|
282
|
-
|
|
283
|
-
HINTS
|