@underpostnet/underpost 2.99.1 → 2.99.4
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/LICENSE +1 -1
- package/README.md +30 -30
- package/bin/deploy.js +49 -3
- package/cli.md +42 -31
- package/jsconfig.json +4 -2
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +2 -2
- package/manifests/deployment/playwright/deployment.yaml +52 -0
- package/package.json +1 -1
- package/scripts/rocky-pwa.sh +2 -2
- package/scripts/ssl.sh +12 -6
- package/src/api/user/user.model.js +1 -0
- package/src/cli/baremetal.js +14 -12
- package/src/cli/deploy.js +6 -24
- package/src/cli/image.js +4 -4
- package/src/cli/index.js +21 -1
- package/src/cli/run.js +96 -92
- package/src/cli/test.js +13 -1
- package/src/client/components/core/Polyhedron.js +896 -7
- package/src/client/components/core/Translate.js +4 -0
- package/src/client/services/default/default.management.js +12 -2
- package/src/index.js +13 -1
- package/src/runtime/express/Express.js +3 -3
- package/src/server/conf.js +6 -4
- package/src/server/logger.js +11 -4
- package/src/server/process.js +27 -2
- package/src/server/proxy.js +4 -6
- package/src/server/tls.js +31 -26
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
<!-- badges -->
|
|
20
20
|
|
|
21
|
-
[](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [](https://www.npmjs.com/package/underpost) [](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [](https://www.npmjs.com/package/underpost) [](https://socket.dev/npm/package/underpost/overview/2.99.4) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](https://www.npmjs.com/package/underpost)
|
|
22
22
|
|
|
23
23
|
<!-- end-badges -->
|
|
24
24
|
|
|
@@ -66,42 +66,42 @@ Run dev client server
|
|
|
66
66
|
npm run dev
|
|
67
67
|
```
|
|
68
68
|
<!-- -->
|
|
69
|
-
## underpost ci/cd cli v2.99.
|
|
69
|
+
## underpost ci/cd cli v2.99.4
|
|
70
70
|
|
|
71
71
|
### Usage: `underpost [options] [command]`
|
|
72
72
|
```
|
|
73
73
|
Options:
|
|
74
|
-
-V, --version
|
|
75
|
-
-h, --help
|
|
74
|
+
-V, --version output the version number
|
|
75
|
+
-h, --help display help for command
|
|
76
76
|
|
|
77
77
|
Commands:
|
|
78
|
-
new [options] [app-name]
|
|
79
|
-
start [options] <deploy-id> [env]
|
|
80
|
-
clone [options] <uri>
|
|
81
|
-
pull [options] <path> <uri>
|
|
82
|
-
cmt [options] [path] [commit-type] [module-tag] [message]
|
|
83
|
-
push [options] <path> <uri>
|
|
84
|
-
env [deploy-id] [env] [subConf]
|
|
85
|
-
static [options]
|
|
86
|
-
config [options] <operator> [key] [value]
|
|
87
|
-
root
|
|
88
|
-
ip [options] [ips]
|
|
89
|
-
cluster [options] [pod-name]
|
|
90
|
-
deploy [options] [deploy-list] [env]
|
|
91
|
-
secret [options] <platform>
|
|
92
|
-
image [options]
|
|
93
|
-
install
|
|
94
|
-
db [options] [deploy-list]
|
|
95
|
-
metadata [options] [deploy-id] [host] [path]
|
|
96
|
-
cron [options] [deploy-list] [job-list]
|
|
97
|
-
fs [options] [path]
|
|
98
|
-
test [options] [deploy-list]
|
|
99
|
-
monitor [options] <deploy-id> [env]
|
|
78
|
+
new [options] [app-name] Initializes a new Underpost project, service, or configuration.
|
|
79
|
+
start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
|
|
80
|
+
clone [options] <uri> Clones a specified GitHub repository into the current directory.
|
|
81
|
+
pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
|
|
82
|
+
cmt [options] [path] [commit-type] [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
|
|
83
|
+
push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
|
|
84
|
+
env [deploy-id] [env] [subConf] Sets environment variables and configurations related to a specific deployment ID.
|
|
85
|
+
static [options] Manages static build of page, bundles, and documentation with comprehensive customization options.
|
|
86
|
+
config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
|
|
87
|
+
root Displays the root path of the npm installation.
|
|
88
|
+
ip [options] [ips] Displays the current public machine IP addresses.
|
|
89
|
+
cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
|
|
90
|
+
deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
|
|
91
|
+
secret [options] <platform> Manages secrets for various platforms.
|
|
92
|
+
image [options] Manages Docker images, including building, saving, and loading into Kubernetes clusters.
|
|
93
|
+
install Quickly imports Underpost npm dependencies by copying them.
|
|
94
|
+
db [options] [deploy-list] Manages database operations with support for MariaDB and MongoDB, including import/export, multi-pod targeting, and Git integration.
|
|
95
|
+
metadata [options] [deploy-id] [host] [path] Manages cluster metadata operations, including import and export.
|
|
96
|
+
cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
|
|
97
|
+
fs [options] [path] Manages file storage, defaulting to file upload operations.
|
|
98
|
+
test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
|
|
99
|
+
monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
|
|
100
100
|
ssh [options]
|
|
101
|
-
run [options] <runner-id> [path]
|
|
102
|
-
lxd [options]
|
|
103
|
-
baremetal [options] [workflow-id]
|
|
104
|
-
help [command]
|
|
101
|
+
run [options] <runner-id> [path] Runs specified scripts using various runners.
|
|
102
|
+
lxd [options] Manages LXD containers and virtual machines.
|
|
103
|
+
baremetal [options] [workflow-id] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
|
|
104
|
+
help [command] display help for command
|
|
105
105
|
|
|
106
106
|
```
|
|
107
107
|
|
package/bin/deploy.js
CHANGED
|
@@ -241,7 +241,7 @@ try {
|
|
|
241
241
|
for (const relativePath of files) {
|
|
242
242
|
const filePah = `./engine-private/conf/${relativePath.replaceAll(`\\`, '/')}`;
|
|
243
243
|
if (filePah.split('/').pop() === 'package.json') {
|
|
244
|
-
const deployPackage = JSON.parse(fs.readFileSync(filePah
|
|
244
|
+
const deployPackage = JSON.parse(fs.readFileSync(filePah, 'utf8'));
|
|
245
245
|
deployPackage.dependencies = originPackage.dependencies;
|
|
246
246
|
deployPackage.devDependencies = originPackage.devDependencies;
|
|
247
247
|
fs.writeFileSync(filePah, JSON.stringify(deployPackage, null, 4), 'utf8');
|
|
@@ -841,7 +841,7 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
|
|
|
841
841
|
const args = [
|
|
842
842
|
`node bin image --build --path ${path}/backend/`,
|
|
843
843
|
`--image-name=${imageName} --image-path=${path}`,
|
|
844
|
-
`--podman-save --${process.argv.includes('kubeadm') ? 'kubeadm' : 'kind'}
|
|
844
|
+
`--podman-save --${process.argv.includes('kubeadm') ? 'kubeadm' : 'kind'} --reset`,
|
|
845
845
|
];
|
|
846
846
|
shellExec(args.join(' '));
|
|
847
847
|
}
|
|
@@ -853,7 +853,7 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
|
|
|
853
853
|
const args = [
|
|
854
854
|
`node bin image --build --path ${path}/frontend/`,
|
|
855
855
|
`--image-name=${imageName} --image-path=${path}`,
|
|
856
|
-
`--podman-save --${process.argv.includes('kubeadm') ? 'kubeadm' : 'kind'}
|
|
856
|
+
`--podman-save --${process.argv.includes('kubeadm') ? 'kubeadm' : 'kind'} --reset`,
|
|
857
857
|
];
|
|
858
858
|
shellExec(args.join(' '));
|
|
859
859
|
}
|
|
@@ -1143,6 +1143,52 @@ nvidia/gpu-operator \
|
|
|
1143
1143
|
}
|
|
1144
1144
|
break;
|
|
1145
1145
|
}
|
|
1146
|
+
|
|
1147
|
+
case 'pw': {
|
|
1148
|
+
const help = `node bin/deploy pw <script-path> <from-path-in-pod> [to-path-on-local]`;
|
|
1149
|
+
const scriptPath = process.argv[3];
|
|
1150
|
+
const fromPath = process.argv[4];
|
|
1151
|
+
const toPath = process.argv[5] ? process.argv[5] : fromPath ? `./${fromPath.split('/').pop()}` : '';
|
|
1152
|
+
if (scriptPath === 'help') {
|
|
1153
|
+
logger.info(help);
|
|
1154
|
+
break;
|
|
1155
|
+
}
|
|
1156
|
+
if (fs.existsSync(toPath)) fs.removeSync(toPath);
|
|
1157
|
+
shellExec(`node bin/deploy pw-conf ${scriptPath}`);
|
|
1158
|
+
shellExec(`kubectl delete deployment playwright-server --ignore-not-found`);
|
|
1159
|
+
while (Underpost.deploy.get('playwright-server').length > 0) {
|
|
1160
|
+
logger.info(`Waiting for playwright-server deployment to be deleted...`);
|
|
1161
|
+
await timer(1000);
|
|
1162
|
+
}
|
|
1163
|
+
shellExec(`kubectl apply -f manifests/deployment/playwright/deployment.yaml`);
|
|
1164
|
+
const id = 'playwright-server';
|
|
1165
|
+
await Underpost.test.statusMonitor(id);
|
|
1166
|
+
const nameSpace = 'default';
|
|
1167
|
+
const [pod] = Underpost.deploy.get(id);
|
|
1168
|
+
const podName = pod.NAME;
|
|
1169
|
+
shellExec(`kubectl logs -f ${podName} -n ${nameSpace}`, {
|
|
1170
|
+
async: true,
|
|
1171
|
+
});
|
|
1172
|
+
(async () => {
|
|
1173
|
+
while (!Underpost.deploy.existsContainerFile({ podName, path: fromPath })) {
|
|
1174
|
+
await timer(1000);
|
|
1175
|
+
logger.info(`Waiting for file ${fromPath} in pod ${podName}...`);
|
|
1176
|
+
}
|
|
1177
|
+
shellExec(`sudo kubectl cp ${nameSpace}/${podName}:${fromPath} ${toPath}`);
|
|
1178
|
+
if (toPath.match('.png') && fs.existsSync(toPath)) shellExec(`firefox ${toPath}`);
|
|
1179
|
+
})();
|
|
1180
|
+
break;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
case 'pw-conf': {
|
|
1184
|
+
const scriptPath = process.argv[3];
|
|
1185
|
+
shellExec(`kubectl delete configmap playwright-script`);
|
|
1186
|
+
shellExec(`kubectl create configmap playwright-script \
|
|
1187
|
+
--from-file=script.js=${scriptPath} \
|
|
1188
|
+
--dry-run=client -o yaml | kubectl apply -f -
|
|
1189
|
+
`);
|
|
1190
|
+
break;
|
|
1191
|
+
}
|
|
1146
1192
|
}
|
|
1147
1193
|
} catch (error) {
|
|
1148
1194
|
logger.error(error, error.stack);
|
package/cli.md
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
## underpost ci/cd cli v2.99.
|
|
1
|
+
## underpost ci/cd cli v2.99.4
|
|
2
2
|
|
|
3
3
|
### Usage: `underpost [options] [command]`
|
|
4
4
|
```
|
|
5
5
|
Options:
|
|
6
|
-
-V, --version
|
|
7
|
-
-h, --help
|
|
6
|
+
-V, --version output the version number
|
|
7
|
+
-h, --help display help for command
|
|
8
8
|
|
|
9
9
|
Commands:
|
|
10
|
-
new [options] [app-name]
|
|
11
|
-
start [options] <deploy-id> [env]
|
|
12
|
-
clone [options] <uri>
|
|
13
|
-
pull [options] <path> <uri>
|
|
14
|
-
cmt [options] [path] [commit-type] [module-tag] [message]
|
|
15
|
-
push [options] <path> <uri>
|
|
16
|
-
env [deploy-id] [env] [subConf]
|
|
17
|
-
static [options]
|
|
18
|
-
config [options] <operator> [key] [value]
|
|
19
|
-
root
|
|
20
|
-
ip [options] [ips]
|
|
21
|
-
cluster [options] [pod-name]
|
|
22
|
-
deploy [options] [deploy-list] [env]
|
|
23
|
-
secret [options] <platform>
|
|
24
|
-
image [options]
|
|
25
|
-
install
|
|
26
|
-
db [options] [deploy-list]
|
|
27
|
-
metadata [options] [deploy-id] [host] [path]
|
|
28
|
-
cron [options] [deploy-list] [job-list]
|
|
29
|
-
fs [options] [path]
|
|
30
|
-
test [options] [deploy-list]
|
|
31
|
-
monitor [options] <deploy-id> [env]
|
|
10
|
+
new [options] [app-name] Initializes a new Underpost project, service, or configuration.
|
|
11
|
+
start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
|
|
12
|
+
clone [options] <uri> Clones a specified GitHub repository into the current directory.
|
|
13
|
+
pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
|
|
14
|
+
cmt [options] [path] [commit-type] [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
|
|
15
|
+
push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
|
|
16
|
+
env [deploy-id] [env] [subConf] Sets environment variables and configurations related to a specific deployment ID.
|
|
17
|
+
static [options] Manages static build of page, bundles, and documentation with comprehensive customization options.
|
|
18
|
+
config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
|
|
19
|
+
root Displays the root path of the npm installation.
|
|
20
|
+
ip [options] [ips] Displays the current public machine IP addresses.
|
|
21
|
+
cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
|
|
22
|
+
deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
|
|
23
|
+
secret [options] <platform> Manages secrets for various platforms.
|
|
24
|
+
image [options] Manages Docker images, including building, saving, and loading into Kubernetes clusters.
|
|
25
|
+
install Quickly imports Underpost npm dependencies by copying them.
|
|
26
|
+
db [options] [deploy-list] Manages database operations with support for MariaDB and MongoDB, including import/export, multi-pod targeting, and Git integration.
|
|
27
|
+
metadata [options] [deploy-id] [host] [path] Manages cluster metadata operations, including import and export.
|
|
28
|
+
cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
|
|
29
|
+
fs [options] [path] Manages file storage, defaulting to file upload operations.
|
|
30
|
+
test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
|
|
31
|
+
monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
|
|
32
32
|
ssh [options]
|
|
33
|
-
run [options] <runner-id> [path]
|
|
34
|
-
lxd [options]
|
|
35
|
-
baremetal [options] [workflow-id]
|
|
36
|
-
help [command]
|
|
33
|
+
run [options] <runner-id> [path] Runs specified scripts using various runners.
|
|
34
|
+
lxd [options] Manages LXD containers and virtual machines.
|
|
35
|
+
baremetal [options] [workflow-id] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
|
|
36
|
+
help [command] display help for command
|
|
37
37
|
|
|
38
38
|
```
|
|
39
39
|
|
|
@@ -800,7 +800,7 @@ Options:
|
|
|
800
800
|
Runs specified scripts using various runners.
|
|
801
801
|
|
|
802
802
|
Arguments:
|
|
803
|
-
runner-id The runner ID to run. Options: dev-cluster,metadata,svc-ls,svc-rm,ssh-deploy-info,dev-hosts-expose,dev-hosts-restore,cluster-build,template-deploy,template-deploy-image,clean,pull,release-deploy,ssh-deploy,ide,crypto-policy,sync,stop,ssh-deploy-stop,ssh-deploy-db-rollback,ssh-deploy-db,ssh-deploy-db-status,tz,cron,get-proxy,instance-promote,instance,ls-deployments,host-update,dd-container,ip-info,
|
|
803
|
+
runner-id The runner ID to run. Options: dev-cluster,metadata,svc-ls,svc-rm,ssh-deploy-info,dev-hosts-expose,dev-hosts-restore,cluster-build,template-deploy,template-deploy-image,clean,pull,release-deploy,ssh-deploy,ide,crypto-policy,sync,stop,ssh-deploy-stop,ssh-deploy-db-rollback,ssh-deploy-db,ssh-deploy-db-status,tz,cron,get-proxy,instance-promote,instance,ls-deployments,host-update,dd-container,ip-info,db-client,git-conf,promote,metrics,cluster,deploy,disk-clean,disk-usage,dev,service,etc-hosts,sh,log,ps,ptls,release-cmt,deploy-test,sync-replica,tf-vae-test,spark-template,rmi,kill,secret,underpost-config,gpu-env,tf-gpu-test,deploy-job.
|
|
804
804
|
path The input value, identifier, or path for the operation.
|
|
805
805
|
|
|
806
806
|
Options:
|
|
@@ -858,6 +858,11 @@ Options:
|
|
|
858
858
|
--retry-count <count> Sets HTTPProxy per-route retry count (e.g., 3).
|
|
859
859
|
--retry-per-try-timeout <duration> Sets HTTPProxy retry per-try timeout (e.g., "150ms").
|
|
860
860
|
--disable-private-conf-update Disables updates to private configuration during execution.
|
|
861
|
+
--logs Streams logs during the runner execution.
|
|
862
|
+
--monitor-status <status> Sets the status to monitor for pod/resource (default: "Running").
|
|
863
|
+
--monitor-status-kind-type <kind-type> Sets the Kubernetes resource kind type to monitor (default: "pods").
|
|
864
|
+
--monitor-status-delta-ms <milliseconds> Sets the polling interval in milliseconds for status monitoring (default: 1000).
|
|
865
|
+
--monitor-status-max-attempts <attempts> Sets the maximum number of status check attempts (default: 600).
|
|
861
866
|
-h, --help display help for command
|
|
862
867
|
|
|
863
868
|
```
|
|
@@ -915,12 +920,18 @@ Options:
|
|
|
915
920
|
|
|
916
921
|
### `baremetal` :
|
|
917
922
|
```
|
|
918
|
-
Usage: underpost baremetal [options] [workflow-id]
|
|
923
|
+
Usage: underpost baremetal [options] [workflow-id]
|
|
919
924
|
|
|
920
925
|
Manages baremetal server operations, including installation, database setup,
|
|
921
926
|
commissioning, and user management.
|
|
922
927
|
|
|
923
928
|
Options:
|
|
929
|
+
--ip-address <ip-address> The IP address of the control server or the local machine.
|
|
930
|
+
--hostname <hostname> The hostname of the target baremetal machine.
|
|
931
|
+
--ip-file-server <ip-file-server> The IP address of the file server (NFS/TFTP).
|
|
932
|
+
--ip-config <ip-config> IP configuration string for the baremetal machine.
|
|
933
|
+
--netmask <netmask> Netmask of network.
|
|
934
|
+
--dns-server <dns-server> DNS server IP address.
|
|
924
935
|
--control-server-install Installs the baremetal control server.
|
|
925
936
|
--control-server-uninstall Uninstalls the baremetal control server.
|
|
926
937
|
--control-server-restart Restarts the baremetal control server.
|
package/jsconfig.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"module": "CommonJS",
|
|
4
|
-
"target": "ES6"
|
|
4
|
+
"target": "ES6",
|
|
5
|
+
"moduleResolution": "Node",
|
|
6
|
+
"checkJs": false
|
|
5
7
|
},
|
|
6
|
-
"exclude": ["node_modules", "public", "engine-private"]
|
|
8
|
+
"exclude": ["node_modules", "public", "engine-private", "volume"]
|
|
7
9
|
}
|
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-default-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v2.99.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.99.4
|
|
21
21
|
# resources:
|
|
22
22
|
# requests:
|
|
23
23
|
# memory: "124Ki"
|
|
@@ -100,7 +100,7 @@ spec:
|
|
|
100
100
|
spec:
|
|
101
101
|
containers:
|
|
102
102
|
- name: dd-default-development-green
|
|
103
|
-
image: localhost/rockylinux9-underpost:v2.99.
|
|
103
|
+
image: localhost/rockylinux9-underpost:v2.99.4
|
|
104
104
|
# resources:
|
|
105
105
|
# requests:
|
|
106
106
|
# memory: "124Ki"
|
|
@@ -18,7 +18,7 @@ spec:
|
|
|
18
18
|
spec:
|
|
19
19
|
containers:
|
|
20
20
|
- name: dd-test-development-blue
|
|
21
|
-
image: localhost/rockylinux9-underpost:v2.99.
|
|
21
|
+
image: localhost/rockylinux9-underpost:v2.99.4
|
|
22
22
|
|
|
23
23
|
command:
|
|
24
24
|
- /bin/sh
|
|
@@ -103,7 +103,7 @@ spec:
|
|
|
103
103
|
spec:
|
|
104
104
|
containers:
|
|
105
105
|
- name: dd-test-development-green
|
|
106
|
-
image: localhost/rockylinux9-underpost:v2.99.
|
|
106
|
+
image: localhost/rockylinux9-underpost:v2.99.4
|
|
107
107
|
|
|
108
108
|
command:
|
|
109
109
|
- /bin/sh
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: Deployment
|
|
3
|
+
metadata:
|
|
4
|
+
name: playwright-server
|
|
5
|
+
spec:
|
|
6
|
+
replicas: 1
|
|
7
|
+
selector:
|
|
8
|
+
matchLabels:
|
|
9
|
+
app: playwright-server
|
|
10
|
+
template:
|
|
11
|
+
metadata:
|
|
12
|
+
labels:
|
|
13
|
+
app: playwright-server
|
|
14
|
+
spec:
|
|
15
|
+
containers:
|
|
16
|
+
- name: playwright
|
|
17
|
+
image: mcr.microsoft.com/playwright:v1.58.1-jammy
|
|
18
|
+
command:
|
|
19
|
+
- /bin/bash
|
|
20
|
+
- -c
|
|
21
|
+
- |
|
|
22
|
+
echo "[startup] Checking injected JS script..."
|
|
23
|
+
if [ -f /app/script.js ]; then
|
|
24
|
+
echo "[startup] Running /app/script.js"
|
|
25
|
+
cd /app
|
|
26
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
|
|
27
|
+
\. "$HOME/.nvm/nvm.sh"
|
|
28
|
+
nvm install 24
|
|
29
|
+
nvm use 24
|
|
30
|
+
npm init -y
|
|
31
|
+
npm pkg set type=module
|
|
32
|
+
npm pkg set main=script.js
|
|
33
|
+
npm pkg set scripts.start="node script.js"
|
|
34
|
+
npm install playwright
|
|
35
|
+
npm start
|
|
36
|
+
else
|
|
37
|
+
echo "[startup] No script found, skipping"
|
|
38
|
+
fi
|
|
39
|
+
exec npx -y playwright@latest run-server --port 3000
|
|
40
|
+
env:
|
|
41
|
+
- name: PLAYWRIGHT_HEADLESS
|
|
42
|
+
value: '1'
|
|
43
|
+
ports:
|
|
44
|
+
- containerPort: 3000
|
|
45
|
+
volumeMounts:
|
|
46
|
+
- name: js-script
|
|
47
|
+
mountPath: /app/script.js
|
|
48
|
+
subPath: script.js
|
|
49
|
+
volumes:
|
|
50
|
+
- name: js-script
|
|
51
|
+
configMap:
|
|
52
|
+
name: playwright-script
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"main": "src/index.js",
|
|
4
4
|
"name": "@underpostnet/underpost",
|
|
5
|
-
"version": "2.99.
|
|
5
|
+
"version": "2.99.4",
|
|
6
6
|
"description": "pwa api rest template",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
|
package/scripts/rocky-pwa.sh
CHANGED
|
@@ -141,7 +141,7 @@ if [[ -z "$FOUND_ICON" ]]; then
|
|
|
141
141
|
fi
|
|
142
142
|
|
|
143
143
|
echo ">>> Downloading icon from $ICON_URL..."
|
|
144
|
-
wget -q -O "$BUILD_TMP/downloaded_icon" "$ICON_URL"
|
|
144
|
+
wget -q -O "$BUILD_TMP/downloaded_icon" "$ICON_URL"
|
|
145
145
|
if [[ -s "$BUILD_TMP/downloaded_icon" ]]; then
|
|
146
146
|
FOUND_ICON="$BUILD_TMP/downloaded_icon"
|
|
147
147
|
fi
|
|
@@ -174,7 +174,7 @@ EOF
|
|
|
174
174
|
|
|
175
175
|
# Update cache
|
|
176
176
|
if command -v update-desktop-database &> /dev/null; then
|
|
177
|
-
update-desktop-database /usr/share/applications
|
|
177
|
+
update-desktop-database /usr/share/applications
|
|
178
178
|
fi
|
|
179
179
|
|
|
180
180
|
# ------------------------------------------------------------------------------
|
package/scripts/ssl.sh
CHANGED
|
@@ -48,7 +48,13 @@ info "Outputs: $CERT_FILE, $KEY_FILE, $FULLCHAIN_FILE, $ROOT_PEM"
|
|
|
48
48
|
|
|
49
49
|
# Install prerequisites
|
|
50
50
|
if ! command -v dnf >/dev/null 2>&1; then err "dnf not found. This script expects RHEL/Rocky with dnf."; exit 1; fi
|
|
51
|
-
|
|
51
|
+
|
|
52
|
+
SUDO=""
|
|
53
|
+
if [ "$EUID" -ne 0 ]; then
|
|
54
|
+
SUDO="sudo"
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
$SUDO dnf install -y curl nss-tools ca-certificates
|
|
52
58
|
|
|
53
59
|
# Download and install mkcert binary (no 'go install')
|
|
54
60
|
download_mkcert_binary() {
|
|
@@ -68,8 +74,8 @@ download_mkcert_binary() {
|
|
|
68
74
|
if [[ -z "$ASSET_URL" ]]; then err "Could not find mkcert asset for your arch"; return 1; fi
|
|
69
75
|
TMP_BIN="$(mktemp -u /tmp/mkcert.XXXXXX)"
|
|
70
76
|
if curl -fSL -o "$TMP_BIN" "$ASSET_URL"; then
|
|
71
|
-
|
|
72
|
-
|
|
77
|
+
$SUDO mv "$TMP_BIN" /usr/local/bin/mkcert
|
|
78
|
+
$SUDO chmod +x /usr/local/bin/mkcert
|
|
73
79
|
info "mkcert installed to /usr/local/bin/mkcert"
|
|
74
80
|
return 0
|
|
75
81
|
fi
|
|
@@ -83,7 +89,7 @@ use_mkcert() {
|
|
|
83
89
|
fi
|
|
84
90
|
MKCERT_BIN="$(command -v mkcert || echo /usr/local/bin/mkcert)"
|
|
85
91
|
info "Running mkcert -install as sudo (if necessary)"
|
|
86
|
-
if !
|
|
92
|
+
if ! $SUDO "$MKCERT_BIN" -install >/dev/null 2>&1; then
|
|
87
93
|
if ! "$MKCERT_BIN" -install >/dev/null 2>&1; then
|
|
88
94
|
err "mkcert -install failed"; return 1
|
|
89
95
|
fi
|
|
@@ -135,8 +141,8 @@ use_openssl() {
|
|
|
135
141
|
mv -f "$CSR_KEY" "$KEY_FILE"
|
|
136
142
|
# create fullchain: leaf + root
|
|
137
143
|
cat "$CERT_FILE" "$ROOT_PEM" > "$FULLCHAIN_FILE"
|
|
138
|
-
|
|
139
|
-
|
|
144
|
+
$SUDO cp "$ROOT_PEM" /etc/pki/ca-trust/source/anchors/
|
|
145
|
+
$SUDO update-ca-trust extract
|
|
140
146
|
if command -v certutil >/dev/null 2>&1; then
|
|
141
147
|
mkdir -p "$HOME/.pki/nssdb"
|
|
142
148
|
certutil -d sql:$HOME/.pki/nssdb -A -t "CT,C,C" -n "Local Dev Root CA" -i "$ROOT_PEM"
|
package/src/cli/baremetal.js
CHANGED
|
@@ -47,13 +47,13 @@ class UnderpostBaremetal {
|
|
|
47
47
|
* It handles NFS root filesystem building, control server installation/uninstallation,
|
|
48
48
|
* and system-level provisioning tasks like timezone and keyboard configuration.
|
|
49
49
|
* @param {string} [workflowId='rpi4mb'] - Identifier for the specific workflow configuration to use.
|
|
50
|
-
* @param {string} [ipAddress=getLocalIPv4Address()] - The IP address of the control server or the local machine.
|
|
51
|
-
* @param {string} [hostname=workflowId] - The hostname of the target baremetal machine.
|
|
52
|
-
* @param {string} [ipFileServer=getLocalIPv4Address()] - The IP address of the file server (NFS/TFTP).
|
|
53
|
-
* @param {string} [ipConfig=''] - IP configuration string for the baremetal machine.
|
|
54
|
-
* @param {string} [netmask=''] - Netmask of network
|
|
55
|
-
* @param {string} [dnsServer=''] - DNS server IP address.
|
|
56
50
|
* @param {object} [options] - An object containing boolean flags for various operations.
|
|
51
|
+
* @param {string} [options.ipAddress=getLocalIPv4Address()] - The IP address of the control server or the local machine.
|
|
52
|
+
* @param {string} [options.hostname=workflowId] - The hostname of the target baremetal machine.
|
|
53
|
+
* @param {string} [options.ipFileServer=getLocalIPv4Address()] - The IP address of the file server (NFS/TFTP).
|
|
54
|
+
* @param {string} [options.ipConfig=''] - IP configuration string for the baremetal machine.
|
|
55
|
+
* @param {string} [options.netmask=''] - Netmask of network
|
|
56
|
+
* @param {string} [options.dnsServer=''] - DNS server IP address.
|
|
57
57
|
* @param {boolean} [options.dev=false] - Development mode flag.
|
|
58
58
|
* @param {boolean} [options.controlServerInstall=false] - Flag to install the control server (e.g., MAAS).
|
|
59
59
|
* @param {boolean} [options.controlServerUninstall=false] - Flag to uninstall the control server.
|
|
@@ -94,13 +94,13 @@ class UnderpostBaremetal {
|
|
|
94
94
|
*/
|
|
95
95
|
async callback(
|
|
96
96
|
workflowId,
|
|
97
|
-
ipAddress,
|
|
98
|
-
hostname,
|
|
99
|
-
ipFileServer,
|
|
100
|
-
ipConfig,
|
|
101
|
-
netmask,
|
|
102
|
-
dnsServer,
|
|
103
97
|
options = {
|
|
98
|
+
ipAddress: undefined,
|
|
99
|
+
hostname: undefined,
|
|
100
|
+
ipFileServer: undefined,
|
|
101
|
+
ipConfig: undefined,
|
|
102
|
+
netmask: undefined,
|
|
103
|
+
dnsServer: undefined,
|
|
104
104
|
dev: false,
|
|
105
105
|
controlServerInstall: false,
|
|
106
106
|
controlServerUninstall: false,
|
|
@@ -139,6 +139,8 @@ class UnderpostBaremetal {
|
|
|
139
139
|
logs: '',
|
|
140
140
|
},
|
|
141
141
|
) {
|
|
142
|
+
let { ipAddress, hostname, ipFileServer, ipConfig, netmask, dnsServer } = options;
|
|
143
|
+
|
|
142
144
|
// Load environment variables from .env file, overriding existing ones if present.
|
|
143
145
|
dotenv.config({ path: `${getUnderpostRootPath()}/.env`, override: true });
|
|
144
146
|
|
package/src/cli/deploy.js
CHANGED
|
@@ -698,30 +698,12 @@ EOF`);
|
|
|
698
698
|
* @memberof UnderpostDeploy
|
|
699
699
|
*/
|
|
700
700
|
existsContainerFile({ podName, path }) {
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
}).trim(),
|
|
708
|
-
);
|
|
709
|
-
const isFolder = JSON.parse(
|
|
710
|
-
shellExec(`docker exec ${podName} sh -c 'test -d "$1" && echo true || echo false' sh ${path}`, {
|
|
711
|
-
stdout: true,
|
|
712
|
-
disableLog: true,
|
|
713
|
-
silent: true,
|
|
714
|
-
}).trim(),
|
|
715
|
-
);
|
|
716
|
-
return isFolder || isFile;
|
|
717
|
-
}
|
|
718
|
-
return JSON.parse(
|
|
719
|
-
shellExec(`kubectl exec ${podName} -- test -f ${path} && echo "true" || echo "false"`, {
|
|
720
|
-
stdout: true,
|
|
721
|
-
disableLog: true,
|
|
722
|
-
silent: true,
|
|
723
|
-
}).trim(),
|
|
724
|
-
);
|
|
701
|
+
const result = shellExec(`kubectl exec ${podName} -- test -f ${path} && echo "true" || echo "false"`, {
|
|
702
|
+
stdout: true,
|
|
703
|
+
disableLog: true,
|
|
704
|
+
silent: true,
|
|
705
|
+
}).trim();
|
|
706
|
+
return result === 'true';
|
|
725
707
|
},
|
|
726
708
|
/**
|
|
727
709
|
* Checks the status of a deployment.
|
package/src/cli/image.js
CHANGED
|
@@ -8,7 +8,7 @@ import fs from 'fs-extra';
|
|
|
8
8
|
import dotenv from 'dotenv';
|
|
9
9
|
import { loggerFactory } from '../server/logger.js';
|
|
10
10
|
import Underpost from '../index.js';
|
|
11
|
-
import { getUnderpostRootPath } from '../server/conf.js';
|
|
11
|
+
import { getNpmRootPath, getUnderpostRootPath } from '../server/conf.js';
|
|
12
12
|
import { shellExec } from '../server/process.js';
|
|
13
13
|
|
|
14
14
|
dotenv.config();
|
|
@@ -32,7 +32,7 @@ class UnderpostImage {
|
|
|
32
32
|
* @param {boolean} [options.kind=false] - If true, load image into Kind cluster.
|
|
33
33
|
* @param {boolean} [options.kubeadm=false] - If true, load image into Kubeadm cluster.
|
|
34
34
|
* @param {boolean} [options.k3s=false] - If true, load image into K3s cluster.
|
|
35
|
-
* @param {string} [options.path=
|
|
35
|
+
* @param {string} [options.path=''] - Path to the Dockerfile context.
|
|
36
36
|
* @param {boolean} [options.dev=false] - If true, use development mode.
|
|
37
37
|
* @param {string} [options.version=''] - Version tag for the image.
|
|
38
38
|
* @param {string} [options.imageName=''] - Custom name for the image.
|
|
@@ -43,7 +43,7 @@ class UnderpostImage {
|
|
|
43
43
|
kind: false,
|
|
44
44
|
kubeadm: false,
|
|
45
45
|
k3s: false,
|
|
46
|
-
path:
|
|
46
|
+
path: '',
|
|
47
47
|
dev: false,
|
|
48
48
|
version: '',
|
|
49
49
|
imageName: '',
|
|
@@ -137,7 +137,7 @@ class UnderpostImage {
|
|
|
137
137
|
),
|
|
138
138
|
);
|
|
139
139
|
for (const key of Object.keys(envObj)) {
|
|
140
|
-
secretsInput += ` && export ${key}="${envObj[key]}" `;
|
|
140
|
+
secretsInput += ` && export ${key}="${envObj[key]}" `;
|
|
141
141
|
secretDockerInput += ` --secret id=${key},env=${key} \ `;
|
|
142
142
|
}
|
|
143
143
|
}
|