underpost 2.8.641 → 2.8.651

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.
@@ -6,7 +6,6 @@
6
6
  "esbenp.prettier-vscode",
7
7
  "foxundermoon.shell-format",
8
8
  "github.vscode-github-actions",
9
- "mintlify.document",
10
9
  "ms-python.black-formatter",
11
10
  "ms-python.debugpy",
12
11
  "ms-python.python",
package/README.md CHANGED
@@ -38,7 +38,7 @@ Develop, build, deploy, test, monitor, and manage multiple runtime applications
38
38
  <!-- https://kapasia-dev-ed.my.site.com/Badges4Me/s/ -->
39
39
  <!-- https://simpleicons.org/ -->
40
40
 
41
- #### Create a new project
41
+ ## Create a new project
42
42
 
43
43
  ```bash
44
44
  npm install -g underpost
@@ -50,7 +50,7 @@ underpost new app-name
50
50
 
51
51
  After template installation, the server will be running on [http://localhost:4001](http://localhost:4001)
52
52
 
53
- #### Usage
53
+ ## Usage
54
54
 
55
55
  ```bash
56
56
  cd app-name
@@ -67,3 +67,41 @@ Run dev client server
67
67
  ```bash
68
68
  npm run dev
69
69
  ```
70
+ <!-- -->
71
+ ## underpost ci/cd cli v2.8.651
72
+
73
+ ### Usage: `underpost [options] [command]`
74
+ ```
75
+ Options:
76
+ -V, --version output the version number
77
+ -h, --help display help for command
78
+
79
+ Commands:
80
+ new <app-name> Create a new project
81
+ start [options] <deploy-id> [env] Start up server, build pipelines, or services
82
+ clone [options] <uri> Clone github repository
83
+ pull <path> <uri> Pull github repository
84
+ cmt [options] <path> <commit-type> [module-tag] [message] Commit github repository
85
+ push [options] <path> <uri> Push github repository
86
+ env <deploy-id> [env] Set environment variables files and conf related to <deploy-id>
87
+ config <operator> [key] [value] Manage configuration, operators
88
+ root Get npm root path
89
+ cluster [options] [pod-name] Manage cluster, for default initialization base kind cluster
90
+ deploy [options] <deploy-list> [env] Manage deployment, for default deploy development pods
91
+ secret [options] <platform> Manage secrets
92
+ dockerfile-image-build [options] Build image from Dockerfile
93
+ dockerfile-pull-base-images Pull underpost dockerfile images requirements
94
+ install Fast import underpost npm dependencies
95
+ db [options] <deploy-list> Manage databases
96
+ script [options] <operator> <script-name> [script-value] Supports a number of built-in underpost global scripts and their preset life cycle events as well as arbitrary scripts
97
+ cron [options] [deploy-list] [job-list] Cron jobs management
98
+ fs [options] [path] File storage management, for default upload file
99
+ test [options] [deploy-list] Manage Test, for default run current underpost default test
100
+ monitor [options] <deploy-id> [env] Monitor health server management
101
+ help [command] display help for command
102
+
103
+ ```
104
+
105
+ <a target="_top" href="https://github.com/underpostnet/pwa-microservices-template/blob/master/cli.md">See complete CLI Docs here.</a>
106
+
107
+
package/bin/deploy.js CHANGED
@@ -36,6 +36,7 @@ import { JSONweb } from '../src/server/client-formatted.js';
36
36
 
37
37
  import { Xampp } from '../src/runtime/xampp/Xampp.js';
38
38
  import { ejs } from '../src/server/json-schema.js';
39
+ import { buildCliDoc } from '../src/cli/index.js';
39
40
 
40
41
  const logger = loggerFactory(import.meta);
41
42
 
@@ -729,7 +730,7 @@ try {
729
730
  fs.readFileSync(`./src/index.js`, 'utf8').replaceAll(`${version}`, `${newVersion}`),
730
731
  'utf8',
731
732
  );
732
-
733
+ shellExec(`node bin/deploy cli-docs`);
733
734
  shellExec(`node bin/deploy update-dependencies`);
734
735
  shellExec(`auto-changelog`);
735
736
  shellExec(`node bin/build dd`);
@@ -1049,6 +1050,48 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
1049
1050
  break;
1050
1051
  }
1051
1052
 
