@studiometa/forge-cli 0.5.2 → 0.5.4
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/README.md +41 -2
- package/dist/cli.js +329 -26
- package/dist/cli.js.map +1 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/servers/command.d.ts.map +1 -1
- package/dist/commands/servers/handlers.d.ts +5 -0
- package/dist/commands/servers/handlers.d.ts.map +1 -1
- package/dist/commands/servers/help.d.ts.map +1 -1
- package/dist/commands/sites/apply/apply.d.ts +18 -0
- package/dist/commands/sites/apply/apply.d.ts.map +1 -1
- package/dist/commands/sites/apply/handler.d.ts.map +1 -1
- package/dist/commands/sites/apply/nginx.d.ts +31 -0
- package/dist/commands/sites/apply/nginx.d.ts.map +1 -0
- package/dist/commands/sites/apply/plan.d.ts +42 -1
- package/dist/commands/sites/apply/plan.d.ts.map +1 -1
- package/dist/commands/sites/apply/site-file.d.ts +37 -3
- package/dist/commands/sites/apply/site-file.d.ts.map +1 -1
- package/dist/commands/sites/apply/test-fixtures.d.ts +37 -1
- package/dist/commands/sites/apply/test-fixtures.d.ts.map +1 -1
- package/dist/commands/sites/help.d.ts.map +1 -1
- package/package.json +3 -3
- package/schemas/site.schema.json +123 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAAA;;GAEG;AA4zBH,wBAAgB,kBAAkB,IAAI,IAAI,CA2CzC;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,CAAM,GACxD,IAAI,CAoEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/commands/servers/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/commands/servers/command.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,oBAAoB,6GAW/B,CAAC"}
|
|
@@ -11,6 +11,11 @@ export declare function serversList(ctx: CommandContext): Promise<void>;
|
|
|
11
11
|
* Get a single server by ID or name.
|
|
12
12
|
*/
|
|
13
13
|
export declare function serversGet(args: string[], ctx: CommandContext): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Print the public key of the `forge` user of a server (`~/.ssh/id_rsa.pub`), the key that
|
|
16
|
+
* Forge uses to clone repositories: add it to the git host before you create a site.
|
|
17
|
+
*/
|
|
18
|
+
export declare function serversPublicKey(args: string[], ctx: CommandContext): Promise<void>;
|
|
14
19
|
/**
|
|
15
20
|
* Create a server. Defaults to a Custom VPS app server on Ubuntu 26.04.
|
|
16
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/commands/servers/handlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/commands/servers/handlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMvD;;GAEG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBpE;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAcnF;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBzF;AAID;;GAEG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA+DtE;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CActF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/commands/servers/help.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/commands/servers/help.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAgIzD"}
|
|
@@ -18,10 +18,28 @@ export declare function resolveApplyServer(server: string | number, ctx: CliExec
|
|
|
18
18
|
* The site named `domain` on the server, compared without case. A partial match never counts.
|
|
19
19
|
*/
|
|
20
20
|
export declare function findSite(sites: Site[], domain: string): Site | null;
|
|
21
|
+
/**
|
|
22
|
+
* The site of the load balancer named `domain` or one of the aliases, compared without case.
|
|
23
|
+
* Its name can be any of them, e.g. the domain without `www`. Two matches are an error: a guess
|
|
24
|
+
* could send the traffic of another site.
|
|
25
|
+
*/
|
|
26
|
+
export declare function findLoadBalancerSite(sites: Site[], names: string[]): Site | null;
|
|
27
|
+
/**
|
|
28
|
+
* Exit with a validation error when the load balancer has no site for the site file: the Forge
|
|
29
|
+
* API cannot create a site on a load balancer.
|
|
30
|
+
*/
|
|
31
|
+
export declare function assertLoadBalancerSite(file: SiteFile, state: RemoteState): void;
|
|
21
32
|
/**
|
|
22
33
|
* Read from Forge what the site file manages, and nothing else.
|
|
23
34
|
*/
|
|
24
35
|
export declare function readRemoteState(file: SiteFile, serverId: string, ctx: CliExecutorContext): Promise<RemoteState>;
|
|
36
|
+
/**
|
|
37
|
+
* Read the Nginx configuration of a site on Forge and render the Nginx file for the site.
|
|
38
|
+
*/
|
|
39
|
+
export declare function readNginx(template: string, serverId: string, site: Site, ctx: CliExecutorContext): Promise<{
|
|
40
|
+
remote: string;
|
|
41
|
+
rendered: string;
|
|
42
|
+
}>;
|
|
25
43
|
/**
|
|
26
44
|
* Exit with a validation error when the site does not exist and the site file cannot create it.
|
|
27
45
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../../src/commands/sites/apply/apply.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../../src/commands/sites/apply/apply.ts"],"names":[],"mappings":"AAAA;;GAEG;AA8BH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAmB,MAAM,oBAAoB,CAAC;AAI/D,OAAO,EACL,KAAK,MAAM,EACX,KAAK,IAAI,EACT,KAAK,WAAW,EAChB,KAAK,IAAI,EAGV,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,8FAA8F;AAC9F,qBAAa,UAAW,SAAQ,QAAQ;IACtC,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,QAAQ,CAAC,aAAa,SAAS;CAChC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,GAAG,EAAE,kBAAkB,GACtB,OAAO,CAAC,MAAM,CAAC,CAKjB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAEnE;AAED;;;;GAIG;AACH,wBAAgB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AM,KAAK,IAAI,CAAC;IACpC,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,MAAM,MAAM,CAAC;CACjC;AAmPD;;;GAGG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,kBAAkB,EACvB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CAyCf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/commands/sites/apply/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EACL,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/commands/sites/apply/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EACL,KAAK,YAAY,EAMlB,MAAM,YAAY,CAAC;AAIpB;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,cAAc,EACnB,YAAY,GAAE,YAAiB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAqDf"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Nginx file of a site file: an Nginx configuration with the template variables of Forge,
|
|
3
|
+
* e.g. `{{ PROXY_PASS }}`, rendered locally with the values of the site.
|
|
4
|
+
* See https://forge.laravel.com/docs/servers/nginx-templates
|
|
5
|
+
*/
|
|
6
|
+
import type { ServerAttributes } from "@studiometa/forge-api";
|
|
7
|
+
import { type Site } from "./plan.ts";
|
|
8
|
+
/** The variables of Forge Nginx templates. Forge accepts spaces inside the braces. */
|
|
9
|
+
export declare const NGINX_VARIABLES: readonly ["DIRECTORY", "DOMAINS", "PATH", "PORT", "PORT_V6", "PROXY_PASS", "ROOT_PATH", "SERVER_PUBLIC_IP", "SERVER_PRIVATE_IP", "SITE", "SITE_ID", "USER"];
|
|
10
|
+
export type NginxVariable = (typeof NGINX_VARIABLES)[number];
|
|
11
|
+
/** The names of the variables in a template, each once, in order. */
|
|
12
|
+
export declare function templateVariables(template: string): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Exit with a validation error when the template has a variable that Forge does not define.
|
|
15
|
+
*/
|
|
16
|
+
export declare function assertNginxTemplate(template: string, source: string): void;
|
|
17
|
+
/** True when rendering the template needs the attributes of the server. */
|
|
18
|
+
export declare function needsServer(template: string): boolean;
|
|
19
|
+
/** `PHP 8.3`, `php83` and `php8.3` all give `8.3`. */
|
|
20
|
+
export declare function phpSocketVersion(version: string): string;
|
|
21
|
+
export type NginxServer = Pick<ServerAttributes, "ip_address" | "private_ip_address">;
|
|
22
|
+
/**
|
|
23
|
+
* The value of each variable for a site, as Forge renders its templates.
|
|
24
|
+
* A server is needed only for the `SERVER_*` variables.
|
|
25
|
+
*/
|
|
26
|
+
export declare function nginxValues(site: Site, server?: NginxServer | null): Record<NginxVariable, string>;
|
|
27
|
+
/**
|
|
28
|
+
* Replace each variable of the template with its value for the site.
|
|
29
|
+
*/
|
|
30
|
+
export declare function renderNginx(template: string, site: Site, server?: NginxServer | null): string;
|
|
31
|
+
//# sourceMappingURL=nginx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nginx.d.ts","sourceRoot":"","sources":["../../../../src/commands/sites/apply/nginx.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI9D,OAAO,EAAE,KAAK,IAAI,EAAqB,MAAM,WAAW,CAAC;AAEzD,sFAAsF;AACtF,eAAO,MAAM,eAAe,YAC1B,WAAW,EACX,SAAS,EACT,MAAM,EACN,MAAM,EACN,SAAS,EACT,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,EACN,SAAS,EACT,MAAM,CACE,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAO7D,qEAAqE;AACrE,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAE5D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAU1E;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,sDAAsD;AACtD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMxD;AAED,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,oBAAoB,CAAC,CAAC;AAEtF;;;GAGG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,IAAI,EACV,MAAM,GAAE,WAAW,GAAG,IAAW,GAChC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAyB/B;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,IAAI,EACV,MAAM,GAAE,WAAW,GAAG,IAAW,GAChC,MAAM,CAKR"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Compare a site file with the state of Forge and list the changes that `apply` makes.
|
|
3
3
|
* Pure functions: no API call here.
|
|
4
4
|
*/
|
|
5
|
-
import type { BackgroundProcessAttributes, DatabaseAttributes, DatabaseUserAttributes, ScheduledJobAttributes, SiteAttributes } from "@studiometa/forge-api";
|
|
5
|
+
import type { BackgroundProcessAttributes, DatabaseAttributes, DatabaseUserAttributes, LoadBalancingNodeAttributes, ScheduledJobAttributes, SiteAttributes } from "@studiometa/forge-api";
|
|
6
6
|
import type { SiteFile } from "./site-file.ts";
|
|
7
7
|
import { type SiteRoots } from "./ownership.ts";
|
|
8
8
|
export type Site = SiteAttributes & {
|
|
@@ -20,6 +20,9 @@ export type Database = DatabaseAttributes & {
|
|
|
20
20
|
export type DatabaseUser = DatabaseUserAttributes & {
|
|
21
21
|
id: number;
|
|
22
22
|
};
|
|
23
|
+
export type LoadBalancingNode = LoadBalancingNodeAttributes & {
|
|
24
|
+
id: number;
|
|
25
|
+
};
|
|
23
26
|
/** Shown in place of a generated password. */
|
|
24
27
|
export declare const GENERATED = "<generated>";
|
|
25
28
|
/** What `apply` reads from Forge. A list is undefined when the site file does not manage it. */
|
|
@@ -40,6 +43,19 @@ export interface RemoteState {
|
|
|
40
43
|
jobs?: ScheduledJob[];
|
|
41
44
|
/** IDs of the scheduled jobs that Forge lists on the site. */
|
|
42
45
|
siteJobIds?: ReadonlySet<number>;
|
|
46
|
+
/** Nginx configuration on Forge and the Nginx file rendered for the site; null when the site does not exist. */
|
|
47
|
+
nginx?: {
|
|
48
|
+
remote: string;
|
|
49
|
+
rendered: string;
|
|
50
|
+
} | null;
|
|
51
|
+
/** The site of the file on its load balancer, with its nodes; site is null when it does not exist. */
|
|
52
|
+
loadBalancer?: {
|
|
53
|
+
serverId: string;
|
|
54
|
+
site: Site | null;
|
|
55
|
+
nodes: LoadBalancingNode[];
|
|
56
|
+
/** The server of the site file: the one node that the load balancer must send traffic to. */
|
|
57
|
+
target: number;
|
|
58
|
+
};
|
|
43
59
|
}
|
|
44
60
|
export interface SiteSettings {
|
|
45
61
|
type?: string;
|
|
@@ -73,7 +89,10 @@ export type Change = {
|
|
|
73
89
|
} | {
|
|
74
90
|
action: "add-env";
|
|
75
91
|
keys: string[];
|
|
92
|
+
/** Keys that get the database name, user and password of a new database user. */
|
|
76
93
|
generated: string[];
|
|
94
|
+
/** The generated key that holds the password; its value never shows. */
|
|
95
|
+
password?: string;
|
|
77
96
|
} | {
|
|
78
97
|
action: "create-worker";
|
|
79
98
|
command: string;
|
|
@@ -90,6 +109,22 @@ export type Change = {
|
|
|
90
109
|
command: string;
|
|
91
110
|
frequency: string;
|
|
92
111
|
cron?: string;
|
|
112
|
+
} | {
|
|
113
|
+
action: "update-load-balancer";
|
|
114
|
+
site: string;
|
|
115
|
+
from: Array<{
|
|
116
|
+
server_id: number;
|
|
117
|
+
port: number;
|
|
118
|
+
}>;
|
|
119
|
+
to: {
|
|
120
|
+
server_id: number;
|
|
121
|
+
port: number;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/** `diff` is null for a site that does not exist yet: the file is rendered once it exists. */
|
|
125
|
+
| {
|
|
126
|
+
action: "update-nginx";
|
|
127
|
+
diff: string | null;
|
|
93
128
|
} | {
|
|
94
129
|
action: "delete-job";
|
|
95
130
|
id: number;
|
|
@@ -111,6 +146,12 @@ export declare function siteWorkDirectory(site: Pick<Site, "user" | "name" | "ro
|
|
|
111
146
|
export declare function siteRoots(sites: Site[]): SiteRoots[];
|
|
112
147
|
/** `PHP 8.3`, `php83` and `php8.3` all give `php83`. */
|
|
113
148
|
export declare function normalizePhp(version: string | null | undefined): string | null;
|
|
149
|
+
/** The .env keys of a new database user, from `database.env` or the Laravel names. */
|
|
150
|
+
export declare function databaseEnvKeys(database: NonNullable<SiteFile["database"]>): {
|
|
151
|
+
name: string;
|
|
152
|
+
user: string;
|
|
153
|
+
password: string;
|
|
154
|
+
};
|
|
114
155
|
/**
|
|
115
156
|
* Compare the site file with the state of Forge. Keys that the file does not have are not
|
|
116
157
|
* compared. The plan creates and updates what differs, and deletes only the workers and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../../src/commands/sites/apply/plan.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,EACf,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../../src/commands/sites/apply/plan.ts"],"names":[],"mappings":"AA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AM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEN,MAAM,WAAW,IAAI;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,mEAAmE;AACnE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAElE;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,gBAAgB,CAAC,GAAG,MAAM,CAE9F;AAcD,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,EAAE,CAKpD;AAED,wDAAwD;AACxD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAE9E;AA0GD,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAMA;AA4PD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAgBlE;AAMD;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CA0CrD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAK7C"}
|
|
@@ -22,6 +22,21 @@ export declare const ScheduledJobSchema: v.SchemaWithPipe<readonly [v.StrictObje
|
|
|
22
22
|
frequency: "custom" | "hourly" | "minutely" | "monthly" | "nightly" | "reboot" | "weekly";
|
|
23
23
|
cron?: string | undefined;
|
|
24
24
|
}, "cron is required with the custom frequency, and only with it">]>;
|
|
25
|
+
/** The .env keys that a new database user gets. Default: the Laravel names. */
|
|
26
|
+
export declare const DatabaseEnvSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
27
|
+
readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "invalid .env variable name">]>, undefined>;
|
|
28
|
+
readonly user: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "invalid .env variable name">]>, undefined>;
|
|
29
|
+
readonly password: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "invalid .env variable name">]>, undefined>;
|
|
30
|
+
}, undefined>, v.CheckAction<{
|
|
31
|
+
name?: string | undefined;
|
|
32
|
+
user?: string | undefined;
|
|
33
|
+
password?: string | undefined;
|
|
34
|
+
}, "the .env keys of the database must be different">]>;
|
|
35
|
+
/** The load balancer that sends the traffic of the site to its server. */
|
|
36
|
+
export declare const LoadBalancerSchema: v.StrictObjectSchema<{
|
|
37
|
+
readonly server: v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>], undefined>;
|
|
38
|
+
readonly port: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 65535, undefined>]>, 80>;
|
|
39
|
+
}, undefined>;
|
|
25
40
|
export declare const SiteFileSchema: v.StrictObjectSchema<{
|
|
26
41
|
readonly $schema: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
27
42
|
readonly server: v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>], undefined>;
|
|
@@ -38,8 +53,18 @@ export declare const SiteFileSchema: v.StrictObjectSchema<{
|
|
|
38
53
|
readonly database: v.OptionalSchema<v.StrictObjectSchema<{
|
|
39
54
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>;
|
|
40
55
|
readonly user: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>;
|
|
56
|
+
readonly env: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
57
|
+
readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "invalid .env variable name">]>, undefined>;
|
|
58
|
+
readonly user: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "invalid .env variable name">]>, undefined>;
|
|
59
|
+
readonly password: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "invalid .env variable name">]>, undefined>;
|
|
60
|
+
}, undefined>, v.CheckAction<{
|
|
61
|
+
name?: string | undefined;
|
|
62
|
+
user?: string | undefined;
|
|
63
|
+
password?: string | undefined;
|
|
64
|
+
}, "the .env keys of the database must be different">]>, undefined>;
|
|
41
65
|
}, undefined>, undefined>;
|
|
42
66
|
readonly env: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "invalid .env variable name">]>, v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.BooleanSchema<undefined>], undefined>, undefined>, undefined>;
|
|
67
|
+
readonly nginx: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>, undefined>;
|
|
43
68
|
readonly workers: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
44
69
|
readonly command: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>;
|
|
45
70
|
readonly processes: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, 1>;
|
|
@@ -54,16 +79,25 @@ export declare const SiteFileSchema: v.StrictObjectSchema<{
|
|
|
54
79
|
frequency: "custom" | "hourly" | "minutely" | "monthly" | "nightly" | "reboot" | "weekly";
|
|
55
80
|
cron?: string | undefined;
|
|
56
81
|
}, "cron is required with the custom frequency, and only with it">]>, undefined>, undefined>;
|
|
82
|
+
readonly loadBalancer: v.OptionalSchema<v.StrictObjectSchema<{
|
|
83
|
+
readonly server: v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>], undefined>;
|
|
84
|
+
readonly port: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 65535, undefined>]>, 80>;
|
|
85
|
+
}, undefined>, undefined>;
|
|
57
86
|
}, undefined>;
|
|
58
|
-
export type
|
|
87
|
+
export type SiteFileData = v.InferOutput<typeof SiteFileSchema>;
|
|
88
|
+
/** A site file with the content of its Nginx file, when it declares one. */
|
|
89
|
+
export type SiteFile = SiteFileData & {
|
|
90
|
+
nginxTemplate?: string;
|
|
91
|
+
};
|
|
59
92
|
export type WorkerDeclaration = v.InferOutput<typeof WorkerSchema>;
|
|
60
93
|
export type ScheduledJobDeclaration = v.InferOutput<typeof ScheduledJobSchema>;
|
|
61
94
|
/**
|
|
62
95
|
* Validate parsed JSON as a site file. Throws a ValidationError that lists every issue.
|
|
63
96
|
*/
|
|
64
|
-
export declare function parseSiteFile(data: unknown, source?: string):
|
|
97
|
+
export declare function parseSiteFile(data: unknown, source?: string): SiteFileData;
|
|
65
98
|
/**
|
|
66
|
-
* Read and validate a site file from disk
|
|
99
|
+
* Read and validate a site file from disk, with its Nginx file: a relative `nginx` path is
|
|
100
|
+
* read against the folder of the site file.
|
|
67
101
|
*/
|
|
68
102
|
export declare function readSiteFile(path: string): SiteFile;
|
|
69
103
|
//# sourceMappingURL=site-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-file.d.ts","sourceRoot":"","sources":["../../../../src/commands/sites/apply/site-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"site-file.d.ts","sourceRoot":"","sources":["../../../../src/commands/sites/apply/site-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAK7B,2EAA2E;AAC3E,eAAO,MAAM,oBAAoB,qEACmC,CAAC;AAOrE,eAAO,MAAM,UAAU,YACrB,SAAS,EACT,SAAS,EACT,UAAU,EACV,WAAW,EACX,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,OAAO,EACP,QAAQ,CACA,CAAC;AAEX,eAAO,MAAM,wBAAwB,YACnC,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,eAAe,EACf,QAAQ,CACA,CAAC;AAEX,eAAO,MAAM,oBAAoB,YAC/B,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,QAAQ,CACA,CAAC;AAEX,eAAO,MAAM,YAAY;;;;aAIvB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;oEAU9B,CAAC;AAOF,+EAA+E;AAC/E,eAAO,MAAM,iBAAiB;;;;;;;;uDAY7B,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB;;;aAG7B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAuBzB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,cAAc,CAAC,CAAC;AAEhE,4EAA4E;AAC5E,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACjE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,YAAY,CAAC,CAAC;AACnE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE/E;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,SAAc,GAAG,YAAY,CAU/E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CA6BnD"}
|
|
@@ -2,13 +2,47 @@
|
|
|
2
2
|
* Fixtures of Forge resources for the tests of `forge sites apply`.
|
|
3
3
|
*/
|
|
4
4
|
import type { CliExecutorContext } from "../../../context.ts";
|
|
5
|
-
import type { Daemon, ScheduledJob, Site } from "./plan.ts";
|
|
5
|
+
import type { Daemon, LoadBalancingNode, ScheduledJob, Site } from "./plan.ts";
|
|
6
6
|
export declare function site(id: number, name: string, overrides?: Partial<Site>): Site;
|
|
7
7
|
export declare function daemon(id: number, command: string, directory: string | null, overrides?: Partial<Daemon>): Daemon;
|
|
8
8
|
export declare function job(id: number, command: string, overrides?: Partial<ScheduledJob>): ScheduledJob;
|
|
9
9
|
type Call = [method: string, url: string, body?: unknown];
|
|
10
|
+
/** Attributes of server 123, for the `SERVER_*` Nginx variables. */
|
|
11
|
+
export declare function webServer(): {
|
|
12
|
+
id: number;
|
|
13
|
+
credential_id: null;
|
|
14
|
+
name: string;
|
|
15
|
+
type: string;
|
|
16
|
+
ubuntu_version: string;
|
|
17
|
+
ssh_port: number;
|
|
18
|
+
provider: string;
|
|
19
|
+
identifier: null;
|
|
20
|
+
size: string;
|
|
21
|
+
region: string;
|
|
22
|
+
php_version: null;
|
|
23
|
+
php_cli_version: null;
|
|
24
|
+
opcache_status: null;
|
|
25
|
+
database_type: null;
|
|
26
|
+
db_status: null;
|
|
27
|
+
redis_status: null;
|
|
28
|
+
revoked: boolean;
|
|
29
|
+
created_at: string;
|
|
30
|
+
updated_at: string;
|
|
31
|
+
connection_status: null;
|
|
32
|
+
timezone: string;
|
|
33
|
+
local_public_key: null;
|
|
34
|
+
is_ready: boolean;
|
|
35
|
+
ip_address: string;
|
|
36
|
+
private_ip_address: string;
|
|
37
|
+
};
|
|
38
|
+
/** A node of a site on the load balancer, with the default weight. */
|
|
39
|
+
export declare function node(serverId: number, overrides?: Partial<LoadBalancingNode>): LoadBalancingNode;
|
|
10
40
|
export interface FakeForge {
|
|
11
41
|
sites: Site[];
|
|
42
|
+
/** Sites of the load balancer, server 300. */
|
|
43
|
+
balancerSites: Site[];
|
|
44
|
+
/** Nodes of each site of the load balancer, by site ID. */
|
|
45
|
+
nodes: Record<number, LoadBalancingNode[]>;
|
|
12
46
|
daemons: Daemon[];
|
|
13
47
|
siteDaemonIds: number[];
|
|
14
48
|
jobs: ScheduledJob[];
|
|
@@ -22,6 +56,8 @@ export interface FakeForge {
|
|
|
22
56
|
name: string;
|
|
23
57
|
}>;
|
|
24
58
|
env: string;
|
|
59
|
+
/** Nginx configuration of every site. */
|
|
60
|
+
nginx: string;
|
|
25
61
|
/** Statuses a new site goes through, one per read. */
|
|
26
62
|
newSiteStatuses: string[];
|
|
27
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-fixtures.d.ts","sourceRoot":"","sources":["../../../../src/commands/sites/apply/test-fixtures.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,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CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC3C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,KAAK,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,OAAO,CAAC,SAAS,CAAM;;;;;yCAoB/B,MAAM;;;;;;;;gBA1GrB,QAAQ;gBAAM,WAAW;gBAAQ,WAAW;;;;;;;;;0CA0K5B,MAAM,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;yCAsCtC,MAAM,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;4CAmBlC,MAAM;;;EAYnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/commands/sites/help.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/commands/sites/help.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CA8FvD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studiometa/forge-cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "CLI tool for managing Laravel Forge servers, sites, and deployments",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agent",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"typecheck": "tsgo -p tsconfig.typecheck.json --noEmit"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@studiometa/forge-api": "0.5.
|
|
53
|
-
"@studiometa/forge-core": "0.5.
|
|
52
|
+
"@studiometa/forge-api": "0.5.4",
|
|
53
|
+
"@studiometa/forge-core": "0.5.4",
|
|
54
54
|
"valibot": "^1.3.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
package/schemas/site.schema.json
CHANGED
|
@@ -7,12 +7,20 @@
|
|
|
7
7
|
"additionalProperties": false,
|
|
8
8
|
"required": ["server", "domain"],
|
|
9
9
|
"properties": {
|
|
10
|
-
"$schema": {
|
|
10
|
+
"$schema": {
|
|
11
|
+
"type": "string"
|
|
12
|
+
},
|
|
11
13
|
"server": {
|
|
12
14
|
"description": "Server name (exact match) or ID.",
|
|
13
15
|
"oneOf": [
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
+
{
|
|
17
|
+
"type": "string",
|
|
18
|
+
"minLength": 1
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"type": "integer",
|
|
22
|
+
"minimum": 1
|
|
23
|
+
}
|
|
16
24
|
]
|
|
17
25
|
},
|
|
18
26
|
"domain": {
|
|
@@ -23,7 +31,10 @@
|
|
|
23
31
|
"aliases": {
|
|
24
32
|
"description": "Domains to add to the site. Aliases are added, never removed.",
|
|
25
33
|
"type": "array",
|
|
26
|
-
"items": {
|
|
34
|
+
"items": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"minLength": 1
|
|
37
|
+
}
|
|
27
38
|
},
|
|
28
39
|
"type": {
|
|
29
40
|
"description": "Site type, used to create the site.",
|
|
@@ -56,9 +67,17 @@
|
|
|
56
67
|
"additionalProperties": false,
|
|
57
68
|
"required": ["provider", "url"],
|
|
58
69
|
"properties": {
|
|
59
|
-
"provider": {
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
"provider": {
|
|
71
|
+
"enum": ["github", "gitlab", "bitbucket", "gitlab-custom", "custom"]
|
|
72
|
+
},
|
|
73
|
+
"url": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"minLength": 1
|
|
76
|
+
},
|
|
77
|
+
"branch": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"minLength": 1
|
|
80
|
+
}
|
|
62
81
|
}
|
|
63
82
|
},
|
|
64
83
|
"database": {
|
|
@@ -67,15 +86,52 @@
|
|
|
67
86
|
"additionalProperties": false,
|
|
68
87
|
"required": ["name", "user"],
|
|
69
88
|
"properties": {
|
|
70
|
-
"name": {
|
|
71
|
-
|
|
89
|
+
"name": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"minLength": 1
|
|
92
|
+
},
|
|
93
|
+
"user": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"minLength": 1
|
|
96
|
+
},
|
|
97
|
+
"env": {
|
|
98
|
+
"description": ".env keys that get the database name, user and password of a new user. The keys must be different.",
|
|
99
|
+
"type": "object",
|
|
100
|
+
"additionalProperties": false,
|
|
101
|
+
"properties": {
|
|
102
|
+
"name": {
|
|
103
|
+
"type": "string",
|
|
104
|
+
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
|
|
105
|
+
"default": "DB_DATABASE"
|
|
106
|
+
},
|
|
107
|
+
"user": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
|
|
110
|
+
"default": "DB_USERNAME"
|
|
111
|
+
},
|
|
112
|
+
"password": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
|
|
115
|
+
"default": "DB_PASSWORD"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
72
119
|
}
|
|
73
120
|
},
|
|
74
121
|
"env": {
|
|
75
122
|
"description": ".env variables to add when missing. Existing values are never overwritten.",
|
|
76
123
|
"type": "object",
|
|
77
|
-
"propertyNames": {
|
|
78
|
-
|
|
124
|
+
"propertyNames": {
|
|
125
|
+
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
|
|
126
|
+
},
|
|
127
|
+
"additionalProperties": {
|
|
128
|
+
"type": ["string", "number", "boolean"]
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"nginx": {
|
|
132
|
+
"description": "Nginx file, relative to the site file, with the Forge template variables {{DIRECTORY}}, {{DOMAINS}}, {{PATH}}, {{PORT}}, {{PORT_V6}}, {{PROXY_PASS}}, {{ROOT_PATH}}, {{SERVER_PUBLIC_IP}}, {{SERVER_PRIVATE_IP}}, {{SITE}}, {{SITE_ID}} and {{USER}}. Rendered for the site and written when it differs from Forge. An unknown variable is an error.",
|
|
133
|
+
"type": "string",
|
|
134
|
+
"minLength": 1
|
|
79
135
|
},
|
|
80
136
|
"workers": {
|
|
81
137
|
"description": "Forge background processes of the site. [] deletes all the workers of the site.",
|
|
@@ -85,8 +141,15 @@
|
|
|
85
141
|
"additionalProperties": false,
|
|
86
142
|
"required": ["command"],
|
|
87
143
|
"properties": {
|
|
88
|
-
"command": {
|
|
89
|
-
|
|
144
|
+
"command": {
|
|
145
|
+
"type": "string",
|
|
146
|
+
"minLength": 1
|
|
147
|
+
},
|
|
148
|
+
"processes": {
|
|
149
|
+
"type": "integer",
|
|
150
|
+
"minimum": 1,
|
|
151
|
+
"default": 1
|
|
152
|
+
},
|
|
90
153
|
"directory": {
|
|
91
154
|
"description": "Directory, absolute or relative to the site root. Default: the site root.",
|
|
92
155
|
"type": "string",
|
|
@@ -103,7 +166,10 @@
|
|
|
103
166
|
"additionalProperties": false,
|
|
104
167
|
"required": ["command", "frequency"],
|
|
105
168
|
"properties": {
|
|
106
|
-
"command": {
|
|
169
|
+
"command": {
|
|
170
|
+
"type": "string",
|
|
171
|
+
"minLength": 1
|
|
172
|
+
},
|
|
107
173
|
"frequency": {
|
|
108
174
|
"enum": ["minutely", "hourly", "nightly", "weekly", "monthly", "reboot", "custom"]
|
|
109
175
|
},
|
|
@@ -113,9 +179,49 @@
|
|
|
113
179
|
"minLength": 1
|
|
114
180
|
}
|
|
115
181
|
},
|
|
116
|
-
"if": {
|
|
117
|
-
|
|
118
|
-
|
|
182
|
+
"if": {
|
|
183
|
+
"properties": {
|
|
184
|
+
"frequency": {
|
|
185
|
+
"const": "custom"
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"then": {
|
|
190
|
+
"required": ["cron"]
|
|
191
|
+
},
|
|
192
|
+
"else": {
|
|
193
|
+
"not": {
|
|
194
|
+
"required": ["cron"]
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"loadBalancer": {
|
|
200
|
+
"description": "Load balancer of the site: apply sets its nodes to the server of the site file only, with round robin and weight 1. The site of the load balancer must exist: its name is the domain or one of the aliases. Create it in Forge (New site on the load balancer): the Forge API cannot. Its certificate is not managed.",
|
|
201
|
+
"type": "object",
|
|
202
|
+
"additionalProperties": false,
|
|
203
|
+
"required": ["server"],
|
|
204
|
+
"properties": {
|
|
205
|
+
"server": {
|
|
206
|
+
"description": "Load balancer name (exact match) or ID.",
|
|
207
|
+
"oneOf": [
|
|
208
|
+
{
|
|
209
|
+
"type": "string",
|
|
210
|
+
"minLength": 1
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"type": "integer",
|
|
214
|
+
"minimum": 1
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
},
|
|
218
|
+
"port": {
|
|
219
|
+
"description": "Port of the site on its server. Default: 80.",
|
|
220
|
+
"type": "integer",
|
|
221
|
+
"minimum": 1,
|
|
222
|
+
"maximum": 65535,
|
|
223
|
+
"default": 80
|
|
224
|
+
}
|
|
119
225
|
}
|
|
120
226
|
}
|
|
121
227
|
}
|