clavarium 0.2.42-next.1 → 0.2.43-next.1
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/deploy/updater.mjs +10 -6
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/deploy/updater.mjs
CHANGED
|
@@ -274,7 +274,7 @@ export class Updater {
|
|
|
274
274
|
this.restart = restart ?? (() => this.#restart());
|
|
275
275
|
/* What was seen when the server did not come up: its journal, its unit, who holds its port. */
|
|
276
276
|
this.diagnose = diagnose ?? (() => this.#diagnose());
|
|
277
|
-
this.health = health ?? ((release) => this.#health(release));
|
|
277
|
+
this.health = health ?? ((release, opts) => this.#health(release, opts));
|
|
278
278
|
this.backup = backup ?? ((app) => this.#backup(app));
|
|
279
279
|
this.restoreData = restoreData ?? ((app, archive) => this.#restoreData(app, archive));
|
|
280
280
|
this.installPrivileged = installPrivileged ?? ((app) => this.#installPrivileged(app));
|
|
@@ -606,13 +606,16 @@ export class Updater {
|
|
|
606
606
|
await this.installPrivileged(release.app);
|
|
607
607
|
} catch (error) { return `it could not be put in place: ${error.message}`; }
|
|
608
608
|
this.#step(action, version, 'Restarting');
|
|
609
|
-
|
|
609
|
+
/* Once the new server answers, the maintenance page is gone but a minute or two of
|
|
610
|
+
watching that it stays up is left: said as "Confirming", not "Restarting", so a page
|
|
611
|
+
back up does not look stuck restarting (deploy/updater.mjs, #health onUp). */
|
|
612
|
+
return this.#restartAndCheck(release, () => this.#step(action, version, 'Confirming'));
|
|
610
613
|
}
|
|
611
614
|
/* '' when it came up, or why not. */
|
|
612
|
-
async #restartAndCheck(release) {
|
|
615
|
+
async #restartAndCheck(release, onUp) {
|
|
613
616
|
const r = await this.restart().catch((e) => ({ code: 1, stderr: e.message }));
|
|
614
617
|
if (r?.code) return `the server did not restart: ${lastLine(r)}`;
|
|
615
|
-
const h = await this.health(release).catch((e) => e.message || 'no answer');
|
|
618
|
+
const h = await this.health(release, { onUp }).catch((e) => e.message || 'no answer');
|
|
616
619
|
return h || '';
|
|
617
620
|
}
|
|
618
621
|
|
|
@@ -802,7 +805,7 @@ export class Updater {
|
|
|
802
805
|
|
|
803
806
|
/* Comes up (answers, from this release) within healthMs, then STAYS up: watched until watchMs after
|
|
804
807
|
the restart; one restart by systemd is forgiven if it answers at the end, not two. */
|
|
805
|
-
async #health(release) {
|
|
808
|
+
async #health(release, { onUp } = {}) {
|
|
806
809
|
const { clock, sleep } = this.#o;
|
|
807
810
|
const start = clock();
|
|
808
811
|
const target = realpathSync(release.dir);
|
|
@@ -820,7 +823,8 @@ export class Updater {
|
|
|
820
823
|
if (clock() - start > this.#o.healthMs) return said;
|
|
821
824
|
await sleep(1000);
|
|
822
825
|
}
|
|
823
|
-
/*
|
|
826
|
+
/* It answers, from this release: the maintenance page gives way. Now it must stay up. */
|
|
827
|
+
onUp?.();
|
|
824
828
|
const until = Math.max(start + this.#o.watchMs, clock() + this.#o.settleMs);
|
|
825
829
|
let restarts = 0;
|
|
826
830
|
while (clock() < until) {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.43-next.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.43-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|