@leverege/build-tools 2.2.2 → 2.2.3
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/CHANGELOG.md +4 -0
- package/lib/server/helmify/files.js +24 -0
- package/lib/server/helmify/helm.js +219 -0
- package/lib/server/helmify/index.js +46 -0
- package/package.json +12 -7
- package/src/helminit-dp +174 -0
- package/src/helminit-scaler +20 -0
- package/src/helminit-svc +21 -0
- package/src/helmup +1 -1
- package/lib/server/dnsify/CloudflareAPI.js +0 -103
- package/lib/server/dnsify/accounts.json.enc +0 -0
- package/lib/server/dnsify/index.js +0 -92
- package/lib/web/dnsify/CloudflareAPI.js +0 -256
- package/lib/web/dnsify/index.js +0 -153
- package/src/helmify +0 -266
package/src/helmify
DELETED
|
@@ -1,266 +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
|
-
# Bootstrap Helm charts
|
|
11
|
-
chartname=${PWD##*/}
|
|
12
|
-
chartname_go=${chartname//-/_}
|
|
13
|
-
|
|
14
|
-
if [ -d helm ];
|
|
15
|
-
then
|
|
16
|
-
printf "\nThere is an existing Helm repo, do you want to override?\n\n"
|
|
17
|
-
printf "Hit return to continue or ^C to exit\n\n"; read ANS
|
|
18
|
-
rm -rf helm
|
|
19
|
-
fi
|
|
20
|
-
|
|
21
|
-
createService() {
|
|
22
|
-
cat<<SVC_YAML > service.yaml
|
|
23
|
-
kind: Service
|
|
24
|
-
apiVersion: v1
|
|
25
|
-
metadata:
|
|
26
|
-
name: $chartname
|
|
27
|
-
spec:
|
|
28
|
-
type: NodePort
|
|
29
|
-
selector:
|
|
30
|
-
app: $chartname
|
|
31
|
-
ports:
|
|
32
|
-
- name: $chartname-input
|
|
33
|
-
protocol: TCP
|
|
34
|
-
port: {{ .Values.$chartname_go.SERVER_PORT }}
|
|
35
|
-
targetPort: api
|
|
36
|
-
SVC_YAML
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
# Make chart directory
|
|
40
|
-
mkdir helm
|
|
41
|
-
mkdir helm/templates
|
|
42
|
-
|
|
43
|
-
# Make Chart.yaml
|
|
44
|
-
cd helm
|
|
45
|
-
|
|
46
|
-
PACKAGE_VERSION=$(node -p "require('../package.json').version")
|
|
47
|
-
|
|
48
|
-
cat<<CHARTYAML > Chart.yaml
|
|
49
|
-
name: $chartname
|
|
50
|
-
version: 1.0.0 # version of the Helm Chart
|
|
51
|
-
appVersion: $PACKAGE_VERSION # minimum version of your application that is compatible with this chart
|
|
52
|
-
|
|
53
|
-
CHARTYAML
|
|
54
|
-
|
|
55
|
-
# Bootstrap values.yaml
|
|
56
|
-
cat<<VALUESYAML > values.yaml
|
|
57
|
-
### These are default env variable values for your application
|
|
58
|
-
### It is not actually used in production, but listed here for others as reference for what types of env variables are required.
|
|
59
|
-
### Overwrite these values in values-local or respective values files in platform-k8s
|
|
60
|
-
|
|
61
|
-
# List your env variables here
|
|
62
|
-
$chartname_go:
|
|
63
|
-
VERSION: vX.Y.Z
|
|
64
|
-
SERVER_PORT: 8080
|
|
65
|
-
IMAGE: gcr.io/leverege-docker-images/$chartname
|
|
66
|
-
|
|
67
|
-
default:
|
|
68
|
-
MAX_CHILD_PROCESSES: "1"
|
|
69
|
-
|
|
70
|
-
MODEL_FIREBASE_SERVICE_ACCOUNT: /var/config/keys/model-data
|
|
71
|
-
MODEL_FIREBASE_DATABASE_URL: https://OVH:<PROJECT_NAME>.firebaseio.com
|
|
72
|
-
MODEL_FIREBASE_CONFIG: /var/config/keys/model-data-config
|
|
73
|
-
|
|
74
|
-
SECRET_KEY: key.json
|
|
75
|
-
|
|
76
|
-
PUBSUB_SERVICE_ACCOUNT: /var/config/keys/pubsub
|
|
77
|
-
|
|
78
|
-
TRANSPORT_CONFIG: "{
|
|
79
|
-
\"type\": \"pubsub\",
|
|
80
|
-
\"projectId\": \"OVH:<PROJECT_NAME>\",
|
|
81
|
-
\"keyFilename\": \"/var/config/keys/pubsub/key.json\" ,
|
|
82
|
-
\"publisher\": {
|
|
83
|
-
\"batching\": {
|
|
84
|
-
\"maxMilliseconds\": 0,
|
|
85
|
-
\"maxMessages\": 999
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}"
|
|
89
|
-
LOG_CONFIG: "{
|
|
90
|
-
\"type\": \"bunyan\",
|
|
91
|
-
\"name\": \"${logName}\",
|
|
92
|
-
\"level\": \"info\",
|
|
93
|
-
\"streams\": [
|
|
94
|
-
{
|
|
95
|
-
\"type\": \"stackdriver\",
|
|
96
|
-
\"logName\": \"${logName}\"
|
|
97
|
-
}
|
|
98
|
-
]
|
|
99
|
-
}"
|
|
100
|
-
CACHE_CONFIG: "{
|
|
101
|
-
\"type\": \"redis\",
|
|
102
|
-
\"connection\": {
|
|
103
|
-
\"host\": \"redis-master\",
|
|
104
|
-
\"port\": \"6379\"
|
|
105
|
-
}
|
|
106
|
-
}"
|
|
107
|
-
LIMIT_CONFIG: "{
|
|
108
|
-
\"type\":\"redis\",
|
|
109
|
-
\"connection\":{
|
|
110
|
-
\"host\":\"redis-master\",
|
|
111
|
-
\"port\":6379
|
|
112
|
-
},
|
|
113
|
-
\"limitOptions\":{
|
|
114
|
-
\"frequency\":30,
|
|
115
|
-
\"period\":60000,
|
|
116
|
-
\"duration\":600000
|
|
117
|
-
}
|
|
118
|
-
}"
|
|
119
|
-
NODE_ENVIRONMENT: production
|
|
120
|
-
|
|
121
|
-
VALUESYAML
|
|
122
|
-
|
|
123
|
-
# Bootstrap templates
|
|
124
|
-
cd templates
|
|
125
|
-
cat<<DEPLOYMENT_YAML > deployment.yaml
|
|
126
|
-
apiVersion: apps/v1beta1
|
|
127
|
-
kind: Deployment
|
|
128
|
-
metadata:
|
|
129
|
-
name: {{ .Chart.Name }}
|
|
130
|
-
spec:
|
|
131
|
-
template:
|
|
132
|
-
metadata:
|
|
133
|
-
labels:
|
|
134
|
-
app: {{ .Chart.Name }}
|
|
135
|
-
chart/version: {{ .Chart.Version }}
|
|
136
|
-
chart/appVersion: {{ .Chart.AppVersion }}
|
|
137
|
-
annotations:
|
|
138
|
-
prometheus.io/port: '5111'
|
|
139
|
-
prometheus.io/scrape: 'true'
|
|
140
|
-
spec:
|
|
141
|
-
volumes:
|
|
142
|
-
- name: model-firebase-key
|
|
143
|
-
secret:
|
|
144
|
-
secretName: model-data
|
|
145
|
-
- name: tmpfs
|
|
146
|
-
emptyDir: {}
|
|
147
|
-
- name: pubsub-key
|
|
148
|
-
secret:
|
|
149
|
-
secretName: pubsub
|
|
150
|
-
{{- if (.Values.$chartname_go.PREEMPTIBLE) and eq .Values.$chartname_go.PREEMPTIBLE "true" }}
|
|
151
|
-
tolerations:
|
|
152
|
-
- key: "preemptible"
|
|
153
|
-
operator: "Equal"
|
|
154
|
-
value: "true"
|
|
155
|
-
effect: "NoSchedule"
|
|
156
|
-
affinity:
|
|
157
|
-
podAntiAffinity:
|
|
158
|
-
preferredDuringSchedulingIgnoredDuringExecution:
|
|
159
|
-
- weight: 100
|
|
160
|
-
podAffinityTerm:
|
|
161
|
-
labelSelector:
|
|
162
|
-
matchExpressions:
|
|
163
|
-
- key: app
|
|
164
|
-
operator: In
|
|
165
|
-
values:
|
|
166
|
-
- {{ .Chart.Name }}
|
|
167
|
-
topologyKey: kubernetes.io/hostname
|
|
168
|
-
nodeAffinity:
|
|
169
|
-
preferredDuringSchedulingIgnoredDuringExecution:
|
|
170
|
-
- preference:
|
|
171
|
-
matchExpressions:
|
|
172
|
-
- key: cloud.google.com/gke-preemptible
|
|
173
|
-
operator: Exists
|
|
174
|
-
weight: 50
|
|
175
|
-
{{- end }}
|
|
176
|
-
containers:
|
|
177
|
-
- name: {{ .Chart.Name }}
|
|
178
|
-
image: {{ .Values.$chartname_go.IMAGE }}:{{ .Values.$chartname_go.VERSION }}
|
|
179
|
-
imagePullPolicy: Always
|
|
180
|
-
securityContext:
|
|
181
|
-
readOnlyRootFilesystem: true
|
|
182
|
-
runAsNonRoot: true
|
|
183
|
-
runAsUser: 1000
|
|
184
|
-
allowPrivilegeEscalation: false
|
|
185
|
-
readinessProbe:
|
|
186
|
-
httpGet:
|
|
187
|
-
path: /
|
|
188
|
-
port: node-metrics
|
|
189
|
-
initialDelaySeconds: 10
|
|
190
|
-
{{- if (.Values.$chartname_go.LIVENESS_PROBE) and eq .Values.$chartname_go.LIVENESS_PROBE "true" }}
|
|
191
|
-
livenessProbe:
|
|
192
|
-
httpGet:
|
|
193
|
-
path: /livenessProbe
|
|
194
|
-
port: api
|
|
195
|
-
initialDelaySeconds: 15
|
|
196
|
-
periodSeconds: 60
|
|
197
|
-
{{- end }}
|
|
198
|
-
resources:
|
|
199
|
-
requests:
|
|
200
|
-
cpu: "50m"
|
|
201
|
-
memory: "256Mi"
|
|
202
|
-
limits:
|
|
203
|
-
cpu: "100m"
|
|
204
|
-
memory: "512Mi"
|
|
205
|
-
ports:
|
|
206
|
-
{{- if .Values.$chartname_go.SERVER_PORT }}
|
|
207
|
-
- name: api
|
|
208
|
-
containerPort: {{ .Values.$chartname_go.SERVER_PORT }}
|
|
209
|
-
{{- end }}
|
|
210
|
-
- name: node-metrics
|
|
211
|
-
containerPort: 5111
|
|
212
|
-
volumeMounts:
|
|
213
|
-
- name: model-firebase-key
|
|
214
|
-
mountPath: {{ .Values.default.MODEL_FIREBASE_SERVICE_ACCOUNT | quote }}
|
|
215
|
-
- name: tmpfs
|
|
216
|
-
mountPath: "/tmp"
|
|
217
|
-
- name: pubsub-key
|
|
218
|
-
mountPath: {{ .Values.default.PUBSUB_SERVICE_ACCOUNT | quote }}
|
|
219
|
-
env:
|
|
220
|
-
- name: NODE_ENV
|
|
221
|
-
value: {{ .Values.default.NODE_ENVIRONMENT }}
|
|
222
|
-
- name: CACHE_CONFIG
|
|
223
|
-
value: {{ required "Cache config required" .Values.default.CACHE_CONFIG | quote }}
|
|
224
|
-
- name: LIMIT_CONFIG
|
|
225
|
-
value: {{ required "Limit config required" .Values.default.LIMIT_CONFIG | quote }}
|
|
226
|
-
- name: TRANSPORT_CONFIG
|
|
227
|
-
value: {{ required "Transport config required" .Values.default.TRANSPORT_CONFIG | quote }}
|
|
228
|
-
- name: LOG_CONFIG
|
|
229
|
-
value: {{ required "Log config required" .Values.default.LOG_CONFIG | quote }}
|
|
230
|
-
- name: MAX_CHILD_PROCESSES
|
|
231
|
-
value: {{ .Values.default.MAX_CHILD_PROCESSES | default 1 | quote }}
|
|
232
|
-
- name: MODEL_FIREBASE_SERVICE_ACCOUNT
|
|
233
|
-
value: {{ .Values.default.MODEL_FIREBASE_SERVICE_ACCOUNT }}/{{ .Values.default.SECRET_KEY }}
|
|
234
|
-
- name: MODEL_FIREBASE_DATABASE_URL
|
|
235
|
-
value: {{ .Values.default.MODEL_FIREBASE_DATABASE_URL | quote }}
|
|
236
|
-
DEPLOYMENT_YAML
|
|
237
|
-
|
|
238
|
-
read -p "Does your server need an open port to the Internet (i.e. ingress or service)? [Y or N] " -n 1 -r
|
|
239
|
-
echo # (optional) move to a new line
|
|
240
|
-
if [[ $REPLY =~ ^[Yy]$ ]]
|
|
241
|
-
then
|
|
242
|
-
echo
|
|
243
|
-
echo '**********************************'
|
|
244
|
-
echo ' CREATING SERVICE TEMPLATES '
|
|
245
|
-
echo '**********************************'
|
|
246
|
-
createService
|
|
247
|
-
|
|
248
|
-
fi
|
|
249
|
-
|
|
250
|
-
# Print out some hints
|
|
251
|
-
cat<<HINTS
|
|
252
|
-
|
|
253
|
-
*** IMPORTANT ***
|
|
254
|
-
|
|
255
|
-
1. You will need to add in additional env variables to both templates/*.yaml and values.yaml
|
|
256
|
-
2. You may not need all the default env variables so feel free to remove them as well
|
|
257
|
-
3. Adjust limit/request cpu and memory values as needed
|
|
258
|
-
4. To use ingress, you need to reserve static ip then add to ingress templates in platform-k8s
|
|
259
|
-
|
|
260
|
-
Further instructions here: https://github.com/kelseyhightower/ingress-with-static-ip
|
|
261
|
-
|
|
262
|
-
5. Finally, follow chart museum directions to add your chart ors
|
|
263
|
-
|
|
264
|
-
helm push helm/ chartmuseum
|
|
265
|
-
|
|
266
|
-
HINTS
|