1053
+ case 'update-instances': {
1054
+ shellExec(`node bin deploy dd production --sync --build-manifest --info-router --dashboard-update`);
1055
+ shellExec(`node bin cron --dashboard-update --init`);
1056
+ const deployId = 'dd-core';
1057
+ const host = 'www.nexodev.org';
1058
+ const path = '/';
1059
+
1060
+ {
1061
+ const outputPath = './engine-private/instances';
1062
+ if (fs.existsSync(outputPath)) fs.mkdirSync(outputPath, { recursive: true });
1063
+ const collection = 'instances';
1064
+ if (process.argv.includes('export'))
1065
+ shellExec(
1066
+ `node bin db --export --collections ${collection} --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
1067
+ );
1068
+ if (process.argv.includes('import'))
1069
+ shellExec(
1070
+ `node bin db --import --drop --preserveUUID --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
1071
+ );
1072
+ }
1073
+ {
1074
+ const outputPath = './engine-private/crons';
1075
+ if (fs.existsSync(outputPath)) fs.mkdirSync(outputPath, { recursive: true });
1076
+ const collection = 'crons';
1077
+ if (process.argv.includes('export'))
1078
+ shellExec(
1079
+ `node bin db --export --collections ${collection} --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
1080
+ );
1081
+ if (process.argv.includes('import'))
1082
+ shellExec(
1083
+ `node bin db --import --drop --preserveUUID --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
1084
+ );
1085
+ }
1086
+
1087
+ break;
1088
+ }
1089
+
1090
+ case 'cli-docs': {
1091
+ buildCliDoc();
1092
+ break;
1093
+ }
1094
+
1052
1095
  default:
1053
1096
  break;
1054
1097
  }
package/bin/file.js CHANGED
@@ -136,6 +136,16 @@ try {
136
136
  JSON.stringify(templatePackageLockJson, null, 4),
137
137
  'utf8',
138
138
  );
139
+ const splitKeyword = '## underpost ci/cd cli';
140
+ fs.writeFileSync(
141
+ `../pwa-microservices-template/README.md`,
142
+ fs.readFileSync(`../pwa-microservices-template/README.md`, 'utf8').replace(
143
+ `<!-- -->`,
144
+ `<!-- -->
145
+ ${splitKeyword + fs.readFileSync(`./README.md`, 'utf8').split(splitKeyword)[1]}`,
146
+ 'utf8',
147
+ ),
148
+ );
139
149
  }
140
150
 
141
151
  break;
package/bin/index.js CHANGED
@@ -1,237 +1,5 @@
1
1
  #! /usr/bin/env node
2
2
 
