@certik/skynet 0.10.29 → 0.10.32
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 +12 -0
- package/api.js +1 -1
- package/app.js +7 -1
- package/deploy.d.ts +2 -0
- package/deploy.js +18 -1
- package/examples/api +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.32
|
|
4
|
+
|
|
5
|
+
- Changed deploy to add a SKYNET_DEPLOYED_AT variable to ensure new deployment would always be triggered in nomad
|
|
6
|
+
|
|
7
|
+
## 0.10.31
|
|
8
|
+
|
|
9
|
+
- `api` app bug fix
|
|
10
|
+
|
|
11
|
+
## 0.10.30
|
|
12
|
+
|
|
13
|
+
- Changed `api` app deployment to service type for rolling updates
|
|
14
|
+
|
|
3
15
|
## 0.10.29
|
|
4
16
|
|
|
5
17
|
- Added `serve.instances` parameter to `api` library to support multiple instances
|
package/api.js
CHANGED
|
@@ -110,7 +110,7 @@ ${getSelectorDesc(selector)}
|
|
|
110
110
|
|
|
111
111
|
const { verbose, ...selectorFlags } = cli.flags;
|
|
112
112
|
|
|
113
|
-
if (!serve.
|
|
113
|
+
if (!serve.instances || serve.instances === 1) {
|
|
114
114
|
await useLock({ name: getJobName(name, selectorFlags), ttl: 50, verbose });
|
|
115
115
|
}
|
|
116
116
|
|
package/app.js
CHANGED
|
@@ -655,7 +655,13 @@ function api({ name, routes, serve, beforeListen, env = {}, region = "us-east-1"
|
|
|
655
655
|
selector,
|
|
656
656
|
region,
|
|
657
657
|
env,
|
|
658
|
-
|
|
658
|
+
type: "service",
|
|
659
|
+
restart: {
|
|
660
|
+
attempts: 3,
|
|
661
|
+
delay: "15s",
|
|
662
|
+
mode: "fail",
|
|
663
|
+
interval: "30m",
|
|
664
|
+
},
|
|
659
665
|
count: serve.instances,
|
|
660
666
|
cpu: serve.cpu,
|
|
661
667
|
mem: serve.mem,
|
package/deploy.d.ts
CHANGED
package/deploy.js
CHANGED
|
@@ -52,12 +52,13 @@ const genConfig = ({
|
|
|
52
52
|
mem,
|
|
53
53
|
service,
|
|
54
54
|
additionalEnv = [],
|
|
55
|
+
type = "batch",
|
|
55
56
|
region = "us-east-1",
|
|
56
57
|
isProduction,
|
|
57
58
|
}) => `job "${jobName}" {
|
|
58
59
|
datacenters = ["${region}"]
|
|
59
60
|
|
|
60
|
-
type = "
|
|
61
|
+
type = "${type}"
|
|
61
62
|
|
|
62
63
|
${
|
|
63
64
|
cron
|
|
@@ -373,6 +374,13 @@ function createModeDeploy({
|
|
|
373
374
|
delta: { cpu: deltaCpu, mem: deltaMem },
|
|
374
375
|
};
|
|
375
376
|
|
|
377
|
+
// added an always changing env var
|
|
378
|
+
// to ensure new deployment always triggers
|
|
379
|
+
env = {
|
|
380
|
+
...env,
|
|
381
|
+
SKYNET_DEPLOYED_AT: new Date().toISOString(),
|
|
382
|
+
};
|
|
383
|
+
|
|
376
384
|
// by default use delta cpu/mem settings
|
|
377
385
|
const { cpu, mem } = modeResouces[mode] || modeResouces.delta;
|
|
378
386
|
|
|
@@ -523,6 +531,7 @@ function createDeploy({
|
|
|
523
531
|
bin = "bin/indexer",
|
|
524
532
|
selector = {},
|
|
525
533
|
region = "us-east-1",
|
|
534
|
+
type = "batch",
|
|
526
535
|
env = {},
|
|
527
536
|
count,
|
|
528
537
|
check,
|
|
@@ -552,6 +561,13 @@ function createDeploy({
|
|
|
552
561
|
cron = cmdSchedule;
|
|
553
562
|
}
|
|
554
563
|
|
|
564
|
+
// added an always changing env var
|
|
565
|
+
// to ensure new deployment always triggers
|
|
566
|
+
env = {
|
|
567
|
+
...env,
|
|
568
|
+
SKYNET_DEPLOYED_AT: new Date().toISOString(),
|
|
569
|
+
};
|
|
570
|
+
|
|
555
571
|
const nomadJobDefinition = genConfig({
|
|
556
572
|
jobName,
|
|
557
573
|
cron: INTERVAL_ALIASES[cron] || cron,
|
|
@@ -560,6 +576,7 @@ function createDeploy({
|
|
|
560
576
|
workingDirectory,
|
|
561
577
|
additionalEnv: env,
|
|
562
578
|
region,
|
|
579
|
+
type,
|
|
563
580
|
cmd: `${bin} ${args}`,
|
|
564
581
|
cpu,
|
|
565
582
|
mem,
|
package/examples/api
CHANGED