@fabrika/provider-zerops 0.9.0-dev.13 → 0.9.0-dev.14
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/package.json +10 -10
- package/src/api/client.ts +8 -0
- package/src/api/readers.ts +12 -0
- package/src/api/types.ts +33 -0
- package/src/api.ts +2 -0
- package/src/build-base.ts +117 -0
- package/src/cli.ts +20 -5
- package/src/collaborators.ts +11 -0
- package/src/control.ts +3 -0
- package/src/index.ts +1 -0
- package/src/installation/admin.ts +6 -1
- package/src/installation/generated/platform-proxy-manifest.ts +80 -0
- package/src/installation/guide.md +90 -12
- package/src/installation/index.ts +9 -1
- package/src/installation/install-environment.ts +4 -0
- package/src/installation/install-options.ts +40 -0
- package/src/installation/install.ts +18 -2
- package/src/installation/templates/README.md +1 -1
- package/src/plan.ts +14 -2
- package/src/provider.ts +160 -2
- package/types/src/api/readers.d.ts +46 -1
- package/types/src/api/types.d.ts +36 -0
- package/types/src/api.d.ts +1 -1
- package/types/src/build-base.d.ts +27 -0
- package/types/src/cli.d.ts +8 -1
- package/types/src/collaborators.d.ts +9 -0
- package/types/src/index.d.ts +1 -0
- package/types/src/installation/install-environment.d.ts +3 -1
- package/types/src/installation/install-options.d.ts +3 -1
- package/types/src/installation/topology/installation-schemas.d.ts +14 -14
- package/types/src/namespace/codec.d.ts +2 -2
- package/types/src/plan.d.ts +9 -3
- package/types/src/provider.d.ts +43 -2
|
@@ -104,7 +104,9 @@ Re-running install after any generated secret was placed is refused.
|
|
|
104
104
|
Two tiers, one project each. \`light\` (core LIGHT): one single-node PostgreSQL and one bucket shared by
|
|
105
105
|
IAM, control and Operations, one container per service. \`standard\` (core SERIOUS): an HA PostgreSQL for
|
|
106
106
|
IAM and control, a second HA PostgreSQL and bucket for Operations, two containers of IAM and the proxy.
|
|
107
|
-
Authentication is PASSWORD ONLY; no administrator exists yet when this
|
|
107
|
+
Authentication is PASSWORD ONLY unless \`--auth-methods\` says otherwise; no administrator exists yet when this
|
|
108
|
+
finishes. With OIDC, register \`https://<iam host>/auth/callback\` at the identity provider once the install
|
|
109
|
+
prints the host; to turn it on for an existing installation, see \`platform guide\`.
|
|
108
110
|
|
|
109
111
|
Options (a flag beats the environment variable beside it):
|
|
110
112
|
|
|
@@ -122,11 +124,17 @@ Options (a flag beats the environment variable beside it):
|
|
|
122
124
|
--email-provider=<name> FABRIKA_EMAIL_PROVIDER default none; or one of: ${EMAIL_PROVIDERS}
|
|
123
125
|
--email-from=<address> FABRIKA_EMAIL_FROM the sender, required with a provider
|
|
124
126
|
--email-from-name=<name> FABRIKA_EMAIL_FROM_NAME the sender's display name, optional
|
|
127
|
+
--auth-methods=<oidc|password|oidc,password> default password; or FABRIKA_IAM_OIDC_ENABLED
|
|
128
|
+
+ FABRIKA_IAM_PASSWORD_ENABLED, both true/false
|
|
129
|
+
--oidc-issuer=<url> FABRIKA_IAM_OIDC_ISSUER required with oidc
|
|
130
|
+
--oidc-client-id=<id> FABRIKA_IAM_OIDC_CLIENT_ID required with oidc
|
|
125
131
|
${UNATTENDED_FLAG} answer every confirmation yes —
|
|
126
132
|
required when stdin is not a terminal
|
|
127
133
|
|
|
128
134
|
FABRIKA_ZEROPS_ACCESS_TOKEN required Zerops access token, environment only and no flag
|
|
129
135
|
FABRIKA_ZEROPS_API_URL optional region API base, when not the default
|
|
136
|
+
FABRIKA_IAM_OIDC_CLIENT_SECRET with oidc the OIDC client secret, environment only and no flag; written
|
|
137
|
+
sensitive on \`iam\` and not into the secrets file
|
|
130
138
|
FABRIKA_EMAIL_<PROVIDER>_* the selected provider's variables, environment only and no flag:
|
|
131
139
|
${EMAIL_PROVIDER_VARIABLES}
|
|
132
140
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
INSTALLATION_SECRET_VARIABLES,
|
|
3
|
+
type InstallationAuthentication,
|
|
3
4
|
type InstallationEmail,
|
|
4
5
|
type InstallationSecrets,
|
|
5
6
|
installationServiceEnvironment,
|
|
@@ -68,6 +69,8 @@ export interface InstallationEnvInput {
|
|
|
68
69
|
readonly zeropsAccessToken: string
|
|
69
70
|
/** IAM sends its own mail with it, and Control hands it to applications whose job declares `mailer: 'installation'`. */
|
|
70
71
|
readonly email: InstallationEmail
|
|
72
|
+
/** How people sign in; written on `iam`, the OIDC client secret sensitive. */
|
|
73
|
+
readonly authentication: InstallationAuthentication
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
/**
|
|
@@ -90,6 +93,7 @@ export const installationServiceEnv = (input: InstallationEnvInput): ReadonlyMap
|
|
|
90
93
|
iamUpstream: PRIVATE_IAM_UPSTREAM,
|
|
91
94
|
secrets,
|
|
92
95
|
email: input.email,
|
|
96
|
+
authentication: input.authentication,
|
|
93
97
|
data: {
|
|
94
98
|
iamDatabase: postgresUrl('db'),
|
|
95
99
|
controlDatabase: postgresUrl('db'),
|
|
@@ -10,13 +10,24 @@
|
|
|
10
10
|
|
|
11
11
|
import { builtinEmailProviders } from '@fabrika/email/providers'
|
|
12
12
|
import {
|
|
13
|
+
AUTH_METHODS_FLAG,
|
|
14
|
+
type AuthMethods,
|
|
15
|
+
checkedOidcIssuer,
|
|
13
16
|
checkedSecretsFilePath,
|
|
14
17
|
describeArgument,
|
|
15
18
|
EMAIL_FLAGS,
|
|
19
|
+
type InstallationAuthentication,
|
|
16
20
|
type InstallationEmail,
|
|
21
|
+
OIDC_CLIENT_ID_FLAG,
|
|
22
|
+
OIDC_CLIENT_ID_INPUT,
|
|
23
|
+
OIDC_CLIENT_SECRET_INPUT,
|
|
24
|
+
OIDC_ISSUER_FLAG,
|
|
25
|
+
OIDC_ISSUER_INPUT,
|
|
26
|
+
readAuthMethods,
|
|
17
27
|
readEnv,
|
|
18
28
|
readFlag,
|
|
19
29
|
readInstallationEmail,
|
|
30
|
+
refuseFlags,
|
|
20
31
|
requiredSetting,
|
|
21
32
|
SECRETS_FILE_FLAG,
|
|
22
33
|
SECRETS_FILE_VARIABLE,
|
|
@@ -62,6 +73,8 @@ export interface PlatformInstallInput {
|
|
|
62
73
|
readonly tier: PlatformTier
|
|
63
74
|
/** The installation's mail transport, written on `iam` and `control`; `none` when the operator named no provider. */
|
|
64
75
|
readonly email: InstallationEmail
|
|
76
|
+
/** How people sign in, written on `iam`; password only when the operator named no method. */
|
|
77
|
+
readonly authentication: InstallationAuthentication
|
|
65
78
|
/** `--yes`: answer every confirmation yes, for a bring-up with nobody at the keyboard. */
|
|
66
79
|
readonly unattended: boolean
|
|
67
80
|
}
|
|
@@ -79,6 +92,9 @@ const FLAGS = [
|
|
|
79
92
|
'--tier',
|
|
80
93
|
SECRETS_FILE_FLAG,
|
|
81
94
|
...EMAIL_FLAGS,
|
|
95
|
+
AUTH_METHODS_FLAG,
|
|
96
|
+
OIDC_ISSUER_FLAG,
|
|
97
|
+
OIDC_CLIENT_ID_FLAG,
|
|
82
98
|
] as const
|
|
83
99
|
|
|
84
100
|
/** `--create-project`: bring the project up too, instead of naming one the operator made. */
|
|
@@ -154,6 +170,29 @@ const readProjectSource = (argv: readonly string[], env: Record<string, string |
|
|
|
154
170
|
return { kind: 'create', projectName: projectName ?? defaultProjectName(readEnvironment(argv, env)) }
|
|
155
171
|
}
|
|
156
172
|
|
|
173
|
+
/** What a run that names no method installs, so an existing invocation installs what it did. */
|
|
174
|
+
const PASSWORD_ONLY: AuthMethods = { oidcEnabled: false, passwordEnabled: true }
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The sign-in methods and, with OIDC, its client: the issuer and the client id from a flag or the variable beside it,
|
|
178
|
+
* the client secret from the environment only. There are no placeholders: IAM refuses to boot with OIDC on and any of
|
|
179
|
+
* the three missing, so a run that turns OIDC on names a real client.
|
|
180
|
+
*/
|
|
181
|
+
const readAuthentication = (argv: readonly string[], env: Record<string, string | undefined>): InstallationAuthentication => {
|
|
182
|
+
const methods = readAuthMethods(argv, env, PASSWORD_ONLY)
|
|
183
|
+
if (!methods.oidcEnabled) {
|
|
184
|
+
refuseFlags(argv, [OIDC_ISSUER_FLAG, OIDC_CLIENT_ID_FLAG], 'OIDC is not among the IAM authentication methods')
|
|
185
|
+
return { passwordEnabled: methods.passwordEnabled }
|
|
186
|
+
}
|
|
187
|
+
const issuer = requiredSetting(setting(argv, env, OIDC_ISSUER_FLAG, OIDC_ISSUER_INPUT), OIDC_ISSUER_FLAG, OIDC_ISSUER_INPUT)
|
|
188
|
+
const oidc = {
|
|
189
|
+
issuer: checkedOidcIssuer(issuer),
|
|
190
|
+
clientId: requiredSetting(setting(argv, env, OIDC_CLIENT_ID_FLAG, OIDC_CLIENT_ID_INPUT), OIDC_CLIENT_ID_FLAG, OIDC_CLIENT_ID_INPUT),
|
|
191
|
+
clientSecret: requiredSetting(readEnv(env, OIDC_CLIENT_SECRET_INPUT), '(no flag)', OIDC_CLIENT_SECRET_INPUT),
|
|
192
|
+
}
|
|
193
|
+
return methods.passwordEnabled ? { passwordEnabled: true, oidc } : { passwordEnabled: false, oidc }
|
|
194
|
+
}
|
|
195
|
+
|
|
157
196
|
/** Parse the command's arguments and environment into the one input `runInstall` takes. */
|
|
158
197
|
export const parsePlatformInstallArgs = (
|
|
159
198
|
argv: readonly string[],
|
|
@@ -178,6 +217,7 @@ export const parsePlatformInstallArgs = (
|
|
|
178
217
|
tier: readTier(setting(argv, env, '--tier', 'FABRIKA_PLATFORM_TIER')),
|
|
179
218
|
// Optional, so an existing unattended install keeps working and installs without mail.
|
|
180
219
|
email: readInstallationEmail(argv, env, { registry: builtinEmailProviders, required: false }),
|
|
220
|
+
authentication: readAuthentication(argv, env),
|
|
181
221
|
unattended: argv.includes(UNATTENDED_FLAG),
|
|
182
222
|
...(apiBaseUrl === undefined ? {} : { apiBaseUrl }),
|
|
183
223
|
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
action as consoleAction,
|
|
7
7
|
confirmations,
|
|
8
8
|
generateInstallationSecrets,
|
|
9
|
+
IAM_OIDC_CLIENT_SECRET_VARIABLE,
|
|
9
10
|
info as consoleInfo,
|
|
10
11
|
type InstallationSecrets,
|
|
11
12
|
ok as consoleOk,
|
|
@@ -183,6 +184,7 @@ const installPreparedPlatform = async (
|
|
|
183
184
|
secrets,
|
|
184
185
|
zeropsAccessToken: token.token,
|
|
185
186
|
email: input.email,
|
|
187
|
+
authentication: input.authentication,
|
|
186
188
|
...(input.apiBaseUrl === undefined ? {} : { apiBaseUrl: input.apiBaseUrl }),
|
|
187
189
|
})
|
|
188
190
|
const total = [...desired.values()].reduce((sum, keys) => sum + keys.size, 0)
|
|
@@ -193,10 +195,12 @@ const installPreparedPlatform = async (
|
|
|
193
195
|
+ `Keep ${input.secretsFile} and arrange operator-owned recovery, or start a fresh installation in a separate empty project`,
|
|
194
196
|
)
|
|
195
197
|
}
|
|
196
|
-
// The mail credentials are the operator's own, so they neither mark an installation nor
|
|
198
|
+
// The mail credentials and the OIDC client secret are the operator's own, so they neither mark an installation nor
|
|
199
|
+
// go to the secrets file.
|
|
197
200
|
const emailSecrets = input.email.kind === 'none' ? [] : [...input.email.secretNames]
|
|
201
|
+
const operatorSecrets = (hostname: string): string[] => hostname === 'iam' ? [...emailSecrets, IAM_OIDC_CLIENT_SECRET_VARIABLE] : emailSecrets
|
|
198
202
|
for (const hostname of PLATFORM_DEPLOY_ORDER) {
|
|
199
|
-
const sensitive = new Set([...(GENERATED_SECRET_KEYS.get(hostname) ?? []), ...
|
|
203
|
+
const sensitive = new Set([...(GENERATED_SECRET_KEYS.get(hostname) ?? []), ...operatorSecrets(hostname)])
|
|
200
204
|
await writeServiceEnv(serviceOf(services, hostname), desired.get(hostname) ?? new Map<string, string>(), collaborators, sensitive)
|
|
201
205
|
}
|
|
202
206
|
|
|
@@ -236,6 +240,18 @@ const installPreparedPlatform = async (
|
|
|
236
240
|
log.info('it holds the vault key, whose loss is unrecoverable, and Zerops does not hand any of them back.')
|
|
237
241
|
log.info('`platform init` and `control key issue` read their credentials from it under the names it uses.')
|
|
238
242
|
log.info(`The console answers at ${platformOrigin(input.scheme, hosts.control)}, once someone can sign in: nobody can yet.`)
|
|
243
|
+
const { oidc, passwordEnabled } = input.authentication
|
|
244
|
+
if (oidc !== undefined) {
|
|
245
|
+
log.action('REGISTER THE REDIRECT URI: single sign-on fails until the identity provider knows it', [
|
|
246
|
+
`${platformOrigin(input.scheme, hosts.iam)}/auth/callback (OIDC client ${oidc.clientId} at ${oidc.issuer})`,
|
|
247
|
+
])
|
|
248
|
+
}
|
|
249
|
+
if (!passwordEnabled) {
|
|
250
|
+
log.info(
|
|
251
|
+
'Without the password method `platform admin` admits the address and grants it the admin role but issues no enrollment: '
|
|
252
|
+
+ 'that person signs in with single sign-on.',
|
|
253
|
+
)
|
|
254
|
+
}
|
|
239
255
|
// `platform admin` is idempotent, so re-running it is safe.
|
|
240
256
|
log.action('ADMIT YOURSELF — the console has no administrator until this runs', [
|
|
241
257
|
withSecrets(`fabrika platform admin --provider=zerops --email=<you> --iam-host=${hosts.iam}`),
|
|
@@ -62,7 +62,7 @@ Namespace source resolution verifies public commit availability before its effec
|
|
|
62
62
|
|
|
63
63
|
Written by `fabrika platform init --provider=zerops {{INSTALLATION}}`, not by hand.
|
|
64
64
|
|
|
65
|
-
Public repositories deploy without a GitHub App. Configure an organization
|
|
65
|
+
Public repositories deploy without a GitHub App. Configure a GitHub App, owned by an organization or a personal account, in the
|
|
66
66
|
authenticated Control console at **Settings → Source**. Its private key and webhook secret stay in
|
|
67
67
|
Control's encrypted vault; neither is copied into this repository or Environment. Init never reads or
|
|
68
68
|
writes a GitHub App credential or a local credential recovery file.
|
package/src/plan.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type FabrikaManifest, manifestServiceHostnames } from './manifest'
|
|
|
3
3
|
export type ZeropsStepKind =
|
|
4
4
|
| 'apply-import'
|
|
5
5
|
| 'verify-exposure'
|
|
6
|
+
| 'backup-database'
|
|
6
7
|
| 'write-service-env'
|
|
7
8
|
| 'raise-start-memory'
|
|
8
9
|
| 'size-database'
|
|
@@ -27,8 +28,12 @@ export const resolveDeployHostname = (manifest: FabrikaManifest): string => {
|
|
|
27
28
|
return deployService
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
/**
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Build the provider-owned deploy order without touching the platform. `backup` adds the backup of the application's
|
|
33
|
+
* database, which a deploy takes when its migrations may change stored data: before anything but the verified import changes, and
|
|
34
|
+
* before a version is reserved, so a backup that does not finish leaves nothing to clean up.
|
|
35
|
+
*/
|
|
36
|
+
export const buildZeropsPlan = (manifest: FabrikaManifest, options: { readonly backup?: boolean } = {}): readonly ZeropsStep[] => {
|
|
32
37
|
const serviceHostnames = manifestServiceHostnames(manifest)
|
|
33
38
|
const steps: ZeropsStep[] = []
|
|
34
39
|
|
|
@@ -42,6 +47,13 @@ export const buildZeropsPlan = (manifest: FabrikaManifest): readonly ZeropsStep[
|
|
|
42
47
|
kind: 'verify-exposure',
|
|
43
48
|
description: 'Read back that no service has subdomain access and every bucket is one the platform created private',
|
|
44
49
|
})
|
|
50
|
+
if (options.backup === true) {
|
|
51
|
+
steps.push({
|
|
52
|
+
id: 'backup-database',
|
|
53
|
+
kind: 'backup-database',
|
|
54
|
+
description: "Back up the application's database before migrations that may change stored data, and wait until the backup is stored",
|
|
55
|
+
})
|
|
56
|
+
}
|
|
45
57
|
steps.push({ id: 'write-service-env', kind: 'write-service-env', description: 'Write the managed service variables' })
|
|
46
58
|
steps.push({
|
|
47
59
|
id: 'raise-start-memory',
|
package/src/provider.ts
CHANGED
|
@@ -29,14 +29,24 @@ import {
|
|
|
29
29
|
ZEROPS_PROCESS_FINISHED,
|
|
30
30
|
ZEROPS_PROCESS_TERMINAL,
|
|
31
31
|
ZEROPS_TERMINAL,
|
|
32
|
+
type ZeropsApi,
|
|
32
33
|
ZeropsApiError,
|
|
33
34
|
type ZeropsAppVersion,
|
|
35
|
+
type ZeropsBackupFile,
|
|
36
|
+
type ZeropsBackupStart,
|
|
34
37
|
type ZeropsLogAccess,
|
|
35
38
|
type ZeropsProcess,
|
|
36
39
|
type ZeropsService,
|
|
37
40
|
type ZeropsServiceAutoscaling,
|
|
38
41
|
} from './api'
|
|
39
|
-
import {
|
|
42
|
+
import {
|
|
43
|
+
defaultZeropsCollaborators,
|
|
44
|
+
type Sleeper,
|
|
45
|
+
systemClock,
|
|
46
|
+
type ZeropsClock,
|
|
47
|
+
type ZeropsCollaboratorFactory,
|
|
48
|
+
type ZeropsCollaborators,
|
|
49
|
+
} from './collaborators'
|
|
40
50
|
import { assertZeropsInvariants, renderYaml } from './compile'
|
|
41
51
|
import {
|
|
42
52
|
MIN_PROCESS_CONNECTIONS,
|
|
@@ -95,6 +105,8 @@ export interface ZeropsDeployRun {
|
|
|
95
105
|
readonly access?: ProviderApprovedAccess
|
|
96
106
|
/** The run-scoped source-map destination Control minted; the build uploads to it. */
|
|
97
107
|
readonly artifactUpload?: ProviderDeployInput['artifactUpload']
|
|
108
|
+
/** Control's `backupBeforeMigrations`, with the run whose tag the backup carries. Absent: no backup. */
|
|
109
|
+
readonly backupBeforeMigrations?: { readonly migrations: readonly string[]; readonly runId: string }
|
|
98
110
|
readonly dryRun: boolean
|
|
99
111
|
readonly signal: AbortSignal
|
|
100
112
|
readonly events: ProviderRunEvents
|
|
@@ -115,6 +127,25 @@ const POLL_INTERVAL_MS = 3000
|
|
|
115
127
|
/** A run stops waiting for its version this long after it started. Zerops' own pipeline limit is 1 hour. */
|
|
116
128
|
export const ZEROPS_VERSION_DEADLINE_MS = 75 * 60 * 1000
|
|
117
129
|
|
|
130
|
+
/**
|
|
131
|
+
* `backup-database` waits at most this long of elapsed time for the backup to be stored, request times included, and
|
|
132
|
+
* never past the run's own deadline. The build that follows has the rest of `ZEROPS_VERSION_DEADLINE_MS`.
|
|
133
|
+
*/
|
|
134
|
+
export const ZEROPS_BACKUP_WAIT_MS = 30 * 60 * 1000
|
|
135
|
+
/** How long to wait between two lists of a backup that runs in the background. */
|
|
136
|
+
const BACKUP_POLL_INTERVAL_MS = 10_000
|
|
137
|
+
/** The backup request answers within the platform's 10 s window, past which it reports the backup `async`. */
|
|
138
|
+
export const ZEROPS_BACKUP_REQUEST_TIMEOUT_MS = 60_000
|
|
139
|
+
export const ZEROPS_BACKUP_LIST_TIMEOUT_MS = 30_000
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The tag of the backup a run takes before its migrations may change stored data. A user tag is at most 24 characters of
|
|
143
|
+
* `[A-Za-z0-9:_-]`, so it carries the first 20 of the run id's own: a UUIDv7's, which start with its timestamp.
|
|
144
|
+
* The tag is not protected: default retention removes a manual backup only past 50 files or 5 GiB, while protected ones
|
|
145
|
+
* would pile up toward the project's backup storage, past which no backup is stored at all.
|
|
146
|
+
*/
|
|
147
|
+
export const zeropsBackupTag = (runId: string): string => `run-${runId.replace(/[^A-Za-z0-9]/g, '').slice(0, 20)}`
|
|
148
|
+
|
|
118
149
|
/** Abandon the step if the run was cancelled. Checked before every real mutation and each poll iteration. */
|
|
119
150
|
const assertRunning = (signal: AbortSignal): void => {
|
|
120
151
|
if (signal.aborted) {
|
|
@@ -804,6 +835,128 @@ const sizeDatabase = async (env: StepEnv): Promise<void> => {
|
|
|
804
835
|
log(` ${database.hostname}: ${limit} connections at ${ram} GB; each process opens at most ${connections}, for ${holders}`)
|
|
805
836
|
}
|
|
806
837
|
|
|
838
|
+
/**
|
|
839
|
+
* Backs up the application's database before a version that runs migrations that may change stored data can start: those run in its
|
|
840
|
+
* init commands, at container start. A backup that fails or is not stored fails the run before a version is reserved.
|
|
841
|
+
* A `cheap` namespace's shared database is backed up whole.
|
|
842
|
+
*/
|
|
843
|
+
const backupDatabase = async (env: StepEnv): Promise<void> => {
|
|
844
|
+
const { run, zerops, log, signal, dryRun } = env
|
|
845
|
+
const request = run.backupBeforeMigrations
|
|
846
|
+
if (request === undefined) return
|
|
847
|
+
const migrations = request.migrations.map((file) => `\`${file}\``).join(', ')
|
|
848
|
+
const database = applicationDatabaseOf(run.artifact)
|
|
849
|
+
if (database === null) throw new Error(`zerops: ${migrations} may change stored data, and the application declares no database to back up`)
|
|
850
|
+
const tag = zeropsBackupTag(request.runId)
|
|
851
|
+
const named = database.shared ? `${database.hostname}, the namespace's shared database,` : database.hostname
|
|
852
|
+
if (dryRun) {
|
|
853
|
+
log(` [dry-run] would back up ${named} under the tag \`${tag}\` and wait until the backup is stored`)
|
|
854
|
+
return
|
|
855
|
+
}
|
|
856
|
+
assertRunning(signal)
|
|
857
|
+
const service = await zerops.api.findService({ projectId: run.target.projectId, hostname: database.hostname, signal })
|
|
858
|
+
if (service === null) throw new Error(`zerops: the database ${database.hostname} does not exist, so it cannot be backed up`)
|
|
859
|
+
log(` ${migrations} may change stored data: backing up ${named} under the tag \`${tag}\``)
|
|
860
|
+
const stored = await storeTaggedBackup({
|
|
861
|
+
api: zerops.api,
|
|
862
|
+
sleep: zerops.sleep,
|
|
863
|
+
clock: zerops.clock ?? systemClock,
|
|
864
|
+
budgetEndMs: env.deadlineMs,
|
|
865
|
+
signal,
|
|
866
|
+
boundary: () => run.events.boundary(),
|
|
867
|
+
log,
|
|
868
|
+
serviceId: service.id,
|
|
869
|
+
hostname: database.hostname,
|
|
870
|
+
tag,
|
|
871
|
+
})
|
|
872
|
+
log(` ${database.hostname}: backup \`${stored.name}\` is stored`)
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* Requests a backup of a managed service under `tag` and answers the stored file. `async: false` answers a finished
|
|
877
|
+
* backup (verified live), so one list read confirms it; `async: true` runs on in the background, and the list is read
|
|
878
|
+
* until it shows the tag. The wait is elapsed time on `clock`, at most `ZEROPS_BACKUP_WAIT_MS` and never past
|
|
879
|
+
* `budgetEndMs`, and each request has its own timeout inside it. A refusal, no answer, a finished backup the list does
|
|
880
|
+
* not show, or a tag not seen before the deadline throws: a tag a late answer shows is still too late.
|
|
881
|
+
*/
|
|
882
|
+
export const storeTaggedBackup = async (input: {
|
|
883
|
+
api: Pick<ZeropsApi, 'createBackup' | 'listBackups'>
|
|
884
|
+
sleep: Sleeper
|
|
885
|
+
clock: ZeropsClock
|
|
886
|
+
/** The instant the deploy's own deadline falls; the wait never runs past it. */
|
|
887
|
+
budgetEndMs: number
|
|
888
|
+
signal: AbortSignal
|
|
889
|
+
/** Crossed before each list, so a cancel or a lost lease stops the wait. */
|
|
890
|
+
boundary: () => Promise<void>
|
|
891
|
+
log: (line: string) => void
|
|
892
|
+
serviceId: string
|
|
893
|
+
hostname: string
|
|
894
|
+
tag: string
|
|
895
|
+
}): Promise<ZeropsBackupFile> => {
|
|
896
|
+
const { api, clock, signal, hostname, tag, serviceId } = input
|
|
897
|
+
const startedMs = clock.now()
|
|
898
|
+
const deadlineMs = Math.min(input.budgetEndMs, startedMs + ZEROPS_BACKUP_WAIT_MS)
|
|
899
|
+
const remaining = (): number => deadlineMs - clock.now()
|
|
900
|
+
/** The run's signal, and a timeout of `ms` that never reaches past the deadline. */
|
|
901
|
+
const within = (ms: number): AbortSignal => AbortSignal.any([signal, clock.timeout(Math.max(0, Math.min(ms, remaining())))])
|
|
902
|
+
const notStored = (): Error => {
|
|
903
|
+
const minutes = Math.round((deadlineMs - startedMs) / 60_000)
|
|
904
|
+
return new Error(
|
|
905
|
+
`zerops: the backup of ${hostname} was not stored within ${minutes} minutes, so nothing was deployed; `
|
|
906
|
+
+ "a backup larger than the project's backup storage is never stored",
|
|
907
|
+
)
|
|
908
|
+
}
|
|
909
|
+
/** The listed file under the tag, `undefined` when it is not there, or null when the list could not be read in time. */
|
|
910
|
+
const listTagged = async (): Promise<ZeropsBackupFile | undefined | null> => {
|
|
911
|
+
let files: ZeropsBackupFile[]
|
|
912
|
+
try {
|
|
913
|
+
files = await api.listBackups({ serviceId, signal: within(ZEROPS_BACKUP_LIST_TIMEOUT_MS) })
|
|
914
|
+
} catch {
|
|
915
|
+
assertRunning(signal)
|
|
916
|
+
return null
|
|
917
|
+
}
|
|
918
|
+
return files.find((file) => file.tags.includes(tag))
|
|
919
|
+
}
|
|
920
|
+
if (remaining() <= 0) throw notStored()
|
|
921
|
+
let started: ZeropsBackupStart
|
|
922
|
+
try {
|
|
923
|
+
started = await api.createBackup({ serviceId, tags: [tag], signal: within(ZEROPS_BACKUP_REQUEST_TIMEOUT_MS) })
|
|
924
|
+
} catch (error) {
|
|
925
|
+
assertRunning(signal)
|
|
926
|
+
if (error instanceof ZeropsApiError) {
|
|
927
|
+
throw new Error(`zerops: the backup of ${hostname} was refused (${error.code === '' ? error.status : error.code}); nothing was deployed`)
|
|
928
|
+
}
|
|
929
|
+
throw new Error(`zerops: the backup request for ${hostname} got no answer; nothing was deployed`)
|
|
930
|
+
}
|
|
931
|
+
if (!started.success) throw new Error(`zerops: the backup of ${hostname} did not start; nothing was deployed`)
|
|
932
|
+
if (!started.async) {
|
|
933
|
+
await input.boundary()
|
|
934
|
+
assertRunning(signal)
|
|
935
|
+
const stored = await listTagged()
|
|
936
|
+
if (stored === null) {
|
|
937
|
+
throw new Error(`zerops: the backup of ${hostname} finished, and its list could not be read to confirm it; nothing was deployed`)
|
|
938
|
+
}
|
|
939
|
+
if (stored === undefined || remaining() < 0) {
|
|
940
|
+
throw new Error(`zerops: the backup of ${hostname} finished, and the list does not show it; nothing was deployed`)
|
|
941
|
+
}
|
|
942
|
+
return stored
|
|
943
|
+
}
|
|
944
|
+
while (remaining() > 0) {
|
|
945
|
+
await input.boundary()
|
|
946
|
+
assertRunning(signal)
|
|
947
|
+
const stored = await listTagged()
|
|
948
|
+
if (stored === null) input.log(` ${hostname}: the backup list is unavailable; retrying`)
|
|
949
|
+
// A list that answered past the deadline proves nothing in time, whatever it shows.
|
|
950
|
+
if (remaining() < 0) break
|
|
951
|
+
if (stored !== null && stored !== undefined) return stored
|
|
952
|
+
const pause = Math.min(BACKUP_POLL_INTERVAL_MS, remaining())
|
|
953
|
+
if (pause <= 0) break
|
|
954
|
+
await input.sleep(pause, signal)
|
|
955
|
+
}
|
|
956
|
+
assertRunning(signal)
|
|
957
|
+
throw notStored()
|
|
958
|
+
}
|
|
959
|
+
|
|
807
960
|
/** The locked execution with the connections `size-database` sized; an application with a database is never sent without. */
|
|
808
961
|
const sizedExecution = (locked: ZeropsLockedExecution, attempt: Attempt): ZeropsLockedExecution => {
|
|
809
962
|
if (locked.databaseUrl === null) return locked
|
|
@@ -861,6 +1014,11 @@ const runStep = async (spec: ZeropsStep, env: StepEnv): Promise<void> => {
|
|
|
861
1014
|
return
|
|
862
1015
|
}
|
|
863
1016
|
|
|
1017
|
+
case 'backup-database': {
|
|
1018
|
+
await backupDatabase(env)
|
|
1019
|
+
return
|
|
1020
|
+
}
|
|
1021
|
+
|
|
864
1022
|
case 'write-service-env': {
|
|
865
1023
|
await writeServiceEnv(env)
|
|
866
1024
|
return
|
|
@@ -1027,7 +1185,7 @@ async (run: ZeropsDeployRun): Promise<ZeropsDeployResult> => {
|
|
|
1027
1185
|
managed: run.managedEnvironment,
|
|
1028
1186
|
deadlineMs: Date.now() + ZEROPS_VERSION_DEADLINE_MS,
|
|
1029
1187
|
}
|
|
1030
|
-
const steps = buildZeropsPlan(run.artifact)
|
|
1188
|
+
const steps = buildZeropsPlan(run.artifact, { backup: run.backupBeforeMigrations !== undefined })
|
|
1031
1189
|
const options = { appId: run.appId, env: run.env, dryRun: run.dryRun, signal: run.signal, log: run.events.log }
|
|
1032
1190
|
const result = await runSteps(steps, options, (step) => runStep(step, env))
|
|
1033
1191
|
const { appVersionId, triggered } = env.attempt
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type { ZeropsBackupConfig, ZeropsImportResult, ZeropsProcess, ZeropsService, ZeropsServiceAutoscaling } from './types';
|
|
2
|
+
import type { ZeropsBackupConfig, ZeropsBackupFile, ZeropsImportResult, ZeropsProcess, ZeropsService, ZeropsServiceAutoscaling } from './types';
|
|
3
3
|
export declare const appVersionSchema: z.ZodObject<{
|
|
4
4
|
id: z.ZodEffects<z.ZodString, string, string>;
|
|
5
5
|
status: z.ZodCatch<z.ZodOptional<z.ZodEnum<["UPLOADING", "WAITING_TO_BUILD", "BUILDING", "BUILD_FAILED", "BUILD_VALIDATION_FAILED", "WAITING_TO_DEPLOY", "DEPLOYING", "DEPLOY_FAILED", "PREPARING_RUNTIME", "PREPARING_RUNTIME_FAILED", "ACTIVE", "BACKUP", "CANCELLED"]>>>;
|
|
@@ -774,6 +774,51 @@ export declare const backupConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
774
774
|
maxMonthly: number;
|
|
775
775
|
} | null | undefined;
|
|
776
776
|
}>;
|
|
777
|
+
export declare const backupFilesSchema: z.ZodEffects<z.ZodObject<{
|
|
778
|
+
files: z.ZodNullable<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
779
|
+
name: z.ZodString;
|
|
780
|
+
metadata: z.ZodCatch<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
781
|
+
tags: z.ZodOptional<z.ZodCatch<z.ZodArray<z.ZodString, "many">>>;
|
|
782
|
+
}, "strip", z.ZodTypeAny, {
|
|
783
|
+
tags?: string[] | undefined;
|
|
784
|
+
}, {
|
|
785
|
+
tags?: unknown;
|
|
786
|
+
}>>>>;
|
|
787
|
+
}, "strip", z.ZodTypeAny, {
|
|
788
|
+
name: string;
|
|
789
|
+
metadata?: {
|
|
790
|
+
tags?: string[] | undefined;
|
|
791
|
+
} | null | undefined;
|
|
792
|
+
}, {
|
|
793
|
+
name: string;
|
|
794
|
+
metadata?: unknown;
|
|
795
|
+
}>, ZeropsBackupFile, {
|
|
796
|
+
name: string;
|
|
797
|
+
metadata?: unknown;
|
|
798
|
+
}>, "many">>;
|
|
799
|
+
}, "strip", z.ZodTypeAny, {
|
|
800
|
+
files: ZeropsBackupFile[] | null;
|
|
801
|
+
}, {
|
|
802
|
+
files: {
|
|
803
|
+
name: string;
|
|
804
|
+
metadata?: unknown;
|
|
805
|
+
}[] | null;
|
|
806
|
+
}>, ZeropsBackupFile[], {
|
|
807
|
+
files: {
|
|
808
|
+
name: string;
|
|
809
|
+
metadata?: unknown;
|
|
810
|
+
}[] | null;
|
|
811
|
+
}>;
|
|
812
|
+
export declare const backupStartSchema: z.ZodObject<{
|
|
813
|
+
success: z.ZodBoolean;
|
|
814
|
+
async: z.ZodBoolean;
|
|
815
|
+
}, "strip", z.ZodTypeAny, {
|
|
816
|
+
success: boolean;
|
|
817
|
+
async: boolean;
|
|
818
|
+
}, {
|
|
819
|
+
success: boolean;
|
|
820
|
+
async: boolean;
|
|
821
|
+
}>;
|
|
777
822
|
export declare const projectSchema: z.ZodObject<{
|
|
778
823
|
id: z.ZodEffects<z.ZodString, string, string>;
|
|
779
824
|
name: z.ZodString;
|
package/types/src/api/types.d.ts
CHANGED
|
@@ -138,6 +138,23 @@ export interface ZeropsBackupConfig {
|
|
|
138
138
|
/** The service's own retention; absent when none was set. */
|
|
139
139
|
retentionPolicy?: ZeropsBackupRetentionPolicy;
|
|
140
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* One stored backup of a managed service: `OutDtoServiceStackBackupFile`, narrowed to its `name` and the `tags` of its
|
|
143
|
+
* `metadata`. Verified live 2026-11-17: `metadata.tags` is a JSON array of strings, and the metadata keys are snake_case
|
|
144
|
+
* (`file_name`, `stack_name`), not the documented `filename` and `stackname`.
|
|
145
|
+
*/
|
|
146
|
+
export interface ZeropsBackupFile {
|
|
147
|
+
/** The moment the backup was taken, as the platform names the file. */
|
|
148
|
+
name: string;
|
|
149
|
+
tags: string[];
|
|
150
|
+
}
|
|
151
|
+
/** What a backup request answers. VERIFIED AS A SHAPE: `ResponseServiceStackBackup`. */
|
|
152
|
+
export interface ZeropsBackupStart {
|
|
153
|
+
/** The backup was started, and is finished or running in the background. */
|
|
154
|
+
success: boolean;
|
|
155
|
+
/** It ran past the platform's 10 s window and goes on in the background; `false` answers a finished backup. */
|
|
156
|
+
async: boolean;
|
|
157
|
+
}
|
|
141
158
|
/** One service. VERIFIED: `ResponseServiceStack` (narrowed to the fields fabrika reads). */
|
|
142
159
|
export interface ZeropsService {
|
|
143
160
|
id: string;
|
|
@@ -482,6 +499,25 @@ export interface ZeropsApi {
|
|
|
482
499
|
retentionPolicy: ZeropsBackupRetentionPolicy;
|
|
483
500
|
signal: AbortSignal;
|
|
484
501
|
}): Promise<ZeropsProcess | null>;
|
|
502
|
+
/**
|
|
503
|
+
* Back a managed service up now, under `tags`. VERIFIED AS A SHAPE: `POST /service-stack/{id}/backup`
|
|
504
|
+
* (`BackupServiceStack`), body `RequestPostServiceStackBackup`, response `ResponseServiceStackBackup`. It names no
|
|
505
|
+
* process. Verified live 2026-11-17: `async: false` answers a finished backup, listed at once; a user tag outside 1–24
|
|
506
|
+
* characters of `[A-Za-z0-9:_-]` is 400 `backupTagNameFormat`.
|
|
507
|
+
*/
|
|
508
|
+
createBackup(input: {
|
|
509
|
+
serviceId: string;
|
|
510
|
+
tags: string[];
|
|
511
|
+
signal: AbortSignal;
|
|
512
|
+
}): Promise<ZeropsBackupStart>;
|
|
513
|
+
/**
|
|
514
|
+
* The stored backups of a managed service. VERIFIED AS A SHAPE: the `files` of `GET /service-stack/{id}/backup`
|
|
515
|
+
* (`ListBackups`). UNVERIFIED: whether a backup still running (`async: true`) is listed before it completes.
|
|
516
|
+
*/
|
|
517
|
+
listBackups(input: {
|
|
518
|
+
serviceId: string;
|
|
519
|
+
signal: AbortSignal;
|
|
520
|
+
}): Promise<ZeropsBackupFile[]>;
|
|
485
521
|
/** One service by id. VERIFIED: `GET /service-stack/{id}`. */
|
|
486
522
|
getService(input: {
|
|
487
523
|
serviceId: string;
|
package/types/src/api.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export { ZEROPS_SERVICE_NOT_HTTP, ZeropsApiError } from './api/errors';
|
|
|
3
3
|
export { enableSubdomainAccessWhenHttp, waitForProcess } from './api/polling';
|
|
4
4
|
export { assertServiceEnvValueFits, ZEROPS_SERVICE_ENV_VALUE_MAX_BYTES, ZEROPS_SERVICE_ENV_VALUE_TOO_LARGE, ZeropsServiceEnvValueTooLargeError, } from './api/service-env-limit';
|
|
5
5
|
export { readableContent } from './api/service-env-response';
|
|
6
|
-
export { type FetchLike, ZEROPS_ACTIVE, ZEROPS_PROCESS_FINISHED, ZEROPS_PROCESS_TERMINAL, ZEROPS_TERMINAL, type ZeropsApi, type ZeropsApiOptions, type ZeropsAppVersion, type ZeropsAppVersionStatus, type ZeropsAppVersionUpload, type ZeropsBackupConfig, type ZeropsBackupRetentionPolicy, type ZeropsImportedService, type ZeropsImportResult, type ZeropsIntegrationToken, type ZeropsLogAccess, type ZeropsLogLine, type ZeropsProcess, type ZeropsProject, type ZeropsProjectMode, type ZeropsProjectStatus, type ZeropsRoleCode, type ZeropsService, type ZeropsServiceAutoscaling, type ZeropsServiceEnv, type ZeropsServiceEnvWrite, type ZeropsServiceStatus, type ZeropsTokenProjectGrant, type ZeropsUserInfo, } from './api/types';
|
|
6
|
+
export { type FetchLike, ZEROPS_ACTIVE, ZEROPS_PROCESS_FINISHED, ZEROPS_PROCESS_TERMINAL, ZEROPS_TERMINAL, type ZeropsApi, type ZeropsApiOptions, type ZeropsAppVersion, type ZeropsAppVersionStatus, type ZeropsAppVersionUpload, type ZeropsBackupConfig, type ZeropsBackupFile, type ZeropsBackupRetentionPolicy, type ZeropsBackupStart, type ZeropsImportedService, type ZeropsImportResult, type ZeropsIntegrationToken, type ZeropsLogAccess, type ZeropsLogLine, type ZeropsProcess, type ZeropsProject, type ZeropsProjectMode, type ZeropsProjectStatus, type ZeropsRoleCode, type ZeropsService, type ZeropsServiceAutoscaling, type ZeropsServiceEnv, type ZeropsServiceEnvWrite, type ZeropsServiceStatus, type ZeropsTokenProjectGrant, type ZeropsUserInfo, } from './api/types';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { FabrikaManifest } from './manifest';
|
|
2
|
+
/**
|
|
3
|
+
* The `lockfileVersion` of a `bun.lock`, or null when the text does not start with one. Bun writes it as the first
|
|
4
|
+
* key; the rest of the file is JSONC (trailing commas), which this never parses.
|
|
5
|
+
*/
|
|
6
|
+
export declare function bunLockfileVersion(text: string): number | null;
|
|
7
|
+
/** The build base of the manifest's selected setup, and whether the application named it or the platform's default applies. */
|
|
8
|
+
export interface ZeropsBuildBase {
|
|
9
|
+
readonly setup: string;
|
|
10
|
+
/** Each base the build image is made of; empty for an application without a contract, whose build is its own. */
|
|
11
|
+
readonly bases: readonly string[];
|
|
12
|
+
readonly authored: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The bases the platform build of a contract application runs on, read as `renderLockedSetup` reads them: the selected
|
|
16
|
+
* setup's `build.base`, or the platform's runtime when it names none. The platform does not generate the build of an
|
|
17
|
+
* application without a contract, so it has none here.
|
|
18
|
+
*/
|
|
19
|
+
export declare function zeropsBuildBase(manifest: FabrikaManifest): ZeropsBuildBase;
|
|
20
|
+
/**
|
|
21
|
+
* Why the build cannot install from a `bun.lock` of this text, or null when it can or when that cannot be known: a
|
|
22
|
+
* lockfile without a readable version, or a base that is not a Bun release with a numeric version (an alias such as
|
|
23
|
+
* `alpine/bun@latest`, or another runtime).
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildBaseLockfileRefusal(lockfile: string, build: ZeropsBuildBase): string | null;
|
|
26
|
+
/** Why the manifest's build cannot install from a `bun.lock` of this text, or null; what every compile runs. */
|
|
27
|
+
export declare const lockfileBuildBaseRefusal: (manifest: FabrikaManifest, lockfile: string) => string | null;
|
package/types/src/cli.d.ts
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import type { AppCli } from '@fabrika/provider-contract/app-cli';
|
|
3
|
+
import { type FabrikaManifest } from './manifest';
|
|
3
4
|
export declare const readZeropsSourceDescriptor: (root?: string) => Promise<import("./manifest").ZeropsArtifactSourceDescriptor>;
|
|
4
5
|
export interface ZeropsManifestBuildOptions {
|
|
5
6
|
/** App config path, resolved against the working directory like `--config`. */
|
|
6
7
|
readonly config: string;
|
|
7
8
|
readonly env: string;
|
|
8
9
|
}
|
|
9
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Refuse a build base whose Bun cannot read the repository-root `bun.lock`, which the platform build installs from with
|
|
12
|
+
* `--frozen-lockfile`. Without a `bun.lock` there is nothing to compare; Control refuses a commit without one. `command`
|
|
13
|
+
* names what ran, as the refusal's prefix.
|
|
14
|
+
*/
|
|
15
|
+
export declare const assertBuildBaseReadsLockfile: (manifest: FabrikaManifest, command: string, root?: string) => Promise<void>;
|
|
16
|
+
/** The exact text `build` writes to `fabrika.manifest.json`, produced in memory and written nowhere: what `app register` sends. */
|
|
10
17
|
export declare const buildZeropsManifestText: (options: ZeropsManifestBuildOptions) => Promise<string>;
|
|
11
18
|
export declare const runZeropsCli: (argv: readonly string[]) => Promise<void>;
|
|
12
19
|
/** What `fabrika app build`, `app register` and `fabrika namespace` run for an application on Zerops. */
|
|
@@ -3,6 +3,13 @@ import { type ExposureAlerter } from './exposure';
|
|
|
3
3
|
import type { ZeropsSourcePort } from './source/port';
|
|
4
4
|
import type { ZeropsRuntimeTarget } from './types';
|
|
5
5
|
export type Sleeper = (ms: number, signal: AbortSignal) => Promise<void>;
|
|
6
|
+
/** Elapsed time and the per-request timeouts measured on it. */
|
|
7
|
+
export interface ZeropsClock {
|
|
8
|
+
now(): number;
|
|
9
|
+
/** A signal that aborts `ms` from now. */
|
|
10
|
+
timeout(ms: number): AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
export declare const systemClock: ZeropsClock;
|
|
6
13
|
export declare const defaultSleep: Sleeper;
|
|
7
14
|
export interface ZeropsCollaborators {
|
|
8
15
|
api: ZeropsApi;
|
|
@@ -11,6 +18,8 @@ export interface ZeropsCollaborators {
|
|
|
11
18
|
/** Raises the Operations alert for a refused activation; best-effort. */
|
|
12
19
|
alertExposure: ExposureAlerter;
|
|
13
20
|
sleep: Sleeper;
|
|
21
|
+
/** The clock the database backup's wait runs on; the system clock when absent. */
|
|
22
|
+
clock?: ZeropsClock;
|
|
14
23
|
}
|
|
15
24
|
export type ZeropsCollaboratorFactory = (target: ZeropsRuntimeTarget) => ZeropsCollaborators;
|
|
16
25
|
export declare const defaultZeropsCollaborators: ZeropsCollaboratorFactory;
|
package/types/src/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { createZeropsApi, enableSubdomainAccessWhenHttp, readableContent, waitFo
|
|
|
2
2
|
export type { FetchLike, ZeropsApi, ZeropsApiOptions, ZeropsAppVersion, ZeropsAppVersionStatus, ZeropsAppVersionUpload, ZeropsBackupConfig, ZeropsBackupRetentionPolicy, ZeropsImportedService, ZeropsImportResult, ZeropsIntegrationToken, ZeropsLogAccess, ZeropsLogLine, ZeropsProcess, ZeropsProject, ZeropsProjectMode, ZeropsProjectStatus, ZeropsRoleCode, ZeropsService, ZeropsServiceAutoscaling, ZeropsServiceEnv, ZeropsServiceEnvWrite, ZeropsServiceStatus, ZeropsTokenProjectGrant, ZeropsUserInfo, } from './api';
|
|
3
3
|
export { defineApp, isZeropsAppConfig, useSharedPostgres, zeropsSharedServiceHostname, zeropsSharedServicePrefix } from './authoring';
|
|
4
4
|
export type { ZeropsAuthoredAppConfig } from './authoring';
|
|
5
|
+
export { lockfileBuildBaseRefusal } from './build-base';
|
|
5
6
|
export { parseZeropsCliArgs } from './cli-args';
|
|
6
7
|
export type { ZeropsCliArgs } from './cli-args';
|
|
7
8
|
export { defaultSleep, defaultZeropsCollaborators } from './collaborators';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type InstallationEmail, type InstallationSecrets, type PlatformHosts } from '@fabrika/installation-init';
|
|
1
|
+
import { type InstallationAuthentication, type InstallationEmail, type InstallationSecrets, type PlatformHosts } from '@fabrika/installation-init';
|
|
2
2
|
import type { ZeropsNamespaceProxySource } from '../index';
|
|
3
3
|
import type { PlatformDeployService, ResolvedService } from './deploy';
|
|
4
4
|
import { type InstallCollaborators } from './install-collaborators';
|
|
@@ -31,6 +31,8 @@ export interface InstallationEnvInput {
|
|
|
31
31
|
readonly zeropsAccessToken: string;
|
|
32
32
|
/** IAM sends its own mail with it, and Control hands it to applications whose job declares `mailer: 'installation'`. */
|
|
33
33
|
readonly email: InstallationEmail;
|
|
34
|
+
/** How people sign in; written on `iam`, the OIDC client secret sensitive. */
|
|
35
|
+
readonly authentication: InstallationAuthentication;
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* EVERY variable this command places, per service: fabrika's (`installationServiceEnvironment`) over this
|