@catapultjs/deploy 0.8.0 → 0.9.0
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/LICENSE +21 -0
- package/README.md +79 -6
- package/build/commands/list_releases.d.ts +1 -0
- package/build/commands/list_releases.js +23 -1
- package/build/commands/list_releases.js.map +1 -1
- package/build/commands/list_revisions.d.ts +1 -0
- package/build/commands/list_revisions.js +32 -2
- package/build/commands/list_revisions.js.map +1 -1
- package/build/commands/list_tasks.d.ts +1 -0
- package/build/commands/list_tasks.js +19 -1
- package/build/commands/list_tasks.js.map +1 -1
- package/build/commands/pipeline.d.ts +1 -0
- package/build/commands/pipeline.js +18 -1
- package/build/commands/pipeline.js.map +1 -1
- package/build/commands/status.d.ts +1 -0
- package/build/commands/status.js +67 -15
- package/build/commands/status.js.map +1 -1
- package/build/commands/version.d.ts +1 -0
- package/build/commands/version.js +18 -1
- package/build/commands/version.js.map +1 -1
- package/build/recipes/pm2.js +2 -2
- package/build/recipes/pm2.js.map +1 -1
- package/build/src/base_command.d.ts +3 -1
- package/build/src/base_command.js +3 -1
- package/build/src/base_command.js.map +1 -1
- package/build/src/pipeline/hooks.d.ts +4 -2
- package/build/src/pipeline/hooks.js.map +1 -1
- package/build/src/pipeline.d.ts +3 -3
- package/build/src/pipeline.js.map +1 -1
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jérémy Chaufourier
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,22 +1,91 @@
|
|
|
1
1
|
# Catapult
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@catapultjs/deploy)
|
|
4
|
+
[](https://nodejs.org)
|
|
5
|
+
[](https://github.com/catapultjs/deploy/blob/main/LICENSE)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
A Capistrano-style deployment tool for Node.js — versioned releases, shared directories, composable task pipeline, automatic rollback. No agent, no server-side dependency, just SSH.
|
|
8
|
+
|
|
9
|
+
Full documentation at **https://catapultjs.com/**
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **SSH-based** — deploys directly over SSH; nothing to install on the server beyond a remote shell
|
|
14
|
+
- **Versioned releases** — every deploy goes into `releases/<timestamp>`, activated by an atomic `current` symlink, with automatic rollback on failure
|
|
15
|
+
- **Composable pipeline** — insert, remove or replace any task with a single function call, or rewrite the whole sequence
|
|
16
|
+
- **Drop-in recipes** — import once, tasks register themselves and wire into the pipeline
|
|
17
|
+
- **Multi-host** — deploy to one server or several, with per-host configuration
|
|
18
|
+
- **Healthcheck** — verify the app responds after a deploy, with automatic rollback on failure
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
Run `init` at the root of your project — it creates a `deploy.ts` config file and installs `@catapultjs/deploy` as a dev dependency:
|
|
6
23
|
|
|
7
24
|
```bash
|
|
8
25
|
npx @catapultjs/deploy init
|
|
9
26
|
```
|
|
10
27
|
|
|
11
|
-
|
|
28
|
+
Edit `deploy.ts` to describe your hosts and pick your recipes:
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { defineConfig } from '@catapultjs/deploy'
|
|
32
|
+
import '@catapultjs/deploy/recipes/git'
|
|
33
|
+
import '@catapultjs/deploy/recipes/pm2'
|
|
34
|
+
|
|
35
|
+
export default defineConfig({
|
|
36
|
+
hosts: [
|
|
37
|
+
{
|
|
38
|
+
name: 'production',
|
|
39
|
+
ssh: 'deploy@example.com',
|
|
40
|
+
deployPath: '/home/deploy/myapp',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
})
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Prepare the server (once per host), then deploy:
|
|
12
47
|
|
|
13
48
|
```bash
|
|
14
|
-
npx cata deploy
|
|
49
|
+
npx cata deploy:setup
|
|
50
|
+
npx cata deploy
|
|
15
51
|
```
|
|
16
52
|
|
|
17
|
-
##
|
|
53
|
+
## Server structure
|
|
18
54
|
|
|
19
|
-
|
|
55
|
+
```
|
|
56
|
+
/home/deploy/myapp/
|
|
57
|
+
current/ → symlink to releases/<release>
|
|
58
|
+
releases/
|
|
59
|
+
2024-01-15T.../ ← active release
|
|
60
|
+
2024-01-14T.../
|
|
61
|
+
shared/
|
|
62
|
+
.env
|
|
63
|
+
logs/
|
|
64
|
+
.catapult/
|
|
65
|
+
repo/ ← bare git mirror (git recipe)
|
|
66
|
+
revisions.log ← JSON deployment history
|
|
67
|
+
deploy.lock ← present during a deployment
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Recipes
|
|
71
|
+
|
|
72
|
+
| Recipe | Description |
|
|
73
|
+
| ---------------- | --------------------------------------------------------------------------- |
|
|
74
|
+
| `git` | Clones the repository into each release, keeps a bare mirror on the server |
|
|
75
|
+
| `rsync` | Pushes a local directory into the release with rsync |
|
|
76
|
+
| `pm2` | Start, reload and manage PM2 processes |
|
|
77
|
+
| `adonisjs` | Install, build and migration tasks for AdonisJS apps |
|
|
78
|
+
| `adonisjs_local` | Builds the AdonisJS app locally, uploads the artifact |
|
|
79
|
+
| `astro` | Builds locally with `astro build`, uploads the output |
|
|
80
|
+
| `nuxt` | Build tasks for Nuxt apps |
|
|
81
|
+
| `vitepress` | Builds locally with `vitepress build`, uploads the static files |
|
|
82
|
+
| `directus` | Directus database migration and schema snapshot tasks |
|
|
83
|
+
| `redis` | Flush one, many or all Redis databases |
|
|
84
|
+
|
|
85
|
+
## Requirements
|
|
86
|
+
|
|
87
|
+
- Node.js >= 24 on the machine running Catapult
|
|
88
|
+
- SSH key-based access to the target servers
|
|
20
89
|
|
|
21
90
|
## Contributing a recipe
|
|
22
91
|
|
|
@@ -25,3 +94,7 @@ If you've written a recipe that could be useful to others, open a pull request a
|
|
|
25
94
|
## Inspiration
|
|
26
95
|
|
|
27
96
|
Inspired by [Deployer PHP](https://deployer.org) and [Capistrano](https://capistranorb.com).
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
[MIT](https://github.com/catapultjs/deploy/blob/main/LICENSE)
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { flags } from '@adonisjs/ace';
|
|
1
11
|
import { Context } from "../src/context.js";
|
|
2
12
|
import { getCurrentRelease } from "../src/deployer.js";
|
|
3
13
|
import { q, getPaths, ssh } from "../src/utils.js";
|
|
@@ -7,9 +17,10 @@ export default class ListReleases extends BaseDeployCommand {
|
|
|
7
17
|
static description = 'List releases on servers';
|
|
8
18
|
async run() {
|
|
9
19
|
const ctx = Context.get();
|
|
10
|
-
const hosts = await this.selectHosts();
|
|
20
|
+
const hosts = await this.selectHosts({ all: this.json });
|
|
11
21
|
if (!hosts)
|
|
12
22
|
return;
|
|
23
|
+
const report = [];
|
|
13
24
|
for (const host of hosts) {
|
|
14
25
|
if (!(await this.ensureHostSetup(ctx, host)))
|
|
15
26
|
continue;
|
|
@@ -25,6 +36,10 @@ export default class ListReleases extends BaseDeployCommand {
|
|
|
25
36
|
.split('\n')
|
|
26
37
|
.map((line) => line.trim().replace(/\/$/, ''))
|
|
27
38
|
.filter(Boolean);
|
|
39
|
+
if (this.json) {
|
|
40
|
+
report.push({ name: host.name, current: current ?? null, releases });
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
28
43
|
const table = this.ui.table();
|
|
29
44
|
table.head(['', 'Release', 'Host']);
|
|
30
45
|
if (releases.length === 0) {
|
|
@@ -37,6 +52,13 @@ export default class ListReleases extends BaseDeployCommand {
|
|
|
37
52
|
}
|
|
38
53
|
table.render();
|
|
39
54
|
}
|
|
55
|
+
if (this.json) {
|
|
56
|
+
this.logger.log(JSON.stringify({ hosts: report }, null, 2));
|
|
57
|
+
}
|
|
40
58
|
}
|
|
41
59
|
}
|
|
60
|
+
__decorate([
|
|
61
|
+
flags.boolean({ description: 'Output result as JSON' }),
|
|
62
|
+
__metadata("design:type", Boolean)
|
|
63
|
+
], ListReleases.prototype, "json", void 0);
|
|
42
64
|
//# sourceMappingURL=list_releases.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_releases.js","sourceRoot":"","sources":["../../commands/list_releases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE1D,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,iBAAiB;IACzD,MAAM,CAAC,WAAW,GAAG,eAAe,CAAA;IACpC,MAAM,CAAC,WAAW,GAAG,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"list_releases.js","sourceRoot":"","sources":["../../commands/list_releases.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE1D,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,iBAAiB;IACzD,MAAM,CAAC,WAAW,GAAG,eAAe,CAAA;IACpC,MAAM,CAAC,WAAW,GAAG,0BAA0B,CAAA;IAK/C,KAAK,CAAC,GAAG;QACP,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;QAEzB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE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AE,CAAC;gBAC1B,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;YAC3C,CAAC;iBAAM,CAAC;gBACN,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;oBAC5B,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;gBAC3D,CAAC;YACH,CAAC;YAED,KAAK,CAAC,MAAM,EAAE,CAAA;QAChB,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;QAC7D,CAAC;IACH,CAAC;;AAtDO;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;;0CACnC"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { flags } from '@adonisjs/ace';
|
|
1
11
|
import { Context } from "../src/context.js";
|
|
2
12
|
import { q, getPaths, ssh } from "../src/utils.js";
|
|
3
13
|
import { BaseDeployCommand } from "../src/base_command.js";
|
|
@@ -6,17 +16,30 @@ export default class ListRevisions extends BaseDeployCommand {
|
|
|
6
16
|
static description = 'List the last 10 revisions on servers';
|
|
7
17
|
async run() {
|
|
8
18
|
const ctx = Context.get();
|
|
9
|
-
const hosts = await this.selectHosts();
|
|
19
|
+
const hosts = await this.selectHosts({ all: this.json });
|
|
10
20
|
if (!hosts)
|
|
11
21
|
return;
|
|
22
|
+
const report = [];
|
|
12
23
|
for (const host of hosts) {
|
|
13
24
|
if (!(await this.ensureHostSetup(ctx, host)))
|
|
14
25
|
continue;
|
|
15
26
|
const paths = getPaths(host.deployPath, ctx.release);
|
|
16
27
|
const logFile = `${paths.cataConfig}/revisions.log`;
|
|
17
|
-
|
|
28
|
+
if (!this.json)
|
|
29
|
+
this.logger.log(this.colors.bold(`\n# ${host.name}`));
|
|
18
30
|
const { stdout } = await ssh(host, `set +e\n[ -f ${q(logFile)} ] && tail -10 ${q(logFile)} || true`);
|
|
19
31
|
const lines = stdout.trim().split('\n').filter(Boolean).reverse();
|
|
32
|
+
if (this.json) {
|
|
33
|
+
const revisions = [];
|
|
34
|
+
for (const line of lines) {
|
|
35
|
+
try {
|
|
36
|
+
revisions.push(JSON.parse(line));
|
|
37
|
+
}
|
|
38
|
+
catch { }
|
|
39
|
+
}
|
|
40
|
+
report.push({ name: host.name, revisions });
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
20
43
|
const table = this.ui.table();
|
|
21
44
|
table.head(['Release', 'Branch', 'Commit', 'By', 'Date']);
|
|
22
45
|
if (lines.length === 0) {
|
|
@@ -39,6 +62,13 @@ export default class ListRevisions extends BaseDeployCommand {
|
|
|
39
62
|
}
|
|
40
63
|
table.render();
|
|
41
64
|
}
|
|
65
|
+
if (this.json) {
|
|
66
|
+
this.logger.log(JSON.stringify({ hosts: report }, null, 2));
|
|
67
|
+
}
|
|
42
68
|
}
|
|
43
69
|
}
|
|
70
|
+
__decorate([
|
|
71
|
+
flags.boolean({ description: 'Output result as JSON' }),
|
|
72
|
+
__metadata("design:type", Boolean)
|
|
73
|
+
], ListRevisions.prototype, "json", void 0);
|
|
44
74
|
//# sourceMappingURL=list_revisions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_revisions.js","sourceRoot":"","sources":["../../commands/list_revisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE1D,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,iBAAiB;IAC1D,MAAM,CAAC,WAAW,GAAG,gBAAgB,CAAA;IACrC,MAAM,CAAC,WAAW,GAAG,uCAAuC,CAAA;
|
|
1
|
+
{"version":3,"file":"list_revisions.js","sourceRoot":"","sources":["../../commands/list_revisions.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE1D,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,iBAAiB;IAC1D,MAAM,CAAC,WAAW,GAAG,gBAAgB,CAAA;IACrC,MAAM,CAAC,WAAW,GAAG,uCAAuC,CAAA;IAK5D,KAAK,CAAC,GAAG;QACP,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;QAEzB,MAAM,KAAK,GAAG,MAAM,IAAI,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,CAAC,CAAC,CAAC,CAAA;QAC7D,CAAC;IACH,CAAC;;AA9DO;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;;2CACnC"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { BaseCommand, flags } from '@adonisjs/ace';
|
|
2
11
|
import { getTasks, getTaskDescription } from "../src/task.js";
|
|
3
12
|
import { getPipeline } from "../src/pipeline.js";
|
|
4
13
|
export default class ListTasks extends BaseCommand {
|
|
@@ -7,6 +16,11 @@ export default class ListTasks extends BaseCommand {
|
|
|
7
16
|
async run() {
|
|
8
17
|
const pipeline = getPipeline();
|
|
9
18
|
const extra = getTasks().filter((t) => !pipeline.includes(t));
|
|
19
|
+
if (this.json) {
|
|
20
|
+
const describe = (name) => ({ name, description: getTaskDescription(name) });
|
|
21
|
+
this.logger.log(JSON.stringify({ pipeline: pipeline.map(describe), extra: extra.map(describe) }, null, 2));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
10
24
|
this.logger.log('Pipeline');
|
|
11
25
|
const pipelineTable = this.ui.table();
|
|
12
26
|
pipelineTable.head(['Task', 'Description']);
|
|
@@ -21,4 +35,8 @@ export default class ListTasks extends BaseCommand {
|
|
|
21
35
|
}
|
|
22
36
|
}
|
|
23
37
|
}
|
|
38
|
+
__decorate([
|
|
39
|
+
flags.boolean({ description: 'Output result as JSON' }),
|
|
40
|
+
__metadata("design:type", Boolean)
|
|
41
|
+
], ListTasks.prototype, "json", void 0);
|
|
24
42
|
//# sourceMappingURL=list_tasks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_tasks.js","sourceRoot":"","sources":["../../commands/list_tasks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"list_tasks.js","sourceRoot":"","sources":["../../commands/list_tasks.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,WAAW;IAChD,MAAM,CAAC,WAAW,GAAG,YAAY,CAAA;IACjC,MAAM,CAAC,WAAW,GAAG,gDAAgD,CAAA;IAKrE,KAAK,CAAC,GAAG;QACP,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;QAC9B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;QAE7D,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YACpF,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,I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key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { BaseCommand, flags } from '@adonisjs/ace';
|
|
2
11
|
import { getPipeline } from "../src/pipeline.js";
|
|
3
12
|
export default class ListPipeline extends BaseCommand {
|
|
4
13
|
static commandName = 'pipeline';
|
|
5
14
|
static description = 'Show the current deployment pipeline';
|
|
6
15
|
async run() {
|
|
7
16
|
const pipeline = getPipeline();
|
|
17
|
+
if (this.json) {
|
|
18
|
+
this.logger.log(JSON.stringify({ pipeline }, null, 2));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
8
21
|
const table = this.ui.table();
|
|
9
22
|
table.head(['#', 'Task']);
|
|
10
23
|
pipeline.forEach((name, i) => table.row([String(i + 1), name]));
|
|
11
24
|
table.render();
|
|
12
25
|
}
|
|
13
26
|
}
|
|
27
|
+
__decorate([
|
|
28
|
+
flags.boolean({ description: 'Output result as JSON' }),
|
|
29
|
+
__metadata("design:type", Boolean)
|
|
30
|
+
], ListPipeline.prototype, "json", void 0);
|
|
14
31
|
//# sourceMappingURL=pipeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../commands/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../commands/pipeline.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW;IACnD,MAAM,CAAC,WAAW,GAAG,UAAU,CAAA;IAC/B,MAAM,CAAC,WAAW,GAAG,sCAAsC,CAAA;IAK3D,KAAK,CAAC,GAAG;QACP,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;QAE9B,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;YACtD,OAAM;QACR,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAA;QAC7B,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAA;QACzB,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;QAC/D,KAAK,CAAC,MAAM,EAAE,CAAA;IAChB,CAAC;;AAdO;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;;0CACnC"}
|
package/build/commands/status.js
CHANGED
|
@@ -1,66 +1,118 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { flags } from '@adonisjs/ace';
|
|
1
11
|
import { Context } from "../src/context.js";
|
|
2
12
|
import { getCurrentRelease } from "../src/deployer.js";
|
|
3
13
|
import { bin } from "../src/task.js";
|
|
4
14
|
import { getPipeline } from "../src/pipeline.js";
|
|
5
15
|
import { hooks } from "../src/pipeline/hooks.js";
|
|
6
16
|
import { q, getPaths, ssh, detectPackageManager } from "../src/utils.js";
|
|
17
|
+
import { MemoryRenderer } from '@poppinss/cliui';
|
|
7
18
|
import { BaseDeployCommand } from "../src/base_command.js";
|
|
8
|
-
import { logger } from "../src/logger.js";
|
|
19
|
+
import { CatapultLogger, logger } from "../src/logger.js";
|
|
9
20
|
export default class Status extends BaseDeployCommand {
|
|
10
21
|
static commandName = 'status';
|
|
11
22
|
static description = 'Show server status';
|
|
12
23
|
async run() {
|
|
13
24
|
const ctx = Context.get();
|
|
14
|
-
const hosts = await this.selectHosts();
|
|
25
|
+
const hosts = await this.selectHosts({ all: this.json });
|
|
15
26
|
if (!hosts)
|
|
16
27
|
return;
|
|
17
28
|
const pm = await detectPackageManager();
|
|
29
|
+
const report = [];
|
|
30
|
+
const hookLogger = this.json ? new CatapultLogger() : logger;
|
|
31
|
+
if (this.json)
|
|
32
|
+
hookLogger.useRenderer(new MemoryRenderer());
|
|
18
33
|
for (const host of hosts) {
|
|
19
34
|
if (!(await this.ensureHostSetup(ctx, host)))
|
|
20
35
|
continue;
|
|
21
36
|
const paths = getPaths(host.deployPath, ctx.release);
|
|
22
|
-
|
|
37
|
+
const status = { name: host.name };
|
|
38
|
+
report.push(status);
|
|
39
|
+
if (!this.json)
|
|
40
|
+
this.logger.log(this.colors.bold(`\n# ${host.name}`));
|
|
23
41
|
try {
|
|
24
42
|
const current = await getCurrentRelease(ctx, host);
|
|
25
|
-
|
|
43
|
+
status.release = current ?? null;
|
|
44
|
+
if (!this.json) {
|
|
45
|
+
this.logger.log(`Release ${current ? this.colors.cyan(current) : this.colors.dim('none')}`);
|
|
46
|
+
}
|
|
26
47
|
if (getPipeline().includes('deploy:healthcheck')) {
|
|
27
48
|
try {
|
|
28
49
|
await ssh(host, `set -e\n${bin('curl')} --fail --silent --show-error --max-time 5 ${q(host.healthcheck?.url)} >/dev/null`);
|
|
29
|
-
|
|
50
|
+
status.health = 'ok';
|
|
51
|
+
if (!this.json)
|
|
52
|
+
this.logger.log(`Health ${this.colors.green('OK')}`);
|
|
30
53
|
}
|
|
31
54
|
catch {
|
|
32
|
-
|
|
55
|
+
status.health = 'fail';
|
|
56
|
+
if (!this.json)
|
|
57
|
+
this.logger.log(`Health ${this.colors.red('FAIL')}`);
|
|
33
58
|
}
|
|
34
59
|
}
|
|
35
60
|
const { stdout: versionsStdout } = await ssh(host, `set +e\ncd ${q(paths.current)}\necho "NODE:$(${bin('node')} --version 2>/dev/null || true)"\necho "PM:$(${bin(pm)} --version 2>/dev/null || true)"`);
|
|
36
61
|
const lines = versionsStdout.trim().split('\n');
|
|
37
62
|
const nodeVersion = lines.find((l) => l.startsWith('NODE:'))?.slice(5) || '';
|
|
38
63
|
const pmVersion = lines.find((l) => l.startsWith('PM:'))?.slice(3) || '';
|
|
39
|
-
|
|
40
|
-
|
|
64
|
+
status.node = nodeVersion || null;
|
|
65
|
+
status.packageManager = { name: pm, version: pmVersion || null };
|
|
66
|
+
if (!this.json) {
|
|
67
|
+
this.logger.log(`Node ${this.colors.dim(nodeVersion || 'unavailable')}`);
|
|
68
|
+
this.logger.log(`${pm.padEnd(8)} ${this.colors.dim(pmVersion || 'unavailable')}`);
|
|
69
|
+
}
|
|
41
70
|
for (const hook of hooks.getStatus()) {
|
|
42
|
-
await hook(ctx, host,
|
|
71
|
+
const data = await hook(ctx, host, hookLogger);
|
|
72
|
+
if (!data)
|
|
73
|
+
continue;
|
|
74
|
+
Object.assign(status, data);
|
|
75
|
+
if (!this.json) {
|
|
76
|
+
for (const [key, value] of Object.entries(data)) {
|
|
77
|
+
this.logger.log(`${key.padEnd(8)} ${this.colors.dim(String(value))}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
43
80
|
}
|
|
44
81
|
const { stdout: revStdout } = await ssh(host, `set +e\n[ -f ${q(paths.cataConfig + '/revisions.log')} ] && tail -1 ${q(paths.cataConfig + '/revisions.log')} || true`);
|
|
45
82
|
const rev = revStdout.trim();
|
|
46
83
|
if (rev) {
|
|
47
84
|
try {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
85
|
+
const revision = JSON.parse(rev);
|
|
86
|
+
const { branch, commit, user, date } = revision;
|
|
87
|
+
status.revision = revision;
|
|
88
|
+
if (!this.json) {
|
|
89
|
+
this.logger.log(`Branch ${this.colors.dim(branch ?? '—')}`);
|
|
90
|
+
this.logger.log(`Commit ${this.colors.dim(commit ? commit.slice(0, 7) : '—')}`);
|
|
91
|
+
this.logger.log(`By ${this.colors.dim(user ?? '—')}`);
|
|
92
|
+
this.logger.log(`Date ${this.colors.dim(date ? new Date(date).toLocaleString() : '—')}`);
|
|
93
|
+
}
|
|
53
94
|
}
|
|
54
95
|
catch { }
|
|
55
96
|
}
|
|
56
97
|
const { stdout: lockStdout } = await ssh(host, `set +e\n[ -f ${q(paths.lock)} ] && cat ${q(paths.lock)} || true`);
|
|
57
98
|
const lock = lockStdout.trim();
|
|
58
|
-
|
|
99
|
+
status.lock = lock || null;
|
|
100
|
+
if (!this.json) {
|
|
101
|
+
this.logger.log(`Lock ${lock ? this.colors.yellow(lock) : this.colors.dim('none')}`);
|
|
102
|
+
}
|
|
59
103
|
}
|
|
60
104
|
catch (error) {
|
|
105
|
+
status.error = error.message;
|
|
61
106
|
this.logger.error(`status error: ${error.message}`);
|
|
62
107
|
}
|
|
63
108
|
}
|
|
109
|
+
if (this.json) {
|
|
110
|
+
this.logger.log(JSON.stringify({ hosts: report }, null, 2));
|
|
111
|
+
}
|
|
64
112
|
}
|
|
65
113
|
}
|
|
114
|
+
__decorate([
|
|
115
|
+
flags.boolean({ description: 'Output result as JSON' }),
|
|
116
|
+
__metadata("design:type", Boolean)
|
|
117
|
+
], Status.prototype, "json", void 0);
|
|
66
118
|
//# sourceMappingURL=status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../commands/status.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,E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C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;gBAC1F,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,KAAK,GAAI,KAAe,CAAC,OAAO,CAAA;gBACvC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAkB,KAAe,CAAC,OAAO,EAAE,CAAC,CAAA;YAChE,CAAC;QACH,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;QAC7D,CAAC;IACH,CAAC;;AA/GO;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;;oCACnC"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { BaseCommand, flags } from '@adonisjs/ace';
|
|
2
11
|
import { readFile } from 'fs/promises';
|
|
3
12
|
import { resolve, dirname } from 'path';
|
|
4
13
|
import { fileURLToPath } from 'url';
|
|
@@ -8,7 +17,15 @@ export default class Version extends BaseCommand {
|
|
|
8
17
|
async run() {
|
|
9
18
|
const pkgPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../package.json');
|
|
10
19
|
const pkg = JSON.parse(await readFile(pkgPath, 'utf-8'));
|
|
20
|
+
if (this.json) {
|
|
21
|
+
this.logger.log(JSON.stringify({ version: pkg.version }, null, 2));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
11
24
|
this.logger.log(pkg.version);
|
|
12
25
|
}
|
|
13
26
|
}
|
|
27
|
+
__decorate([
|
|
28
|
+
flags.boolean({ description: 'Output result as JSON' }),
|
|
29
|
+
__metadata("design:type", Boolean)
|
|
30
|
+
], Version.prototype, "json", void 0);
|
|
14
31
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../commands/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../commands/version.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,WAAW;IAC9C,MAAM,CAAC,WAAW,GAAG,SAAS,CAAA;IAC9B,MAAM,CAAC,WAAW,GAAG,0BAA0B,CAAA;IAK/C,KAAK,CAAC,GAAG;QACP,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAA;QACtF,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;QAExD,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;YAClE,OAAM;QACR,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IAC9B,CAAC;;AAZO;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;;qCACnC"}
|
package/build/recipes/pm2.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
import { task, desc, cd, run, after, onStatus, bin } from "../index.js";
|
|
3
3
|
import { ssh, q } from "../src/utils.js";
|
|
4
|
-
onStatus(async (_ctx, host
|
|
4
|
+
onStatus(async (_ctx, host) => {
|
|
5
5
|
const { stdout } = await ssh(host, `set +e\n${bin('pm2')} --version || true`);
|
|
6
|
-
|
|
6
|
+
return { pm2: stdout.trim() || 'unavailable' };
|
|
7
7
|
});
|
|
8
8
|
desc('Starts PM2 processes with updated environment');
|
|
9
9
|
task('pm2:start', () => {
|
package/build/recipes/pm2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pm2.js","sourceRoot":"","sources":["../../recipes/pm2.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAoB,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EA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AAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,uBAAuB,CAAC,CAAA;IAClE,MAAM,KAAK,GAAG,CAAC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAC1E,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAC1B,IAAI,EACJ,cAAc,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE,EAC/D;YACE,KAAK,EAAE,IAAI;SACZ,CACF,CAAA;QACD,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;IAC3B,CAAC;AACH,CAAC,CAAC,CAAA;AAEF,KAAK,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAA;AAC5C,KAAK,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAA"}
|
|
@@ -2,7 +2,9 @@ import type { DeployContext, Host } from './types.ts';
|
|
|
2
2
|
import { BaseCommand } from '@adonisjs/ace';
|
|
3
3
|
export declare abstract class BaseDeployCommand extends BaseCommand {
|
|
4
4
|
host: string | undefined;
|
|
5
|
-
protected selectHosts(
|
|
5
|
+
protected selectHosts(options?: {
|
|
6
|
+
all?: boolean;
|
|
7
|
+
}): Promise<Host[] | null>;
|
|
6
8
|
protected setupCommand(host: Host): string;
|
|
7
9
|
protected missingSetupMessage(host: Host): string;
|
|
8
10
|
protected ensureHostSetup(ctx: DeployContext, host: Host): Promise<boolean>;
|
|
@@ -11,7 +11,7 @@ import { BaseCommand, flags } from '@adonisjs/ace';
|
|
|
11
11
|
import { Context } from "./context.js";
|
|
12
12
|
import { isHostSetup } from "./deployer.js";
|
|
13
13
|
export class BaseDeployCommand extends BaseCommand {
|
|
14
|
-
async selectHosts() {
|
|
14
|
+
async selectHosts(options = {}) {
|
|
15
15
|
const ctx = Context.get();
|
|
16
16
|
if (this.host) {
|
|
17
17
|
const hosts = ctx.config.hosts.filter((h) => h.name === this.host);
|
|
@@ -22,6 +22,8 @@ export class BaseDeployCommand extends BaseCommand {
|
|
|
22
22
|
}
|
|
23
23
|
return hosts;
|
|
24
24
|
}
|
|
25
|
+
if (options.all)
|
|
26
|
+
return ctx.config.hosts;
|
|
25
27
|
if (ctx.config.hosts.length > 1) {
|
|
26
28
|
const selected = await this.prompt.multiple('Select hosts', ctx.config.hosts.map((h) => ({ name: h.name, message: h.name })));
|
|
27
29
|
const hosts = ctx.config.hosts.filter((h) => selected.includes(h.name));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base_command.js","sourceRoot":"","sources":["../../src/base_command.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,OAAgB,iBAAkB,SAAQ,WAAW;IAI/C,KAAK,CAAC,WAAW;
|
|
1
|
+
{"version":3,"file":"base_command.js","sourceRoot":"","sources":["../../src/base_command.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,OAAgB,iBAAkB,SAAQ,WAAW;IAI/C,KAAK,CAAC,WAAW,CAAC,UAA6B,EAAE;QACzD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;QAEzB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,MAAM,KAAK,GAAG,GAAG,CAAC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AAK,CAAA;IACzB,CAAC;IAES,YAAY,CAAC,IAAU;QAC/B,OAAO,4BAA4B,IAAI,CAAC,IAAI,EAAE,CAAA;IAChD,CAAC;IAES,mBAAmB,CAAC,IAAU;QACtC,OAAO,IAAI,IAAI,CAAC,IAAI,sDAAsD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAA;IACrG,CAAC;IAES,KAAK,CAAC,eAAe,CAAC,GAAkB,EAAE,IAAU;QAC5D,IAAI,MAAM,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC;YAAE,OAAO,IAAI,CAAA;QAE7C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAA;QACjD,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAA;QACjB,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAjDS;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;;+CACpC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Host, DeployContext } from '../types.ts';
|
|
2
2
|
import type { CatapultLogger } from '../logger.ts';
|
|
3
3
|
export type LifecycleHook = (ctx: DeployContext, host: Host, logger: CatapultLogger) => Promise<void> | void;
|
|
4
|
+
export type StatusData = Record<string, unknown>;
|
|
5
|
+
export type StatusHook = (ctx: DeployContext, host: Host, logger: CatapultLogger) => Promise<StatusData | void> | StatusData | void;
|
|
4
6
|
export declare class PipelineHookStore {
|
|
5
7
|
#private;
|
|
6
8
|
addSetup(fn: LifecycleHook): void;
|
|
7
9
|
getSetup(): LifecycleHook[];
|
|
8
|
-
addStatus(fn:
|
|
9
|
-
getStatus():
|
|
10
|
+
addStatus(fn: StatusHook): void;
|
|
11
|
+
getStatus(): StatusHook[];
|
|
10
12
|
}
|
|
11
13
|
export declare const hooks: PipelineHookStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/pipeline/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/pipeline/hooks.ts"],"names":[],"mappings":"AAiBA,MAAM,OAAO,iBAAiB;IAC5B,WAAW,GAAoB,EAAE,CAAA;IACjC,YAAY,GAAiB,EAAE,CAAA;IAE/B,QAAQ,CAAC,EAAiB;QACxB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3B,CAAC;IAED,QAAQ;QACN,OAAO,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAA;IAC9B,CAAC;IAED,SAAS,CAAC,EAAc;QACtB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC5B,CAAC;IAED,SAAS;QACP,OAAO,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAA;IAC/B,CAAC;CACF;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,iBAAiB,EAAE,CAAA"}
|
package/build/src/pipeline.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TaskName } from './types.ts';
|
|
2
|
-
import { hooks, type LifecycleHook } from './pipeline/hooks.ts';
|
|
2
|
+
import { hooks, type LifecycleHook, type StatusHook } from './pipeline/hooks.ts';
|
|
3
3
|
export { hooks };
|
|
4
|
-
export type { LifecycleHook } from './pipeline/hooks.ts';
|
|
4
|
+
export type { LifecycleHook, StatusHook, StatusData } from './pipeline/hooks.ts';
|
|
5
5
|
export declare function getPipeline(): string[];
|
|
6
6
|
export declare function setPipeline(tasks: TaskName[]): void;
|
|
7
7
|
export declare function initPipeline(tasks: TaskName[]): void;
|
|
@@ -10,4 +10,4 @@ export declare function after(existing: TaskName, newTask: TaskName): void;
|
|
|
10
10
|
export declare function inPipeline(name: TaskName): boolean;
|
|
11
11
|
export declare function remove(name: TaskName): void;
|
|
12
12
|
export declare function onSetup(fn: LifecycleHook): void;
|
|
13
|
-
export declare function onStatus(fn:
|
|
13
|
+
export declare function onStatus(fn: StatusHook): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/pipeline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/pipeline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAuC,MAAM,qBAAqB,CAAA;AAEhF,OAAO,EAAE,KAAK,EAAE,CAAA;AAIhB,MAAM,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAA;AAGpC,MAAM,UAAU,WAAW;IACzB,OAAO,QAAQ,CAAC,GAAG,EAAE,CAAA;AACvB,CAAC;AAGD,MAAM,UAAU,WAAW,CAAC,KAAiB;IAC3C,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AACrB,CAAC;AAGD,MAAM,UAAU,YAAY,CAAC,KAAiB;IAC5C,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AACtB,CAAC;AAGD,MAAM,UAAU,MAAM,CAAC,QAAkB,EAAE,OAAiB;IAC1D,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAGD,MAAM,UAAU,KAAK,CAAC,QAAkB,EAAE,OAAiB;IACzD,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;AACnC,CAAC;AAGD,MAAM,UAAU,UAAU,CAAC,IAAc;IACvC,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAC3B,CAAC;AAGD,MAAM,UAAU,MAAM,CAAC,IAAc;IACnC,QAAQ,CAAC,MAAM,CAAC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