underpost 2.8.799 → 2.8.811
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/deploy.js +379 -101
- package/bin/vs.js +10 -3
- package/cli.md +331 -219
- package/docker-compose.yml +1 -1
- package/manifests/deployment/dd-template-development/deployment.yaml +18 -18
- package/manifests/lxd/underpost-setup.sh +1 -1
- package/manifests/maas/lxd-preseed.yaml +32 -0
- package/manifests/maas/maas-setup.sh +64 -0
- package/manifests/mariadb/statefulset.yaml +2 -1
- package/manifests/mariadb/storage-class.yaml +10 -0
- package/package.json +1 -1
- package/src/cli/baremetal.js +99 -0
- package/src/cli/cluster.js +14 -0
- package/src/cli/deploy.js +1 -1
- package/src/cli/env.js +2 -2
- package/src/cli/image.js +4 -3
- package/src/cli/index.js +244 -239
- package/src/index.js +9 -1
- package/src/runtime/lampp/Dockerfile +68 -38
- package/src/server/conf.js +58 -0
- package/supervisord-openssh-server.conf +0 -5
package/src/cli/index.js
CHANGED
|
@@ -6,7 +6,9 @@ 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,349 +16,352 @@ 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('--
|
|
116
|
-
.option('--
|
|
117
|
-
.option('--
|
|
118
|
-
.option('--k3s', 'Initialize the cluster using K3s')
|
|
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).')
|
|
119
135
|
.action(Underpost.cluster.init)
|
|
120
|
-
.description('
|
|
136
|
+
.description('Manages Kubernetes clusters, defaulting to Kind cluster initialization.');
|
|
121
137
|
|
|
138
|
+
// 'deploy' command: Manage deployments
|
|
122
139
|
program
|
|
123
140
|
.command('deploy')
|
|
124
|
-
.argument('[deploy-list]', '
|
|
125
|
-
.argument(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
.option('--
|
|
130
|
-
.option('--
|
|
131
|
-
.option('--
|
|
132
|
-
.option('--
|
|
133
|
-
.option('--
|
|
134
|
-
.option('--
|
|
135
|
-
.option(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
.option('--
|
|
140
|
-
.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.')
|
|
141
164
|
.option(
|
|
142
165
|
'--rebuild-clients-bundle',
|
|
143
|
-
'Inside container,
|
|
166
|
+
'Inside the container, rebuilds client bundles (only static public or storage client files).',
|
|
144
167
|
)
|
|
145
|
-
.description('
|
|
168
|
+
.description('Manages application deployments, defaulting to deploying development pods.')
|
|
146
169
|
.action(Underpost.deploy.callback);
|
|
147
170
|
|
|
171
|
+
// 'secret' command: Manage secrets
|
|
148
172
|
program
|
|
149
173
|
.command('secret')
|
|
150
|
-
.argument('<platform>', `Options: ${Object.keys(Underpost.secret)}
|
|
151
|
-
.option('--init', '
|
|
152
|
-
.option('--create-from-file <path-env-file>', '
|
|
153
|
-
.option('--list', 'Lists secrets')
|
|
154
|
-
|
|
155
|
-
// .option('--create [secret-key] [secret-value]', 'Create secret key, with secret value')
|
|
156
|
-
.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.`)
|
|
157
179
|
.action((...args) => {
|
|
158
180
|
if (args[1].createFromFile) return Underpost.secret[args[0]].createFromEnvFile(args[1].createFromFile);
|
|
159
181
|
if (args[1].list) return Underpost.secret[args[0]].list();
|
|
160
182
|
if (args[1].init) return Underpost.secret[args[0]].init();
|
|
161
183
|
});
|
|
162
184
|
|
|
185
|
+
// 'dockerfile-image-build' command: Build Docker images from Dockerfiles
|
|
163
186
|
program
|
|
164
187
|
.command('dockerfile-image-build')
|
|
165
|
-
.option('--path [path]', 'Dockerfile
|
|
166
|
-
.option('--image-name [image-name]', '
|
|
167
|
-
.option('--image-path [image-path]', '
|
|
168
|
-
.option('--dockerfile-name [dockerfile-name]', '
|
|
169
|
-
.option('--podman-save', '
|
|
170
|
-
.option('--kind-load', '
|
|
171
|
-
.option('--kubeadm-load', '
|
|
172
|
-
.option('--secrets', 'Dockerfile
|
|
173
|
-
.option('--secrets-path [secrets-path]', '
|
|
174
|
-
.option('--reset', '
|
|
175
|
-
.option('--k3s-load', '
|
|
176
|
-
.description(
|
|
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
|
+
)
|
|
177
202
|
.action(Underpost.image.dockerfile.build);
|
|
178
203
|
|
|
204
|
+
// 'dockerfile-pull-base-images' command: Pull base Dockerfile images
|
|
179
205
|
program
|
|
180
206
|
.command('dockerfile-pull-base-images')
|
|
181
|
-
.option('--path [path]', 'Dockerfile
|
|
182
|
-
.option('--kind-load', '
|
|
183
|
-
.option('--kubeadm-load', '
|
|
184
|
-
.option('--version', '
|
|
185
|
-
.option('--k3s-load', '
|
|
186
|
-
.description('
|
|
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.')
|
|
187
213
|
.action(Underpost.image.dockerfile.pullBaseImages);
|
|
188
214
|
|
|
215
|
+
// 'install' command: Fast import npm dependencies
|
|
189
216
|
program
|
|
190
217
|
.command('install')
|
|
191
|
-
.description('
|
|
218
|
+
.description('Quickly imports Underpost npm dependencies by copying them.')
|
|
192
219
|
.action(() => {
|
|
193
220
|
fs.copySync(`${underpostRootPath}/node_modules`, './node_modules');
|
|
194
221
|
});
|
|
195
222
|
|
|
223
|
+
// 'db' command: Manage databases
|
|
196
224
|
program
|
|
197
225
|
.command('db')
|
|
198
|
-
.argument('<deploy-list>', '
|
|
199
|
-
.option('--import', '
|
|
200
|
-
.option('--export', '
|
|
201
|
-
.option('--pod-name <pod-name>', 'Optional pod context')
|
|
202
|
-
.option('--collections <collections>', '
|
|
203
|
-
.option('--out-path <out-path>', '
|
|
204
|
-
.option('--drop', '
|
|
205
|
-
.option('--preserveUUID', '
|
|
206
|
-
.option('--git', '
|
|
207
|
-
.option('--hosts <hosts>', '
|
|
208
|
-
.option('--paths <paths>', '
|
|
209
|
-
.option('--ns <ns-name>', 'Optional
|
|
210
|
-
.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.')
|
|
211
239
|
.action(Underpost.db.callback);
|
|
212
240
|
|
|
241
|
+
// 'script' command: Execute scripts
|
|
213
242
|
program
|
|
214
243
|
.command('script')
|
|
215
|
-
.argument('operator', `Options: ${Object.keys(Underpost.script)}
|
|
216
|
-
.argument('<script-name>', '
|
|
217
|
-
.argument('[script-value]', '
|
|
218
|
-
.option('--itc', '
|
|
219
|
-
.option('--itc-path', '
|
|
220
|
-
.option('--ns <ns-name>', '
|
|
221
|
-
.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.')
|
|
222
251
|
.description(
|
|
223
|
-
'Supports a
|
|
252
|
+
'Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.',
|
|
224
253
|
)
|
|
225
254
|
.action((...args) => Underpost.script[args[0]](args[1], args[2], args[3]));
|
|
226
255
|
|
|
256
|
+
// 'cron' command: Manage cron jobs
|
|
227
257
|
program
|
|
228
258
|
.command('cron')
|
|
229
|
-
.argument('[deploy-list]', '
|
|
230
|
-
.argument(
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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.')
|
|
236
271
|
.action(Underpost.cron.callback);
|
|
237
272
|
|
|
273
|
+
// 'fs' command: File storage management
|
|
238
274
|
program
|
|
239
275
|
.command('fs')
|
|
240
|
-
.argument('[path]', '
|
|
241
|
-
.option('--rm', '
|
|
242
|
-
.option('--git', '
|
|
243
|
-
.option('--recursive', '
|
|
244
|
-
.option('--deploy-id <deploy-id>', '
|
|
245
|
-
.option('--pull', '
|
|
246
|
-
.option('--force', '
|
|
247
|
-
.option('--storage-file-path <storage-file-path>', 'custom file storage path')
|
|
248
|
-
.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.')
|
|
249
285
|
.action(Underpost.fs.callback);
|
|
250
286
|
|
|
287
|
+
// 'test' command: Manage tests
|
|
251
288
|
program
|
|
252
289
|
.command('test')
|
|
253
|
-
.argument('[deploy-list]', '
|
|
254
|
-
.description('
|
|
255
|
-
.option('--itc', '
|
|
256
|
-
.option('--sh', '
|
|
257
|
-
.option('--logs', '
|
|
258
|
-
.option('--pod-name <pod-name>')
|
|
259
|
-
.option('--pod-status <pod-status>')
|
|
260
|
-
.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.')
|
|
261
298
|
.action(Underpost.test.callback);
|
|
262
299
|
|
|
300
|
+
// 'monitor' command: Monitor health server
|
|
263
301
|
program
|
|
264
302
|
.command('monitor')
|
|
265
|
-
.argument('<deploy-id>', '
|
|
266
|
-
.argument(
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
.option('--
|
|
271
|
-
.option('--
|
|
272
|
-
.option('--
|
|
273
|
-
.
|
|
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.')
|
|
274
315
|
.action(Underpost.monitor.callback);
|
|
275
316
|
|
|
317
|
+
// 'lxd' command: LXD management
|
|
276
318
|
program
|
|
277
319
|
.command('lxd')
|
|
278
|
-
.option('--init', '
|
|
279
|
-
.option('--reset', '
|
|
280
|
-
.option('--install', '
|
|
281
|
-
.option('--dev', '
|
|
282
|
-
.option('--create-virtual-network', '
|
|
283
|
-
.option('--create-admin-profile', '
|
|
284
|
-
.option('--control', '
|
|
285
|
-
.option('--worker', '
|
|
286
|
-
.option('--create-vm <vm-id>', '
|
|
287
|
-
.option('--init-vm <vm-id>', '
|
|
288
|
-
.option('--info-vm <vm-id>', '
|
|
289
|
-
.option('--test <vm-id>', '
|
|
290
|
-
.option('--root-size <gb-size>', '
|
|
291
|
-
.option('--k3s', 'Flag to indicate
|
|
292
|
-
.option(
|
|
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
|
+
)
|
|
293
338
|
.option(
|
|
294
339
|
'--expose <vm-name-ports>',
|
|
295
|
-
'
|
|
340
|
+
'Exposes specified ports on a VM (e.g., "k8s-control:80,443"). Multiple VM-port pairs can be comma-separated.',
|
|
296
341
|
)
|
|
297
342
|
.option(
|
|
298
343
|
'--delete-expose <vm-name-ports>',
|
|
299
|
-
'
|
|
344
|
+
'Removes exposed ports on a VM (e.g., "k8s-control:80,443"). Multiple VM-port pairs can be comma-separated.',
|
|
300
345
|
)
|
|
301
|
-
.option('--auto-expose-k8s-ports <vm-id>', 'Automatically
|
|
302
|
-
.description('
|
|
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.')
|
|
303
348
|
.action(UnderpostLxd.API.callback);
|
|
304
349
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
`
|
|
322
|
-
|
|
323
|
-
## Commands:
|
|
324
|
-
`;
|
|
325
|
-
program.commands.map((o) => {
|
|
326
|
-
md +=
|
|
327
|
-
`
|
|
328
|
-
|
|
329
|
-
` +
|
|
330
|
-
'### `' +
|
|
331
|
-
o._name +
|
|
332
|
-
'` :' +
|
|
333
|
-
`
|
|
334
|
-
` +
|
|
335
|
-
'```\n ' +
|
|
336
|
-
shellExec(`node bin help ${o._name}`, { silent: true, stdout: true }) +
|
|
337
|
-
' \n```' +
|
|
338
|
-
`
|
|
339
|
-
`;
|
|
340
|
-
});
|
|
341
|
-
fs.writeFileSync(`./src/client/public/nexodev/docs/references/Command Line Interface.md`, md, 'utf8');
|
|
342
|
-
fs.writeFileSync(`./cli.md`, md, 'utf8');
|
|
343
|
-
const readmeSplit = `pwa-microservices-template</a>`;
|
|
344
|
-
const readme = fs.readFileSync(`./README.md`, 'utf8').split(readmeSplit);
|
|
345
|
-
fs.writeFileSync(
|
|
346
|
-
'./README.md',
|
|
347
|
-
readme[0] +
|
|
348
|
-
readmeSplit +
|
|
349
|
-
`
|
|
350
|
-
|
|
351
|
-
` +
|
|
352
|
-
baseOptions +
|
|
353
|
-
`
|
|
354
|
-
|
|
355
|
-
<a target="_top" href="https://github.com/underpostnet/pwa-microservices-template/blob/master/cli.md">See complete CLI Docs here.</a>
|
|
356
|
-
|
|
357
|
-
`,
|
|
358
|
-
'utf8',
|
|
359
|
-
);
|
|
360
|
-
};
|
|
350
|
+
// 'baremetal' command: Baremetal server management
|
|
351
|
+
program
|
|
352
|
+
.command('baremetal')
|
|
353
|
+
.option('--control-server-install', 'Installs the baremetal control server.')
|
|
354
|
+
.option('--control-server-db-init', 'Sets up the database for the baremetal control server.')
|
|
355
|
+
.option('--control-server-db-uninstall', 'Uninstalls the database for the baremetal control server.')
|
|
356
|
+
.option('--control-server-init', 'Initializes the baremetal control server.')
|
|
357
|
+
.option('--control-server-login', 'Logs in as an administrator to the control server.')
|
|
358
|
+
.option('--control-server-uninstall', 'Uninstalls the baremetal control server.')
|
|
359
|
+
.option('--control-server-stop', 'Stops the baremetal control server.')
|
|
360
|
+
.option('--control-server-start', 'Starts the baremetal control server.')
|
|
361
|
+
.option('--get-users', 'Retrieves a list of users from the control server.')
|
|
362
|
+
.option('--new-api-key', 'Generates a new API key for the control server.')
|
|
363
|
+
.option('--dev', 'Sets the development context environment for baremetal operations.')
|
|
364
|
+
.description('Manages baremetal server operations, including installation, database setup, and user management.')
|
|
365
|
+
.action(UnderpostBaremetal.API.callback);
|
|
361
366
|
|
|
362
|
-
export { program
|
|
367
|
+
export { program };
|