@kadi.build/deploy-ability 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 +523 -0
- package/dist/constants.d.ts +82 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +82 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors/certificate-error.d.ts +95 -0
- package/dist/errors/certificate-error.d.ts.map +1 -0
- package/dist/errors/certificate-error.js +111 -0
- package/dist/errors/certificate-error.js.map +1 -0
- package/dist/errors/deployment-error.d.ts +122 -0
- package/dist/errors/deployment-error.d.ts.map +1 -0
- package/dist/errors/deployment-error.js +185 -0
- package/dist/errors/deployment-error.js.map +1 -0
- package/dist/errors/index.d.ts +13 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +18 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/profile-error.d.ts +106 -0
- package/dist/errors/profile-error.d.ts.map +1 -0
- package/dist/errors/profile-error.js +127 -0
- package/dist/errors/profile-error.js.map +1 -0
- package/dist/errors/provider-error.d.ts +104 -0
- package/dist/errors/provider-error.d.ts.map +1 -0
- package/dist/errors/provider-error.js +120 -0
- package/dist/errors/provider-error.js.map +1 -0
- package/dist/errors/wallet-error.d.ts +131 -0
- package/dist/errors/wallet-error.d.ts.map +1 -0
- package/dist/errors/wallet-error.js +154 -0
- package/dist/errors/wallet-error.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/targets/akash/bid-selectors.d.ts +251 -0
- package/dist/targets/akash/bid-selectors.d.ts.map +1 -0
- package/dist/targets/akash/bid-selectors.js +322 -0
- package/dist/targets/akash/bid-selectors.js.map +1 -0
- package/dist/targets/akash/bid-types.d.ts +297 -0
- package/dist/targets/akash/bid-types.d.ts.map +1 -0
- package/dist/targets/akash/bid-types.js +89 -0
- package/dist/targets/akash/bid-types.js.map +1 -0
- package/dist/targets/akash/blockchain-client.d.ts +577 -0
- package/dist/targets/akash/blockchain-client.d.ts.map +1 -0
- package/dist/targets/akash/blockchain-client.js +803 -0
- package/dist/targets/akash/blockchain-client.js.map +1 -0
- package/dist/targets/akash/certificate-manager.d.ts +228 -0
- package/dist/targets/akash/certificate-manager.d.ts.map +1 -0
- package/dist/targets/akash/certificate-manager.js +395 -0
- package/dist/targets/akash/certificate-manager.js.map +1 -0
- package/dist/targets/akash/constants.d.ts +231 -0
- package/dist/targets/akash/constants.d.ts.map +1 -0
- package/dist/targets/akash/constants.js +225 -0
- package/dist/targets/akash/constants.js.map +1 -0
- package/dist/targets/akash/deployer.d.ts +136 -0
- package/dist/targets/akash/deployer.d.ts.map +1 -0
- package/dist/targets/akash/deployer.js +599 -0
- package/dist/targets/akash/deployer.js.map +1 -0
- package/dist/targets/akash/environment.d.ts +241 -0
- package/dist/targets/akash/environment.d.ts.map +1 -0
- package/dist/targets/akash/environment.js +245 -0
- package/dist/targets/akash/environment.js.map +1 -0
- package/dist/targets/akash/index.d.ts +1113 -0
- package/dist/targets/akash/index.d.ts.map +1 -0
- package/dist/targets/akash/index.js +909 -0
- package/dist/targets/akash/index.js.map +1 -0
- package/dist/targets/akash/lease-monitor.d.ts +51 -0
- package/dist/targets/akash/lease-monitor.d.ts.map +1 -0
- package/dist/targets/akash/lease-monitor.js +110 -0
- package/dist/targets/akash/lease-monitor.js.map +1 -0
- package/dist/targets/akash/logs.d.ts +71 -0
- package/dist/targets/akash/logs.d.ts.map +1 -0
- package/dist/targets/akash/logs.js +311 -0
- package/dist/targets/akash/logs.js.map +1 -0
- package/dist/targets/akash/logs.types.d.ts +102 -0
- package/dist/targets/akash/logs.types.d.ts.map +1 -0
- package/dist/targets/akash/logs.types.js +9 -0
- package/dist/targets/akash/logs.types.js.map +1 -0
- package/dist/targets/akash/pricing.d.ts +247 -0
- package/dist/targets/akash/pricing.d.ts.map +1 -0
- package/dist/targets/akash/pricing.js +246 -0
- package/dist/targets/akash/pricing.js.map +1 -0
- package/dist/targets/akash/provider-client.d.ts +114 -0
- package/dist/targets/akash/provider-client.d.ts.map +1 -0
- package/dist/targets/akash/provider-client.js +318 -0
- package/dist/targets/akash/provider-client.js.map +1 -0
- package/dist/targets/akash/provider-metadata.d.ts +228 -0
- package/dist/targets/akash/provider-metadata.d.ts.map +1 -0
- package/dist/targets/akash/provider-metadata.js +14 -0
- package/dist/targets/akash/provider-metadata.js.map +1 -0
- package/dist/targets/akash/provider-service.d.ts +133 -0
- package/dist/targets/akash/provider-service.d.ts.map +1 -0
- package/dist/targets/akash/provider-service.js +391 -0
- package/dist/targets/akash/provider-service.js.map +1 -0
- package/dist/targets/akash/query-client.d.ts +125 -0
- package/dist/targets/akash/query-client.d.ts.map +1 -0
- package/dist/targets/akash/query-client.js +332 -0
- package/dist/targets/akash/query-client.js.map +1 -0
- package/dist/targets/akash/sdl-generator.d.ts +31 -0
- package/dist/targets/akash/sdl-generator.d.ts.map +1 -0
- package/dist/targets/akash/sdl-generator.js +279 -0
- package/dist/targets/akash/sdl-generator.js.map +1 -0
- package/dist/targets/akash/types.d.ts +285 -0
- package/dist/targets/akash/types.d.ts.map +1 -0
- package/dist/targets/akash/types.js +54 -0
- package/dist/targets/akash/types.js.map +1 -0
- package/dist/targets/akash/wallet-manager.d.ts +526 -0
- package/dist/targets/akash/wallet-manager.d.ts.map +1 -0
- package/dist/targets/akash/wallet-manager.js +953 -0
- package/dist/targets/akash/wallet-manager.js.map +1 -0
- package/dist/targets/local/compose-generator.d.ts +244 -0
- package/dist/targets/local/compose-generator.d.ts.map +1 -0
- package/dist/targets/local/compose-generator.js +324 -0
- package/dist/targets/local/compose-generator.js.map +1 -0
- package/dist/targets/local/deployer.d.ts +82 -0
- package/dist/targets/local/deployer.d.ts.map +1 -0
- package/dist/targets/local/deployer.js +367 -0
- package/dist/targets/local/deployer.js.map +1 -0
- package/dist/targets/local/engine-manager.d.ts +155 -0
- package/dist/targets/local/engine-manager.d.ts.map +1 -0
- package/dist/targets/local/engine-manager.js +250 -0
- package/dist/targets/local/engine-manager.js.map +1 -0
- package/dist/targets/local/index.d.ts +40 -0
- package/dist/targets/local/index.d.ts.map +1 -0
- package/dist/targets/local/index.js +43 -0
- package/dist/targets/local/index.js.map +1 -0
- package/dist/targets/local/network-manager.d.ts +160 -0
- package/dist/targets/local/network-manager.d.ts.map +1 -0
- package/dist/targets/local/network-manager.js +337 -0
- package/dist/targets/local/network-manager.js.map +1 -0
- package/dist/targets/local/types.d.ts +327 -0
- package/dist/targets/local/types.d.ts.map +1 -0
- package/dist/targets/local/types.js +9 -0
- package/dist/targets/local/types.js.map +1 -0
- package/dist/types/common.d.ts +585 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +13 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +12 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/options.d.ts +329 -0
- package/dist/types/options.d.ts.map +1 -0
- package/dist/types/options.js +10 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/profiles.d.ts +329 -0
- package/dist/types/profiles.d.ts.map +1 -0
- package/dist/types/profiles.js +27 -0
- package/dist/types/profiles.js.map +1 -0
- package/dist/types/results.d.ts +443 -0
- package/dist/types/results.d.ts.map +1 -0
- package/dist/types/results.js +64 -0
- package/dist/types/results.js.map +1 -0
- package/dist/types/validators.d.ts +118 -0
- package/dist/types/validators.d.ts.map +1 -0
- package/dist/types/validators.js +198 -0
- package/dist/types/validators.js.map +1 -0
- package/dist/utils/command-runner.d.ts +128 -0
- package/dist/utils/command-runner.d.ts.map +1 -0
- package/dist/utils/command-runner.js +210 -0
- package/dist/utils/command-runner.js.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +10 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +68 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +93 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/profile-loader.d.ts +76 -0
- package/dist/utils/profile-loader.d.ts.map +1 -0
- package/dist/utils/profile-loader.js +194 -0
- package/dist/utils/profile-loader.js.map +1 -0
- package/dist/utils/registry/index.d.ts +27 -0
- package/dist/utils/registry/index.d.ts.map +1 -0
- package/dist/utils/registry/index.js +29 -0
- package/dist/utils/registry/index.js.map +1 -0
- package/dist/utils/registry/manager.d.ts +319 -0
- package/dist/utils/registry/manager.d.ts.map +1 -0
- package/dist/utils/registry/manager.js +671 -0
- package/dist/utils/registry/manager.js.map +1 -0
- package/dist/utils/registry/setup.d.ts +135 -0
- package/dist/utils/registry/setup.d.ts.map +1 -0
- package/dist/utils/registry/setup.js +207 -0
- package/dist/utils/registry/setup.js.map +1 -0
- package/dist/utils/registry/transformer.d.ts +92 -0
- package/dist/utils/registry/transformer.d.ts.map +1 -0
- package/dist/utils/registry/transformer.js +131 -0
- package/dist/utils/registry/transformer.js.map +1 -0
- package/dist/utils/registry/types.d.ts +241 -0
- package/dist/utils/registry/types.d.ts.map +1 -0
- package/dist/utils/registry/types.js +10 -0
- package/dist/utils/registry/types.js.map +1 -0
- package/docs/EXAMPLES.md +293 -0
- package/docs/PLACEMENT.md +433 -0
- package/docs/STORAGE.md +318 -0
- package/docs/building-provider-reliability-tracker.md +2581 -0
- package/package.json +109 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry Infrastructure Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for temporary container registry that makes local images
|
|
5
|
+
* accessible to Akash providers during deployment.
|
|
6
|
+
*
|
|
7
|
+
* @module utils/registry/types
|
|
8
|
+
*/
|
|
9
|
+
import type { AkashDeploymentProfile } from '../../types/profiles.js';
|
|
10
|
+
/**
|
|
11
|
+
* Registry context returned by setupRegistryIfNeeded
|
|
12
|
+
*
|
|
13
|
+
* Contains a transformed deployment profile where local image references have been
|
|
14
|
+
* replaced with public registry URLs, plus a cleanup function to shut down the
|
|
15
|
+
* temporary registry after deployment completes.
|
|
16
|
+
*
|
|
17
|
+
* **Lifecycle:**
|
|
18
|
+
* 1. Call `setupRegistryIfNeeded()` → Returns `RegistryContext`
|
|
19
|
+
* 2. Use `deployableProfile` for deployment
|
|
20
|
+
* 3. After deployment, call `cleanup()` to shut down registry
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const ctx = await setupRegistryIfNeeded(profile, logger);
|
|
25
|
+
*
|
|
26
|
+
* try {
|
|
27
|
+
* await deployToAkash({
|
|
28
|
+
* loadedProfile: {
|
|
29
|
+
* profile: ctx.deployableProfile // Use transformed profile
|
|
30
|
+
* }
|
|
31
|
+
* });
|
|
32
|
+
* } finally {
|
|
33
|
+
* await ctx.cleanup(); // Always cleanup
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export interface RegistryContext {
|
|
38
|
+
/**
|
|
39
|
+
* Profile ready for deployment to Akash
|
|
40
|
+
*
|
|
41
|
+
* Local images have been replaced with public registry URLs.
|
|
42
|
+
* For example:
|
|
43
|
+
* - Original: `{ image: "my-app" }`
|
|
44
|
+
* - Deployable: `{ image: "abc123.serveo.net/my-app:latest", credentials: {...} }`
|
|
45
|
+
*
|
|
46
|
+
* If no local images were detected, this will be the same as the original profile.
|
|
47
|
+
*/
|
|
48
|
+
readonly deployableProfile: AkashDeploymentProfile;
|
|
49
|
+
/**
|
|
50
|
+
* Cleanup function to call after deployment
|
|
51
|
+
*
|
|
52
|
+
* Shuts down the temporary registry. Should be called after Akash providers
|
|
53
|
+
* have successfully pulled the images (containers are running).
|
|
54
|
+
*
|
|
55
|
+
* **Important:** Always call this in a finally block to ensure cleanup happens
|
|
56
|
+
* even if deployment fails.
|
|
57
|
+
*
|
|
58
|
+
* If no registry was started (no local images), this is a no-op function.
|
|
59
|
+
*/
|
|
60
|
+
cleanup: () => Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Configuration options for registry setup
|
|
64
|
+
*
|
|
65
|
+
* Controls how the temporary registry is started and exposed publicly.
|
|
66
|
+
*/
|
|
67
|
+
export interface RegistryOptions {
|
|
68
|
+
/**
|
|
69
|
+
* Skip registry setup and assume images are in remote registries
|
|
70
|
+
*
|
|
71
|
+
* When true, no temporary registry is started regardless of whether local
|
|
72
|
+
* images are detected. Use this when you've manually pushed all images to
|
|
73
|
+
* Docker Hub, GHCR, or another registry.
|
|
74
|
+
*
|
|
75
|
+
* **Warning:** If set to true but images aren't actually in a remote registry,
|
|
76
|
+
* deployment will fail when providers try to pull them.
|
|
77
|
+
*
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
useRemoteRegistry?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Container engine to use for image operations
|
|
83
|
+
*
|
|
84
|
+
* Used for checking if images exist locally and pushing them to the registry.
|
|
85
|
+
*
|
|
86
|
+
* @default 'docker'
|
|
87
|
+
*/
|
|
88
|
+
containerEngine?: 'docker' | 'podman';
|
|
89
|
+
/**
|
|
90
|
+
* Tunnel service to expose registry publicly
|
|
91
|
+
*
|
|
92
|
+
* The temporary registry runs on localhost and needs to be exposed publicly
|
|
93
|
+
* so Akash providers can pull images. Choose a tunnel service:
|
|
94
|
+
*
|
|
95
|
+
* - **ngrok**: Reliable, requires auth token for extended sessions
|
|
96
|
+
* - **serveo**: Free, no signup, but less reliable
|
|
97
|
+
* - **bore**: Modern alternative, requires bore.pub service
|
|
98
|
+
*
|
|
99
|
+
* @default 'serveo'
|
|
100
|
+
*/
|
|
101
|
+
tunnelService?: 'ngrok' | 'serveo' | 'bore';
|
|
102
|
+
/**
|
|
103
|
+
* How long to keep registry running before auto-shutdown (milliseconds)
|
|
104
|
+
*
|
|
105
|
+
* Provides a safety net in case cleanup() isn't called. The registry will
|
|
106
|
+
* automatically shut down after this duration.
|
|
107
|
+
*
|
|
108
|
+
* @default 600000 (10 minutes)
|
|
109
|
+
*/
|
|
110
|
+
registryDuration?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Enable automatic shutdown when downloads complete
|
|
113
|
+
*
|
|
114
|
+
* When true, the registry monitors download activity and automatically shuts
|
|
115
|
+
* down once all images have been pulled. This is more efficient than waiting
|
|
116
|
+
* for the duration timeout.
|
|
117
|
+
*
|
|
118
|
+
* @default true
|
|
119
|
+
*/
|
|
120
|
+
autoShutdown?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Authentication token for tunnel service
|
|
123
|
+
*
|
|
124
|
+
* Required for ngrok. Optional for other services depending on their features.
|
|
125
|
+
*
|
|
126
|
+
* **Environment variable:** Can also be set via NGROK_AUTH_TOKEN
|
|
127
|
+
*
|
|
128
|
+
* @default undefined
|
|
129
|
+
*/
|
|
130
|
+
tunnelAuthToken?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Region for tunnel service
|
|
133
|
+
*
|
|
134
|
+
* For ngrok: 'us', 'eu', 'ap', 'au', 'sa', 'jp', 'in'
|
|
135
|
+
*
|
|
136
|
+
* **Environment variable:** Can also be set via NGROK_REGION
|
|
137
|
+
*
|
|
138
|
+
* @default undefined (uses tunnel service default)
|
|
139
|
+
*/
|
|
140
|
+
tunnelRegion?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Protocol for tunnel
|
|
143
|
+
*
|
|
144
|
+
* @default 'http'
|
|
145
|
+
*/
|
|
146
|
+
tunnelProtocol?: 'http' | 'https';
|
|
147
|
+
/**
|
|
148
|
+
* Custom subdomain for tunnel
|
|
149
|
+
*
|
|
150
|
+
* May require paid plan depending on tunnel service.
|
|
151
|
+
*
|
|
152
|
+
* @default undefined (random subdomain assigned)
|
|
153
|
+
*/
|
|
154
|
+
tunnelSubdomain?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Port for local registry server
|
|
157
|
+
*
|
|
158
|
+
* @default 3000
|
|
159
|
+
*/
|
|
160
|
+
port?: number;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Container mapping that tracks original image to registry URL transformation
|
|
164
|
+
*
|
|
165
|
+
* Internal type used by TemporaryContainerRegistryManager to track how images
|
|
166
|
+
* are transformed during the registry setup process.
|
|
167
|
+
*/
|
|
168
|
+
export interface ContainerMapping {
|
|
169
|
+
/** Original image name from agent.json (e.g., "my-app" or "my-app:latest") */
|
|
170
|
+
originalImage: string;
|
|
171
|
+
/** Service name from profile (e.g., "frontend", "api") */
|
|
172
|
+
serviceName: string;
|
|
173
|
+
/** Full registry URL with credentials host (e.g., "temp-registry.serveo.net/my-app:latest") */
|
|
174
|
+
registryUrl: string;
|
|
175
|
+
/** Repository name extracted from image (e.g., "my-app") */
|
|
176
|
+
repoName: string;
|
|
177
|
+
/** Image tag (e.g., "latest", "v1.0.0") */
|
|
178
|
+
imageTag: string;
|
|
179
|
+
/** Sanitized alias used in registry (e.g., "my-app") */
|
|
180
|
+
actualAlias: string;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Registry credentials for SDL generation
|
|
184
|
+
*
|
|
185
|
+
* Credentials required for Akash providers to authenticate with the temporary registry.
|
|
186
|
+
* These are automatically added to the SDL services section.
|
|
187
|
+
*/
|
|
188
|
+
export interface RegistryCredentials {
|
|
189
|
+
/** Registry host without protocol (e.g., "abc123.serveo.net") */
|
|
190
|
+
host: string;
|
|
191
|
+
/** Username for registry authentication */
|
|
192
|
+
username: string;
|
|
193
|
+
/** Password for registry authentication */
|
|
194
|
+
password: string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Registry information from container registry instance
|
|
198
|
+
*
|
|
199
|
+
* Internal type containing connection details for the running registry.
|
|
200
|
+
*/
|
|
201
|
+
export interface RegistryInfo {
|
|
202
|
+
/** Primary registry URL (tunnel URL if available, otherwise local) */
|
|
203
|
+
url: string;
|
|
204
|
+
/** Local registry URL (always present - always starts locally) */
|
|
205
|
+
localUrl: string;
|
|
206
|
+
/** Tunnel URL (optional - tunneling might fail) */
|
|
207
|
+
tunnelUrl?: string;
|
|
208
|
+
/** Authentication credentials (optional - may not be required) */
|
|
209
|
+
credentials?: {
|
|
210
|
+
username: string;
|
|
211
|
+
password: string;
|
|
212
|
+
accessKey: string;
|
|
213
|
+
secretKey: string;
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Registry URL components including local and tunnel endpoints
|
|
218
|
+
*
|
|
219
|
+
* Internal type used for managing both local and public registry URLs.
|
|
220
|
+
*/
|
|
221
|
+
export interface RegistryUrls {
|
|
222
|
+
/** Local URL with protocol (e.g., "http://localhost:3000") */
|
|
223
|
+
localUrl: string;
|
|
224
|
+
/** Local domain without protocol (e.g., "localhost:3000") */
|
|
225
|
+
localDomain: string;
|
|
226
|
+
/** Tunnel URL with protocol (e.g., "https://abc123.serveo.net") or null */
|
|
227
|
+
tunnelUrl: string | null;
|
|
228
|
+
/** Tunnel domain without protocol (e.g., "abc123.serveo.net") or null */
|
|
229
|
+
tunnelDomain: string | null;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Container information returned by the registry
|
|
233
|
+
*
|
|
234
|
+
* Represents a container that has been added to the temporary registry.
|
|
235
|
+
* The alias is the sanitized name used to reference the container in the registry.
|
|
236
|
+
*/
|
|
237
|
+
export interface ContainerInfo {
|
|
238
|
+
/** Sanitized container alias used in the registry (e.g., "my-app") */
|
|
239
|
+
alias: string;
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/registry/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;IAEnD;;;;;;;;;;OAUG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;;OAWG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAEtC;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAE5C;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAElC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8EAA8E;IAC9E,aAAa,EAAE,MAAM,CAAC;IAEtB,0DAA0D;IAC1D,WAAW,EAAE,MAAM,CAAC;IAEpB,+FAA+F;IAC/F,WAAW,EAAE,MAAM,CAAC;IAEpB,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IAEjB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IAEjB,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IAEb,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IAEjB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAC;IAEZ,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;IAEjB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,kEAAkE;IAClE,WAAW,CAAC,EAAE;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;IAEjB,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAC;IAEpB,2EAA2E;IAC3E,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB,yEAAyE;IACzE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry Infrastructure Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for temporary container registry that makes local images
|
|
5
|
+
* accessible to Akash providers during deployment.
|
|
6
|
+
*
|
|
7
|
+
* @module utils/registry/types
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/registry/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
package/docs/EXAMPLES.md
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# deploy-ability Examples
|
|
2
|
+
|
|
3
|
+
Detailed examples for various use cases.
|
|
4
|
+
|
|
5
|
+
## 3. CI/CD Automation
|
|
6
|
+
|
|
7
|
+
**Scenario:** Automated deployments from GitHub Actions, GitLab CI, or other CI/CD platforms.
|
|
8
|
+
|
|
9
|
+
### GitHub Actions Example
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
// .github/workflows/deploy.ts
|
|
13
|
+
import { createWalletContextFromSigner, deployToAkash } from 'deploy-ability';
|
|
14
|
+
import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing';
|
|
15
|
+
|
|
16
|
+
async function deploy() {
|
|
17
|
+
const environment = process.env.GITHUB_REF_NAME; // branch name
|
|
18
|
+
const profile = environment === 'main' ? 'production' : 'staging';
|
|
19
|
+
const network = environment === 'main' ? 'mainnet' : 'testnet';
|
|
20
|
+
|
|
21
|
+
console.log(`Deploying ${environment} to ${network}...`);
|
|
22
|
+
|
|
23
|
+
// Create signer from GitHub Secret
|
|
24
|
+
const mnemonic = process.env.AKASH_DEPLOYMENT_MNEMONIC!;
|
|
25
|
+
const signer = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, {
|
|
26
|
+
prefix: 'akash'
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Create wallet context
|
|
30
|
+
const wallet = await createWalletContextFromSigner(signer, network);
|
|
31
|
+
|
|
32
|
+
if (!wallet.success) {
|
|
33
|
+
console.error('Wallet setup failed:', wallet.error.message);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Deploy!
|
|
38
|
+
const result = await deployToAkash({
|
|
39
|
+
wallet: wallet.data,
|
|
40
|
+
projectRoot: process.cwd(),
|
|
41
|
+
profile,
|
|
42
|
+
network
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
if (result.success) {
|
|
46
|
+
console.log(`Deployed successfully!`);
|
|
47
|
+
console.log(` DSEQ: ${result.data.dseq}`);
|
|
48
|
+
console.log(` Provider: ${result.data.providerUri}`);
|
|
49
|
+
console.log(` Console: https://console.akash.network/deployments/${result.data.dseq}`);
|
|
50
|
+
|
|
51
|
+
// Post to Slack/Discord
|
|
52
|
+
await notify({
|
|
53
|
+
environment,
|
|
54
|
+
dseq: result.data.dseq,
|
|
55
|
+
url: `https://console.akash.network/deployments/${result.data.dseq}`
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
process.exit(0);
|
|
59
|
+
} else {
|
|
60
|
+
console.error('Deployment failed:', result.error.message);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
deploy().catch(err => {
|
|
66
|
+
console.error('Fatal error:', err);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### GitHub Actions Workflow
|
|
72
|
+
|
|
73
|
+
```yaml
|
|
74
|
+
# .github/workflows/deploy.yml
|
|
75
|
+
name: Deploy to Akash
|
|
76
|
+
|
|
77
|
+
on:
|
|
78
|
+
push:
|
|
79
|
+
branches: [main, staging]
|
|
80
|
+
|
|
81
|
+
jobs:
|
|
82
|
+
deploy:
|
|
83
|
+
runs-on: ubuntu-latest
|
|
84
|
+
steps:
|
|
85
|
+
- uses: actions/checkout@v3
|
|
86
|
+
|
|
87
|
+
- name: Setup Node.js
|
|
88
|
+
uses: actions/setup-node@v3
|
|
89
|
+
with:
|
|
90
|
+
node-version: '20'
|
|
91
|
+
|
|
92
|
+
- name: Install dependencies
|
|
93
|
+
run: npm ci
|
|
94
|
+
|
|
95
|
+
- name: Deploy to Akash
|
|
96
|
+
env:
|
|
97
|
+
AKASH_DEPLOYMENT_MNEMONIC: ${{ secrets.AKASH_DEPLOYMENT_MNEMONIC }}
|
|
98
|
+
run: npx tsx .github/workflows/deploy.ts
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 4. API Servers
|
|
104
|
+
|
|
105
|
+
**Scenario:** Deployment-as-a-Service - users trigger deployments via REST API.
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import express from 'express';
|
|
109
|
+
import {
|
|
110
|
+
deployToAkash,
|
|
111
|
+
createWalletContextFromSigner,
|
|
112
|
+
DeploymentError
|
|
113
|
+
} from 'deploy-ability';
|
|
114
|
+
import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing';
|
|
115
|
+
|
|
116
|
+
const app = express();
|
|
117
|
+
app.use(express.json());
|
|
118
|
+
|
|
119
|
+
// Service wallet (pays for deployments)
|
|
120
|
+
let serviceWallet: WalletContext;
|
|
121
|
+
|
|
122
|
+
async function initializeServiceWallet() {
|
|
123
|
+
const mnemonic = process.env.SERVICE_WALLET_MNEMONIC!;
|
|
124
|
+
const signer = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, {
|
|
125
|
+
prefix: 'akash'
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const result = await createWalletContextFromSigner(signer, 'mainnet');
|
|
129
|
+
if (!result.success) throw result.error;
|
|
130
|
+
|
|
131
|
+
serviceWallet = result.data;
|
|
132
|
+
console.log('Service wallet initialized:', serviceWallet.address);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
app.post('/api/deployments', async (req, res) => {
|
|
136
|
+
const { projectPath, profile, network } = req.body;
|
|
137
|
+
|
|
138
|
+
// Validate request
|
|
139
|
+
if (!projectPath || !profile) {
|
|
140
|
+
return res.status(400).json({
|
|
141
|
+
error: 'Missing required fields: projectPath, profile'
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
try {
|
|
146
|
+
// Deploy using service wallet
|
|
147
|
+
const result = await deployToAkash({
|
|
148
|
+
wallet: serviceWallet,
|
|
149
|
+
projectRoot: projectPath,
|
|
150
|
+
profile,
|
|
151
|
+
network: network || 'mainnet'
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
if (result.success) {
|
|
155
|
+
res.json({
|
|
156
|
+
success: true,
|
|
157
|
+
deployment: {
|
|
158
|
+
dseq: result.data.dseq,
|
|
159
|
+
provider: result.data.provider,
|
|
160
|
+
providerUri: result.data.providerUri,
|
|
161
|
+
consoleUrl: `https://console.akash.network/deployments/${result.data.dseq}`
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
} else {
|
|
165
|
+
res.status(500).json({
|
|
166
|
+
success: false,
|
|
167
|
+
error: result.error.message,
|
|
168
|
+
code: result.error.code
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
} catch (error) {
|
|
172
|
+
console.error('Deployment error:', error);
|
|
173
|
+
|
|
174
|
+
if (error instanceof DeploymentError) {
|
|
175
|
+
res.status(400).json({
|
|
176
|
+
success: false,
|
|
177
|
+
error: error.message,
|
|
178
|
+
code: error.code,
|
|
179
|
+
context: error.context
|
|
180
|
+
});
|
|
181
|
+
} else {
|
|
182
|
+
res.status(500).json({
|
|
183
|
+
success: false,
|
|
184
|
+
error: 'Internal server error'
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// Initialize and start server
|
|
191
|
+
initializeServiceWallet().then(() => {
|
|
192
|
+
app.listen(3000, () => {
|
|
193
|
+
console.log('Deployment API running on http://localhost:3000');
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
## Examples
|
|
200
|
+
|
|
201
|
+
### Complete Deployment Script
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
import {
|
|
205
|
+
connectWallet,
|
|
206
|
+
createSigningClient,
|
|
207
|
+
ensureCertificate,
|
|
208
|
+
deployToAkash
|
|
209
|
+
} from 'deploy-ability';
|
|
210
|
+
import QRCode from 'qrcode-terminal';
|
|
211
|
+
|
|
212
|
+
async function main() {
|
|
213
|
+
console.log('Deploying to Akash Network...\n');
|
|
214
|
+
|
|
215
|
+
// 1. Connect wallet
|
|
216
|
+
console.log('Step 1: Connect Keplr Wallet');
|
|
217
|
+
const walletResult = await connectWallet(
|
|
218
|
+
'your-project-id',
|
|
219
|
+
'mainnet',
|
|
220
|
+
{
|
|
221
|
+
onUriGenerated: (uri) => {
|
|
222
|
+
QRCode.generate(uri, { small: true });
|
|
223
|
+
console.log('Scan QR code with Keplr mobile app');
|
|
224
|
+
console.log('Waiting for approval...');
|
|
225
|
+
},
|
|
226
|
+
timeoutMs: 120000
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
if (!walletResult.success) {
|
|
231
|
+
console.error('Wallet connection failed:', walletResult.error.message);
|
|
232
|
+
process.exit(1);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
console.log(`Connected: ${walletResult.data.address}\n`);
|
|
236
|
+
|
|
237
|
+
// 2. Create signing client
|
|
238
|
+
console.log('Step 2: Connect to Akash Blockchain');
|
|
239
|
+
const clientResult = await createSigningClient(walletResult.data, 'mainnet');
|
|
240
|
+
|
|
241
|
+
if (!clientResult.success) {
|
|
242
|
+
console.error('Client creation failed:', clientResult.error.message);
|
|
243
|
+
process.exit(1);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
console.log('Connected to Akash RPC\n');
|
|
247
|
+
|
|
248
|
+
// 3. Ensure certificate
|
|
249
|
+
console.log('Step 3: Setup Certificate');
|
|
250
|
+
const certResult = await ensureCertificate(
|
|
251
|
+
walletResult.data,
|
|
252
|
+
'mainnet',
|
|
253
|
+
clientResult.data.client
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
if (!certResult.success) {
|
|
257
|
+
console.error('Certificate setup failed:', certResult.error.message);
|
|
258
|
+
process.exit(1);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
console.log('Certificate ready\n');
|
|
262
|
+
|
|
263
|
+
// 4. Deploy!
|
|
264
|
+
console.log('Step 4: Deploy to Akash');
|
|
265
|
+
const result = await deployToAkash({
|
|
266
|
+
wallet: walletResult.data,
|
|
267
|
+
certificate: certResult.data,
|
|
268
|
+
projectRoot: process.cwd(),
|
|
269
|
+
profile: 'production',
|
|
270
|
+
network: 'mainnet'
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
if (!result.success) {
|
|
274
|
+
console.error('Deployment failed:', result.error.message);
|
|
275
|
+
process.exit(1);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Success!
|
|
279
|
+
console.log('\nDeployment Successful!\n');
|
|
280
|
+
console.log('Deployment Details:');
|
|
281
|
+
console.log(` DSEQ: ${result.data.dseq}`);
|
|
282
|
+
console.log(` Provider: ${result.data.provider}`);
|
|
283
|
+
console.log(` Provider URI: ${result.data.providerUri}`);
|
|
284
|
+
console.log(` Console: https://console.akash.network/deployments/${result.data.dseq}`);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
main().catch(err => {
|
|
288
|
+
console.error('Fatal error:', err);
|
|
289
|
+
process.exit(1);
|
|
290
|
+
});
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
---
|