@crossdelta/infrastructure 0.2.11 → 0.2.13
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 +294 -41
- package/dist/helpers/droplet-builder.d.ts +38 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/index.cjs +311692 -1
- package/dist/index.js +311680 -1
- package/dist/types/index.d.ts +70 -4
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -24,6 +24,50 @@ export interface ImageConfig {
|
|
|
24
24
|
/** Image tag (e.g., '2.10-alpine', 'latest') */
|
|
25
25
|
tag: string;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Platform type for service deployment.
|
|
29
|
+
*/
|
|
30
|
+
export declare const Platform: {
|
|
31
|
+
/** DigitalOcean App Platform (default) */
|
|
32
|
+
readonly APP_PLATFORM: "app-platform";
|
|
33
|
+
/** DigitalOcean Droplet with Docker */
|
|
34
|
+
readonly DROPLET: "droplet";
|
|
35
|
+
};
|
|
36
|
+
export type Platform = (typeof Platform)[keyof typeof Platform];
|
|
37
|
+
/**
|
|
38
|
+
* Volume configuration for persistent storage (Droplet only).
|
|
39
|
+
*/
|
|
40
|
+
export interface VolumeConfig {
|
|
41
|
+
/** Volume name (must be unique) */
|
|
42
|
+
name: string;
|
|
43
|
+
/** Mount path inside the container */
|
|
44
|
+
mountPath: string;
|
|
45
|
+
/** Size in GB */
|
|
46
|
+
sizeGb: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Droplet-specific configuration options.
|
|
50
|
+
*/
|
|
51
|
+
export interface DropletConfig {
|
|
52
|
+
/** Droplet size slug (e.g., 's-1vcpu-1gb') */
|
|
53
|
+
size: string;
|
|
54
|
+
/** Persistent volumes to attach */
|
|
55
|
+
volumes?: VolumeConfig[];
|
|
56
|
+
/** Firewall rules for VPC access */
|
|
57
|
+
vpcPorts?: number[];
|
|
58
|
+
/** Additional Docker run arguments */
|
|
59
|
+
dockerArgs?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Config file to mount into the container.
|
|
62
|
+
* The content will be written to the Droplet and mounted into Docker.
|
|
63
|
+
*/
|
|
64
|
+
configFile?: {
|
|
65
|
+
/** Path inside the container (e.g., '/etc/nats/nats.conf') */
|
|
66
|
+
containerPath: string;
|
|
67
|
+
/** File content (will be written to Droplet) */
|
|
68
|
+
content: string;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
27
71
|
/**
|
|
28
72
|
* Configuration for a service that will be deployed to DigitalOcean App Platform.
|
|
29
73
|
* Each service in infra/services/*.ts should export a default object of this type.
|
|
@@ -39,17 +83,30 @@ export interface ImageConfig {
|
|
|
39
83
|
* - `<SERVICE>_PORT` environment variable
|
|
40
84
|
* - `<SERVICE>_URL` environment variable (unless `internalUrl` is set)
|
|
41
85
|
*
|
|
86
|
+
* ## Platform Selection
|
|
87
|
+
*
|
|
88
|
+
* By default, services run on App Platform. Set `platform: 'droplet'` for services
|
|
89
|
+
* that need persistent storage or special networking (e.g., NATS with JetStream).
|
|
90
|
+
*
|
|
42
91
|
* ## Examples
|
|
43
92
|
*
|
|
44
93
|
* ```ts
|
|
45
|
-
* // Public service (API Gateway)
|
|
94
|
+
* // Public service on App Platform (API Gateway)
|
|
46
95
|
* { httpPort: 4000, ingressPrefix: '/api' }
|
|
47
96
|
*
|
|
48
|
-
* // Internal-only service (Orders)
|
|
97
|
+
* // Internal-only service on App Platform (Orders)
|
|
49
98
|
* { internalPorts: [4001] }
|
|
50
99
|
*
|
|
51
|
-
* //
|
|
52
|
-
* {
|
|
100
|
+
* // Service on Droplet with persistent volume (NATS)
|
|
101
|
+
* {
|
|
102
|
+
* platform: 'droplet',
|
|
103
|
+
* internalPorts: [4222, 8222],
|
|
104
|
+
* internalUrl: 'nats://nats:4222',
|
|
105
|
+
* droplet: {
|
|
106
|
+
* size: 's-1vcpu-1gb',
|
|
107
|
+
* volumes: [{ name: 'nats-data', mountPath: '/data', sizeGb: 10 }],
|
|
108
|
+
* },
|
|
109
|
+
* }
|
|
53
110
|
* ```
|
|
54
111
|
*
|
|
55
112
|
* @see https://docs.digitalocean.com/reference/api/digitalocean/#tag/Apps
|
|
@@ -57,6 +114,11 @@ export interface ImageConfig {
|
|
|
57
114
|
export type ServiceConfig = Partial<Omit<AppSpecService, 'image'>> & {
|
|
58
115
|
/** Unique name of the service (required) */
|
|
59
116
|
name: string;
|
|
117
|
+
/**
|
|
118
|
+
* Deployment platform. Defaults to 'app-platform'.
|
|
119
|
+
* Use 'droplet' for services that need persistent storage or special networking.
|
|
120
|
+
*/
|
|
121
|
+
platform?: Platform;
|
|
60
122
|
/**
|
|
61
123
|
* Ingress path prefix for public routing (e.g., '/api').
|
|
62
124
|
* Only used when `httpPort` is set. Services with only `internalPorts` cannot have ingress.
|
|
@@ -72,6 +134,10 @@ export type ServiceConfig = Partial<Omit<AppSpecService, 'image'>> & {
|
|
|
72
134
|
* If not set, defaults to `http://{name}:{primaryPort}`.
|
|
73
135
|
*/
|
|
74
136
|
internalUrl?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Droplet-specific configuration. Only used when `platform: 'droplet'`.
|
|
139
|
+
*/
|
|
140
|
+
droplet?: DropletConfig;
|
|
75
141
|
};
|
|
76
142
|
/**
|
|
77
143
|
* Full service spec after merging with common config.
|