3
- import dotenv from 'dotenv';
4
- import { Command } from 'commander';
5
- import Underpost from '../src/index.js';
6
- import { getUnderpostRootPath, loadConf } from '../src/server/conf.js';
7
- import fs from 'fs-extra';
8
- import { commitData } from '../src/client/components/core/CommonJs.js';
9
-
10
- const underpostRootPath = getUnderpostRootPath();
11
- fs.existsSync(`${underpostRootPath}/.env`)
12
- ? dotenv.config({ path: `${underpostRootPath}/.env`, override: true })
13
- : dotenv.config();
14
-
15
- const program = new Command();
16
-
17
- program.name('underpost').description(`underpost ci/cd cli ${Underpost.version}`).version(Underpost.version);
18
-
19
- program
20
- .command('new')
21
- .argument('<app-name>', 'Application name')
22
- .description('Create a new project')
23
- .action(Underpost.repo.new);
24
-
25
- program
26
- .command('clone')
27
- .argument(`<uri>`, 'e.g. username/repository')
28
- .option('--bare', 'Clone only .git files')
29
- .description('Clone github repository')
30
- .action(Underpost.repo.clone);
31
-
32
- program
33
- .command('pull')
34
- .argument('<path>', 'Absolute or relative directory')
35
- .argument(`<uri>`, 'e.g. username/repository')
36
- .description('Pull github repository')
37
- .action(Underpost.repo.pull);
38
-
39
- program
40
- .command('cmt')
41
- .argument('<path>', 'Absolute or relative directory')
42
- .argument(`<commit-type>`, `Options: ${Object.keys(commitData)}`)
43
- .argument(`[module-tag]`, 'Optional set module tag')
44
- .argument(`[message]`, 'Optional set additional message')
45
- .option('--empty', 'Allow empty files')
46
- .option('--copy', 'Copy to clipboard message')
47
- .option('--info', 'Info commit types')
48
- .description('Commit github repository')
49
- .action(Underpost.repo.commit);
50
-
51
- program
52
- .command('push')
53
- .argument('<path>', 'Absolute or relative directory')
54
- .argument(`<uri>`, 'e.g. username/repository')
55
- .option('-f', 'Force push overwriting repository')
56
- .description('Push github repository')
57
- .action(Underpost.repo.push);
58
-
59
- program
60
- .command('env')
61
- .argument('<deploy-id>', `deploy configuration id, if 'clean' restore default`)
62
- .argument('[env]', 'Optional environment, for default is production')
63
- .description('Set environment variables files and conf related to <deploy-id>')
64
- .action(loadConf);
65
-
66
- program
67
- .command('config')
68
- .argument('operator', `Options: ${Object.keys(Underpost.env)}`)
69
- .argument('[key]', 'Config key')
70
- .argument('[value]', 'Config value')
71
- .description(`Manage configuration, operators`)
72
- .action((...args) => Underpost.env[args[0]](args[1], args[2]));
73
-
74
- program
75
- .command('root')
76
- .description('Get npm root path')
77
- .action(() => console.log(getNpmRootPath()));
78
-
79
- program
80
- .command('cluster')
81
- .argument('[pod-name]', 'Optional pod name filter')
82
- .option('--reset', `Delete all clusters and prune all data and caches`)
83
- .option('--mariadb', 'Init with mariadb statefulset')
84
- .option('--mongodb', 'Init with mongodb statefulset')
85
- .option('--mongodb4', 'Init with mongodb 4.4 service')
86
- .option('--valkey', 'Init with valkey service')
87
- .option('--contour', 'Init with project contour base HTTPProxy and envoy')
88
- .option('--cert-manager', 'Init with letsencrypt-prod ClusterIssuer')
89
- .option('--info', 'Get all kinds objects deployed')
90
- .option('--full', 'Init with all statefulsets and services available')
91
- .option('--ns-use <ns-name>', 'Switches current context to namespace')
92
- .option('--dev', 'init with dev cluster')
93
- .option('--list-pods', 'Display list pods information')
94
- .action(Underpost.cluster.init)
95
- .description('Manage cluster, for default initialization base kind cluster');
96
-
97
- program
98
- .command('deploy')
99
- .argument('<deploy-list>', 'Deploy id list, e.g. default-a,default-b')
100
- .argument('[env]', 'Optional environment, for default is development')
101
- .option('--remove', 'Delete deployments and services')
102
- .option('--sync', 'Sync deployments env, ports, and replicas')
103
- .option('--info-router', 'Display router structure')
104
- .option('--expose', 'Expose service match deploy-list')
105
- .option('--info-util', 'Display kubectl util management commands')
106
- .option('--cert', 'Reset tls/ssl certificate secrets')
107
- .option('--build-manifest', 'Build kind yaml manifests: deployments, services, proxy and secrets')
108
- .option('--dashboard-update', 'Update dashboard instance data with current router config')
109
- .option('--version', 'Set custom version')
110
- .description('Manage deployment, for default deploy development pods')
111
- .action(Underpost.deploy.callback);
112
-
113
- program
114
- .command('secret')
115
- .argument('<platform>', `Options: ${Object.keys(Underpost.secret)}`)
116
- .option('--init', 'Init secrets platform environment')
117
- .option('--create-from-file <path-env-file>', 'Create secret from env file')
118
- .option('--list', 'Lists secrets')
119
- // .option('--delete [secret-key]', 'Delete key secret, if not set, are default delete all')
120
- // .option('--create [secret-key] [secret-value]', 'Create secret key, with secret value')
121
- .description(`Manage secrets`)
122
- .action((...args) => {
123
- if (args[1].createFromFile) return Underpost.secret[args[0]].createFromEnvFile(args[1].createFromFile);
124
- if (args[1].list) return Underpost.secret[args[0]].list();
125
- if (args[1].init) return Underpost.secret[args[0]].init();
126
- });
127
-
128
- program
129
- .command('dockerfile-node-script')
130
- .argument('<deploy-id>', 'Deploy configuration id')
131
- .argument('[env]', 'Optional environment, for default is development')
132
- .option('--run', 'Run custom entry point script')
133
- .option('--build', 'Build custom image container scripts')
134
- .description('Dockerfile custom node build script')
135
- .action(Underpost.image.dockerfile.script);
136
-
137
- program
138
- .command('dockerfile-image-build')
139
- .option('--path [path]', 'Dockerfile path')
140
- .option('--image-name [image-name]', 'Set image name')
141
- .option('--image-path [image-path]', 'Set tar image path')
142
- .option('--dockerfile-name [dockerfile-name]', 'set Dockerfile name')
143
- .option('--podman-save', 'Export tar file from podman')
144
- .option('--kind-load', 'Import tar image to Kind cluster')
145
- .option('--secrets', 'Dockerfile env secrets')
146
- .option('--secrets-path [secrets-path]', 'Dockerfile custom path env secrets')
147
- .option('--no-cache', 'Build without using cache')
148
- .description('Build image from Dockerfile')
149
- .action(Underpost.image.dockerfile.build);
150
-
151
- program
152
- .command('dockerfile-pull-base-images')
153
- .description('Pull underpost dockerfile images requirements')
154
- .action(Underpost.image.dockerfile.pullBaseImages);
155
-
156
- program
157
- .command('install')
158
- .description('Fast import underpost npm dependencies')
159
- .action(() => {
160
- fs.copySync(`${underpostRootPath}/node_modules`, './node_modules');
161
- });
162
-
163
- program
164
- .command('db')
165
- .argument('<deploy-list>', 'Deploy id list, e.g. default-a,default-b')
166
- .option('--import', 'Import container backups from repositories')
167
- .option('--export', 'Export container backups to repositories')
168
- .option('--pod-name <pod-name>', 'Optional pod context')
169
- .option('--collection <collection>', 'Collection')
170
- .option('--out-path <out-path>', 'Custom out path backup')
171
- .option('--drop', 'Drop databases')
172
- .option('--preserveUUID', 'Preserve Ids')
173
- .option('--git', 'Upload to github')
174
- .option('--ns <ns-name>', 'Optional name space context')
175
- .description('Manage databases')
176
- .action(Underpost.db.callback);
177
-
178
- program
179
- .command('script')
180
- .argument('operator', `Options: ${Object.keys(Underpost.script)}`)
181
- .argument('<script-name>', 'Script name')
182
- .argument('[script-value]', 'Literal command, or path')
183
- .option('--itc', 'Inside container execution context')
184
- .option('--itc-path', 'Inside container path options')
185
- .option('--ns <ns-name>', 'Options name space context')
186
- .option('--pod-name <pod-name>')
187
- .description(
188
- 'Supports a number of built-in underpost global scripts and their preset life cycle events as well as arbitrary scripts',
189
- )
190
- .action((...args) => Underpost.script[args[0]](args[1], args[2], args[3]));
191
-
192
- program
193
- .command('cron')
194
- .argument('[deploy-list]', 'Deploy id list, e.g. default-a,default-b')
195
- .argument('[job-list]', `Deploy id list, e.g. ${Object.keys(Underpost.cron)}, for default all available jobs`)
196
- .option('--itc', 'Inside container execution context')
197
- .option('--init', 'Init cron jobs for cron job default deploy id')
198
- .option('--git', 'Upload to github')
199
- .option('--dashboard-update', 'Update dashboard cron data with current jobs config')
200
- .description('Cron jobs management')
201
- .action(Underpost.cron.callback);
202
-
203
- program
204
- .command('fs')
205
- .argument('[path]', 'Absolute or relative directory')
206
- .option('--rm', 'Remove file')
207
- .option('--git', 'Current git changes')
208
- .option('--recursive', 'Upload files recursively')
209
- .option('--deploy-id <deploy-id>', 'Deploy configuration id')
210
- .option('--pull', 'Download file')
211
- .option('--force', 'Force action')
212
- .description('File storage management, for default upload file')
213
- .action(Underpost.fs.callback);
214
-
215
- program
216
- .command('test')
217
- .argument('[deploy-list]', 'Deploy id list, e.g. default-a,default-b')
218
- .description('Manage Test, for default run current underpost default test')
219
- .option('--itc', 'Inside container execution context')
220
- .option('--sh', 'Copy to clipboard, container entrypoint shell command')
221
- .option('--logs', 'Display container logs')
222
- .option('--pod-name <pod-name>')
223
- .option('--pod-status <pod-status>')
224
- .option('--kind-type <kind-type>')
225
- .action(Underpost.test.callback);
226
-
227
- program
228
- .command('monitor')
229
- .argument('<deploy-id>', 'Deploy configuration id')
230
- .argument('[env]', 'Optional environment, for default is development')
231
- .option('--ms-interval <ms-interval>', 'Custom ms interval delta time')
232
- .option('--now', 'Exec immediately monitor script')
233
- .option('--single', 'Disable recurrence')
234
- .description('Monitor health server management')
235
- .action(Underpost.monitor.callback);
3
+ import { program } from '../src/cli/index.js';
236
4
 
237
5
  program.parse();