@vibesdotdev/infra-doks 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.
- package/README.md +107 -0
- package/SPEC.md +285 -0
- package/dist/client/digitalocean-app-deploy.client.d.ts +46 -0
- package/dist/client/digitalocean-app-deploy.client.d.ts.map +1 -0
- package/dist/client/digitalocean-app-deploy.client.js +135 -0
- package/dist/client/digitalocean-app-deploy.client.js.map +1 -0
- package/dist/client/index.d.ts +15 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +18 -0
- package/dist/client/index.js.map +1 -0
- package/dist/cloud/base.d.ts +33 -0
- package/dist/cloud/base.d.ts.map +1 -0
- package/dist/cloud/base.js +86 -0
- package/dist/cloud/base.js.map +1 -0
- package/dist/cloud/digitalocean.d.ts +33 -0
- package/dist/cloud/digitalocean.d.ts.map +1 -0
- package/dist/cloud/digitalocean.js +258 -0
- package/dist/cloud/digitalocean.js.map +1 -0
- package/dist/cloud/factory.d.ts +28 -0
- package/dist/cloud/factory.d.ts.map +1 -0
- package/dist/cloud/factory.js +151 -0
- package/dist/cloud/factory.js.map +1 -0
- package/dist/cloud/index.d.ts +12 -0
- package/dist/cloud/index.d.ts.map +1 -0
- package/dist/cloud/index.js +11 -0
- package/dist/cloud/index.js.map +1 -0
- package/dist/doks.plugin.d.ts +41 -0
- package/dist/doks.plugin.d.ts.map +1 -0
- package/dist/doks.plugin.js +287 -0
- package/dist/doks.plugin.js.map +1 -0
- package/dist/implementations/deployment.impl.d.ts +34 -0
- package/dist/implementations/deployment.impl.d.ts.map +1 -0
- package/dist/implementations/deployment.impl.js +86 -0
- package/dist/implementations/deployment.impl.js.map +1 -0
- package/dist/implementations/droplet.impl.d.ts +85 -0
- package/dist/implementations/droplet.impl.d.ts.map +1 -0
- package/dist/implementations/droplet.impl.js +113 -0
- package/dist/implementations/droplet.impl.js.map +1 -0
- package/dist/implementations/gitea.impl.d.ts +68 -0
- package/dist/implementations/gitea.impl.d.ts.map +1 -0
- package/dist/implementations/gitea.impl.js +295 -0
- package/dist/implementations/gitea.impl.js.map +1 -0
- package/dist/implementations/managed-db.impl.d.ts +25 -0
- package/dist/implementations/managed-db.impl.d.ts.map +1 -0
- package/dist/implementations/managed-db.impl.js +31 -0
- package/dist/implementations/managed-db.impl.js.map +1 -0
- package/dist/implementations/managed-redis.impl.d.ts +37 -0
- package/dist/implementations/managed-redis.impl.d.ts.map +1 -0
- package/dist/implementations/managed-redis.impl.js +40 -0
- package/dist/implementations/managed-redis.impl.js.map +1 -0
- package/dist/implementations/spaces.impl.d.ts +36 -0
- package/dist/implementations/spaces.impl.d.ts.map +1 -0
- package/dist/implementations/spaces.impl.js +40 -0
- package/dist/implementations/spaces.impl.js.map +1 -0
- package/dist/implementations/statefulset.impl.d.ts +65 -0
- package/dist/implementations/statefulset.impl.d.ts.map +1 -0
- package/dist/implementations/statefulset.impl.js +165 -0
- package/dist/implementations/statefulset.impl.js.map +1 -0
- package/dist/implementations/verdaccio.impl.d.ts +65 -0
- package/dist/implementations/verdaccio.impl.d.ts.map +1 -0
- package/dist/implementations/verdaccio.impl.js +259 -0
- package/dist/implementations/verdaccio.impl.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/kubernetes/index.d.ts +95 -0
- package/dist/kubernetes/index.d.ts.map +1 -0
- package/dist/kubernetes/index.js +625 -0
- package/dist/kubernetes/index.js.map +1 -0
- package/dist/secrets/index.d.ts +4 -0
- package/dist/secrets/index.d.ts.map +1 -0
- package/dist/secrets/index.js +4 -0
- package/dist/secrets/index.js.map +1 -0
- package/dist/secrets/vault.descriptor.d.ts +10 -0
- package/dist/secrets/vault.descriptor.d.ts.map +1 -0
- package/dist/secrets/vault.descriptor.js +25 -0
- package/dist/secrets/vault.descriptor.js.map +1 -0
- package/dist/secrets/vault.impl.cloud.d.ts +40 -0
- package/dist/secrets/vault.impl.cloud.d.ts.map +1 -0
- package/dist/secrets/vault.impl.cloud.js +178 -0
- package/dist/secrets/vault.impl.cloud.js.map +1 -0
- package/dist/secrets/vault.impl.d.ts +29 -0
- package/dist/secrets/vault.impl.d.ts.map +1 -0
- package/dist/secrets/vault.impl.js +137 -0
- package/dist/secrets/vault.impl.js.map +1 -0
- package/dist/types.d.ts +509 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +47 -0
- package/dist/types.js.map +1 -0
- package/package.json +145 -0
- package/src/client/digitalocean-app-deploy.client.ts +226 -0
- package/src/client/index.ts +24 -0
- package/src/cloud/base.ts +149 -0
- package/src/cloud/digitalocean.ts +363 -0
- package/src/cloud/factory.ts +190 -0
- package/src/cloud/index.ts +81 -0
- package/src/doks.plugin.ts +401 -0
- package/src/implementations/deployment.impl.ts +93 -0
- package/src/implementations/droplet.impl.ts +157 -0
- package/src/implementations/gitea.impl.ts +319 -0
- package/src/implementations/managed-db.impl.ts +37 -0
- package/src/implementations/managed-redis.impl.ts +49 -0
- package/src/implementations/spaces.impl.ts +52 -0
- package/src/implementations/statefulset.impl.ts +186 -0
- package/src/implementations/verdaccio.impl.ts +300 -0
- package/src/index.ts +136 -0
- package/src/kubernetes/index.ts +754 -0
- package/src/secrets/index.ts +9 -0
- package/src/secrets/vault.descriptor.ts +28 -0
- package/src/secrets/vault.impl.cloud.ts +278 -0
- package/src/secrets/vault.impl.ts +149 -0
- package/src/types.ts +563 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implementation: infra/sandbox → digitalocean-droplet
|
|
3
|
+
*
|
|
4
|
+
* Wires the existing `DigitalOceanProvider` (./cloud/digitalocean.ts) into
|
|
5
|
+
* the runtime kind resolution path. The resolved impl exposes a
|
|
6
|
+
* `provision(descriptor)` method that creates a DigitalOcean droplet via
|
|
7
|
+
* the v2 API, waits for `status: 'active'`, and returns the platform-side
|
|
8
|
+
* `SandboxProvisionResult` shape that
|
|
9
|
+
* `apps/platform-web/src/lib/hosts/server/queries/host-provision.ts`
|
|
10
|
+
* consumes.
|
|
11
|
+
*
|
|
12
|
+
* The DO API token resolves in this order:
|
|
13
|
+
* 1. `descriptor.config.apiToken` (explicit override; tests use this).
|
|
14
|
+
* 2. `process.env.DIGITALOCEAN_API_TOKEN` (the existing dev fallback,
|
|
15
|
+
* matching the `DigitalOceanAppDeployClient` in `./client/`).
|
|
16
|
+
* 3. `packages/secrets` `cloud-credentials.digitalocean.token` —
|
|
17
|
+
* brokerage path, currently DEFERRED to the migration debt entry
|
|
18
|
+
* in `infra-deploy/SPEC.md`. When that lands, this impl resolves
|
|
19
|
+
* the same secret per actor scope.
|
|
20
|
+
*/
|
|
21
|
+
import * as z from 'zod/v4';
|
|
22
|
+
import { DigitalOceanDropletSandboxConfigSchema } from '@vibesdotdev/infra-core/kinds';
|
|
23
|
+
import { DigitalOceanProvider } from "../cloud/digitalocean.js";
|
|
24
|
+
export const DoDropletConfigSchema = DigitalOceanDropletSandboxConfigSchema.extend({
|
|
25
|
+
adapter: z.literal('digitalocean-droplet'),
|
|
26
|
+
region: z.string().default('nyc3'),
|
|
27
|
+
image: z.string().default('ubuntu-24-04-x64'),
|
|
28
|
+
tags: z.array(z.string()).default([]),
|
|
29
|
+
sshKeyIds: z.array(z.string()).default([]),
|
|
30
|
+
apiToken: z.string().optional()
|
|
31
|
+
});
|
|
32
|
+
export const DoDropletDescriptorSchema = z.object({
|
|
33
|
+
kind: z.literal('infra/sandbox'),
|
|
34
|
+
id: z.string().min(1),
|
|
35
|
+
name: z.string().optional(),
|
|
36
|
+
description: z.string().optional(),
|
|
37
|
+
config: DoDropletConfigSchema,
|
|
38
|
+
cloudInitScript: z.string().optional()
|
|
39
|
+
});
|
|
40
|
+
function resolveApiToken(config) {
|
|
41
|
+
if (config.apiToken)
|
|
42
|
+
return config.apiToken;
|
|
43
|
+
const envToken = (typeof process !== 'undefined' && process.env?.DIGITALOCEAN_API_TOKEN) || '';
|
|
44
|
+
if (envToken)
|
|
45
|
+
return envToken;
|
|
46
|
+
throw new Error('digitalocean-droplet provision failed: no API token. Pass config.apiToken or set DIGITALOCEAN_API_TOKEN.');
|
|
47
|
+
}
|
|
48
|
+
function tagsArrayToRecord(tags) {
|
|
49
|
+
const record = {};
|
|
50
|
+
for (const tag of tags)
|
|
51
|
+
record[tag] = '';
|
|
52
|
+
return record;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* `DoDropletSandbox` is a singleton-friendly impl: a single instance is
|
|
56
|
+
* registered per worker and serves every `provision(descriptor)` call.
|
|
57
|
+
* Per-call descriptors carry their own API token + region, so multi-tenant
|
|
58
|
+
* use is safe — the impl holds no per-tenant state.
|
|
59
|
+
*
|
|
60
|
+
* For unit tests, pass `providerFactory` to swap in a mock
|
|
61
|
+
* `DigitalOceanProvider`.
|
|
62
|
+
*/
|
|
63
|
+
export class DoDropletSandbox {
|
|
64
|
+
providerFactory;
|
|
65
|
+
constructor(providerFactory = (token, region) => new DigitalOceanProvider(token, region)) {
|
|
66
|
+
this.providerFactory = providerFactory;
|
|
67
|
+
}
|
|
68
|
+
async provision(descriptorInput) {
|
|
69
|
+
const descriptor = DoDropletDescriptorSchema.parse(descriptorInput);
|
|
70
|
+
const cfg = descriptor.config;
|
|
71
|
+
const provider = this.providerFactory(resolveApiToken(cfg), cfg.region);
|
|
72
|
+
const resourceTag = `vibes:resourceId=${descriptor.id}`;
|
|
73
|
+
// Idempotency: list existing droplets carrying our resource tag.
|
|
74
|
+
// Returning early prevents double-create on retry / restart while
|
|
75
|
+
// the upstream DB row still tracks the provisioning intent (per
|
|
76
|
+
// SPEC §Hard rule "Droplet creation is idempotent against the
|
|
77
|
+
// descriptor id").
|
|
78
|
+
const existing = await provider.listInstances({ tags: { vibes: resourceTag.replace('vibes:', '') } });
|
|
79
|
+
if (existing.length > 0) {
|
|
80
|
+
const instance = existing[0];
|
|
81
|
+
return {
|
|
82
|
+
instanceId: instance.id,
|
|
83
|
+
publicIp: instance.publicIp,
|
|
84
|
+
privateIp: instance.privateIp,
|
|
85
|
+
region: instance.region,
|
|
86
|
+
createdAt: instance.createdAt
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// Inject the resource tag onto user-supplied tags. Duplicates are
|
|
90
|
+
// harmless — Record dedupes by key.
|
|
91
|
+
const tags = tagsArrayToRecord([...cfg.tags, resourceTag]);
|
|
92
|
+
const instance = await provider.createInstance({
|
|
93
|
+
name: descriptor.name ?? `vibes-${descriptor.id}`,
|
|
94
|
+
type: cfg.dropletSize,
|
|
95
|
+
region: cfg.region,
|
|
96
|
+
image: cfg.image,
|
|
97
|
+
sshKeys: cfg.sshKeyIds,
|
|
98
|
+
userData: descriptor.cloudInitScript,
|
|
99
|
+
tags
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
instanceId: instance.id,
|
|
103
|
+
publicIp: instance.publicIp,
|
|
104
|
+
privateIp: instance.privateIp,
|
|
105
|
+
region: instance.region,
|
|
106
|
+
createdAt: instance.createdAt
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export function createDoDropletImpl(providerFactory) {
|
|
111
|
+
return new DoDropletSandbox(providerFactory);
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=droplet.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"droplet.impl.js","sourceRoot":"","sources":["../../src/implementations/droplet.impl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,sCAAsC,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,MAAM,CAAC,MAAM,qBAAqB,GAAG,sCAAsC,CAAC,MAAM,CAAC;IAClF,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAC1C,MAAM,EAA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S;aAC7B,CAAC;QACH,CAAC;QAED,kEAAkE;QAClE,oCAAoC;QACpC,MAAM,IAAI,GAAG,iBAAiB,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,cAAc,CAAC;YAC9C,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,SAAS,UAAU,CAAC,EAAE,EAAE;YACjD,IAAI,EAAE,GAAG,CAAC,WAAW;YACrB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,OAAO,EAAE,GAAG,CAAC,SAAS;YACtB,QAAQ,EAAE,UAAU,CAAC,eAAe;YACpC,IAAI;SACJ,CAAC,CAAC;QACH,OAAO;YACN,UAAU,EAAE,QAAQ,CAAC,EAAE;YACvB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,SAAS,EAAE,QAAQ,CAAC,SAAS;SAC7B,CAAC;IACH,CAAC;CACD;AAED,MAAM,UAAU,mBAAmB,CAClC,eAAiC;IAEjC,OAAO,IAAI,gBAAgB,CAAC,eAAe,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import type { K8sDeployment, K8sService } from '../types.ts';
|
|
3
|
+
export declare const GiteaDoksDescriptorSchema: z.ZodObject<{
|
|
4
|
+
kind: z.ZodLiteral<"infra/git-hosting">;
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
name: z.ZodOptional<z.ZodString>;
|
|
7
|
+
description: z.ZodOptional<z.ZodString>;
|
|
8
|
+
url: z.ZodString;
|
|
9
|
+
hostname: z.ZodString;
|
|
10
|
+
type: z.ZodEnum<{
|
|
11
|
+
gitea: "gitea";
|
|
12
|
+
forgejo: "forgejo";
|
|
13
|
+
}>;
|
|
14
|
+
storagePath: z.ZodDefault<z.ZodString>;
|
|
15
|
+
authMethod: z.ZodDefault<z.ZodEnum<{
|
|
16
|
+
local: "local";
|
|
17
|
+
oauth: "oauth";
|
|
18
|
+
token: "token";
|
|
19
|
+
}>>;
|
|
20
|
+
ssl: z.ZodDefault<z.ZodBoolean>;
|
|
21
|
+
env: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
public: z.ZodDefault<z.ZodBoolean>;
|
|
24
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
25
|
+
value: z.ZodOptional<z.ZodString>;
|
|
26
|
+
secret: z.ZodDefault<z.ZodBoolean>;
|
|
27
|
+
description: z.ZodOptional<z.ZodString>;
|
|
28
|
+
storeKey: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$strip>>>;
|
|
30
|
+
config: z.ZodObject<{
|
|
31
|
+
dropletSize: z.ZodDefault<z.ZodString>;
|
|
32
|
+
dockerImage: z.ZodDefault<z.ZodString>;
|
|
33
|
+
volumeSizeGb: z.ZodDefault<z.ZodNumber>;
|
|
34
|
+
domain: z.ZodString;
|
|
35
|
+
sshPort: z.ZodDefault<z.ZodNumber>;
|
|
36
|
+
httpPort: z.ZodDefault<z.ZodNumber>;
|
|
37
|
+
adapter: z.ZodLiteral<"gitea-doks">;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export type GiteaDoksDescriptorInput = z.input<typeof GiteaDoksDescriptorSchema>;
|
|
41
|
+
export type GiteaDoksDescriptor = z.infer<typeof GiteaDoksDescriptorSchema>;
|
|
42
|
+
export interface GiteaManifest {
|
|
43
|
+
deployment: K8sDeployment;
|
|
44
|
+
service: K8sService;
|
|
45
|
+
pvc: {
|
|
46
|
+
apiVersion: string;
|
|
47
|
+
kind: string;
|
|
48
|
+
metadata: Record<string, unknown>;
|
|
49
|
+
spec: Record<string, unknown>;
|
|
50
|
+
};
|
|
51
|
+
themeConfigMap: {
|
|
52
|
+
apiVersion: string;
|
|
53
|
+
kind: string;
|
|
54
|
+
metadata: Record<string, unknown>;
|
|
55
|
+
data: Record<string, string>;
|
|
56
|
+
};
|
|
57
|
+
ingress: {
|
|
58
|
+
apiVersion: string;
|
|
59
|
+
kind: string;
|
|
60
|
+
metadata: Record<string, unknown>;
|
|
61
|
+
spec: Record<string, unknown>;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export declare function generateGiteaManifest(input: GiteaDoksDescriptorInput): GiteaManifest;
|
|
65
|
+
export declare function createGiteaImpl(input: GiteaDoksDescriptorInput): import("@vibesdotdev/runtime").RuntimeImplementationWrapper<{
|
|
66
|
+
generateConfig: () => GiteaManifest;
|
|
67
|
+
}>;
|
|
68
|
+
//# sourceMappingURL=gitea.impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitea.impl.d.ts","sourceRoot":"","sources":["../../src/implementations/gitea.impl.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAI5B,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBpC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AACjF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,MAAM,WAAW,aAAa;IAC7B,UAAU,EAAE,aAAa,CAAC;IAC1B,OAAO,EAAE,UAAU,CAAC;IACpB,GAAG,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IAC5G,cAAc,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;IACtH,OAAO,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;CAChH;AA4BD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,wBAAwB,GAAG,aAAa,CAwOpF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,wBAAwB;;GAU9D"}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implementation: infra/git-hosting -> gitea-doks
|
|
3
|
+
*
|
|
4
|
+
* Generates K8s manifests for a Gitea git hosting service on DOKS.
|
|
5
|
+
*/
|
|
6
|
+
import { createHash } from 'node:crypto';
|
|
7
|
+
import * as z from 'zod/v4';
|
|
8
|
+
import { createRuntimeImplementation } from '@vibesdotdev/runtime';
|
|
9
|
+
import { GiteaDoksGitHostingConfigSchema, GitHostingTypeSchema } from '@vibesdotdev/infra-core/kinds';
|
|
10
|
+
import { loadGiteaThemeAssets } from '@vibesdotdev/registry-theme';
|
|
11
|
+
export const GiteaDoksDescriptorSchema = z.object({
|
|
12
|
+
kind: z.literal('infra/git-hosting'),
|
|
13
|
+
id: z.string().min(1),
|
|
14
|
+
name: z.string().optional(),
|
|
15
|
+
description: z.string().optional(),
|
|
16
|
+
url: z.string().url(),
|
|
17
|
+
hostname: z.string().min(1),
|
|
18
|
+
type: GitHostingTypeSchema,
|
|
19
|
+
storagePath: z.string().min(1).default('/data'),
|
|
20
|
+
authMethod: z.enum(['local', 'oauth', 'token']).default('token'),
|
|
21
|
+
ssl: z.boolean().default(true),
|
|
22
|
+
env: z.array(z.object({
|
|
23
|
+
name: z.string().regex(/^[_A-Z0-9]+$/),
|
|
24
|
+
public: z.boolean().default(false),
|
|
25
|
+
required: z.boolean().default(true),
|
|
26
|
+
value: z.string().optional(),
|
|
27
|
+
secret: z.boolean().default(false),
|
|
28
|
+
description: z.string().optional(),
|
|
29
|
+
storeKey: z.string().min(1).optional()
|
|
30
|
+
})).optional(),
|
|
31
|
+
config: GiteaDoksGitHostingConfigSchema.extend({
|
|
32
|
+
adapter: z.literal('gitea-doks')
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* ConfigMap keys → relative paths under the staging mount. The install-theme
|
|
37
|
+
* initContainer copies these into the PVC's gitea/custom/ tree where Gitea
|
|
38
|
+
* picks them up at runtime. Keys are dot-separated because K8s ConfigMap keys
|
|
39
|
+
* cannot contain slashes; the volume `items[].path` translation produces the
|
|
40
|
+
* final on-disk layout.
|
|
41
|
+
*/
|
|
42
|
+
const THEME_FILES = {
|
|
43
|
+
'public.css.vibes-tokens.css': 'public/css/vibes-tokens.css',
|
|
44
|
+
'public.css.vibes-overlay.css': 'public/css/vibes-overlay.css',
|
|
45
|
+
'public.img.logo.svg': 'public/img/logo.svg',
|
|
46
|
+
'public.img.favicon.svg': 'public/img/favicon.svg',
|
|
47
|
+
'templates.custom.header.tmpl': 'templates/custom/header.tmpl',
|
|
48
|
+
'templates.custom.body_outer_pre.tmpl': 'templates/custom/body_outer_pre.tmpl',
|
|
49
|
+
'templates.custom.extra_links_footer.tmpl': 'templates/custom/extra_links_footer.tmpl',
|
|
50
|
+
// home.tmpl REPLACES the stock home page (not under custom/) — go-template
|
|
51
|
+
// resolution checks templates/home.tmpl first, then falls back to embedded.
|
|
52
|
+
'templates.home.tmpl': 'templates/home.tmpl',
|
|
53
|
+
// head_navbar.tmpl REPLACES the stock <nav id="navbar">. We render the
|
|
54
|
+
// vibes-brand-bar inline here instead of duplicating chrome via body_outer_pre.
|
|
55
|
+
'templates.base.head_navbar.tmpl': 'templates/base/head_navbar.tmpl'
|
|
56
|
+
};
|
|
57
|
+
const ELEMENTS_KEY = 'public.js.elements.js';
|
|
58
|
+
const ELEMENTS_PATH = 'public/js/elements.js';
|
|
59
|
+
export function generateGiteaManifest(input) {
|
|
60
|
+
const d = GiteaDoksDescriptorSchema.parse(input);
|
|
61
|
+
const ns = 'vibes';
|
|
62
|
+
const name = `vibes-${d.id}`;
|
|
63
|
+
const pvcName = `${name}-data`;
|
|
64
|
+
const themeCmName = `${name}-theme`;
|
|
65
|
+
const themeStagingPath = '/etc/gitea-theme';
|
|
66
|
+
// The official gitea/gitea image sets GITEA_CUSTOM=${GITEA_WORK_DIR}, where
|
|
67
|
+
// GITEA_WORK_DIR defaults to /data/gitea (NOT /data/gitea/custom). So
|
|
68
|
+
// custom templates and static assets live directly under /data/gitea/.
|
|
69
|
+
const giteaCustomPath = `${d.storagePath}/gitea`;
|
|
70
|
+
const cfg = d.config;
|
|
71
|
+
const port = cfg.httpPort;
|
|
72
|
+
const secretName = 'gitea-secrets';
|
|
73
|
+
const themeAssets = loadGiteaThemeAssets();
|
|
74
|
+
const themeData = {
|
|
75
|
+
'public.css.vibes-tokens.css': themeAssets.tokensCss,
|
|
76
|
+
'public.css.vibes-overlay.css': themeAssets.overlayCss,
|
|
77
|
+
'public.img.logo.svg': themeAssets.logoSvg,
|
|
78
|
+
'public.img.favicon.svg': themeAssets.faviconSvg,
|
|
79
|
+
'templates.custom.header.tmpl': themeAssets.headerTmpl,
|
|
80
|
+
'templates.custom.body_outer_pre.tmpl': themeAssets.bodyOuterPreTmpl,
|
|
81
|
+
'templates.custom.extra_links_footer.tmpl': themeAssets.extraLinksFooterTmpl,
|
|
82
|
+
'templates.home.tmpl': themeAssets.homeTmpl,
|
|
83
|
+
'templates.base.head_navbar.tmpl': themeAssets.headNavbarTmpl
|
|
84
|
+
};
|
|
85
|
+
const themeItems = Object.entries(THEME_FILES).map(([key, path]) => ({ key, path }));
|
|
86
|
+
if (themeAssets.elementsBundle) {
|
|
87
|
+
themeData[ELEMENTS_KEY] = themeAssets.elementsBundle;
|
|
88
|
+
themeItems.push({ key: ELEMENTS_KEY, path: ELEMENTS_PATH });
|
|
89
|
+
}
|
|
90
|
+
// Hash of theme content so any change causes a rollout (otherwise a
|
|
91
|
+
// ConfigMap-only diff leaves pods with stale assets in their PVC).
|
|
92
|
+
const themeChecksum = createHash('sha256')
|
|
93
|
+
.update(Object.entries(themeData).sort().map(([k, v]) => `${k}:${v}`).join('\n'))
|
|
94
|
+
.digest('hex')
|
|
95
|
+
.slice(0, 16);
|
|
96
|
+
// NOTE: the previous Gitea bootstrap container has been removed. It tried to
|
|
97
|
+
// curl localhost:3000 from inside an *init* container — but Gitea hadn't
|
|
98
|
+
// started yet (init containers run first), so it could never have worked.
|
|
99
|
+
// Admin user creation and OAuth provider registration should run as a
|
|
100
|
+
// separate Job (or via `gitea admin user create` exec) post-Ready.
|
|
101
|
+
const deployment = {
|
|
102
|
+
apiVersion: 'apps/v1',
|
|
103
|
+
kind: 'Deployment',
|
|
104
|
+
metadata: {
|
|
105
|
+
name,
|
|
106
|
+
namespace: ns,
|
|
107
|
+
labels: { app: d.id, 'app.kubernetes.io/part-of': 'vibes' },
|
|
108
|
+
annotations: {
|
|
109
|
+
'secrets.hashicorp.com/rollout-restart': 'true'
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
spec: {
|
|
113
|
+
replicas: 1,
|
|
114
|
+
// PVC is ReadWriteOnce — RollingUpdate would Multi-Attach-deadlock.
|
|
115
|
+
// Recreate stops the old pod, then starts the new one with the freed volume.
|
|
116
|
+
strategy: { type: 'Recreate' },
|
|
117
|
+
selector: { matchLabels: { app: d.id } },
|
|
118
|
+
template: {
|
|
119
|
+
metadata: {
|
|
120
|
+
labels: { app: d.id },
|
|
121
|
+
annotations: { 'vibes.dev/theme-checksum': themeChecksum }
|
|
122
|
+
},
|
|
123
|
+
spec: {
|
|
124
|
+
initContainers: [
|
|
125
|
+
{
|
|
126
|
+
name: 'chown',
|
|
127
|
+
image: 'busybox:1.36',
|
|
128
|
+
command: ['sh', '-c', `chown -R 1000:1000 ${d.storagePath}`],
|
|
129
|
+
volumeMounts: [{ name: 'data', mountPath: d.storagePath }],
|
|
130
|
+
resources: { requests: { cpu: '50m', memory: '32Mi' }, limits: { memory: '128Mi' } }
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'install-theme',
|
|
134
|
+
image: 'busybox:1.36',
|
|
135
|
+
command: ['sh', '-c', [
|
|
136
|
+
// Gitea v1.21 expects custom static assets under `public/assets/<type>/`
|
|
137
|
+
// (NOT `public/<type>/` — that's a legacy layout it now rejects).
|
|
138
|
+
`mkdir -p ${giteaCustomPath}/public/assets/css`,
|
|
139
|
+
`mkdir -p ${giteaCustomPath}/public/assets/img`,
|
|
140
|
+
`mkdir -p ${giteaCustomPath}/public/assets/js`,
|
|
141
|
+
`mkdir -p ${giteaCustomPath}/templates/custom`,
|
|
142
|
+
// Versioned filenames (.v5.) sidestep Cloudflare negative-cache on the unversioned URLs.
|
|
143
|
+
// Bump the version when bytes change to invalidate browser/edge caches.
|
|
144
|
+
`cp -f ${themeStagingPath}/public/css/vibes-tokens.css ${giteaCustomPath}/public/assets/css/vibes-tokens.v5.css`,
|
|
145
|
+
`cp -f ${themeStagingPath}/public/css/vibes-overlay.css ${giteaCustomPath}/public/assets/css/vibes-overlay.v5.css`,
|
|
146
|
+
`cp -f ${themeStagingPath}/public/img/logo.svg ${giteaCustomPath}/public/assets/img/logo.v5.svg`,
|
|
147
|
+
`cp -f ${themeStagingPath}/public/img/favicon.svg ${giteaCustomPath}/public/assets/img/favicon.v5.svg`,
|
|
148
|
+
`cp -f ${themeStagingPath}/templates/custom/header.tmpl ${giteaCustomPath}/templates/custom/header.tmpl`,
|
|
149
|
+
`cp -f ${themeStagingPath}/templates/custom/body_outer_pre.tmpl ${giteaCustomPath}/templates/custom/body_outer_pre.tmpl`,
|
|
150
|
+
`cp -f ${themeStagingPath}/templates/custom/extra_links_footer.tmpl ${giteaCustomPath}/templates/custom/extra_links_footer.tmpl`,
|
|
151
|
+
`cp -f ${themeStagingPath}/templates/home.tmpl ${giteaCustomPath}/templates/home.tmpl`,
|
|
152
|
+
`mkdir -p ${giteaCustomPath}/templates/base`,
|
|
153
|
+
`cp -f ${themeStagingPath}/templates/base/head_navbar.tmpl ${giteaCustomPath}/templates/base/head_navbar.tmpl`,
|
|
154
|
+
// elements.js is optional — copy only if the staging volume includes it (i.e. the @vibesdotdev/elements bundle was built before manifest generation).
|
|
155
|
+
`if [ -f ${themeStagingPath}/public/js/elements.js ]; then cp -f ${themeStagingPath}/public/js/elements.js ${giteaCustomPath}/public/assets/js/elements.v5.js; fi`,
|
|
156
|
+
// Clean up files from the previous wrong layouts so they don't confuse Gitea's legacy detection.
|
|
157
|
+
`rm -rf ${giteaCustomPath}/public/css ${giteaCustomPath}/public/img ${giteaCustomPath}/public/js ${giteaCustomPath}/custom 2>/dev/null || true`,
|
|
158
|
+
// Update APP_NAME in app.ini directly. Gitea v1.21 doesn't have
|
|
159
|
+
// `environment-to-ini`, so GITEA__DEFAULT__APP_NAME never reaches
|
|
160
|
+
// the running config. sed is idempotent: if the line already
|
|
161
|
+
// matches we no-op.
|
|
162
|
+
`if [ -f ${giteaCustomPath}/conf/app.ini ]; then sed -i 's|^APP_NAME = .*$|APP_NAME = Vibes Git|' ${giteaCustomPath}/conf/app.ini || true; fi`,
|
|
163
|
+
`chown -R 1000:1000 ${giteaCustomPath}`,
|
|
164
|
+
'echo "vibes theme installed"'
|
|
165
|
+
].join(' && ')],
|
|
166
|
+
volumeMounts: [
|
|
167
|
+
{ name: 'data', mountPath: d.storagePath },
|
|
168
|
+
{ name: 'theme', mountPath: themeStagingPath, readOnly: true }
|
|
169
|
+
],
|
|
170
|
+
resources: { requests: { cpu: '50m', memory: '32Mi' }, limits: { memory: '128Mi' } }
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
containers: [{
|
|
174
|
+
name: d.id,
|
|
175
|
+
image: cfg.dockerImage,
|
|
176
|
+
ports: [
|
|
177
|
+
{ name: 'http', containerPort: port },
|
|
178
|
+
{ name: 'ssh', containerPort: cfg.sshPort, protocol: 'TCP' }
|
|
179
|
+
],
|
|
180
|
+
envFrom: [{ secretRef: { name: secretName } }],
|
|
181
|
+
env: [
|
|
182
|
+
{ name: 'USER_UID', value: '1000' },
|
|
183
|
+
{ name: 'USER_GID', value: '1000' },
|
|
184
|
+
{ name: 'GITEA__server__PROTOCOL', value: 'http' },
|
|
185
|
+
{ name: 'GITEA__server__DOMAIN', value: cfg.domain },
|
|
186
|
+
{ name: 'GITEA__server__ROOT_URL', value: `https://${cfg.domain}` },
|
|
187
|
+
{ name: 'GITEA__server__HTTP_PORT', value: String(port) },
|
|
188
|
+
{ name: 'GITEA__server__SSH_PORT', value: String(cfg.sshPort) },
|
|
189
|
+
{ name: 'GITEA__DEFAULT__APP_NAME', value: 'Vibes Git' },
|
|
190
|
+
{ name: 'GITEA__ui__THEMES', value: 'auto,gitea,arc-green' },
|
|
191
|
+
{ name: 'GITEA__ui__DEFAULT_THEME', value: 'auto' },
|
|
192
|
+
{ name: 'GITEA__security__INSTALL_LOCK', value: 'true' },
|
|
193
|
+
{ name: 'GITEA__oauth2__CLIENT_ID', valueFrom: { secretKeyRef: { name: secretName, key: 'oauth2-client-id' } } },
|
|
194
|
+
{ name: 'GITEA__oauth2__CLIENT_SECRET', valueFrom: { secretKeyRef: { name: secretName, key: 'oauth2-client-secret' } } },
|
|
195
|
+
{ name: 'GITEA__security__JWT_SECRET', valueFrom: { secretKeyRef: { name: secretName, key: 'jwt-secret' } } },
|
|
196
|
+
{ name: 'GITEA__mailer__FROM', valueFrom: { secretKeyRef: { name: 'shared-secrets', key: 'smtp-from' } } },
|
|
197
|
+
{ name: 'GITEA__mailer__PASSWD', valueFrom: { secretKeyRef: { name: secretName, key: 'smtp-password' } } }
|
|
198
|
+
],
|
|
199
|
+
volumeMounts: [{ name: 'data', mountPath: d.storagePath }],
|
|
200
|
+
livenessProbe: {
|
|
201
|
+
httpGet: { path: '/', port },
|
|
202
|
+
initialDelaySeconds: 60,
|
|
203
|
+
periodSeconds: 30
|
|
204
|
+
},
|
|
205
|
+
readinessProbe: {
|
|
206
|
+
httpGet: { path: '/api/healthz', port },
|
|
207
|
+
periodSeconds: 10
|
|
208
|
+
},
|
|
209
|
+
resources: {
|
|
210
|
+
requests: { cpu: '100m', memory: '128Mi' },
|
|
211
|
+
limits: { cpu: '1', memory: '1Gi' }
|
|
212
|
+
}
|
|
213
|
+
}],
|
|
214
|
+
volumes: [
|
|
215
|
+
{ name: 'data', persistentVolumeClaim: { claimName: pvcName } },
|
|
216
|
+
{
|
|
217
|
+
name: 'theme',
|
|
218
|
+
configMap: {
|
|
219
|
+
name: themeCmName,
|
|
220
|
+
items: themeItems
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
const service = {
|
|
229
|
+
apiVersion: 'v1',
|
|
230
|
+
kind: 'Service',
|
|
231
|
+
metadata: { name, namespace: ns },
|
|
232
|
+
spec: {
|
|
233
|
+
type: 'ClusterIP',
|
|
234
|
+
selector: { app: d.id },
|
|
235
|
+
ports: [
|
|
236
|
+
{ name: 'http', port, targetPort: port },
|
|
237
|
+
{ name: 'ssh', port: cfg.sshPort, targetPort: cfg.sshPort }
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
const pvc = {
|
|
242
|
+
apiVersion: 'v1',
|
|
243
|
+
kind: 'PersistentVolumeClaim',
|
|
244
|
+
metadata: { name: pvcName, namespace: ns, labels: { app: d.id } },
|
|
245
|
+
spec: {
|
|
246
|
+
accessModes: ['ReadWriteOnce'],
|
|
247
|
+
resources: { requests: { storage: `${cfg.volumeSizeGb}Gi` } }
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
const themeConfigMap = {
|
|
251
|
+
apiVersion: 'v1',
|
|
252
|
+
kind: 'ConfigMap',
|
|
253
|
+
metadata: { name: themeCmName, namespace: ns, labels: { app: d.id } },
|
|
254
|
+
data: themeData
|
|
255
|
+
};
|
|
256
|
+
const ingress = {
|
|
257
|
+
apiVersion: 'networking.k8s.io/v1',
|
|
258
|
+
kind: 'Ingress',
|
|
259
|
+
metadata: {
|
|
260
|
+
name,
|
|
261
|
+
namespace: ns,
|
|
262
|
+
labels: { app: d.id },
|
|
263
|
+
annotations: {
|
|
264
|
+
'cert-manager.io/cluster-issuer': 'letsencrypt-prod',
|
|
265
|
+
'nginx.ingress.kubernetes.io/proxy-body-size': '100m'
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
spec: {
|
|
269
|
+
tls: [{ hosts: [cfg.domain], secretName: `${name}-tls` }],
|
|
270
|
+
rules: [{
|
|
271
|
+
host: cfg.domain,
|
|
272
|
+
http: {
|
|
273
|
+
paths: [{
|
|
274
|
+
path: '/',
|
|
275
|
+
pathType: 'Prefix',
|
|
276
|
+
backend: { service: { name, port: { number: port } } }
|
|
277
|
+
}]
|
|
278
|
+
}
|
|
279
|
+
}]
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
return { deployment, service, pvc, themeConfigMap, ingress };
|
|
283
|
+
}
|
|
284
|
+
export function createGiteaImpl(input) {
|
|
285
|
+
const descriptor = GiteaDoksDescriptorSchema.parse(input);
|
|
286
|
+
return createRuntimeImplementation({
|
|
287
|
+
id: 'gitea-doks',
|
|
288
|
+
kind: 'infra/git-hosting',
|
|
289
|
+
priority: 20,
|
|
290
|
+
implementation: {
|
|
291
|
+
generateConfig: () => generateGiteaManifest(descriptor)
|
|
292
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iB;gCAC3B,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;6BACtD,CAAC;qBACF;iBACD,CAAC;SACF;KACD,CAAC;IAEF,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAA+B;IAC9D,MAAM,UAAU,GAAG,yBAAyB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1D,OAAO,2BAA2B,CAAC;QAClC,EAAE,EAAE,YAAY;QAChB,IAAI,EAAE,mBAAmB;QACzB,QAAQ,EAAE,EAAE;QACZ,cAAc,EAAE;YACf,cAAc,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,UAAU,CAAC;SACvD;KACD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implementation: infra/database -> do-managed-postgres
|
|
3
|
+
*
|
|
4
|
+
* Generates a DigitalOcean API-compatible managed database specification.
|
|
5
|
+
*/
|
|
6
|
+
import * as z from 'zod/v4';
|
|
7
|
+
import type { DOManagedDBSpec } from '../types.ts';
|
|
8
|
+
export declare const DOManagedPostgresDescriptorSchema: z.ZodObject<{
|
|
9
|
+
kind: z.ZodLiteral<"infra/database">;
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
name: z.ZodOptional<z.ZodString>;
|
|
12
|
+
description: z.ZodOptional<z.ZodString>;
|
|
13
|
+
engine: z.ZodLiteral<"postgres">;
|
|
14
|
+
replicas: z.ZodDefault<z.ZodNumber>;
|
|
15
|
+
config: z.ZodObject<{
|
|
16
|
+
size: z.ZodDefault<z.ZodString>;
|
|
17
|
+
region: z.ZodDefault<z.ZodString>;
|
|
18
|
+
version: z.ZodDefault<z.ZodString>;
|
|
19
|
+
adapter: z.ZodLiteral<"do-managed-postgres">;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export type DOManagedPostgresDescriptorInput = z.input<typeof DOManagedPostgresDescriptorSchema>;
|
|
23
|
+
export type DOManagedPostgresDescriptor = z.infer<typeof DOManagedPostgresDescriptorSchema>;
|
|
24
|
+
export declare function generateDOManagedDB(descriptor: DOManagedPostgresDescriptor): DOManagedDBSpec;
|
|
25
|
+
//# sourceMappingURL=managed-db.impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-db.impl.d.ts","sourceRoot":"","sources":["../../src/implementations/managed-db.impl.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;iBAU5C,CAAC;AAEH,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AACjG,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAE5F,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,2BAA2B,GAAG,eAAe,CAW5F"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implementation: infra/database -> do-managed-postgres
|
|
3
|
+
*
|
|
4
|
+
* Generates a DigitalOcean API-compatible managed database specification.
|
|
5
|
+
*/
|
|
6
|
+
import * as z from 'zod/v4';
|
|
7
|
+
import { DOManagedPostgresConfigSchema } from '@vibesdotdev/infra-core/kinds';
|
|
8
|
+
export const DOManagedPostgresDescriptorSchema = z.object({
|
|
9
|
+
kind: z.literal('infra/database'),
|
|
10
|
+
id: z.string().min(1),
|
|
11
|
+
name: z.string().optional(),
|
|
12
|
+
description: z.string().optional(),
|
|
13
|
+
engine: z.literal('postgres'),
|
|
14
|
+
replicas: z.number().int().nonnegative().default(0),
|
|
15
|
+
config: DOManagedPostgresConfigSchema.extend({
|
|
16
|
+
adapter: z.literal('do-managed-postgres')
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
export function generateDOManagedDB(descriptor) {
|
|
20
|
+
const parsed = DOManagedPostgresDescriptorSchema.parse(descriptor);
|
|
21
|
+
const cfg = parsed.config;
|
|
22
|
+
return {
|
|
23
|
+
name: `vibes-${parsed.id}`,
|
|
24
|
+
engine: 'pg',
|
|
25
|
+
version: cfg.version,
|
|
26
|
+
size: cfg.size,
|
|
27
|
+
region: cfg.region,
|
|
28
|
+
num_nodes: (parsed.replicas ?? 0) + 1
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=managed-db.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-db.impl.js","sourceRoot":"","sources":["../../src/implementations/managed-db.impl.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAG9E,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACjC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,MAAM,EAAE,6BAA6B,CAAC,MAAM,CAAC;QAC5C,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC;KACzC,CAAC;CACF,CAAC,CAAC;AAKH,MAAM,UAAU,mBAAmB,CAAC,UAAuC;IAC1E,MAAM,MAAM,GAAG,iCAAiC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACnE,MAAM,GAAG,GAAG,MAAM,CAAC,MAAO,CAAC;IAC3B,OAAO;QACN,IAAI,EAAE,SAAS,MAAM,CAAC,EAAE,EAAE;QAC1B,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,SAAS,EAAE,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC;KACrC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implementation: infra/cache -> do-managed-redis
|
|
3
|
+
*
|
|
4
|
+
* Generates a DigitalOcean API-compatible managed Redis specification.
|
|
5
|
+
*/
|
|
6
|
+
import * as z from 'zod/v4';
|
|
7
|
+
import type { DOManagedRedisSpec } from '../types.ts';
|
|
8
|
+
export declare const DOManagedRedisDescriptorSchema: z.ZodObject<{
|
|
9
|
+
kind: z.ZodLiteral<"infra/cache">;
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
name: z.ZodOptional<z.ZodString>;
|
|
12
|
+
description: z.ZodOptional<z.ZodString>;
|
|
13
|
+
engine: z.ZodLiteral<"redis">;
|
|
14
|
+
maxMemory: z.ZodOptional<z.ZodString>;
|
|
15
|
+
eviction: z.ZodOptional<z.ZodEnum<{
|
|
16
|
+
lru: "lru";
|
|
17
|
+
lfu: "lfu";
|
|
18
|
+
ttl: "ttl";
|
|
19
|
+
}>>;
|
|
20
|
+
config: z.ZodObject<{
|
|
21
|
+
maxMemory: z.ZodOptional<z.ZodString>;
|
|
22
|
+
eviction: z.ZodOptional<z.ZodEnum<{
|
|
23
|
+
lru: "lru";
|
|
24
|
+
lfu: "lfu";
|
|
25
|
+
ttl: "ttl";
|
|
26
|
+
}>>;
|
|
27
|
+
region: z.ZodDefault<z.ZodString>;
|
|
28
|
+
version: z.ZodDefault<z.ZodString>;
|
|
29
|
+
numNodes: z.ZodDefault<z.ZodNumber>;
|
|
30
|
+
size: z.ZodOptional<z.ZodString>;
|
|
31
|
+
adapter: z.ZodLiteral<"do-managed-redis">;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type DOManagedRedisDescriptorInput = z.input<typeof DOManagedRedisDescriptorSchema>;
|
|
35
|
+
export type DOManagedRedisDescriptor = z.infer<typeof DOManagedRedisDescriptorSchema>;
|
|
36
|
+
export declare function generateDOManagedRedis(descriptor: DOManagedRedisDescriptor): DOManagedRedisSpec;
|
|
37
|
+
//# sourceMappingURL=managed-redis.impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-redis.impl.d.ts","sourceRoot":"","sources":["../../src/implementations/managed-redis.impl.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAQtD,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;iBAWzC,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAC3F,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,wBAAwB,GAAG,kBAAkB,CAgB/F"}
|