underpost 2.8.79 → 2.8.84
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/.github/workflows/ghpkg.yml +22 -20
- package/.github/workflows/npmpkg.yml +15 -10
- package/.github/workflows/pwa-microservices-template.page.yml +12 -3
- package/.github/workflows/pwa-microservices-template.test.yml +20 -17
- package/.vscode/extensions.json +2 -3
- package/.vscode/settings.json +2 -42
- package/Dockerfile +14 -33
- package/README.md +43 -25
- package/bin/db.js +1 -0
- package/bin/deploy.js +104 -797
- package/bin/file.js +18 -1
- package/bin/vs.js +18 -3
- package/cli.md +367 -207
- package/conf.js +4 -0
- package/docker-compose.yml +1 -1
- package/manifests/deployment/dd-template-development/deployment.yaml +167 -0
- package/manifests/deployment/dd-template-development/proxy.yaml +46 -0
- package/manifests/deployment/tensorflow/tf-gpu-test.yaml +65 -0
- package/manifests/lxd/lxd-admin-profile.yaml +1 -0
- package/manifests/lxd/lxd-preseed.yaml +9 -37
- package/manifests/lxd/underpost-setup.sh +98 -81
- package/manifests/maas/device-scan.sh +43 -0
- package/manifests/maas/gpu-diag.sh +19 -0
- package/manifests/maas/lxd-preseed.yaml +32 -0
- package/manifests/maas/maas-setup.sh +120 -0
- package/manifests/maas/nat-iptables.sh +26 -0
- package/manifests/maas/snap-clean.sh +26 -0
- package/manifests/mariadb/statefulset.yaml +2 -1
- package/manifests/mariadb/storage-class.yaml +10 -0
- package/manifests/mongodb-4.4/service-deployment.yaml +2 -2
- package/manifests/valkey/service.yaml +3 -9
- package/manifests/valkey/statefulset.yaml +10 -12
- package/package.json +1 -1
- package/src/cli/baremetal.js +1280 -0
- package/src/cli/cloud-init.js +537 -0
- package/src/cli/cluster.js +506 -243
- package/src/cli/deploy.js +41 -3
- package/src/cli/env.js +2 -2
- package/src/cli/image.js +57 -9
- package/src/cli/index.js +271 -232
- package/src/cli/lxd.js +314 -81
- package/src/cli/repository.js +7 -4
- package/src/cli/run.js +262 -0
- package/src/cli/test.js +1 -1
- package/src/index.js +28 -1
- package/src/runtime/lampp/Dockerfile +41 -47
- package/src/server/conf.js +61 -0
- package/src/server/logger.js +3 -3
- package/src/server/process.js +16 -19
- package/src/server/runtime.js +1 -6
- package/src/server/ssl.js +1 -12
- package/src/server/valkey.js +3 -3
- package/supervisord-openssh-server.conf +0 -5
package/src/cli/index.js
CHANGED
|
@@ -4,9 +4,11 @@ import Underpost from '../index.js';
|
|
|
4
4
|
import { getNpmRootPath, getUnderpostRootPath, loadConf } from '../server/conf.js';
|
|
5
5
|
import fs from 'fs-extra';
|
|
6
6
|
import { commitData } from '../client/components/core/CommonJs.js';
|
|
7
|
-
import { shellExec } from '../server/process.js';
|
|
8
7
|
import UnderpostLxd from './lxd.js';
|
|
8
|
+
import UnderpostBaremetal from './baremetal.js';
|
|
9
|
+
import UnderpostRun from './run.js';
|
|
9
10
|
|
|
11
|
+
// Load environment variables from .env file
|
|
10
12
|
const underpostRootPath = getUnderpostRootPath();
|
|
11
13
|
fs.existsSync(`${underpostRootPath}/.env`)
|
|
12
14
|
? dotenv.config({ path: `${underpostRootPath}/.env`, override: true })
|
|
@@ -14,338 +16,375 @@ fs.existsSync(`${underpostRootPath}/.env`)
|
|
|
14
16
|
|
|
15
17
|
const program = new Command();
|
|
16
18
|
|
|
19
|
+
// Set up the main program information
|
|
17
20
|
program.name('underpost').description(`underpost ci/cd cli ${Underpost.version}`).version(Underpost.version);
|
|
18
21
|
|
|
22
|
+
// 'new' command: Create a new project
|
|
19
23
|
program
|
|
20
24
|
.command('new')
|
|
21
|
-
.argument('<app-name>', '
|
|
22
|
-
.description('
|
|
25
|
+
.argument('<app-name>', 'The name of the application to create.')
|
|
26
|
+
.description('Initializes a new Underpost project with a predefined structure.')
|
|
23
27
|
.action(Underpost.repo.new);
|
|
24
28
|
|
|
29
|
+
// 'start' command: Start application servers, build pipelines, or services
|
|
25
30
|
program
|
|
26
31
|
.command('start')
|
|
27
|
-
.argument('<deploy-id>', '
|
|
28
|
-
.argument(
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
.argument('<deploy-id>', 'The unique identifier for the deployment configuration.')
|
|
33
|
+
.argument(
|
|
34
|
+
'[env]',
|
|
35
|
+
'Optional: The environment to start (e.g., "development", "production"). Defaults to "development".',
|
|
36
|
+
)
|
|
37
|
+
.option('--run', 'Starts application servers and monitors their health.')
|
|
38
|
+
.option('--build', 'Triggers the client-side application build process.')
|
|
31
39
|
.action(Underpost.start.callback)
|
|
32
|
-
.description('
|
|
40
|
+
.description('Initiates application servers, build pipelines, or other defined services based on the deployment ID.');
|
|
33
41
|
|
|
42
|
+
// 'clone' command: Clone a GitHub repository
|
|
34
43
|
program
|
|
35
44
|
.command('clone')
|
|
36
|
-
.argument(`<uri>`, 'e.g
|
|
37
|
-
.option('--bare', '
|
|
38
|
-
.option('-g8', '
|
|
39
|
-
.description('
|
|
45
|
+
.argument(`<uri>`, 'The URI of the GitHub repository (e.g., "username/repository").')
|
|
46
|
+
.option('--bare', 'Performs a bare clone, downloading only the .git files.')
|
|
47
|
+
.option('-g8', 'Uses the g8 repository extension for cloning.')
|
|
48
|
+
.description('Clones a specified GitHub repository into the current directory.')
|
|
40
49
|
.action(Underpost.repo.clone);
|
|
41
50
|
|
|
51
|
+
// 'pull' command: Pull updates from a GitHub repository
|
|
42
52
|
program
|
|
43
53
|
.command('pull')
|
|
44
|
-
.argument('<path>', '
|
|
45
|
-
.argument(`<uri>`, 'e.g
|
|
46
|
-
.description('
|
|
47
|
-
.option('-g8', '
|
|
54
|
+
.argument('<path>', 'The absolute or relative directory path where the repository is located.')
|
|
55
|
+
.argument(`<uri>`, 'The URI of the GitHub repository (e.g., "username/repository").')
|
|
56
|
+
.description('Pulls the latest changes from a specified GitHub repository.')
|
|
57
|
+
.option('-g8', 'Uses the g8 repository extension for pulling.')
|
|
48
58
|
.action(Underpost.repo.pull);
|
|
49
59
|
|
|
60
|
+
// 'cmt' command: Commit changes to a GitHub repository
|
|
50
61
|
program
|
|
51
62
|
.command('cmt')
|
|
52
|
-
.argument('<path>', '
|
|
53
|
-
.argument(`<commit-type>`, `Options: ${Object.keys(commitData)}
|
|
54
|
-
.argument(`[module-tag]`, 'Optional
|
|
55
|
-
.argument(`[message]`, 'Optional
|
|
56
|
-
.option('--empty', '
|
|
57
|
-
.option('--copy', '
|
|
58
|
-
.option('--info', '
|
|
59
|
-
.description('
|
|
63
|
+
.argument('<path>', 'The absolute or relative directory path of the repository.')
|
|
64
|
+
.argument(`<commit-type>`, `The type of commit to perform. Options: ${Object.keys(commitData).join(', ')}.`)
|
|
65
|
+
.argument(`[module-tag]`, 'Optional: Sets a specific module tag for the commit.')
|
|
66
|
+
.argument(`[message]`, 'Optional: Provides an additional custom message for the commit.')
|
|
67
|
+
.option('--empty', 'Allows committing with empty files.')
|
|
68
|
+
.option('--copy', 'Copies the generated commit message to the clipboard.')
|
|
69
|
+
.option('--info', 'Displays information about available commit types.')
|
|
70
|
+
.description('Manages commits to a GitHub repository, supporting various commit types and options.')
|
|
60
71
|
.action(Underpost.repo.commit);
|
|
61
72
|
|
|
73
|
+
// 'push' command: Push changes to a GitHub repository
|
|
62
74
|
program
|
|
63
75
|
.command('push')
|
|
64
|
-
.argument('<path>', '
|
|
65
|
-
.argument(`<uri>`, 'e.g
|
|
66
|
-
.option('-f', '
|
|
67
|
-
.option('-g8', '
|
|
68
|
-
.description('
|
|
76
|
+
.argument('<path>', 'The absolute or relative directory path of the repository.')
|
|
77
|
+
.argument(`<uri>`, 'The URI of the GitHub repository (e.g., "username/repository").')
|
|
78
|
+
.option('-f', 'Forces the push, overwriting the remote repository history.')
|
|
79
|
+
.option('-g8', 'Uses the g8 repository extension for pushing.')
|
|
80
|
+
.description('Pushes committed changes from a local repository to a remote GitHub repository.')
|
|
69
81
|
.action(Underpost.repo.push);
|
|
70
82
|
|
|
83
|
+
// 'env' command: Manage environment variables
|
|
71
84
|
program
|
|
72
85
|
.command('env')
|
|
73
|
-
.argument('<deploy-id>', `
|
|
74
|
-
.argument('[env]', 'Optional environment,
|
|
75
|
-
.description('
|
|
86
|
+
.argument('<deploy-id>', `The deployment configuration ID. Use 'clean' to restore default environment settings.`)
|
|
87
|
+
.argument('[env]', 'Optional: The environment to set (e.g., "production", "development"). Defaults to "production".')
|
|
88
|
+
.description('Sets environment variables and configurations related to a specific deployment ID.')
|
|
76
89
|
.action(loadConf);
|
|
77
90
|
|
|
91
|
+
// 'config' command: Manage Underpost configurations
|
|
78
92
|
program
|
|
79
93
|
.command('config')
|
|
80
|
-
.argument('operator', `Options: ${Object.keys(Underpost.env)}
|
|
81
|
-
.argument('[key]', '
|
|
82
|
-
.argument('[value]', '
|
|
83
|
-
.
|
|
84
|
-
.
|
|
94
|
+
.argument('operator', `The configuration operation to perform. Options: ${Object.keys(Underpost.env).join(', ')}.`)
|
|
95
|
+
.argument('[key]', 'Optional: The specific configuration key to manage.')
|
|
96
|
+
.argument('[value]', 'Optional: The value to set for the configuration key.')
|
|
97
|
+
.option('--plain', 'Prints the configuration value in plain text.')
|
|
98
|
+
.description(`Manages Underpost configurations using various operators.`)
|
|
99
|
+
.action((...args) => Underpost.env[args[0]](args[1], args[2], args[3]));
|
|
85
100
|
|
|
101
|
+
// 'root' command: Get npm root path
|
|
86
102
|
program
|
|
87
103
|
.command('root')
|
|
88
|
-
.description('
|
|
104
|
+
.description('Displays the root path of the npm installation.')
|
|
89
105
|
.action(() => console.log(getNpmRootPath()));
|
|
90
106
|
|
|
107
|
+
// 'cluster' command: Manage Kubernetes clusters
|
|
91
108
|
program
|
|
92
109
|
.command('cluster')
|
|
93
|
-
.argument('[pod-name]', 'Optional pod name
|
|
94
|
-
.option('--reset', `
|
|
95
|
-
.option('--mariadb', '
|
|
96
|
-
.option('--mysql', '
|
|
97
|
-
.option('--mongodb', '
|
|
98
|
-
.option('--postgresql', '
|
|
99
|
-
.option('--mongodb4', '
|
|
100
|
-
|
|
101
|
-
.option('--
|
|
102
|
-
.option('--
|
|
103
|
-
.option('--
|
|
104
|
-
.option('--
|
|
105
|
-
.option('--
|
|
106
|
-
.option('--
|
|
107
|
-
.option('--
|
|
108
|
-
.option('--
|
|
109
|
-
.option('--
|
|
110
|
-
.option('--
|
|
111
|
-
.option('--info-capacity', '
|
|
112
|
-
.option('--
|
|
113
|
-
.option('--
|
|
114
|
-
.option('--
|
|
115
|
-
.option('--config', '
|
|
116
|
-
.option('--worker', '
|
|
117
|
-
.option('--chown', '
|
|
110
|
+
.argument('[pod-name]', 'Optional: Filters information by a specific pod name.')
|
|
111
|
+
.option('--reset', `Deletes all clusters and prunes all related data and caches.`)
|
|
112
|
+
.option('--mariadb', 'Initializes the cluster with a MariaDB statefulset.')
|
|
113
|
+
.option('--mysql', 'Initializes the cluster with a MySQL statefulset.')
|
|
114
|
+
.option('--mongodb', 'Initializes the cluster with a MongoDB statefulset.')
|
|
115
|
+
.option('--postgresql', 'Initializes the cluster with a PostgreSQL statefulset.')
|
|
116
|
+
.option('--mongodb4', 'Initializes the cluster with a MongoDB 4.4 service.')
|
|
117
|
+
.option('--valkey', 'Initializes the cluster with a Valkey service.')
|
|
118
|
+
.option('--contour', 'Initializes the cluster with Project Contour base HTTPProxy and Envoy.')
|
|
119
|
+
.option('--cert-manager', "Initializes the cluster with a Let's Encrypt production ClusterIssuer.")
|
|
120
|
+
.option('--dedicated-gpu', 'Initializes the cluster with dedicated GPU base resources and environment settings.')
|
|
121
|
+
.option('--info', 'Retrieves information about all deployed Kubernetes objects.')
|
|
122
|
+
.option('--full', 'Initializes the cluster with all available statefulsets and services.')
|
|
123
|
+
.option('--ns-use <ns-name>', 'Switches the current Kubernetes context to the specified namespace.')
|
|
124
|
+
.option('--kubeadm', 'Initializes the cluster using kubeadm for control plane management.')
|
|
125
|
+
.option('--dev', 'Initializes a development-specific cluster configuration.')
|
|
126
|
+
.option('--list-pods', 'Displays detailed information about all pods.')
|
|
127
|
+
.option('--info-capacity', 'Displays the current total machine capacity information.')
|
|
128
|
+
.option('--info-capacity-pod', 'Displays the current machine capacity information per pod.')
|
|
129
|
+
.option('--pull-image', 'Sets an optional associated image to pull during initialization.')
|
|
130
|
+
.option('--init-host', 'Installs necessary Kubernetes node CLI tools (e.g., kind, kubeadm, docker, podman, helm).')
|
|
131
|
+
.option('--uninstall-host', 'Uninstalls all host components installed by init-host.')
|
|
132
|
+
.option('--config', 'Sets the base Kubernetes node configuration.')
|
|
133
|
+
.option('--worker', 'Sets the context for a worker node.')
|
|
134
|
+
.option('--chown', 'Sets the appropriate ownership for Kubernetes kubeconfig files.')
|
|
135
|
+
.option('--k3s', 'Initializes the cluster using K3s (Lightweight Kubernetes).')
|
|
118
136
|
.action(Underpost.cluster.init)
|
|
119
|
-
.description('
|
|
137
|
+
.description('Manages Kubernetes clusters, defaulting to Kind cluster initialization.');
|
|
120
138
|
|
|
139
|
+
// 'deploy' command: Manage deployments
|
|
121
140
|
program
|
|
122
141
|
.command('deploy')
|
|
123
|
-
.argument('[deploy-list]', '
|
|
124
|
-
.argument(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
.option('--
|
|
129
|
-
.option('--
|
|
130
|
-
.option('--
|
|
131
|
-
.option('--
|
|
132
|
-
.option('--
|
|
133
|
-
.option('--
|
|
134
|
-
.option(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
.option('--
|
|
139
|
-
.option('--
|
|
142
|
+
.argument('[deploy-list]', 'A comma-separated list of deployment IDs (e.g., "default-a,default-b").')
|
|
143
|
+
.argument(
|
|
144
|
+
'[env]',
|
|
145
|
+
'Optional: The environment for deployment (e.g., "development", "production"). Defaults to "development".',
|
|
146
|
+
)
|
|
147
|
+
.option('--remove', 'Deletes specified deployments and their associated services.')
|
|
148
|
+
.option('--sync', 'Synchronizes deployment environment variables, ports, and replica counts.')
|
|
149
|
+
.option('--info-router', 'Displays the current router structure and configuration.')
|
|
150
|
+
.option('--expose', 'Exposes services matching the provided deployment ID list.')
|
|
151
|
+
.option('--info-util', 'Displays useful `kubectl` utility management commands.')
|
|
152
|
+
.option('--cert', 'Resets TLS/SSL certificate secrets for deployments.')
|
|
153
|
+
.option(
|
|
154
|
+
'--build-manifest',
|
|
155
|
+
'Builds Kubernetes YAML manifests, including deployments, services, proxies, and secrets.',
|
|
156
|
+
)
|
|
157
|
+
.option('--dashboard-update', 'Updates dashboard instance data with the current router configuration.')
|
|
158
|
+
.option('--replicas <replicas>', 'Sets a custom number of replicas for deployments.')
|
|
159
|
+
.option('--versions <deployment-versions>', 'A comma-separated list of custom deployment versions.')
|
|
160
|
+
.option('--traffic <traffic-versions>', 'A comma-separated list of custom deployment traffic weights.')
|
|
161
|
+
.option('--disable-update-deployment', 'Disables updates to deployments.')
|
|
162
|
+
.option('--info-traffic', 'Retrieves traffic configuration from current resource deployments.')
|
|
163
|
+
.option('--kubeadm', 'Enables the kubeadm context for deployment operations.')
|
|
164
|
+
.option('--restore-hosts', 'Restores default `/etc/hosts` entries.')
|
|
140
165
|
.option(
|
|
141
166
|
'--rebuild-clients-bundle',
|
|
142
|
-
'Inside container,
|
|
167
|
+
'Inside the container, rebuilds client bundles (only static public or storage client files).',
|
|
143
168
|
)
|
|
144
|
-
.description('
|
|
169
|
+
.description('Manages application deployments, defaulting to deploying development pods.')
|
|
145
170
|
.action(Underpost.deploy.callback);
|
|
146
171
|
|
|
172
|
+
// 'secret' command: Manage secrets
|
|
147
173
|
program
|
|
148
174
|
.command('secret')
|
|
149
|
-
.argument('<platform>', `Options: ${Object.keys(Underpost.secret)}
|
|
150
|
-
.option('--init', '
|
|
151
|
-
.option('--create-from-file <path-env-file>', '
|
|
152
|
-
.option('--list', 'Lists secrets')
|
|
153
|
-
|
|
154
|
-
// .option('--create [secret-key] [secret-value]', 'Create secret key, with secret value')
|
|
155
|
-
.description(`Manage secrets`)
|
|
175
|
+
.argument('<platform>', `The secret management platform. Options: ${Object.keys(Underpost.secret).join(', ')}.`)
|
|
176
|
+
.option('--init', 'Initializes the secrets platform environment.')
|
|
177
|
+
.option('--create-from-file <path-env-file>', 'Creates secrets from a specified environment file.')
|
|
178
|
+
.option('--list', 'Lists all available secrets for the platform.')
|
|
179
|
+
.description(`Manages secrets for various platforms.`)
|
|
156
180
|
.action((...args) => {
|
|
157
181
|
if (args[1].createFromFile) return Underpost.secret[args[0]].createFromEnvFile(args[1].createFromFile);
|
|
158
182
|
if (args[1].list) return Underpost.secret[args[0]].list();
|
|
159
183
|
if (args[1].init) return Underpost.secret[args[0]].init();
|
|
160
184
|
});
|
|
161
185
|
|
|
186
|
+
// 'dockerfile-image-build' command: Build Docker images from Dockerfiles
|
|
162
187
|
program
|
|
163
188
|
.command('dockerfile-image-build')
|
|
164
|
-
.option('--path [path]', 'Dockerfile
|
|
165
|
-
.option('--image-name [image-name]', '
|
|
166
|
-
.option('--image-path [image-path]', '
|
|
167
|
-
.option('--dockerfile-name [dockerfile-name]', '
|
|
168
|
-
.option('--podman-save', '
|
|
169
|
-
.option('--kind-load', '
|
|
170
|
-
.option('--kubeadm-load', '
|
|
171
|
-
.option('--secrets', 'Dockerfile
|
|
172
|
-
.option('--secrets-path [secrets-path]', '
|
|
173
|
-
.option('--
|
|
174
|
-
.
|
|
189
|
+
.option('--path [path]', 'The path to the Dockerfile directory.')
|
|
190
|
+
.option('--image-name [image-name]', 'Sets a custom name for the Docker image.')
|
|
191
|
+
.option('--image-path [image-path]', 'Sets the output path for the tar image archive.')
|
|
192
|
+
.option('--dockerfile-name [dockerfile-name]', 'Sets a custom name for the Dockerfile.')
|
|
193
|
+
.option('--podman-save', 'Exports the built image as a tar file using Podman.')
|
|
194
|
+
.option('--kind-load', 'Imports the tar image into a Kind cluster.')
|
|
195
|
+
.option('--kubeadm-load', 'Imports the tar image into a Kubeadm cluster.')
|
|
196
|
+
.option('--secrets', 'Includes Dockerfile environment secrets during the build.')
|
|
197
|
+
.option('--secrets-path [secrets-path]', 'Specifies a custom path for Dockerfile environment secrets.')
|
|
198
|
+
.option('--reset', 'Performs a build without using the cache.')
|
|
199
|
+
.option('--k3s-load', 'Loads the image into a K3s cluster.')
|
|
200
|
+
.description(
|
|
201
|
+
'Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.',
|
|
202
|
+
)
|
|
175
203
|
.action(Underpost.image.dockerfile.build);
|
|
176
204
|
|
|
205
|
+
// 'dockerfile-pull-base-images' command: Pull base Dockerfile images
|
|
177
206
|
program
|
|
178
207
|
.command('dockerfile-pull-base-images')
|
|
179
|
-
.option('--path [path]', 'Dockerfile
|
|
180
|
-
.option('--kind-load', '
|
|
181
|
-
.option('--kubeadm-load', '
|
|
182
|
-
.option('--version', '
|
|
183
|
-
.
|
|
208
|
+
.option('--path [path]', 'The path to the Dockerfile directory.')
|
|
209
|
+
.option('--kind-load', 'Imports the pulled image into a Kind cluster.')
|
|
210
|
+
.option('--kubeadm-load', 'Imports the pulled image into a Kubeadm cluster.')
|
|
211
|
+
.option('--version', 'Sets a custom version for the base images.')
|
|
212
|
+
.option('--k3s-load', 'Loads the image into a K3s cluster.')
|
|
213
|
+
.description('Pulls required Underpost Dockerfile base images and optionally loads them into clusters.')
|
|
184
214
|
.action(Underpost.image.dockerfile.pullBaseImages);
|
|
185
215
|
|
|
216
|
+
// 'install' command: Fast import npm dependencies
|
|
186
217
|
program
|
|
187
218
|
.command('install')
|
|
188
|
-
.description('
|
|
219
|
+
.description('Quickly imports Underpost npm dependencies by copying them.')
|
|
189
220
|
.action(() => {
|
|
190
221
|
fs.copySync(`${underpostRootPath}/node_modules`, './node_modules');
|
|
191
222
|
});
|
|
192
223
|
|
|
224
|
+
// 'db' command: Manage databases
|
|
193
225
|
program
|
|
194
226
|
.command('db')
|
|
195
|
-
.argument('<deploy-list>', '
|
|
196
|
-
.option('--import', '
|
|
197
|
-
.option('--export', '
|
|
198
|
-
.option('--pod-name <pod-name>', 'Optional pod context')
|
|
199
|
-
.option('--collections <collections>', '
|
|
200
|
-
.option('--out-path <out-path>', '
|
|
201
|
-
.option('--drop', '
|
|
202
|
-
.option('--preserveUUID', '
|
|
203
|
-
.option('--git', '
|
|
204
|
-
.option('--hosts <hosts>', '
|
|
205
|
-
.option('--paths <paths>', '
|
|
206
|
-
.option('--ns <ns-name>', 'Optional
|
|
207
|
-
.description('
|
|
227
|
+
.argument('<deploy-list>', 'A comma-separated list of deployment IDs (e.g., "default-a,default-b").')
|
|
228
|
+
.option('--import', 'Imports container backups from specified repositories.')
|
|
229
|
+
.option('--export', 'Exports container backups to specified repositories.')
|
|
230
|
+
.option('--pod-name <pod-name>', 'Optional: Specifies the pod context for database operations.')
|
|
231
|
+
.option('--collections <collections>', 'A comma-separated list of database collections to operate on.')
|
|
232
|
+
.option('--out-path <out-path>', 'Specifies a custom output path for backups.')
|
|
233
|
+
.option('--drop', 'Drops the specified databases or collections.')
|
|
234
|
+
.option('--preserveUUID', 'Preserves UUIDs during database operations.')
|
|
235
|
+
.option('--git', 'Uploads database backups to GitHub.')
|
|
236
|
+
.option('--hosts <hosts>', 'A comma-separated list of database hosts.')
|
|
237
|
+
.option('--paths <paths>', 'A comma-separated list of paths for database files.')
|
|
238
|
+
.option('--ns <ns-name>', 'Optional: Specifies the namespace context for database operations.')
|
|
239
|
+
.description('Manages database operations, including import, export, and collection management.')
|
|
208
240
|
.action(Underpost.db.callback);
|
|
209
241
|
|
|
242
|
+
// 'script' command: Execute scripts
|
|
210
243
|
program
|
|
211
244
|
.command('script')
|
|
212
|
-
.argument('operator', `Options: ${Object.keys(Underpost.script)}
|
|
213
|
-
.argument('<script-name>', '
|
|
214
|
-
.argument('[script-value]', '
|
|
215
|
-
.option('--itc', '
|
|
216
|
-
.option('--itc-path', '
|
|
217
|
-
.option('--ns <ns-name>', '
|
|
218
|
-
.option('--pod-name <pod-name>')
|
|
245
|
+
.argument('operator', `The script operation to perform. Options: ${Object.keys(Underpost.script).join(', ')}.`)
|
|
246
|
+
.argument('<script-name>', 'The name of the script to execute.')
|
|
247
|
+
.argument('[script-value]', 'Optional: A literal command or a path to a script file.')
|
|
248
|
+
.option('--itc', 'Executes the script within the container execution context.')
|
|
249
|
+
.option('--itc-path', 'Specifies container path options for script execution.')
|
|
250
|
+
.option('--ns <ns-name>', 'Optional: Specifies the namespace context for script execution.')
|
|
251
|
+
.option('--pod-name <pod-name>', 'Optional: Specifies the pod name for script execution.')
|
|
219
252
|
.description(
|
|
220
|
-
'Supports a
|
|
253
|
+
'Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.',
|
|
221
254
|
)
|
|
222
255
|
.action((...args) => Underpost.script[args[0]](args[1], args[2], args[3]));
|
|
223
256
|
|
|
257
|
+
// 'cron' command: Manage cron jobs
|
|
224
258
|
program
|
|
225
259
|
.command('cron')
|
|
226
|
-
.argument('[deploy-list]', '
|
|
227
|
-
.argument(
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
260
|
+
.argument('[deploy-list]', 'A comma-separated list of deployment IDs (e.g., "default-a,default-b").')
|
|
261
|
+
.argument(
|
|
262
|
+
'[job-list]',
|
|
263
|
+
`A comma-separated list of job IDs. Options: ${Object.keys(Underpost.cron).join(
|
|
264
|
+
', ',
|
|
265
|
+
)}. Defaults to all available jobs.`,
|
|
266
|
+
)
|
|
267
|
+
.option('--itc', 'Executes cron jobs within the container execution context.')
|
|
268
|
+
.option('--init', 'Initializes cron jobs for the default deployment ID.')
|
|
269
|
+
.option('--git', 'Uploads cron job configurations to GitHub.')
|
|
270
|
+
.option('--dashboard-update', 'Updates dashboard cron data with the current job configurations.')
|
|
271
|
+
.description('Manages cron jobs, including initialization, execution, and configuration updates.')
|
|
233
272
|
.action(Underpost.cron.callback);
|
|
234
273
|
|
|
274
|
+
// 'fs' command: File storage management
|
|
235
275
|
program
|
|
236
276
|
.command('fs')
|
|
237
|
-
.argument('[path]', '
|
|
238
|
-
.option('--rm', '
|
|
239
|
-
.option('--git', '
|
|
240
|
-
.option('--recursive', '
|
|
241
|
-
.option('--deploy-id <deploy-id>', '
|
|
242
|
-
.option('--pull', '
|
|
243
|
-
.option('--force', '
|
|
244
|
-
.option('--storage-file-path <storage-file-path>', 'custom file storage path')
|
|
245
|
-
.description('
|
|
277
|
+
.argument('[path]', 'The absolute or relative directory path for file operations.')
|
|
278
|
+
.option('--rm', 'Removes the specified file.')
|
|
279
|
+
.option('--git', 'Displays current Git changes related to file storage.')
|
|
280
|
+
.option('--recursive', 'Uploads files recursively from the specified path.')
|
|
281
|
+
.option('--deploy-id <deploy-id>', 'Specifies the deployment configuration ID for file operations.')
|
|
282
|
+
.option('--pull', 'Downloads the specified file.')
|
|
283
|
+
.option('--force', 'Forces the action, overriding any warnings or conflicts.')
|
|
284
|
+
.option('--storage-file-path <storage-file-path>', 'Specifies a custom file storage path.')
|
|
285
|
+
.description('Manages file storage, defaulting to file upload operations.')
|
|
246
286
|
.action(Underpost.fs.callback);
|
|
247
287
|
|
|
288
|
+
// 'test' command: Manage tests
|
|
248
289
|
program
|
|
249
290
|
.command('test')
|
|
250
|
-
.argument('[deploy-list]', '
|
|
251
|
-
.description('
|
|
252
|
-
.option('--itc', '
|
|
253
|
-
.option('--sh', '
|
|
254
|
-
.option('--logs', '
|
|
255
|
-
.option('--pod-name <pod-name>')
|
|
256
|
-
.option('--pod-status <pod-status>')
|
|
257
|
-
.option('--kind-type <kind-type>')
|
|
291
|
+
.argument('[deploy-list]', 'A comma-separated list of deployment IDs (e.g., "default-a,default-b").')
|
|
292
|
+
.description('Manages and runs tests, defaulting to the current Underpost default test suite.')
|
|
293
|
+
.option('--itc', 'Executes tests within the container execution context.')
|
|
294
|
+
.option('--sh', 'Copies the container entrypoint shell command to the clipboard.')
|
|
295
|
+
.option('--logs', 'Displays container logs for test debugging.')
|
|
296
|
+
.option('--pod-name <pod-name>', 'Optional: Specifies the pod name for test execution.')
|
|
297
|
+
.option('--pod-status <pod-status>', 'Optional: Filters tests by pod status.')
|
|
298
|
+
.option('--kind-type <kind-type>', 'Optional: Specifies the Kind cluster type for tests.')
|
|
258
299
|
.action(Underpost.test.callback);
|
|
259
300
|
|
|
301
|
+
// 'monitor' command: Monitor health server
|
|
260
302
|
program
|
|
261
303
|
.command('monitor')
|
|
262
|
-
.argument('<deploy-id>', '
|
|
263
|
-
.argument(
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
.option('--
|
|
268
|
-
.option('--
|
|
269
|
-
.option('--
|
|
270
|
-
.
|
|
304
|
+
.argument('<deploy-id>', 'The deployment configuration ID to monitor.')
|
|
305
|
+
.argument(
|
|
306
|
+
'[env]',
|
|
307
|
+
'Optional: The environment to monitor (e.g., "development", "production"). Defaults to "development".',
|
|
308
|
+
)
|
|
309
|
+
.option('--ms-interval <ms-interval>', 'Sets a custom millisecond interval for monitoring checks.')
|
|
310
|
+
.option('--now', 'Executes the monitor script immediately.')
|
|
311
|
+
.option('--single', 'Disables recurrence, running the monitor script only once.')
|
|
312
|
+
.option('--replicas <replicas>', 'Sets a custom number of replicas for monitoring.')
|
|
313
|
+
.option('--type <type>', 'Sets a custom monitor type.')
|
|
314
|
+
.option('--sync', 'Synchronizes with current proxy deployments and traffic configurations.')
|
|
315
|
+
.description('Manages health server monitoring for specified deployments.')
|
|
271
316
|
.action(Underpost.monitor.callback);
|
|
272
317
|
|
|
318
|
+
// 'run' command: Run a script
|
|
319
|
+
program
|
|
320
|
+
.command('run')
|
|
321
|
+
.argument('<runner-id>', `The runner ID to run. Options: ${Object.keys(UnderpostRun.RUNNERS).join(', ')}.`)
|
|
322
|
+
.argument('[path]', 'The absolute or relative directory path where the script is located.')
|
|
323
|
+
.option('--command <command-array>', 'Array of commands to run.')
|
|
324
|
+
.option('--args <args-array>', 'Array of arguments to pass to the command.')
|
|
325
|
+
.option('--dev', 'Sets the development context environment for the script.')
|
|
326
|
+
.option('--pod-name <pod-name>', 'Optional: Specifies the pod name for test execution.')
|
|
327
|
+
.option('--volume-host-path <volume-host-path>', 'Optional: Specifies the volume host path for test execution.')
|
|
328
|
+
.option('--volume-mount-path <volume-mount-path>', 'Optional: Specifies the volume mount path for test execution.')
|
|
329
|
+
.option('--image-name <image-name>', 'Optional: Specifies the image name for test execution.')
|
|
330
|
+
.option('--container-name <container-name>', 'Optional: Specifies the container name for test execution.')
|
|
331
|
+
.option('--namespace <namespace>', 'Optional: Specifies the namespace for test execution.')
|
|
332
|
+
.description('Runs a script from the specified path.')
|
|
333
|
+
.action(UnderpostRun.API.callback);
|
|
334
|
+
|
|
335
|
+
// 'lxd' command: LXD management
|
|
273
336
|
program
|
|
274
337
|
.command('lxd')
|
|
275
|
-
.option('--init', '
|
|
276
|
-
.option('--reset', '
|
|
277
|
-
.option('--install', '
|
|
278
|
-
.option('--dev', '
|
|
279
|
-
.option('--
|
|
280
|
-
.option('--
|
|
281
|
-
.option('--
|
|
282
|
-
.option('--
|
|
283
|
-
.option('--
|
|
284
|
-
.option('--
|
|
285
|
-
.option('--
|
|
286
|
-
.option('--
|
|
338
|
+
.option('--init', 'Initializes LXD on the current machine.')
|
|
339
|
+
.option('--reset', 'Resets LXD on the current machine, deleting all configurations.')
|
|
340
|
+
.option('--install', 'Installs LXD on the current machine.')
|
|
341
|
+
.option('--dev', 'Sets the development context environment for LXD.')
|
|
342
|
+
.option('--create-virtual-network', 'Creates an LXD virtual network bridge.')
|
|
343
|
+
.option('--create-admin-profile', 'Creates an admin profile for LXD management.')
|
|
344
|
+
.option('--control', 'Sets the context for a control node VM.')
|
|
345
|
+
.option('--worker', 'Sets the context for a worker node VM.')
|
|
346
|
+
.option('--create-vm <vm-id>', 'Creates default virtual machines with the specified ID.')
|
|
347
|
+
.option('--init-vm <vm-id>', 'Retrieves the Underpost initialization script for the specified VM.')
|
|
348
|
+
.option('--info-vm <vm-id>', 'Retrieves all information about the specified VM.')
|
|
349
|
+
.option('--test <vm-id>', 'Tests the health, status, and network connectivity for a VM.')
|
|
350
|
+
.option('--root-size <gb-size>', 'Sets the root partition size (in GB) for the VM.')
|
|
351
|
+
.option('--k3s', 'Flag to indicate that the VM initialization is for a K3s cluster type.')
|
|
352
|
+
.option(
|
|
353
|
+
'--join-node <nodes>',
|
|
354
|
+
'A comma-separated list of worker and control nodes to join (e.g., "k8s-worker-1,k8s-control").',
|
|
355
|
+
)
|
|
287
356
|
.option(
|
|
288
357
|
'--expose <vm-name-ports>',
|
|
289
|
-
'
|
|
358
|
+
'Exposes specified ports on a VM (e.g., "k8s-control:80,443"). Multiple VM-port pairs can be comma-separated.',
|
|
359
|
+
)
|
|
360
|
+
.option(
|
|
361
|
+
'--delete-expose <vm-name-ports>',
|
|
362
|
+
'Removes exposed ports on a VM (e.g., "k8s-control:80,443"). Multiple VM-port pairs can be comma-separated.',
|
|
290
363
|
)
|
|
291
|
-
.
|
|
364
|
+
.option('--auto-expose-k8s-ports <vm-id>', 'Automatically exposes common Kubernetes ports for the specified VM.')
|
|
365
|
+
.description('Manages LXD containers and virtual machines.')
|
|
292
366
|
.action(UnderpostLxd.API.callback);
|
|
293
367
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
md +=
|
|
316
|
-
`
|
|
317
|
-
|
|
318
|
-
` +
|
|
319
|
-
'### `' +
|
|
320
|
-
o._name +
|
|
321
|
-
'` :' +
|
|
322
|
-
`
|
|
323
|
-
` +
|
|
324
|
-
'```\n ' +
|
|
325
|
-
shellExec(`node bin help ${o._name}`, { silent: true, stdout: true }) +
|
|
326
|
-
' \n```' +
|
|
327
|
-
`
|
|
328
|
-
`;
|
|
329
|
-
});
|
|
330
|
-
fs.writeFileSync(`./src/client/public/nexodev/docs/references/Command Line Interface.md`, md, 'utf8');
|
|
331
|
-
fs.writeFileSync(`./cli.md`, md, 'utf8');
|
|
332
|
-
const readmeSplit = `pwa-microservices-template</a>`;
|
|
333
|
-
const readme = fs.readFileSync(`./README.md`, 'utf8').split(readmeSplit);
|
|
334
|
-
fs.writeFileSync(
|
|
335
|
-
'./README.md',
|
|
336
|
-
readme[0] +
|
|
337
|
-
readmeSplit +
|
|
338
|
-
`
|
|
339
|
-
|
|
340
|
-
` +
|
|
341
|
-
baseOptions +
|
|
342
|
-
`
|
|
343
|
-
|
|
344
|
-
<a target="_top" href="https://github.com/underpostnet/pwa-microservices-template/blob/master/cli.md">See complete CLI Docs here.</a>
|
|
345
|
-
|
|
346
|
-
`,
|
|
347
|
-
'utf8',
|
|
348
|
-
);
|
|
349
|
-
};
|
|
368
|
+
// 'baremetal' command: Baremetal server management
|
|
369
|
+
program
|
|
370
|
+
.command('baremetal [workflow-id] [hostname] [ip-address]')
|
|
371
|
+
.option('--control-server-install', 'Installs the baremetal control server.')
|
|
372
|
+
.option('--control-server-uninstall', 'Uninstalls the baremetal control server.')
|
|
373
|
+
.option('--control-server-db-install', 'Installs up the database for the baremetal control server.')
|
|
374
|
+
.option('--control-server-db-uninstall', 'Uninstalls the database for the baremetal control server.')
|
|
375
|
+
.option('--commission', 'Init workflow for commissioning a physical machine.')
|
|
376
|
+
.option('--nfs-build', 'Builds an NFS root filesystem for a workflow id config architecture using QEMU emulation.')
|
|
377
|
+
.option('--nfs-mount', 'Mounts the NFS root filesystem for a workflow id config architecture.')
|
|
378
|
+
.option('--nfs-unmount', 'Unmounts the NFS root filesystem for a workflow id config architecture.')
|
|
379
|
+
.option('--nfs-sh', 'Copies QEMU emulation root entrypoint shell command to the clipboard.')
|
|
380
|
+
.option('--cloud-init-update', 'Updates cloud init for a workflow id config architecture.')
|
|
381
|
+
.option('--cloud-init-reset', 'Resets cloud init for a workflow id config architecture.')
|
|
382
|
+
.option('--logs <log-id>', 'Displays logs for log id: dhcp, cloud, machine, cloud-config.')
|
|
383
|
+
.option('--dev', 'Sets the development context environment for baremetal operations.')
|
|
384
|
+
.option('--ls', 'Lists available boot resources and machines.')
|
|
385
|
+
.description(
|
|
386
|
+
'Manages baremetal server operations, including installation, database setup, commissioning, and user management.',
|
|
387
|
+
)
|
|
388
|
+
.action(UnderpostBaremetal.API.callback);
|
|
350
389
|
|
|
351
|
-
export { program
|
|
390
|
+
export { program };
|