@leverege/build-tools 1.12.5 → 1.12.7

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.
@@ -9,24 +9,18 @@ require("core-js/modules/web.dom.iterable");
9
9
 
10
10
  require("core-js/modules/es6.array.iterator");
11
11
 
12
+ require("core-js/modules/es6.object.to-string");
13
+
12
14
  require("core-js/modules/es6.object.keys");
13
15
 
14
16
  require("regenerator-runtime/runtime");
15
17
 
16
- require("core-js/modules/es6.promise");
17
-
18
- require("core-js/modules/es6.object.to-string");
19
-
20
18
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
21
19
 
22
20
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
23
21
 
24
22
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25
23
 
26
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
27
-
28
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
29
-
30
24
  var commandLineArgs = require('command-line-args');
31
25
 
32
26
  var commandLineUsage = require('command-line-usage');
@@ -101,61 +95,52 @@ var optionDefinitions = [{
101
95
  var args = commandLineArgs(optionDefinitions);
102
96
 
103
97
  function main() {
104
- return _main.apply(this, arguments);
105
- }
106
-
107
- function _main() {
108
- _main = _asyncToGenerator(
109
- /*#__PURE__*/
110
- regeneratorRuntime.mark(function _callee() {
111
- var packleator;
112
- return regeneratorRuntime.wrap(function _callee$(_context) {
113
- while (1) {
114
- switch (_context.prev = _context.next) {
115
- case 0:
116
- if (!args.help) {
117
- _context.next = 4;
118
- break;
119
- }
120
-
121
- console.log(usage);
122
- _context.next = 16;
98
+ var packleator;
99
+ return regeneratorRuntime.async(function main$(_context) {
100
+ while (1) {
101
+ switch (_context.prev = _context.next) {
102
+ case 0:
103
+ if (!args.help) {
104
+ _context.next = 4;
123
105
  break;
106
+ }
124
107
 
125
- case 4:
126
- packleator = new Packleator(_objectSpread({}, defaultConfig, {
127
- args: args
128
- }));
108
+ console.log(usage);
109
+ _context.next = 16;
110
+ break;
129
111
 
130
- if (args.verbose) {
131
- console.log(packleator.args);
132
- }
112
+ case 4:
113
+ packleator = new Packleator(_objectSpread({}, defaultConfig, {
114
+ args: args
115
+ }));
133
116
 
134
- _context.prev = 6;
135
- _context.next = 9;
136
- return packleator.getPackageJson();
117
+ if (args.verbose) {
118
+ console.log(packleator.args);
119
+ }
137
120
 
138
- case 9:
139
- _context.next = 11;
140
- return packleator.run();
121
+ _context.prev = 6;
122
+ _context.next = 9;
123
+ return regeneratorRuntime.awrap(packleator.getPackageJson());
141
124
 
142
- case 11:
143
- _context.next = 16;
144
- break;
125
+ case 9:
126
+ _context.next = 11;
127
+ return regeneratorRuntime.awrap(packleator.run());
128
+
129
+ case 11:
130
+ _context.next = 16;
131
+ break;
145
132
 
146
- case 13:
147
- _context.prev = 13;
148
- _context.t0 = _context["catch"](6);
149
- console.error(_context.t0.message);
133
+ case 13:
134
+ _context.prev = 13;
135
+ _context.t0 = _context["catch"](6);
136
+ console.error(_context.t0.message);
150
137
 
151
- case 16:
152
- case "end":
153
- return _context.stop();
154
- }
138
+ case 16:
139
+ case "end":
140
+ return _context.stop();
155
141
  }
156
- }, _callee, null, [[6, 13]]);
157
- }));
158
- return _main.apply(this, arguments);
142
+ }
143
+ }, null, null, [[6, 13]]);
159
144
  }
160
145
 
161
146
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "1.12.5",
3
+ "version": "1.12.7",
4
4
  "description": "A package for development build tools.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -32,33 +32,33 @@
32
32
  "author": "Leverege Devs",
33
33
  "license": "SEE LICENSE IN LICENSE.md",
34
34
  "dependencies": {
35
- "@google-cloud/kms": "^1.3.1",
36
- "async": "^2.6.2",
35
+ "@google-cloud/kms": "^1.5.1",
36
+ "async": "^2.6.3",
37
37
  "chalk": "^2.4.2",
38
- "cloudflare": "^2.4.1",
38
+ "cloudflare": "^2.7.0",
39
39
  "command-line-args": "^5.1.1",
40
40
  "command-line-usage": "^5.0.5",
41
- "commander": "^2.20.0",
41
+ "commander": "^2.20.3",
42
42
  "fs-extra": "^8.1.0",
43
43
  "git-branch": "^2.0.1",
44
- "glob": "^7.1.4",
44
+ "glob": "^7.1.6",
45
45
  "js-yaml": "^3.13.1",
46
46
  "ora": "^3.4.0",
47
47
  "parse-gitignore": "^1.0.1",
48
- "readline-sync": "^1.4.9",
48
+ "readline-sync": "^1.4.10",
49
49
  "recursive-copy": "^2.0.10",
50
- "regenerator-runtime": "^0.13.2",
51
- "semver": "^6.2.0",
52
- "tar": "^4.4.10"
50
+ "regenerator-runtime": "^0.13.3",
51
+ "semver": "^6.3.0",
52
+ "tar": "^4.4.13"
53
53
  },
54
54
  "devDependencies": {
55
- "@babel/cli": "^7.6.0",
56
- "@babel/core": "^7.6.0",
57
- "@babel/plugin-proposal-class-properties": "^7.5.0",
55
+ "@babel/cli": "^7.7.0",
56
+ "@babel/core": "^7.7.2",
57
+ "@babel/plugin-proposal-class-properties": "^7.7.0",
58
58
  "@babel/plugin-proposal-optional-chaining": "^7.6.0",
59
- "@babel/preset-env": "^7.6.0",
60
- "@babel/register": "^7.6.0",
61
- "@leverege/eslint-config-leverege": "^1.5.3",
62
- "core-js": "^3.2.1"
59
+ "@babel/preset-env": "^7.7.1",
60
+ "@babel/register": "^7.7.0",
61
+ "@leverege/eslint-config-leverege": "^2.0.0",
62
+ "core-js": "^3.4.1"
63
63
  }
64
64
  }
package/src/circleate CHANGED
@@ -375,7 +375,7 @@ jobs:
375
375
 
376
376
  - run:
377
377
  name: Check if coverage meets at least 70%
378
- command: ./node_modules/.bin/nyc check-coverage --branches 70 --functions 70 --lines 70 --statements 70
378
+ command: ./node_modules/.bin/nyc check-coverage --functions 70 --lines 70 --statements 70
379
379
 
380
380
  - run:
381
381
  name: Generate docs
package/src/dockreate CHANGED
@@ -38,7 +38,7 @@ strip_undefined() {
38
38
  }
39
39
 
40
40
  # Useful links with information regarding k8s/docker/nodejs and PID 1
41
- # No PID 1 for NodeJS => https://bit.ly/2Txi9Jq
41
+ # No PID 1 for NodeJS => https://bit.ly/2r4gHkZ
42
42
  # What tini is all about => https://bit.ly/2HsSxqP
43
43
  # Graceful kills with k8s => https://bit.ly/2NONEJG
44
44
  #
@@ -104,7 +104,6 @@ create_bashrc() {
104
104
  #
105
105
  # Version $1 @ `date`
106
106
 
107
- alias golog='cd /var/log/levlog;ls -l'
108
107
  alias h=history
109
108
 
110
109
  alias ls='ls -CF --color=auto'
@@ -113,18 +112,15 @@ alias lla='ls -lha'
113
112
  alias ltr='ls -CF --color=auto -lthr'
114
113
  alias genv='env | grep -i'
115
114
  alias glep='grep -l -s'
116
- alias golog='cd /var/log/levlog'
117
115
  alias m=less
118
116
  alias menv='env | sort | less'
119
117
 
120
118
  alias whatsmyip='wget -qO- ifconfig.co'
121
119
 
122
- alias rcli='redis-cli -h \${DATABASES_REDIS_SERVICE_HOST}'
123
-
124
- alias buny='/usr/src/app/node_modules/bunyan/bin/bunyan'
125
- alias bunlog='golog;cat *-1.log | buny | m'
126
120
  alias dbg='wget -q -O- localhost:5111/logLevel/debug'
127
121
  alias inf='wget -q -O- localhost:5111/logLevel/info'
122
+ alias err='wget -q -O- localhost:5111/logLevel/error'
123
+ alias wrn='wget -q -O- localhost:5111/logLevel/warn'
128
124
 
129
125
  loglev()
130
126
  {
@@ -136,7 +132,7 @@ loglev()
136
132
  logl="logLevel/\$1"
137
133
  fi
138
134
 
139
- printf "Running=> \$wget/\$logl\n"
135
+ printf "Running=> \$wget/\${logl}\n"
140
136
  printf "\n\`\$wget/\$logl\`\n\n"
141
137
  }
142
138
  EOBASHRC
package/src/helmify CHANGED
@@ -53,32 +53,6 @@ spec:
53
53
  SVC_YAML
54
54
  }
55
55
 
56
- createIngress(){
57
- cat<<INGRESS_YAML > ingress.yaml
58
- apiVersion: extensions/v1beta1
59
- kind: Ingress
60
- metadata:
61
- name: $chartname-ingress
62
- annotations:
63
- kubernetes.io/ingress.global-static-ip-name: $chartname-ingress
64
- spec:
65
- tls:
66
- - secretName: frontendtls
67
- rules:
68
- - host: {{ quote .Values.$chartname_go.INGRESS_HOST }}
69
- http:
70
- paths:
71
- - backend:
72
- serviceName: $chartname
73
- servicePort: {{ .Values.$chartname_go.SERVER_PORT }}
74
- - http:
75
- paths:
76
- - backend:
77
- serviceName: $chartname
78
- servicePort: {{ .Values.$chartname_go.SERVER_PORT }}
79
- INGRESS_YAML
80
- }
81
-
82
56
  # Make chart directory
83
57
  mkdir helm
84
58
  mkdir helm/templates
@@ -90,13 +64,17 @@ PACKAGE_VERSION=$(node -p "require('../package.json').version")
90
64
 
91
65
  cat<<CHARTYAML > Chart.yaml
92
66
  name: $chartname
93
- version: 1.0.0
94
- appVersion: $PACKAGE_VERSION
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
95
69
 
96
70
  CHARTYAML
97
71
 
98
72
  # Bootstrap values.yaml
99
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
+
100
78
  # List your env variables here
101
79
  $chartname_go:
102
80
  VERSION: vX.Y.Z
@@ -104,8 +82,6 @@ $chartname_go:
104
82
  IMAGE: gcr.io/leverege-docker-images/$chartname
105
83
 
106
84
  default:
107
- LOG_DIR: "/var/log/levlog"
108
- LOG_LEVEL: "info"
109
85
  MAX_CHILD_PROCESSES: "1"
110
86
 
111
87
  MODEL_FIREBASE_SERVICE_ACCOUNT: /var/config/keys/model-data
@@ -132,12 +108,7 @@ default:
132
108
  \"name\": \"${logName}\",
133
109
  \"level\": \"info\",
134
110
  \"streams\": [
135
- {
136
- \"type\": \"rotating-file\",
137
- \"period\": \"1d\",
138
- \"count\": 3,
139
- \"path\": \"/var/log/levlog/${logName}.log\"
140
- }, {
111
+ {
141
112
  \"type\": \"stackdriver\",
142
113
  \"logName\": \"${logName}\"
143
114
  }
@@ -172,13 +143,14 @@ cat<<DEPLOYMENT_YAML > deployment.yaml
172
143
  apiVersion: apps/v1beta1
173
144
  kind: Deployment
174
145
  metadata:
175
- name: $chartname
146
+ name: {{ .Chart.Name }}
176
147
  spec:
177
148
  template:
178
149
  metadata:
179
150
  labels:
180
- app: $chartname
181
- redis-client: 'true'
151
+ app: {{ .Chart.Name }}
152
+ chart/version: {{ .Chart.Version }}
153
+ chart/appVersion: {{ .Chart.AppVersion }}
182
154
  annotations:
183
155
  prometheus.io/port: '5111'
184
156
  prometheus.io/scrape: 'true'
@@ -187,7 +159,7 @@ spec:
187
159
  - name: model-firebase-key
188
160
  secret:
189
161
  secretName: model-data
190
- - name: logs
162
+ - name: tmpfs
191
163
  emptyDir: {}
192
164
  - name: pubsub-key
193
165
  secret:
@@ -208,7 +180,7 @@ spec:
208
180
  - key: app
209
181
  operator: In
210
182
  values:
211
- - api-server
183
+ - {{ .Chart.Name }}
212
184
  topologyKey: kubernetes.io/hostname
213
185
  nodeAffinity:
214
186
  preferredDuringSchedulingIgnoredDuringExecution:
@@ -219,15 +191,26 @@ spec:
219
191
  weight: 50
220
192
  {{- end }}
221
193
  containers:
222
- - name: $chartname
223
- image: gcr.io/leverege-docker-images/$chartname:{{ .Values.$chartname_go.VERSION }}
194
+ - name: {{ .Chart.Name }}
195
+ image: {{ .Values.$chartname_go.IMAGE }}:{{ .Values.$chartname_go.VERSION }}
224
196
  imagePullPolicy: Always
225
197
  securityContext:
198
+ readOnlyRootFilesystem: true
199
+ runAsNonRoot: true
226
200
  runAsUser: 1000
227
201
  allowPrivilegeEscalation: false
202
+ readinessProbe:
203
+ httpGet:
204
+ path: /
205
+ port: node-metrics
206
+ initialDelaySeconds: 10
228
207
  resources:
229
208
  requests:
230
- cpu: "10m"
209
+ cpu: "50m"
210
+ memory: "256Mi"
211
+ limits:
212
+ cpu: "100m"
213
+ memory: "512Mi"
231
214
  ports:
232
215
  {{- if .Values.$chartname_go.SERVER_PORT }}
233
216
  - name: api
@@ -238,8 +221,8 @@ spec:
238
221
  volumeMounts:
239
222
  - name: model-firebase-key
240
223
  mountPath: {{ quote .Values.default.MODEL_FIREBASE_SERVICE_ACCOUNT }}
241
- - name: logs
242
- mountPath: {{ quote .Values.default.LOG_DIR }}
224
+ - name: tmpfs
225
+ mountPath: "/tmp"
243
226
  - name: pubsub-key
244
227
  mountPath: {{ quote .Values.default.PUBSUB_SERVICE_ACCOUNT }}
245
228
  env:
@@ -251,10 +234,6 @@ spec:
251
234
  value: {{ required "Limit config required" .Values.default.LIMIT_CONFIG | quote }}
252
235
  - name: TRANSPORT_CONFIG
253
236
  value: {{ required "Transport config required" .Values.default.TRANSPORT_CONFIG | quote }}
254
- - name: LOG_DIR
255
- value: {{ quote .Values.default.LOG_DIR }}
256
- - name: LOG_LEVEL
257
- value: {{ quote .Values.default.LOG_LEVEL }}
258
237
  - name: LOG_CONFIG
259
238
  value: {{ required "Log config required" .Values.default.LOG_CONFIG | quote }}
260
239
  - name: MAX_CHILD_PROCESSES
@@ -270,11 +249,11 @@ echo # (optional) move to a new line
270
249
  if [[ $REPLY =~ ^[Yy]$ ]]
271
250
  then
272
251
  echo
273
- echo '**************************************'
274
- echo 'CREATING SERVICE AND INGRESS TEMPLATES'
275
- echo '**************************************'
252
+ echo '**********************************'
253
+ echo ' CREATING SERVICE TEMPLATES '
254
+ echo '**********************************'
276
255
  createService
277
- createIngress
256
+
278
257
  fi
279
258
 
280
259
  # Print out some hints
@@ -284,11 +263,12 @@ cat<<HINTS
284
263
 
285
264
  1. You will need to add in additional env variables to both templates/*.yaml and values.yaml
286
265
  2. You may not need all the default env variables so feel free to remove them as well
287
- 3. To use ingress, you need to reserve static ip as specified in ingress.yaml
266
+ 3. Adjust limit/request cpu and memory values as needed
267
+ 4. To use ingress, you need to reserve static ip then add to ingress templates in platform-k8s
288
268
 
289
269
  Further instructions here: https://github.com/kelseyhightower/ingress-with-static-ip
290
270
 
291
- 4. Finally, follow chart museum directions to add your chart or
271
+ 5. Finally, follow chart museum directions to add your chart ors
292
272
 
293
273
  helm push helm/ chartmuseum
294
274
 
package/src/helmup CHANGED
@@ -355,10 +355,13 @@ function doInstall() {
355
355
  fi
356
356
  HELMUP="helm upgrade --install $SERVICE chartmuseum/$MUSEUM -f $SERVICE/values.yaml $CHARTVER"
357
357
  printf "Helming => `color g \"$HELMUP\"`\n" && $HELMUP
358
- if [ $? -ne 0 ];
358
+ SAVERR=$?
359
+ if [ $SAVERR -ne 0 ];
359
360
  then
360
361
  cat<<NOTRUNNING
361
362
 
363
+ $RED_ERROR helm exited with error status: $SAVERR
364
+
362
365
  $RED_ERROR The $SERVICE chart failed to upgrade or install. There may be an
363
366
  issue with the service's helm charts, or chartmuseum may not be
364
367
  up and running? If the latter, try firing it up with: