underpost 2.8.78 → 2.8.82
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 +23 -21
- package/.github/workflows/npmpkg.yml +16 -11
- package/.github/workflows/pwa-microservices-template.page.yml +12 -3
- package/.github/workflows/pwa-microservices-template.test.yml +20 -17
- package/.vscode/extensions.json +1 -2
- package/.vscode/settings.json +3 -0
- package/Dockerfile +14 -33
- package/README.md +25 -24
- package/bin/db.js +1 -0
- package/bin/deploy.js +91 -796
- package/bin/vs.js +10 -3
- package/cli.md +340 -191
- 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/lxd/lxd-admin-profile.yaml +17 -0
- package/manifests/lxd/lxd-preseed.yaml +30 -0
- package/manifests/lxd/underpost-setup.sh +163 -0
- package/manifests/maas/device-scan.sh +43 -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/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 +1248 -0
- package/src/cli/cloud-init.js +528 -0
- package/src/cli/cluster.js +459 -232
- package/src/cli/deploy.js +34 -10
- package/src/cli/env.js +2 -2
- package/src/cli/image.js +57 -9
- package/src/cli/index.js +256 -218
- package/src/cli/lxd.js +380 -4
- package/src/index.js +40 -14
- package/src/runtime/lampp/Dockerfile +41 -47
- package/src/server/conf.js +58 -0
- package/src/server/logger.js +3 -3
- 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
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import dotenv from 'dotenv';
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import Underpost from '../index.js';
|
|
4
|
-
import { getUnderpostRootPath, loadConf } from '../server/conf.js';
|
|
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
7
|
import { shellExec } from '../server/process.js';
|
|
8
8
|
import UnderpostLxd from './lxd.js';
|
|
9
|
+
import UnderpostBaremetal from './baremetal.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,321 +16,357 @@ 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
|
-
.option('--
|
|
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('--
|
|
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('--config', 'Sets the base Kubernetes node configuration.')
|
|
132
|
+
.option('--worker', 'Sets the context for a worker node.')
|
|
133
|
+
.option('--chown', 'Sets the appropriate ownership for Kubernetes kubeconfig files.')
|
|
134
|
+
.option('--k3s', 'Initializes the cluster using K3s (Lightweight Kubernetes).')
|
|
114
135
|
.action(Underpost.cluster.init)
|
|
115
|
-
.description('
|
|
136
|
+
.description('Manages Kubernetes clusters, defaulting to Kind cluster initialization.');
|
|
116
137
|
|
|
138
|
+
// 'deploy' command: Manage deployments
|
|
117
139
|
program
|
|
118
140
|
.command('deploy')
|
|
119
|
-
.argument('[deploy-list]', '
|
|
120
|
-
.argument(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
.option('--
|
|
125
|
-
.option('--
|
|
126
|
-
.option('--
|
|
127
|
-
.option('--
|
|
128
|
-
.option('--
|
|
129
|
-
.option('--
|
|
130
|
-
.option(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
.option('--
|
|
135
|
-
.option('--
|
|
141
|
+
.argument('[deploy-list]', 'A comma-separated list of deployment IDs (e.g., "default-a,default-b").')
|
|
142
|
+
.argument(
|
|
143
|
+
'[env]',
|
|
144
|
+
'Optional: The environment for deployment (e.g., "development", "production"). Defaults to "development".',
|
|
145
|
+
)
|
|
146
|
+
.option('--remove', 'Deletes specified deployments and their associated services.')
|
|
147
|
+
.option('--sync', 'Synchronizes deployment environment variables, ports, and replica counts.')
|
|
148
|
+
.option('--info-router', 'Displays the current router structure and configuration.')
|
|
149
|
+
.option('--expose', 'Exposes services matching the provided deployment ID list.')
|
|
150
|
+
.option('--info-util', 'Displays useful `kubectl` utility management commands.')
|
|
151
|
+
.option('--cert', 'Resets TLS/SSL certificate secrets for deployments.')
|
|
152
|
+
.option(
|
|
153
|
+
'--build-manifest',
|
|
154
|
+
'Builds Kubernetes YAML manifests, including deployments, services, proxies, and secrets.',
|
|
155
|
+
)
|
|
156
|
+
.option('--dashboard-update', 'Updates dashboard instance data with the current router configuration.')
|
|
157
|
+
.option('--replicas <replicas>', 'Sets a custom number of replicas for deployments.')
|
|
158
|
+
.option('--versions <deployment-versions>', 'A comma-separated list of custom deployment versions.')
|
|
159
|
+
.option('--traffic <traffic-versions>', 'A comma-separated list of custom deployment traffic weights.')
|
|
160
|
+
.option('--disable-update-deployment', 'Disables updates to deployments.')
|
|
161
|
+
.option('--info-traffic', 'Retrieves traffic configuration from current resource deployments.')
|
|
162
|
+
.option('--kubeadm', 'Enables the kubeadm context for deployment operations.')
|
|
163
|
+
.option('--restore-hosts', 'Restores default `/etc/hosts` entries.')
|
|
136
164
|
.option(
|
|
137
165
|
'--rebuild-clients-bundle',
|
|
138
|
-
'Inside container,
|
|
166
|
+
'Inside the container, rebuilds client bundles (only static public or storage client files).',
|
|
139
167
|
)
|
|
140
|
-
.description('
|
|
168
|
+
.description('Manages application deployments, defaulting to deploying development pods.')
|
|
141
169
|
.action(Underpost.deploy.callback);
|
|
142
170
|
|
|
171
|
+
// 'secret' command: Manage secrets
|
|
143
172
|
program
|
|
144
173
|
.command('secret')
|
|
145
|
-
.argument('<platform>', `Options: ${Object.keys(Underpost.secret)}
|
|
146
|
-
.option('--init', '
|
|
147
|
-
.option('--create-from-file <path-env-file>', '
|
|
148
|
-
.option('--list', 'Lists secrets')
|
|
149
|
-
|
|
150
|
-
// .option('--create [secret-key] [secret-value]', 'Create secret key, with secret value')
|
|
151
|
-
.description(`Manage secrets`)
|
|
174
|
+
.argument('<platform>', `The secret management platform. Options: ${Object.keys(Underpost.secret).join(', ')}.`)
|
|
175
|
+
.option('--init', 'Initializes the secrets platform environment.')
|
|
176
|
+
.option('--create-from-file <path-env-file>', 'Creates secrets from a specified environment file.')
|
|
177
|
+
.option('--list', 'Lists all available secrets for the platform.')
|
|
178
|
+
.description(`Manages secrets for various platforms.`)
|
|
152
179
|
.action((...args) => {
|
|
153
180
|
if (args[1].createFromFile) return Underpost.secret[args[0]].createFromEnvFile(args[1].createFromFile);
|
|
154
181
|
if (args[1].list) return Underpost.secret[args[0]].list();
|
|
155
182
|
if (args[1].init) return Underpost.secret[args[0]].init();
|
|
156
183
|
});
|
|
157
184
|
|
|
185
|
+
// 'dockerfile-image-build' command: Build Docker images from Dockerfiles
|
|
158
186
|
program
|
|
159
187
|
.command('dockerfile-image-build')
|
|
160
|
-
.option('--path [path]', 'Dockerfile
|
|
161
|
-
.option('--image-name [image-name]', '
|
|
162
|
-
.option('--image-path [image-path]', '
|
|
163
|
-
.option('--dockerfile-name [dockerfile-name]', '
|
|
164
|
-
.option('--podman-save', '
|
|
165
|
-
.option('--kind-load', '
|
|
166
|
-
.option('--kubeadm-load', '
|
|
167
|
-
.option('--secrets', 'Dockerfile
|
|
168
|
-
.option('--secrets-path [secrets-path]', '
|
|
169
|
-
.option('--
|
|
170
|
-
.
|
|
188
|
+
.option('--path [path]', 'The path to the Dockerfile directory.')
|
|
189
|
+
.option('--image-name [image-name]', 'Sets a custom name for the Docker image.')
|
|
190
|
+
.option('--image-path [image-path]', 'Sets the output path for the tar image archive.')
|
|
191
|
+
.option('--dockerfile-name [dockerfile-name]', 'Sets a custom name for the Dockerfile.')
|
|
192
|
+
.option('--podman-save', 'Exports the built image as a tar file using Podman.')
|
|
193
|
+
.option('--kind-load', 'Imports the tar image into a Kind cluster.')
|
|
194
|
+
.option('--kubeadm-load', 'Imports the tar image into a Kubeadm cluster.')
|
|
195
|
+
.option('--secrets', 'Includes Dockerfile environment secrets during the build.')
|
|
196
|
+
.option('--secrets-path [secrets-path]', 'Specifies a custom path for Dockerfile environment secrets.')
|
|
197
|
+
.option('--reset', 'Performs a build without using the cache.')
|
|
198
|
+
.option('--k3s-load', 'Loads the image into a K3s cluster.')
|
|
199
|
+
.description(
|
|
200
|
+
'Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.',
|
|
201
|
+
)
|
|
171
202
|
.action(Underpost.image.dockerfile.build);
|
|
172
203
|
|
|
204
|
+
// 'dockerfile-pull-base-images' command: Pull base Dockerfile images
|
|
173
205
|
program
|
|
174
206
|
.command('dockerfile-pull-base-images')
|
|
175
|
-
.option('--path [path]', 'Dockerfile
|
|
176
|
-
.option('--kind-load', '
|
|
177
|
-
.option('--kubeadm-load', '
|
|
178
|
-
.option('--version', '
|
|
179
|
-
.
|
|
207
|
+
.option('--path [path]', 'The path to the Dockerfile directory.')
|
|
208
|
+
.option('--kind-load', 'Imports the pulled image into a Kind cluster.')
|
|
209
|
+
.option('--kubeadm-load', 'Imports the pulled image into a Kubeadm cluster.')
|
|
210
|
+
.option('--version', 'Sets a custom version for the base images.')
|
|
211
|
+
.option('--k3s-load', 'Loads the image into a K3s cluster.')
|
|
212
|
+
.description('Pulls required Underpost Dockerfile base images and optionally loads them into clusters.')
|
|
180
213
|
.action(Underpost.image.dockerfile.pullBaseImages);
|
|
181
214
|
|
|
215
|
+
// 'install' command: Fast import npm dependencies
|
|
182
216
|
program
|
|
183
217
|
.command('install')
|
|
184
|
-
.description('
|
|
218
|
+
.description('Quickly imports Underpost npm dependencies by copying them.')
|
|
185
219
|
.action(() => {
|
|
186
220
|
fs.copySync(`${underpostRootPath}/node_modules`, './node_modules');
|
|
187
221
|
});
|
|
188
222
|
|
|
223
|
+
// 'db' command: Manage databases
|
|
189
224
|
program
|
|
190
225
|
.command('db')
|
|
191
|
-
.argument('<deploy-list>', '
|
|
192
|
-
.option('--import', '
|
|
193
|
-
.option('--export', '
|
|
194
|
-
.option('--pod-name <pod-name>', 'Optional pod context')
|
|
195
|
-
.option('--collections <collections>', '
|
|
196
|
-
.option('--out-path <out-path>', '
|
|
197
|
-
.option('--drop', '
|
|
198
|
-
.option('--preserveUUID', '
|
|
199
|
-
.option('--git', '
|
|
200
|
-
.option('--hosts <hosts>', '
|
|
201
|
-
.option('--paths <paths>', '
|
|
202
|
-
.option('--ns <ns-name>', 'Optional
|
|
203
|
-
.description('
|
|
226
|
+
.argument('<deploy-list>', 'A comma-separated list of deployment IDs (e.g., "default-a,default-b").')
|
|
227
|
+
.option('--import', 'Imports container backups from specified repositories.')
|
|
228
|
+
.option('--export', 'Exports container backups to specified repositories.')
|
|
229
|
+
.option('--pod-name <pod-name>', 'Optional: Specifies the pod context for database operations.')
|
|
230
|
+
.option('--collections <collections>', 'A comma-separated list of database collections to operate on.')
|
|
231
|
+
.option('--out-path <out-path>', 'Specifies a custom output path for backups.')
|
|
232
|
+
.option('--drop', 'Drops the specified databases or collections.')
|
|
233
|
+
.option('--preserveUUID', 'Preserves UUIDs during database operations.')
|
|
234
|
+
.option('--git', 'Uploads database backups to GitHub.')
|
|
235
|
+
.option('--hosts <hosts>', 'A comma-separated list of database hosts.')
|
|
236
|
+
.option('--paths <paths>', 'A comma-separated list of paths for database files.')
|
|
237
|
+
.option('--ns <ns-name>', 'Optional: Specifies the namespace context for database operations.')
|
|
238
|
+
.description('Manages database operations, including import, export, and collection management.')
|
|
204
239
|
.action(Underpost.db.callback);
|
|
205
240
|
|
|
241
|
+
// 'script' command: Execute scripts
|
|
206
242
|
program
|
|
207
243
|
.command('script')
|
|
208
|
-
.argument('operator', `Options: ${Object.keys(Underpost.script)}
|
|
209
|
-
.argument('<script-name>', '
|
|
210
|
-
.argument('[script-value]', '
|
|
211
|
-
.option('--itc', '
|
|
212
|
-
.option('--itc-path', '
|
|
213
|
-
.option('--ns <ns-name>', '
|
|
214
|
-
.option('--pod-name <pod-name>')
|
|
244
|
+
.argument('operator', `The script operation to perform. Options: ${Object.keys(Underpost.script).join(', ')}.`)
|
|
245
|
+
.argument('<script-name>', 'The name of the script to execute.')
|
|
246
|
+
.argument('[script-value]', 'Optional: A literal command or a path to a script file.')
|
|
247
|
+
.option('--itc', 'Executes the script within the container execution context.')
|
|
248
|
+
.option('--itc-path', 'Specifies container path options for script execution.')
|
|
249
|
+
.option('--ns <ns-name>', 'Optional: Specifies the namespace context for script execution.')
|
|
250
|
+
.option('--pod-name <pod-name>', 'Optional: Specifies the pod name for script execution.')
|
|
215
251
|
.description(
|
|
216
|
-
'Supports a
|
|
252
|
+
'Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.',
|
|
217
253
|
)
|
|
218
254
|
.action((...args) => Underpost.script[args[0]](args[1], args[2], args[3]));
|
|
219
255
|
|
|
256
|
+
// 'cron' command: Manage cron jobs
|
|
220
257
|
program
|
|
221
258
|
.command('cron')
|
|
222
|
-
.argument('[deploy-list]', '
|
|
223
|
-
.argument(
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
259
|
+
.argument('[deploy-list]', 'A comma-separated list of deployment IDs (e.g., "default-a,default-b").')
|
|
260
|
+
.argument(
|
|
261
|
+
'[job-list]',
|
|
262
|
+
`A comma-separated list of job IDs. Options: ${Object.keys(Underpost.cron).join(
|
|
263
|
+
', ',
|
|
264
|
+
)}. Defaults to all available jobs.`,
|
|
265
|
+
)
|
|
266
|
+
.option('--itc', 'Executes cron jobs within the container execution context.')
|
|
267
|
+
.option('--init', 'Initializes cron jobs for the default deployment ID.')
|
|
268
|
+
.option('--git', 'Uploads cron job configurations to GitHub.')
|
|
269
|
+
.option('--dashboard-update', 'Updates dashboard cron data with the current job configurations.')
|
|
270
|
+
.description('Manages cron jobs, including initialization, execution, and configuration updates.')
|
|
229
271
|
.action(Underpost.cron.callback);
|
|
230
272
|
|
|
273
|
+
// 'fs' command: File storage management
|
|
231
274
|
program
|
|
232
275
|
.command('fs')
|
|
233
|
-
.argument('[path]', '
|
|
234
|
-
.option('--rm', '
|
|
235
|
-
.option('--git', '
|
|
236
|
-
.option('--recursive', '
|
|
237
|
-
.option('--deploy-id <deploy-id>', '
|
|
238
|
-
.option('--pull', '
|
|
239
|
-
.option('--force', '
|
|
240
|
-
.option('--storage-file-path <storage-file-path>', 'custom file storage path')
|
|
241
|
-
.description('
|
|
276
|
+
.argument('[path]', 'The absolute or relative directory path for file operations.')
|
|
277
|
+
.option('--rm', 'Removes the specified file.')
|
|
278
|
+
.option('--git', 'Displays current Git changes related to file storage.')
|
|
279
|
+
.option('--recursive', 'Uploads files recursively from the specified path.')
|
|
280
|
+
.option('--deploy-id <deploy-id>', 'Specifies the deployment configuration ID for file operations.')
|
|
281
|
+
.option('--pull', 'Downloads the specified file.')
|
|
282
|
+
.option('--force', 'Forces the action, overriding any warnings or conflicts.')
|
|
283
|
+
.option('--storage-file-path <storage-file-path>', 'Specifies a custom file storage path.')
|
|
284
|
+
.description('Manages file storage, defaulting to file upload operations.')
|
|
242
285
|
.action(Underpost.fs.callback);
|
|
243
286
|
|
|
287
|
+
// 'test' command: Manage tests
|
|
244
288
|
program
|
|
245
289
|
.command('test')
|
|
246
|
-
.argument('[deploy-list]', '
|
|
247
|
-
.description('
|
|
248
|
-
.option('--itc', '
|
|
249
|
-
.option('--sh', '
|
|
250
|
-
.option('--logs', '
|
|
251
|
-
.option('--pod-name <pod-name>')
|
|
252
|
-
.option('--pod-status <pod-status>')
|
|
253
|
-
.option('--kind-type <kind-type>')
|
|
290
|
+
.argument('[deploy-list]', 'A comma-separated list of deployment IDs (e.g., "default-a,default-b").')
|
|
291
|
+
.description('Manages and runs tests, defaulting to the current Underpost default test suite.')
|
|
292
|
+
.option('--itc', 'Executes tests within the container execution context.')
|
|
293
|
+
.option('--sh', 'Copies the container entrypoint shell command to the clipboard.')
|
|
294
|
+
.option('--logs', 'Displays container logs for test debugging.')
|
|
295
|
+
.option('--pod-name <pod-name>', 'Optional: Specifies the pod name for test execution.')
|
|
296
|
+
.option('--pod-status <pod-status>', 'Optional: Filters tests by pod status.')
|
|
297
|
+
.option('--kind-type <kind-type>', 'Optional: Specifies the Kind cluster type for tests.')
|
|
254
298
|
.action(Underpost.test.callback);
|
|
255
299
|
|
|
300
|
+
// 'monitor' command: Monitor health server
|
|
256
301
|
program
|
|
257
302
|
.command('monitor')
|
|
258
|
-
.argument('<deploy-id>', '
|
|
259
|
-
.argument(
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
.option('--
|
|
264
|
-
.option('--
|
|
265
|
-
.option('--
|
|
266
|
-
.
|
|
303
|
+
.argument('<deploy-id>', 'The deployment configuration ID to monitor.')
|
|
304
|
+
.argument(
|
|
305
|
+
'[env]',
|
|
306
|
+
'Optional: The environment to monitor (e.g., "development", "production"). Defaults to "development".',
|
|
307
|
+
)
|
|
308
|
+
.option('--ms-interval <ms-interval>', 'Sets a custom millisecond interval for monitoring checks.')
|
|
309
|
+
.option('--now', 'Executes the monitor script immediately.')
|
|
310
|
+
.option('--single', 'Disables recurrence, running the monitor script only once.')
|
|
311
|
+
.option('--replicas <replicas>', 'Sets a custom number of replicas for monitoring.')
|
|
312
|
+
.option('--type <type>', 'Sets a custom monitor type.')
|
|
313
|
+
.option('--sync', 'Synchronizes with current proxy deployments and traffic configurations.')
|
|
314
|
+
.description('Manages health server monitoring for specified deployments.')
|
|
267
315
|
.action(Underpost.monitor.callback);
|
|
268
316
|
|
|
317
|
+
// 'lxd' command: LXD management
|
|
269
318
|
program
|
|
270
319
|
.command('lxd')
|
|
271
|
-
.option('--init', '
|
|
272
|
-
.option('--reset', '
|
|
273
|
-
.option('--install', '
|
|
274
|
-
.
|
|
320
|
+
.option('--init', 'Initializes LXD on the current machine.')
|
|
321
|
+
.option('--reset', 'Resets LXD on the current machine, deleting all configurations.')
|
|
322
|
+
.option('--install', 'Installs LXD on the current machine.')
|
|
323
|
+
.option('--dev', 'Sets the development context environment for LXD.')
|
|
324
|
+
.option('--create-virtual-network', 'Creates an LXD virtual network bridge.')
|
|
325
|
+
.option('--create-admin-profile', 'Creates an admin profile for LXD management.')
|
|
326
|
+
.option('--control', 'Sets the context for a control node VM.')
|
|
327
|
+
.option('--worker', 'Sets the context for a worker node VM.')
|
|
328
|
+
.option('--create-vm <vm-id>', 'Creates default virtual machines with the specified ID.')
|
|
329
|
+
.option('--init-vm <vm-id>', 'Retrieves the Underpost initialization script for the specified VM.')
|
|
330
|
+
.option('--info-vm <vm-id>', 'Retrieves all information about the specified VM.')
|
|
331
|
+
.option('--test <vm-id>', 'Tests the health, status, and network connectivity for a VM.')
|
|
332
|
+
.option('--root-size <gb-size>', 'Sets the root partition size (in GB) for the VM.')
|
|
333
|
+
.option('--k3s', 'Flag to indicate that the VM initialization is for a K3s cluster type.')
|
|
334
|
+
.option(
|
|
335
|
+
'--join-node <nodes>',
|
|
336
|
+
'A comma-separated list of worker and control nodes to join (e.g., "k8s-worker-1,k8s-control").',
|
|
337
|
+
)
|
|
338
|
+
.option(
|
|
339
|
+
'--expose <vm-name-ports>',
|
|
340
|
+
'Exposes specified ports on a VM (e.g., "k8s-control:80,443"). Multiple VM-port pairs can be comma-separated.',
|
|
341
|
+
)
|
|
342
|
+
.option(
|
|
343
|
+
'--delete-expose <vm-name-ports>',
|
|
344
|
+
'Removes exposed ports on a VM (e.g., "k8s-control:80,443"). Multiple VM-port pairs can be comma-separated.',
|
|
345
|
+
)
|
|
346
|
+
.option('--auto-expose-k8s-ports <vm-id>', 'Automatically exposes common Kubernetes ports for the specified VM.')
|
|
347
|
+
.description('Manages LXD containers and virtual machines.')
|
|
275
348
|
.action(UnderpostLxd.API.callback);
|
|
276
349
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
md +=
|
|
299
|
-
`
|
|
300
|
-
|
|
301
|
-
` +
|
|
302
|
-
'### `' +
|
|
303
|
-
o._name +
|
|
304
|
-
'` :' +
|
|
305
|
-
`
|
|
306
|
-
` +
|
|
307
|
-
'```\n ' +
|
|
308
|
-
shellExec(`node bin help ${o._name}`, { silent: true, stdout: true }) +
|
|
309
|
-
' \n```' +
|
|
310
|
-
`
|
|
311
|
-
`;
|
|
312
|
-
});
|
|
313
|
-
fs.writeFileSync(`./src/client/public/nexodev/docs/references/Command Line Interface.md`, md, 'utf8');
|
|
314
|
-
fs.writeFileSync(`./cli.md`, md, 'utf8');
|
|
315
|
-
const readmeSplit = `pwa-microservices-template</a>`;
|
|
316
|
-
const readme = fs.readFileSync(`./README.md`, 'utf8').split(readmeSplit);
|
|
317
|
-
fs.writeFileSync(
|
|
318
|
-
'./README.md',
|
|
319
|
-
readme[0] +
|
|
320
|
-
readmeSplit +
|
|
321
|
-
`
|
|
322
|
-
|
|
323
|
-
` +
|
|
324
|
-
baseOptions +
|
|
325
|
-
`
|
|
326
|
-
|
|
327
|
-
<a target="_top" href="https://github.com/underpostnet/pwa-microservices-template/blob/master/cli.md">See complete CLI Docs here.</a>
|
|
328
|
-
|
|
329
|
-
`,
|
|
330
|
-
'utf8',
|
|
331
|
-
);
|
|
332
|
-
};
|
|
350
|
+
// 'baremetal' command: Baremetal server management
|
|
351
|
+
program
|
|
352
|
+
.command('baremetal [workflow-id] [hostname] [ip-address]')
|
|
353
|
+
.option('--control-server-install', 'Installs the baremetal control server.')
|
|
354
|
+
.option('--control-server-uninstall', 'Uninstalls the baremetal control server.')
|
|
355
|
+
.option('--control-server-db-install', 'Installs up the database for the baremetal control server.')
|
|
356
|
+
.option('--control-server-db-uninstall', 'Uninstalls the database for the baremetal control server.')
|
|
357
|
+
.option('--commission', 'Init workflow for commissioning a physical machine.')
|
|
358
|
+
.option('--nfs-build', 'Builds an NFS root filesystem for a workflow id config architecture using QEMU emulation.')
|
|
359
|
+
.option('--nfs-mount', 'Mounts the NFS root filesystem for a workflow id config architecture.')
|
|
360
|
+
.option('--nfs-unmount', 'Unmounts the NFS root filesystem for a workflow id config architecture.')
|
|
361
|
+
.option('--nfs-sh', 'Copies QEMU emulation root entrypoint shell command to the clipboard.')
|
|
362
|
+
.option('--cloud-init-update', 'Updates cloud init for a workflow id config architecture.')
|
|
363
|
+
.option('--cloud-init-reset', 'Resets cloud init for a workflow id config architecture.')
|
|
364
|
+
.option('--logs <log-id>', 'Displays logs for log id: dhcp, cloud, machine, cloud-config.')
|
|
365
|
+
.option('--dev', 'Sets the development context environment for baremetal operations.')
|
|
366
|
+
.option('--ls', 'Lists available boot resources and machines.')
|
|
367
|
+
.description(
|
|
368
|
+
'Manages baremetal server operations, including installation, database setup, commissioning, and user management.',
|
|
369
|
+
)
|
|
370
|
+
.action(UnderpostBaremetal.API.callback);
|
|
333
371
|
|
|
334
|
-
export { program
|
|
372
|
+
export { program };
|