@catapultjs/deploy 0.11.0 → 0.12.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/build/bin/run.js +13 -13
- package/build/commands/init.js +3 -3
- package/build/commands/init.js.map +1 -1
- package/build/recipes/caddy.d.ts +10 -0
- package/build/recipes/caddy.js +64 -0
- package/build/recipes/caddy.js.map +1 -0
- package/build/recipes/systemd.d.ts +9 -0
- package/build/recipes/systemd.js +37 -0
- package/build/recipes/systemd.js.map +1 -0
- package/package.json +4 -4
- package/skills/catapultjs/SKILL.md +1 -1
- package/skills/catapultjs/references/recipes.md +66 -0
package/build/bin/run.js
CHANGED
|
@@ -15,19 +15,19 @@ import { Context } from "../src/context.js";
|
|
|
15
15
|
import { logger } from "../src/logger.js";
|
|
16
16
|
import { Verbose } from "../src/enums.js";
|
|
17
17
|
import { Kernel, ListLoader, HelpCommand } from '@adonisjs/ace';
|
|
18
|
-
import Version from
|
|
19
|
-
import Init from
|
|
20
|
-
import Setup from
|
|
21
|
-
import Deploy from
|
|
22
|
-
import Rollback from
|
|
23
|
-
import Status from
|
|
24
|
-
import ListReleases from
|
|
25
|
-
import ListRevisions from
|
|
26
|
-
import ListTasks from
|
|
27
|
-
import Pipeline from
|
|
28
|
-
import RunTask from
|
|
29
|
-
import Ssh from
|
|
30
|
-
import Run from
|
|
18
|
+
import Version from "../commands/version.js";
|
|
19
|
+
import Init from "../commands/init.js";
|
|
20
|
+
import Setup from "../commands/setup.js";
|
|
21
|
+
import Deploy from "../commands/deploy.js";
|
|
22
|
+
import Rollback from "../commands/rollback.js";
|
|
23
|
+
import Status from "../commands/status.js";
|
|
24
|
+
import ListReleases from "../commands/list_releases.js";
|
|
25
|
+
import ListRevisions from "../commands/list_revisions.js";
|
|
26
|
+
import ListTasks from "../commands/list_tasks.js";
|
|
27
|
+
import Pipeline from "../commands/pipeline.js";
|
|
28
|
+
import RunTask from "../commands/run_task.js";
|
|
29
|
+
import Ssh from "../commands/ssh.js";
|
|
30
|
+
import Run from "../commands/run.js";
|
|
31
31
|
function parseVerboseLevel(argv) {
|
|
32
32
|
let count = 0;
|
|
33
33
|
for (const arg of argv) {
|
package/build/commands/init.js
CHANGED
|
@@ -35,10 +35,10 @@ export default class Init extends BaseCommand {
|
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
const lang = await this.prompt.choice('Which language do you want to use?', [
|
|
38
|
-
{ name: 'ts', message: 'TypeScript (deploy.ts)' },
|
|
39
|
-
{ name: 'js', message: 'JavaScript (deploy.js)' },
|
|
38
|
+
{ name: 'ts', message: 'TypeScript (deploy.config.ts)' },
|
|
39
|
+
{ name: 'js', message: 'JavaScript (deploy.config.js)' },
|
|
40
40
|
]);
|
|
41
|
-
const filename = lang === 'ts' ? 'deploy.ts' : 'deploy.js';
|
|
41
|
+
const filename = lang === 'ts' ? 'deploy.config.ts' : 'deploy.config.js';
|
|
42
42
|
const dest = resolve(process.cwd(), filename);
|
|
43
43
|
await writeFile(dest, TEMPLATE);
|
|
44
44
|
this.logger.action(`create ${filename}`).succeeded();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../commands/init.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAEtE,MAAM,QAAQ,GAAG;;;;;;;;;;;;CAYhB,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,WAAW;IAC3C,MAAM,CAAC,WAAW,GAAG,MAAM,CAAA;IAC3B,MAAM,CAAC,WAAW,GAAG,o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AE;YACxD,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,+BAA+B,EAAE;SACzD,CAAC,CAAA;QAEF,MAAM,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,kBAAkB,CAAA;QACxE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAA;QAE7C,MAAM,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;QAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,QAAQ,EAAE,CAAC,CAAC,SAAS,EAAE,CAAA;QAEpD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAA;YAC5D,OAAM;QACR,CAAC;QAED,MAAM,EAAE,GAAG,MAAM,oBAAoB,EAAE,CAAA;QACvC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAA;QACpD,MAAM,KAAK,CAAC,EAAE,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,oBAAoB,CAAC,EAAE;YACvD,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;YAClB,KAAK,EAAE,SAAS;SACjB,CAAC,CAAA;QACF,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAC,SAAS,EAAE,CAAA;IAC9D,CAAC;;AAhCO;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,8DAA8D,EAAE,CAAC;;yCACnE"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { task, desc, after, get, bin, upload, onStatus } from "../index.js";
|
|
2
|
+
import { ssh, q } from "../src/utils.js";
|
|
3
|
+
function sudo() {
|
|
4
|
+
return get('caddy_use_sudo', true) ? 'sudo ' : '';
|
|
5
|
+
}
|
|
6
|
+
function configPath() {
|
|
7
|
+
return get('caddy_config_path', '/etc/caddy/Caddyfile');
|
|
8
|
+
}
|
|
9
|
+
function localConfigPath() {
|
|
10
|
+
return get('caddy_local_config_path', './Caddyfile');
|
|
11
|
+
}
|
|
12
|
+
function validateCommand() {
|
|
13
|
+
return `${sudo()}${bin('caddy')} validate --config ${q(configPath())}`;
|
|
14
|
+
}
|
|
15
|
+
function reloadCommand() {
|
|
16
|
+
return `${sudo()}${bin('caddy')} reload --config ${q(configPath())}`;
|
|
17
|
+
}
|
|
18
|
+
onStatus(async (_ctx, host) => {
|
|
19
|
+
const { stdout } = await ssh(host, `set +e\n${bin('caddy')} version || true`);
|
|
20
|
+
const version = stdout.trim().split(/\s+/)[0];
|
|
21
|
+
return { caddy: version || 'unavailable' };
|
|
22
|
+
});
|
|
23
|
+
desc('Validates the Caddy configuration');
|
|
24
|
+
task('caddy:validate', async ({ host, logger }) => {
|
|
25
|
+
const { stdout } = await ssh(host, `set -e\n${validateCommand()}`, { color: true });
|
|
26
|
+
logger.log(stdout.trim());
|
|
27
|
+
});
|
|
28
|
+
desc('Formats the configured Caddyfile');
|
|
29
|
+
task('caddy:fmt', async ({ host, logger }) => {
|
|
30
|
+
const { stdout } = await ssh(host, `set -e\n${sudo()}${bin('caddy')} fmt --overwrite ${q(configPath())}`, { color: true });
|
|
31
|
+
logger.log(stdout.trim());
|
|
32
|
+
});
|
|
33
|
+
desc('Reloads Caddy with the configured Caddyfile');
|
|
34
|
+
task('caddy:reload', async ({ host, logger }) => {
|
|
35
|
+
const validateBeforeReload = get('caddy_validate_before_reload', true);
|
|
36
|
+
const commands = [
|
|
37
|
+
'set -e',
|
|
38
|
+
validateBeforeReload ? validateCommand() : '',
|
|
39
|
+
reloadCommand(),
|
|
40
|
+
].filter(Boolean);
|
|
41
|
+
const { stdout } = await ssh(host, commands.join('\n'), { color: true });
|
|
42
|
+
logger.log(stdout.trim());
|
|
43
|
+
});
|
|
44
|
+
desc('Displays the configured Caddyfile');
|
|
45
|
+
task('caddy:config:show', async ({ host, logger }) => {
|
|
46
|
+
const { stdout } = await ssh(host, `set -e\n${sudo()}cat ${q(configPath())}`, { color: true });
|
|
47
|
+
logger.log(stdout.trim());
|
|
48
|
+
});
|
|
49
|
+
desc('Uploads and validates a local Caddyfile');
|
|
50
|
+
task('caddy:config:upload', async ({ host, paths, logger }) => {
|
|
51
|
+
const remoteTmp = `${paths.cataConfig}/Caddyfile.upload`;
|
|
52
|
+
await ssh(host, `set -e\nmkdir -p ${q(paths.cataConfig)}`);
|
|
53
|
+
await upload(localConfigPath(), remoteTmp);
|
|
54
|
+
const { stdout } = await ssh(host, [
|
|
55
|
+
'set -e',
|
|
56
|
+
`${sudo()}install -m 0644 ${q(remoteTmp)} ${q(configPath())}`,
|
|
57
|
+
validateCommand(),
|
|
58
|
+
].join('\n'), { color: true });
|
|
59
|
+
logger.log(stdout.trim());
|
|
60
|
+
});
|
|
61
|
+
if (get('caddy_reload_after_publish', false)) {
|
|
62
|
+
after('deploy:publish', 'caddy:reload');
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=caddy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caddy.js","sourceRoot":"","sources":["../../recipes/caddy.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC7F,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAA;AAYxC,SAAS,IAAI;IACX,OAAO,GAAG,CAAU,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAA;AAC5D,CAAC;AAED,SAAS,UAAU;IACjB,OAAO,GAAG,CAAS,mBAAmB,EAAE,sBAAsB,CAAC,CAAA;AACjE,CAAC;AAED,SAAS,eAAe;IACtB,OAAO,GAAG,CAAS,yBAAyB,E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,IAAI,CAAC,yCAAyC,CAAC,CAAA;AAC/C,IAAI,CAAC,qBAAqB,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAe,EAAE,EAAE;IACzE,MAAM,SAAS,GAAG,GAAG,KAAK,CAAC,UAAU,mBAAmB,CAAA;IAExD,MAAM,GAAG,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;IAC1D,MAAM,MAAM,CAAC,eAAe,EAAE,EAAE,SAAS,CAAC,CAAA;IAE1C,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAC1B,IAAI,EACJ;QACE,QAAQ;QACR,GAAG,IAAI,EAAE,mBAAmB,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC,EAAE;QAC7D,eAAe,EAAE;KAClB,CAAC,IAAI,CAAC,IAAI,CAAC,EACZ,EAAE,KAAK,EAAE,IAAI,EAAE,CAChB,CAAA;IAED,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;AAC3B,CAAC,CAAC,CAAA;AAEF,IAAI,GAAG,CAAU,4BAA4B,EAAE,KAAK,CAAC,EAAE,CAAC;IACtD,KAAK,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAA;AACzC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { task, desc, get } from "../index.js";
|
|
2
|
+
import { ssh, q } from "../src/utils.js";
|
|
3
|
+
function sudo() {
|
|
4
|
+
return get('systemd_use_sudo', true) ? 'sudo ' : '';
|
|
5
|
+
}
|
|
6
|
+
function service() {
|
|
7
|
+
return get('systemd_service', 'app');
|
|
8
|
+
}
|
|
9
|
+
function logLines() {
|
|
10
|
+
const lines = Number(get('systemd_logs_lines', 100));
|
|
11
|
+
return Number.isFinite(lines) && lines > 0 ? Math.floor(lines) : 100;
|
|
12
|
+
}
|
|
13
|
+
desc('Restarts the configured systemd service');
|
|
14
|
+
task('systemd:restart', async ({ host, logger }) => {
|
|
15
|
+
const { stdout } = await ssh(host, `set -e\n${sudo()}systemctl restart ${q(service())}`, {
|
|
16
|
+
color: true,
|
|
17
|
+
});
|
|
18
|
+
logger.log(stdout.trim());
|
|
19
|
+
});
|
|
20
|
+
desc('Reloads the configured systemd service');
|
|
21
|
+
task('systemd:reload', async ({ host, logger }) => {
|
|
22
|
+
const { stdout } = await ssh(host, `set -e\n${sudo()}systemctl reload ${q(service())}`, {
|
|
23
|
+
color: true,
|
|
24
|
+
});
|
|
25
|
+
logger.log(stdout.trim());
|
|
26
|
+
});
|
|
27
|
+
desc('Displays the configured systemd service status');
|
|
28
|
+
task('systemd:status', async ({ host, logger }) => {
|
|
29
|
+
const { stdout } = await ssh(host, `set +e\n${sudo()}systemctl status ${q(service())} --no-pager`, { color: true });
|
|
30
|
+
logger.log(stdout.trim());
|
|
31
|
+
});
|
|
32
|
+
desc('Displays journal logs for the configured systemd service');
|
|
33
|
+
task('systemd:logs', async ({ host, logger }) => {
|
|
34
|
+
const { stdout } = await ssh(host, `set +e\n${sudo()}journalctl -u ${q(service())} -n ${q(String(logLines()))} --no-pager`, { color: true });
|
|
35
|
+
logger.log(stdout.trim());
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=systemd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemd.js","sourceRoot":"","sources":["../../recipes/systemd.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAA;AAWxC,SAAS,IAAI;IACX,OAAO,GAAG,CAAU,kBAAkB,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAA;AAC9D,CAAC;AAED,SAAS,OAAO;IACd,OAAO,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,EAAE,EAAE;IAC7D,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAC1B,IAAI,EACJ,WAAW,IAAI,EAAE,oBAAoB,CAAC,CAAC,OAAO,EAAE,CAAC,aAAa,EAC9D,EAAE,KAAK,EAAE,IAAI,EAAE,CAChB,CAAA;IACD,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;AAC3B,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,0DAA0D,CAAC,CAAA;AAChE,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAe,EAAE,EAAE;IAC3D,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAC1B,IAAI,EACJ,WAAW,IAAI,EAAE,iBAAiB,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,aAAa,EACvF,EAAE,KAAK,EAAE,IAAI,EAAE,CAChB,CAAA;IACD,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;AAC3B,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@catapultjs/deploy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
"@adonisjs/tsconfig": "^2.0.0",
|
|
85
85
|
"@japa/assert": "^4.2.0",
|
|
86
86
|
"@japa/runner": "^5.3.0",
|
|
87
|
-
"@types/node": "^25.9.
|
|
88
|
-
"eslint": "^10.
|
|
89
|
-
"prettier": "^3.
|
|
87
|
+
"@types/node": "^25.9.4",
|
|
88
|
+
"eslint": "^10.6.0",
|
|
89
|
+
"prettier": "^3.9.3",
|
|
90
90
|
"typescript": "^6.0.3",
|
|
91
91
|
"vitepress": "^2.0.0-alpha.17"
|
|
92
92
|
},
|
|
@@ -19,7 +19,7 @@ Read the file matching the task before writing code:
|
|
|
19
19
|
| --- | --- |
|
|
20
20
|
| Create or update `deploy.ts`: hosts, recipe selection, healthchecks, lifecycle hooks, pipeline tuning, `setPipeline()` | [references/config.md](references/config.md) |
|
|
21
21
|
| Write or modify a recipe or deployment task: task DSL, `onSetup`/`onStatus` hooks, store options, `TaskRegistry` | [references/recipe.md](references/recipe.md) |
|
|
22
|
-
| Use an official recipe (git, rsync, nextjs, nuxt, astro, tanstack, nestjs, adonisjs, vitepress, directus, pm2, redis): tasks added, store keys, monorepo patterns | [references/recipes.md](references/recipes.md) |
|
|
22
|
+
| Use an official recipe (git, rsync, nextjs, nuxt, astro, tanstack, nestjs, adonisjs, vitepress, directus, pm2, redis, caddy, systemd): tasks added, store keys, monorepo patterns | [references/recipes.md](references/recipes.md) |
|
|
23
23
|
| Script deployments from Node.js (scripts, CI, bots, dashboards) with the `Catapult` class | [references/api.md](references/api.md) |
|
|
24
24
|
| Set up a GitHub Actions workflow with `catapultjs/deploy-action`: inputs, SSH secrets, env vars | [references/github-actions.md](references/github-actions.md) |
|
|
25
25
|
| Use the `cata` CLI: deploy, rollback, task, status, run, ssh, list commands and their options | [references/cli.md](references/cli.md) |
|
|
@@ -21,8 +21,10 @@ Full docs: https://catapultjs.com/guide/recipes
|
|
|
21
21
|
| `recipes/nuxt` | No (pair with `git` or `rsync`) | Nuxt, build on the server |
|
|
22
22
|
| `recipes/nuxt_static` | Uses default SCP; `rsync` optional | Static Nuxt site, generate locally |
|
|
23
23
|
| `recipes/directus` | No (pair with `git` or `rsync`) | Directus, migrations and schema snapshots |
|
|
24
|
+
| `recipes/caddy` | No | Caddy validation, reload, and config upload |
|
|
24
25
|
| `recipes/pm2` | No | Process management (add to any stack) |
|
|
25
26
|
| `recipes/redis` | No | Redis cache flush (add to any stack) |
|
|
27
|
+
| `recipes/systemd` | No | systemd service management (add when the host uses systemd) |
|
|
26
28
|
| `recipes/tanstack` | No (pair with `git` or `rsync`) | TanStack Start, build on the server |
|
|
27
29
|
|
|
28
30
|
---
|
|
@@ -512,6 +514,70 @@ import '@catapultjs/deploy/recipes/directus'
|
|
|
512
514
|
|
|
513
515
|
---
|
|
514
516
|
|
|
517
|
+
## `recipes/caddy`
|
|
518
|
+
|
|
519
|
+
```typescript
|
|
520
|
+
import '@catapultjs/deploy/recipes/caddy'
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
Manages Caddy configuration. Does not deliver application code and does not reload Caddy by default unless `caddy_reload_after_publish` is set before importing the recipe. Service management is intentionally separate; combine with `recipes/systemd` and set `systemd_service` to `caddy` when Caddy is managed by systemd.
|
|
524
|
+
|
|
525
|
+
> [!WARNING]
|
|
526
|
+
> Caddy must be able to traverse every parent directory of the configured web root and read the published files. Deploying under a private home directory such as `/home/deploy/...` may require extra permissions or ACLs. Prefer a web root under `/var/www/<app>` or `/srv/www/<app>` for static sites. On the server, use `namei -l /path/to/current/index.html` to inspect which directory blocks access.
|
|
527
|
+
|
|
528
|
+
| Task | Inserted | Description |
|
|
529
|
+
| --- | --- | --- |
|
|
530
|
+
| `caddy:reload` | after `deploy:publish` when `caddy_reload_after_publish` is true | Validates and reloads Caddy |
|
|
531
|
+
| `caddy:validate` | manual | Runs `caddy validate` |
|
|
532
|
+
| `caddy:fmt` | manual | Formats the configured Caddyfile |
|
|
533
|
+
| `caddy:config:show` | manual | Displays the configured Caddyfile |
|
|
534
|
+
| `caddy:config:upload` | manual | Uploads a local Caddyfile, installs it, and validates it |
|
|
535
|
+
|
|
536
|
+
`onStatus` displays the Caddy version in `cata status`.
|
|
537
|
+
|
|
538
|
+
| Key | Type | Default | Description |
|
|
539
|
+
| --- | --- | --- | --- |
|
|
540
|
+
| `caddy_config_path` | `string` | `'/etc/caddy/Caddyfile'` | Remote Caddyfile path |
|
|
541
|
+
| `caddy_local_config_path` | `string` | `'./Caddyfile'` | Local Caddyfile for upload |
|
|
542
|
+
| `caddy_use_sudo` | `boolean` | `true` | Prefix privileged commands with `sudo` |
|
|
543
|
+
| `caddy_validate_before_reload` | `boolean` | `true` | Validate before reload |
|
|
544
|
+
| `caddy_reload_after_publish` | `boolean` | `false` | Add reload after publish |
|
|
545
|
+
|
|
546
|
+
```typescript
|
|
547
|
+
set('caddy_reload_after_publish', true)
|
|
548
|
+
import '@catapultjs/deploy/recipes/caddy'
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
---
|
|
552
|
+
|
|
553
|
+
## `recipes/systemd`
|
|
554
|
+
|
|
555
|
+
```typescript
|
|
556
|
+
import '@catapultjs/deploy/recipes/systemd'
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
Generic systemd service management. Import only when the target host uses systemd.
|
|
560
|
+
|
|
561
|
+
| Task | Inserted | Description |
|
|
562
|
+
| --- | --- | --- |
|
|
563
|
+
| `systemd:restart` | manual | Restarts the configured service |
|
|
564
|
+
| `systemd:reload` | manual | Reloads the configured service |
|
|
565
|
+
| `systemd:status` | manual | Shows `systemctl status` for the service |
|
|
566
|
+
| `systemd:logs` | manual | Shows recent `journalctl` lines for the service |
|
|
567
|
+
|
|
568
|
+
| Key | Type | Default | Description |
|
|
569
|
+
| --- | --- | --- | --- |
|
|
570
|
+
| `systemd_service` | `string` | `'app'` | systemd service name |
|
|
571
|
+
| `systemd_use_sudo` | `boolean` | `true` | Prefix privileged commands with `sudo` |
|
|
572
|
+
| `systemd_logs_lines` | `number` | `100` | Number of journal lines shown by `systemd:logs` |
|
|
573
|
+
|
|
574
|
+
```typescript
|
|
575
|
+
set('systemd_service', 'caddy')
|
|
576
|
+
import '@catapultjs/deploy/recipes/systemd'
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
---
|
|
580
|
+
|
|
515
581
|
## `recipes/pm2`
|
|
516
582
|
|
|
517
583
|
```typescript
|