@fabrika/provider-zerops 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,607 @@
1
+ // GENERATED FILE — DO NOT EDIT BY HAND.
2
+ //
3
+ // Source: Zerops' published JSON schema for `zerops-import.yaml`
4
+ // https://api.app-prg1.zerops.io/api/rest/public/settings/import-project-yml-json-schema.json
5
+ //
6
+ // Regenerate with `bun packages/provider-zerops/scripts/generate-zerops-types.ts`. This is a FAITHFUL
7
+ // transcription of the platform contract — it is deliberately NOT the app-authoring surface.
8
+ // What an app may actually declare is `./types.ts`, which subtracts the fields fabrika owns
9
+ // (see ADR-0004: `envIsolation` and project-level env are compiler-owned, never authorable).
10
+
11
+ /** Only one project can be defined. */
12
+ export interface ZeropsImportProject {
13
+ /** The name of the new project. Duplicates are allowed. */
14
+ name: string
15
+ /** Description of the new project. */
16
+ description?: string
17
+ /**
18
+ * Project core package.
19
+ * Zerops default: `"LIGHT"`.
20
+ */
21
+ corePackage?: 'LIGHT' | 'SERIOUS'
22
+ /** One or more string tags. Tags do not have functional meaning, they only provide better orientation in projects. */
23
+ tags?: string[]
24
+ /** List of environment variables of project configuration. */
25
+ envVariables?: Record<string, string>
26
+ /**
27
+ * Defines the visibility scope for environment variables. Allowed values: none (no isolation, everyone sees all
28
+ * variables), service (isolation at service level, each service can only see its own variables). Explicit variable
29
+ * referencing is still possible regardless of the isolation setting.
30
+ */
31
+ envIsolation?: string
32
+ /**
33
+ * Defines who is authorized to access the service via SSH. Values can be combined using spaces (e.g., project vpn). To
34
+ * exclude a specific access type, use a negative prefix (e.g., -vpn). Allowed values: project (anyone from the project),
35
+ * vpn (anyone from the VPN), service (anyone from the same service), service@name (anyone from the service named "name").
36
+ */
37
+ sshIsolation?: string
38
+ /**
39
+ * When enabled, project domain includes both AAAA records and an A record pointing to Zerops shared IPv4 address. When
40
+ * disabled, the A record is not defined. If the project has its own dedicated IPv4 address, the domain always contains an
41
+ * A record with this assigned IPv4 address.
42
+ */
43
+ sharedIpv4?: boolean
44
+ /** Defines project's primary/fallback location'. */
45
+ location?: 'eu-central' | 'us-east-1' | 'us-west-1'
46
+ }
47
+
48
+ export interface ZeropsImportService {
49
+ /**
50
+ * The unique service identifier. Limitations: duplicates in the same project forbidden; maximum 25 characters, lowercase
51
+ * ASCII letters (a-z) or numbers (0-9) only.
52
+ */
53
+ hostname: string
54
+ /** Specifies the service type and version. */
55
+ type: ZeropsServiceType
56
+ /**
57
+ * Deprecated, use Type version only. Defines the operation mode of the service.
58
+ * @deprecated
59
+ */
60
+ mode?: string
61
+ /**
62
+ * List of key-value pairs. Environment variables that are blurred by default in Zerops GUI. Can be edited or deleted in
63
+ * Zerops GUI.
64
+ */
65
+ envSecrets?: Record<string, string>
66
+ /**
67
+ * List of key-value pairs in .env format. Environment variables that are blurred by default in Zerops GUI. Can be edited
68
+ * or deleted in Zerops GUI.
69
+ */
70
+ dotEnvSecrets?: string
71
+ /** Insert full nginx config. */
72
+ nginxConfig?: string
73
+ /** Object storage size in GB. */
74
+ objectStorageSize?: number
75
+ /** Select a predefined AWS S3 bucket access policy. */
76
+ objectStoragePolicy?: 'custom' | 'private' | 'public-read' | 'public-objects-read' | 'public-write' | 'public-read-write'
77
+ /**
78
+ * Define your own AWS S3 bucket access policy. See AWS docs for details. Use {{ .BucketName }} placeholder if you need to
79
+ * use bucket name in your custom policy rules.
80
+ */
81
+ objectStorageRawPolicy?: string
82
+ /** A URL of a Github or Gitlab repository used for a one-time build of your service. */
83
+ buildFromGit?: string
84
+ /** Set true, if you want to start service without code. */
85
+ startWithoutCode?: boolean
86
+ /**
87
+ * Set true, if you want to enable a public access to your service via a Zerops subdomain. Not suitable for production.
88
+ * Zerops default: `false`.
89
+ */
90
+ enableSubdomainAccess?: boolean
91
+ /**
92
+ * Services are sorted before creation by priority in descending order, i.e. the higher the priority the sooner the service
93
+ * is created.
94
+ */
95
+ priority?: number
96
+ /** Vertical autoscaling settings. */
97
+ verticalAutoscaling?: ZeropsVerticalAutoscaling
98
+ /** Minimum number of containers of the service. */
99
+ minContainers?: number
100
+ /** Maximum number of containers of the service. */
101
+ maxContainers?: number
102
+ /** Defines the autoscaling profile for the service. */
103
+ profile?: string
104
+ /** Json formatted list of overrides for the selected autoscaling profile. */
105
+ profileOverrides?: unknown
106
+ /** Mount shared storages to the service, buildFromGit must be filled. */
107
+ mount?: string[]
108
+ /** Set true, if you want to enable CDN for the object storage bucket. Currently only relevant for object storage services. */
109
+ enableCdn?: boolean
110
+ /**
111
+ * Defines the visibility scope for environment variables. Allowed values: none (no isolation, everyone sees all
112
+ * variables), service (isolation at service level, each service can only see its own variables). Explicit variable
113
+ * referencing is still possible regardless of the isolation setting. When set at the service level, these values override
114
+ * any project-level defined isolation settings.
115
+ */
116
+ envIsolation?: string
117
+ /**
118
+ * Defines who is authorized to access the service via SSH. Values can be combined using spaces (e.g., project vpn). To
119
+ * exclude a specific access type, use a negative prefix (e.g., -vpn). Allowed values: project (anyone from the project),
120
+ * vpn (anyone from the VPN), service (anyone from the same service), service@name (anyone from the service named "name").
121
+ * When set at the service level, these values override any project-level defined isolation settings.
122
+ */
123
+ sshIsolation?: string
124
+ /**
125
+ * Deprecated, use Type version only. Optionally specifies the OS of the runtime service imported with
126
+ * 'startWithoutCode=true'.
127
+ * @deprecated
128
+ */
129
+ os?: string
130
+ zeropsSetup?: string
131
+ zeropsYaml?: ZeropsYaml
132
+ /** Override existing service. */
133
+ override?: boolean
134
+ }
135
+
136
+ /** Specifies the service type and version. */
137
+ export type ZeropsServiceType =
138
+ | 'alpine/bun@1'
139
+ | 'alpine/bun@1.2'
140
+ | 'alpine/bun@1.2.2'
141
+ | 'alpine/bun@1.3'
142
+ | 'alpine/bun@1.3.9'
143
+ | 'alpine/bun@canary'
144
+ | 'alpine/bun@latest'
145
+ | 'alpine/bun@nightly'
146
+ | 'alpine/docker@26'
147
+ | 'alpine/docker@26.1'
148
+ | 'alpine/docker@26.1.5'
149
+ | 'alpine/docker@latest'
150
+ | 'alpine/dotnet@10'
151
+ | 'alpine/dotnet@8'
152
+ | 'alpine/dotnet@9'
153
+ | 'alpine/dotnet@latest'
154
+ | 'alpine/elixir@1'
155
+ | 'alpine/elixir@1.16'
156
+ | 'alpine/elixir@1.16.3'
157
+ | 'alpine/elixir@latest'
158
+ | 'alpine/gleam@1'
159
+ | 'alpine/gleam@1.5'
160
+ | 'alpine/gleam@1.5.1'
161
+ | 'alpine/gleam@latest'
162
+ | 'alpine/go@1'
163
+ | 'alpine/go@1.22'
164
+ | 'alpine/go@latest'
165
+ | 'alpine/golang@1'
166
+ | 'alpine/golang@1.22'
167
+ | 'alpine/golang@latest'
168
+ | 'alpine/java@17'
169
+ | 'alpine/java@21'
170
+ | 'alpine/java@latest'
171
+ | 'alpine/nginx@1.22'
172
+ | 'alpine/nginx@latest'
173
+ | 'alpine/nodejs@20'
174
+ | 'alpine/nodejs@22'
175
+ | 'alpine/nodejs@24'
176
+ | 'alpine/nodejs@latest'
177
+ | 'alpine/php-apache@8.1'
178
+ | 'alpine/php-apache@8.1+2.4'
179
+ | 'alpine/php-apache@8.3'
180
+ | 'alpine/php-apache@8.3+2.4'
181
+ | 'alpine/php-apache@8.4'
182
+ | 'alpine/php-apache@8.4+2.4'
183
+ | 'alpine/php-apache@8.5'
184
+ | 'alpine/php-apache@8.5+2.4'
185
+ | 'alpine/php-apache@latest'
186
+ | 'alpine/php-nginx@8.3'
187
+ | 'alpine/php-nginx@8.3+1.22'
188
+ | 'alpine/php-nginx@8.4'
189
+ | 'alpine/php-nginx@8.4+1.22'
190
+ | 'alpine/php-nginx@8.5'
191
+ | 'alpine/php-nginx@8.5+1.28'
192
+ | 'alpine/php-nginx@latest'
193
+ | 'alpine/python@3.11'
194
+ | 'alpine/python@3.12'
195
+ | 'alpine/python@latest'
196
+ | 'alpine/ruby@3.3'
197
+ | 'alpine/ruby@3.4'
198
+ | 'alpine/ruby@4.0'
199
+ | 'alpine/ruby@latest'
200
+ | 'alpine/rust@1'
201
+ | 'alpine/rust@latest'
202
+ | 'alpine/rust@nightly'
203
+ | 'alpine/rust@stable'
204
+ | 'alpine/static'
205
+ | 'alpine/static@1.0'
206
+ | 'alpine/static@latest'
207
+ | 'alpine/zero@0.1'
208
+ | 'alpine/zero@latest'
209
+ | 'alpine/zero@nightly'
210
+ | 'alpine@3.21'
211
+ | 'alpine@3.22'
212
+ | 'alpine@3.23'
213
+ | 'alpine@3.24'
214
+ | 'alpine@latest'
215
+ | 'clickhouse:ha@25.3'
216
+ | 'clickhouse:single@25.3'
217
+ | 'elasticsearch:ha@8.16'
218
+ | 'elasticsearch:ha@9.2'
219
+ | 'elasticsearch:single@8.16'
220
+ | 'elasticsearch:single@9.2'
221
+ | 'kafka:ha@3.9'
222
+ | 'kafka:single@3.9'
223
+ | 'mariadb:ha@10.6'
224
+ | 'mariadb:single@10.6'
225
+ | 'meilisearch:single@1.10'
226
+ | 'meilisearch:single@1.20'
227
+ | 'meilisearch:single@1.44'
228
+ | 'nats:ha@2.10'
229
+ | 'nats:ha@2.12'
230
+ | 'nats:single@2.10'
231
+ | 'nats:single@2.12'
232
+ | 'object-storage'
233
+ | 'objectstorage'
234
+ | 'postgresql:ha@14'
235
+ | 'postgresql:ha@16'
236
+ | 'postgresql:ha@17'
237
+ | 'postgresql:ha@18'
238
+ | 'postgresql:single@14'
239
+ | 'postgresql:single@16'
240
+ | 'postgresql:single@17'
241
+ | 'postgresql:single@18'
242
+ | 'qdrant:ha@1.10'
243
+ | 'qdrant:ha@1.12'
244
+ | 'qdrant:single@1.10'
245
+ | 'qdrant:single@1.12'
246
+ | 'seaweedfs:ha@3'
247
+ | 'seaweedfs:single@3'
248
+ | 'shared-storage:ha'
249
+ | 'shared-storage:single'
250
+ | 'sharedstorage:ha'
251
+ | 'sharedstorage:single'
252
+ | 'static'
253
+ | 'typesense:ha@27.1'
254
+ | 'typesense:ha@30.2'
255
+ | 'typesense:single@27.1'
256
+ | 'typesense:single@30.2'
257
+ | 'ubuntu/bun@1'
258
+ | 'ubuntu/bun@1.1'
259
+ | 'ubuntu/bun@1.1.34'
260
+ | 'ubuntu/bun@1.2'
261
+ | 'ubuntu/bun@1.2.2'
262
+ | 'ubuntu/bun@1.3'
263
+ | 'ubuntu/bun@1.3.9'
264
+ | 'ubuntu/bun@canary'
265
+ | 'ubuntu/bun@latest'
266
+ | 'ubuntu/bun@nightly'
267
+ | 'ubuntu/deno@2'
268
+ | 'ubuntu/deno@2.0'
269
+ | 'ubuntu/deno@2.0.0'
270
+ | 'ubuntu/deno@latest'
271
+ | 'ubuntu/dotnet@10'
272
+ | 'ubuntu/dotnet@8'
273
+ | 'ubuntu/dotnet@9'
274
+ | 'ubuntu/dotnet@latest'
275
+ | 'ubuntu/elixir@1'
276
+ | 'ubuntu/elixir@1.16'
277
+ | 'ubuntu/elixir@1.16.2'
278
+ | 'ubuntu/elixir@latest'
279
+ | 'ubuntu/gleam@1'
280
+ | 'ubuntu/gleam@1.5'
281
+ | 'ubuntu/gleam@1.5.1'
282
+ | 'ubuntu/gleam@latest'
283
+ | 'ubuntu/go@1'
284
+ | 'ubuntu/go@1.22'
285
+ | 'ubuntu/go@latest'
286
+ | 'ubuntu/golang@1'
287
+ | 'ubuntu/golang@1.22'
288
+ | 'ubuntu/golang@latest'
289
+ | 'ubuntu/java@17'
290
+ | 'ubuntu/java@21'
291
+ | 'ubuntu/java@latest'
292
+ | 'ubuntu/nginx@1.22'
293
+ | 'ubuntu/nginx@latest'
294
+ | 'ubuntu/nodejs@20'
295
+ | 'ubuntu/nodejs@22'
296
+ | 'ubuntu/nodejs@24'
297
+ | 'ubuntu/nodejs@latest'
298
+ | 'ubuntu/php-apache@8.1'
299
+ | 'ubuntu/php-apache@8.1+2.4'
300
+ | 'ubuntu/php-apache@8.3'
301
+ | 'ubuntu/php-apache@8.3+2.4'
302
+ | 'ubuntu/php-apache@8.4'
303
+ | 'ubuntu/php-apache@8.4+2.4'
304
+ | 'ubuntu/php-apache@8.5'
305
+ | 'ubuntu/php-apache@8.5+2.4'
306
+ | 'ubuntu/php-apache@latest'
307
+ | 'ubuntu/php-nginx@8.3'
308
+ | 'ubuntu/php-nginx@8.3+1.22'
309
+ | 'ubuntu/php-nginx@8.4'
310
+ | 'ubuntu/php-nginx@8.4+1.22'
311
+ | 'ubuntu/php-nginx@8.5'
312
+ | 'ubuntu/php-nginx@8.5+1.28'
313
+ | 'ubuntu/php-nginx@latest'
314
+ | 'ubuntu/python@3.11'
315
+ | 'ubuntu/python@3.12'
316
+ | 'ubuntu/python@3.14'
317
+ | 'ubuntu/python@latest'
318
+ | 'ubuntu/ruby@3.3'
319
+ | 'ubuntu/ruby@3.4'
320
+ | 'ubuntu/ruby@4.0'
321
+ | 'ubuntu/ruby@latest'
322
+ | 'ubuntu/rust@1'
323
+ | 'ubuntu/rust@latest'
324
+ | 'ubuntu/rust@nightly'
325
+ | 'ubuntu/rust@stable'
326
+ | 'ubuntu/static'
327
+ | 'ubuntu/static@1.0'
328
+ | 'ubuntu/static@latest'
329
+ | 'ubuntu/zero@0.1'
330
+ | 'ubuntu/zero@latest'
331
+ | 'ubuntu/zero@nightly'
332
+ | 'ubuntu@22.04'
333
+ | 'ubuntu@24.04'
334
+ | 'ubuntu@26.04'
335
+ | 'ubuntu@latest'
336
+ | 'valkey:ha@7.2'
337
+ | 'valkey:single@7.2'
338
+ | 'zcp@1'
339
+ | 'zcp@latest'
340
+
341
+ /** Vertical autoscaling settings. */
342
+ export interface ZeropsVerticalAutoscaling {
343
+ /** Fixed CPU thread count that each container of the service will be set to. */
344
+ cpu?: number
345
+ /** Fixed RAM in GB that each container of the service will be set to. */
346
+ ram?: number
347
+ /** Fixed disk space in GB that each container of the service will be set to. */
348
+ disk?: number
349
+ /** CPU mode that each container of the service will be set to. */
350
+ cpuMode?: 'DEDICATED' | 'SHARED'
351
+ /** Minimum CPU thread count that each container of the service can scale down to. */
352
+ minCpu?: number
353
+ /** Maximum CPU thread count that each container of the service can scale up to. */
354
+ maxCpu?: number
355
+ /** Minimum RAM in GB that each container of the service can scale down to. */
356
+ minRam?: number
357
+ /** Maximum RAM in GB that each container of the service can scale up to. */
358
+ maxRam?: number
359
+ /** Minimum disk space in GB that each container of the service can scale down to. */
360
+ minDisk?: number
361
+ /** Maximum disk space in GB that each container of the service can scale up to. */
362
+ maxDisk?: number
363
+ /** Number of CPU cores with which each container starts. */
364
+ startCpuCoreCount?: number
365
+ /** Whether to enable swap memory for containers. Swap is enabled by default. Refer to documentation for more details. */
366
+ swapEnabled?: boolean
367
+ /** Minimum number of unused CPU cores before a container starts scaling. */
368
+ minFreeCpuCores?: number
369
+ /** Minimum percentage of unused CPU cores before a container starts scaling. */
370
+ minFreeCpuPercent?: number
371
+ /** Minimum unused memory in GB before a container starts scaling. */
372
+ minFreeRamGB?: number
373
+ /** Minimum percentage of unused memory before a container starts scaling. */
374
+ minFreeRamPercent?: number
375
+ /** @deprecated */
376
+ minVCpu?: number
377
+ /** @deprecated */
378
+ maxVCpu?: number
379
+ }
380
+
381
+ export interface ZeropsYaml {
382
+ /** The top-level element is always zerops. */
383
+ zerops: ZeropsYamlSetup[]
384
+ }
385
+
386
+ export interface ZeropsYamlSetup {
387
+ /**
388
+ * The first element setup contains the hostname of your service. A runtime service with the same hostname must exist in
389
+ * Zerops. Zerops supports the definition of multiple runtime services in a single zerops.yml. This is useful when you use
390
+ * a monorepo. Just add multiple setup elements in your zerops.yml.
391
+ */
392
+ setup: string
393
+ /** Build pipeline configuration. */
394
+ build?: ZeropsYamlBuild
395
+ /** Deploy configuration. */
396
+ deploy?: ZeropsYamlDeploy
397
+ /** Runtime configuration. */
398
+ run?: ZeropsYamlRun
399
+ }
400
+
401
+ /** Build pipeline configuration. */
402
+ export interface ZeropsYamlBuild {
403
+ /** Deprecated - use base attribute. Sets the operating system for the build environment. */
404
+ os?: string
405
+ /** Sets the base technology for the build environment. */
406
+ base?: string[]
407
+ /** Customises the build environment by installing additional dependencies or tools to the base build environment. */
408
+ prepareCommands?: string[]
409
+ /** Defines build commands. Zerops triggers each command in the defined order in a dedicated build container. */
410
+ buildCommands?: string[]
411
+ deploy?: string[]
412
+ /**
413
+ * Selects which files or folders will be deployed after the build has successfully finished. To filter out specific files
414
+ * or folders, use .deployignore file.
415
+ */
416
+ deployFiles: string[]
417
+ /** Defines which files or folders will be cached for the next build. */
418
+ cache?: unknown
419
+ /**
420
+ * Defines what files or folders will be copied from the build container to the prepare runtime container. The prepare
421
+ * runtime container is used to customize your runtime environment.
422
+ */
423
+ addToRunPrepare?: string[]
424
+ /** Defines the environment variables for the build environment. */
425
+ envVariables?: Record<string, string>
426
+ }
427
+
428
+ /** Deploy configuration. */
429
+ export interface ZeropsYamlDeploy {
430
+ /** Defines a readiness check. Requires either httpGet object or exec object. */
431
+ readinessCheck?: ZeropsReadinessCheck
432
+ temporaryShutdown?: boolean
433
+ }
434
+
435
+ /** Defines a readiness check. Requires either httpGet object or exec object. */
436
+ export interface ZeropsReadinessCheck {
437
+ /** Configures the readiness check to request a local URL using a http GET method. */
438
+ httpGet?: ZeropsHttpGetProbe
439
+ /** Configures the readiness check to run a local command. */
440
+ exec?: ZeropsExecProbe
441
+ /** Time until container is marked as failed. */
442
+ failureTimeout?: number
443
+ /** Time interval between readiness check attempts. */
444
+ retryPeriod?: number
445
+ }
446
+
447
+ /** Configures the readiness check to request a local URL using a http GET method. */
448
+ export interface ZeropsHttpGetProbe {
449
+ /**
450
+ * The readiness check is triggered from inside of your runtime container so no https is required. If your application
451
+ * requires a https request, set scheme: https
452
+ */
453
+ scheme?: string
454
+ /**
455
+ * The readiness check is triggered from inside of your runtime container so it always uses the localhost (127.0.0.1). If
456
+ * you need to add a host to the request header, specify it in the host attribute.
457
+ */
458
+ host?: string
459
+ /** Defines the port of the HTTP GET request. */
460
+ port: number
461
+ /** Defines the URL path of the HTTP GET request. */
462
+ path: string
463
+ }
464
+
465
+ /** Configures the readiness check to run a local command. */
466
+ export interface ZeropsExecProbe {
467
+ /**
468
+ * Defines a local command to be run. The command has access to the same environment variables. A single string is
469
+ * required. If you need to run multiple commands create a shell script or, use a multiline format as in the example below.
470
+ */
471
+ command: string
472
+ }
473
+
474
+ /** Runtime configuration. */
475
+ export interface ZeropsYamlRun {
476
+ /** Defines one or more commands to be run each time a new runtime container is started or a container is restarted. */
477
+ initCommands?: string[]
478
+ /** Customises the runtime environment by installing additional dependencies or tools to the base runtime environment. */
479
+ prepareCommands?: string[]
480
+ /** Deprecated - use base attribute. Sets the operating system for the runtime environment. */
481
+ os?: string
482
+ /**
483
+ * Sets the base technology for the runtime environment. If you don't specify the run.base attribute, Zerops keeps the
484
+ * current version for your runtime.
485
+ */
486
+ base?: string
487
+ /** Defines the start command for your application. */
488
+ start?: string
489
+ /**
490
+ * Customizes the folder that will be used as the root of the publicly accessible web server content. This attribute is
491
+ * available only for runtimes with webservers.
492
+ */
493
+ documentRoot?: string
494
+ /** Sets the custom webserver configuration. This attribute is available only for runtimes with webservers. */
495
+ siteConfigPath?: string
496
+ envReplace?: ZeropsEnvReplace
497
+ /** Defines a health check. */
498
+ healthCheck?: ZeropsHealthCheck
499
+ routing?: ZeropsRouting
500
+ /** Specifies one or more internal ports on which your application will listen. */
501
+ ports?: ZeropsPort[]
502
+ /** Defines the environment variables for the runtime environment. */
503
+ envVariables?: Record<string, string>
504
+ /** Defines the start commands for the runtime environment. */
505
+ startCommands?: ZeropsStartCommand[]
506
+ /**
507
+ * A list of cron jobs with their respective schedule (timing), the command to run (command), and additional options like
508
+ * allContainers and workingDir.
509
+ */
510
+ crontab?: ZeropsCrontabEntry[]
511
+ }
512
+
513
+ export interface ZeropsEnvReplace {
514
+ target: string[]
515
+ delimiter: string[]
516
+ }
517
+
518
+ /** Defines a health check. */
519
+ export interface ZeropsHealthCheck {
520
+ /** Configures the health check to request a local URL using a http GET method. */
521
+ httpGet?: ZeropsHttpGetProbe
522
+ /** Configures the health check to run a local command. */
523
+ exec?: ZeropsExecProbe
524
+ /** Time until container fails after consecutive health check failures (reset by success). */
525
+ failureTimeout?: number
526
+ /** Time until container is disconnected and becomes publicly unavailable. */
527
+ disconnectTimeout?: number
528
+ /** Time until container is connected and becomes publicly available. */
529
+ recoveryTimeout?: number
530
+ /** Time interval between health check attempts. */
531
+ execPeriod?: number
532
+ }
533
+
534
+ export interface ZeropsRouting {
535
+ root?: string
536
+ /**
537
+ * Content of default Access-Control headers (Allow-Origin, Allow-Methods, Allow-Headers and Expose-Headers), e.g. "'*'
538
+ * always"
539
+ */
540
+ cors?: string
541
+ redirects?: ZeropsRoutingRedirect[]
542
+ headers?: ZeropsRoutingHeader[]
543
+ }
544
+
545
+ export interface ZeropsRoutingRedirect {
546
+ /**
547
+ * Relative or an absolute (defined by with http://) path to be matched against request location. May contain * at the end
548
+ * for regex.
549
+ */
550
+ from: string
551
+ /** Relative or an absolute (defined by with http://) path to redirect user to. */
552
+ to: string
553
+ /**
554
+ * Which HTTP status code to use for the redirect. If not set, and To and From are relative, an internal/masked redirect
555
+ * will be used.
556
+ */
557
+ status?: number
558
+ /**
559
+ * Whether part of the path after From should be preserved. Used to forward contents of one directory to another in
560
+ * non-masked redirects.
561
+ */
562
+ preservePath?: boolean
563
+ /** Whether query parameters should be preserved. Used in non-masked redirects. */
564
+ preserveQuery?: boolean
565
+ }
566
+
567
+ export interface ZeropsRoutingHeader {
568
+ /** Relative path to be matched against request location. May contain * at the end for prefix-based match. */
569
+ for: string
570
+ /** Header name as Key and raw content as Value, e.g. "Access-Control-Allow-Origin": "'*' always" */
571
+ values: Record<string, string>
572
+ }
573
+
574
+ export interface ZeropsPort {
575
+ /** Defines the protocol. Allowed values are TCP or UDP. Default value is TCP. */
576
+ protocol?: string
577
+ /**
578
+ * Defines the port number. You can set any port number between 10 and 65435. Ports outside this interval are reserved for
579
+ * internal Zerops systems.
580
+ */
581
+ port: number
582
+ description?: string
583
+ /**
584
+ * Set to true if a web server is running on the port. Zerops uses this information for the configuration of public access.
585
+ * True is available only in combination with the TCP protocol. Default value is false.
586
+ */
587
+ httpSupport?: boolean
588
+ }
589
+
590
+ export interface ZeropsStartCommand {
591
+ name?: string
592
+ command: string
593
+ workingDir?: string
594
+ /** Defines one or more commands to be run each time a new runtime container is started or a container is restarted. */
595
+ initCommands?: string[]
596
+ }
597
+
598
+ export interface ZeropsCrontabEntry {
599
+ /** Defines when the cron job runs in standard cron format. */
600
+ timing: string
601
+ /** Specifies the shell command to run at the scheduled time. */
602
+ command: string
603
+ /** The directory where the command will be executed (default: /var/www) */
604
+ workingDir?: string
605
+ /** If set to true, the job runs on all containers; otherwise, it runs on a single container (default: false) */
606
+ allContainers: boolean
607
+ }
@@ -0,0 +1,38 @@
1
+ import { ZEROPS_SERVICE_HOSTNAME_PATTERN } from './manifest'
2
+
3
+ const SHARED_PREFIX_MAX_LENGTH = 12
4
+ const LOCAL_SERVICE_PATTERN = /^[a-z0-9]+$/
5
+
6
+ const fnv1a = (value: string): number => {
7
+ let hash = 0x811c9dc5
8
+ for (let index = 0; index < value.length; index += 1) {
9
+ hash ^= value.charCodeAt(index)
10
+ hash = Math.imul(hash, 0x01000193)
11
+ }
12
+ return hash >>> 0
13
+ }
14
+
15
+ /** Deterministic app prefix for services placed in a shared Zerops namespace. */
16
+ export const zeropsSharedServicePrefix = (appId: string): string => {
17
+ if (/^[a-z0-9]{1,12}$/.test(appId)) {
18
+ return appId
19
+ }
20
+ const normalized = appId.toLowerCase().replaceAll(/[^a-z0-9]/g, '')
21
+ if (normalized === '') {
22
+ throw new Error('Zerops shared service prefix requires an app id containing a letter or number')
23
+ }
24
+ const hash = fnv1a(appId).toString(36).padStart(7, '0')
25
+ return `${normalized.slice(0, 5)}${hash}`.slice(0, SHARED_PREFIX_MAX_LENGTH)
26
+ }
27
+
28
+ /** Build one app-owned service hostname for a shared namespace. */
29
+ export const zeropsSharedServiceHostname = (appId: string, localService: string): string => {
30
+ if (!LOCAL_SERVICE_PATTERN.test(localService)) {
31
+ throw new Error('Zerops local service name must contain lowercase letters and numbers only')
32
+ }
33
+ const hostname = `${zeropsSharedServicePrefix(appId)}${localService}`
34
+ if (!ZEROPS_SERVICE_HOSTNAME_PATTERN.test(hostname)) {
35
+ throw new Error(`Zerops shared service hostname \`${hostname}\` exceeds the 25-character platform limit`)
36
+ }
37
+ return hostname
38
+ }