underpost 3.2.12 → 3.2.21
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.ci.yml +1 -0
- package/.github/workflows/npmpkg.ci.yml +9 -5
- package/CHANGELOG.md +114 -1
- package/CLI-HELP.md +973 -1130
- package/README.md +47 -41
- package/bin/build.js +88 -137
- package/bin/build.template.js +25 -179
- package/bin/deploy.js +4 -1
- package/bin/index.js +2 -2
- package/conf.js +11 -37
- package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +2 -2
- package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +1 -1
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/package.json +9 -14
- package/scripts/link-local-underpost-cli.sh +6 -0
- package/scripts/test-monitor.sh +86 -0
- package/src/cli/deploy.js +195 -274
- package/src/cli/env.js +1 -4
- package/src/cli/image.js +58 -4
- package/src/cli/index.js +39 -0
- package/src/cli/monitor.js +302 -6
- package/src/cli/release.js +26 -11
- package/src/cli/repository.js +98 -7
- package/src/cli/run.js +137 -69
- package/src/db/mongo/MongooseDB.js +2 -1
- package/src/index.js +1 -1
- package/src/runtime/wp/Dockerfile +3 -3
- package/src/server/catalog-underpost.js +61 -0
- package/src/server/catalog.js +77 -0
- package/src/server/conf.js +365 -56
- package/src/server/runtime-status.js +235 -0
- package/src/server/start.js +17 -8
- package/test/deploy-monitor.test.js +223 -0
- package/manifests/deployment/dd-test-development/deployment.yaml +0 -256
- package/manifests/deployment/dd-test-development/proxy.yaml +0 -102
package/bin/index.js
CHANGED
package/conf.js
CHANGED
|
@@ -95,16 +95,8 @@ const DefaultConf = /**/ {
|
|
|
95
95
|
{ path: '/default-management', client: 'Default', ssr: 'Default' },
|
|
96
96
|
{ client: 'Default', ssr: 'Default', path: '/404', title: '404 Not Found' },
|
|
97
97
|
{ client: 'Default', ssr: 'Default', path: '/500', title: '500 Server Error' },
|
|
98
|
-
{
|
|
99
|
-
|
|
100
|
-
client: 'Default',
|
|
101
|
-
ssr: 'Default',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
path: '/chat',
|
|
105
|
-
client: 'Default',
|
|
106
|
-
ssr: 'Default',
|
|
107
|
-
},
|
|
98
|
+
{ path: '/blog', client: 'Default', ssr: 'Default' },
|
|
99
|
+
{ path: '/chat', client: 'Default', ssr: 'Default' },
|
|
108
100
|
],
|
|
109
101
|
dists: [
|
|
110
102
|
{
|
|
@@ -121,10 +113,7 @@ const DefaultConf = /**/ {
|
|
|
121
113
|
import_name_build: '/dist/sortablejs/sortable.complete.esm.js',
|
|
122
114
|
},
|
|
123
115
|
{ folder: './node_modules/validator', public_folder: '/dist/validator' },
|
|
124
|
-
{
|
|
125
|
-
folder: './node_modules/easymde/dist',
|
|
126
|
-
public_folder: '/dist/easymde',
|
|
127
|
-
},
|
|
116
|
+
{ folder: './node_modules/easymde/dist', public_folder: '/dist/easymde' },
|
|
128
117
|
{
|
|
129
118
|
folder: './node_modules/marked/lib',
|
|
130
119
|
public_folder: '/dist/marked',
|
|
@@ -157,7 +146,6 @@ const DefaultConf = /**/ {
|
|
|
157
146
|
import_name: 'dexie',
|
|
158
147
|
import_name_build: '/dist/dexie/dexie.mjs',
|
|
159
148
|
},
|
|
160
|
-
|
|
161
149
|
{ folder: './node_modules/peerjs/dist', public_folder: '/dist/peerjs' },
|
|
162
150
|
],
|
|
163
151
|
services: ['default', 'core', 'user', 'test', 'file', 'document'],
|
|
@@ -201,40 +189,26 @@ const DefaultConf = /**/ {
|
|
|
201
189
|
proxy: [80, 443],
|
|
202
190
|
db: {
|
|
203
191
|
provider: 'env:DB_PROVIDER:mongoose',
|
|
204
|
-
host: 'env:DB_HOST:mongodb://
|
|
192
|
+
host: 'env:DB_HOST:mongodb://127.0.0.1:27017',
|
|
205
193
|
name: 'env:DB_NAME:default',
|
|
206
194
|
replicaSet: 'env:DB_REPLICA_SET:rs0',
|
|
195
|
+
authSource: 'env:DB_AUTH_SOURCE:admin',
|
|
196
|
+
user: 'env:DB_USER:',
|
|
197
|
+
password: 'env:DB_PASSWORD:',
|
|
207
198
|
},
|
|
208
199
|
mailer: {
|
|
209
|
-
sender: {
|
|
210
|
-
email: 'env:MAILER_SENDER_EMAIL:noreply@default.net',
|
|
211
|
-
name: 'env:MAILER_SENDER_NAME:Default',
|
|
212
|
-
},
|
|
200
|
+
sender: { email: 'env:MAILER_SENDER_EMAIL:noreply@default.net', name: 'env:MAILER_SENDER_NAME:Default' },
|
|
213
201
|
transport: {
|
|
214
202
|
host: 'env:SMTP_HOST:smtp.default.com',
|
|
215
203
|
port: 'env:SMTP_PORT:int:465',
|
|
216
204
|
secure: 'env:SMTP_SECURE:bool:true',
|
|
217
|
-
auth: {
|
|
218
|
-
user: 'env:SMTP_AUTH_USER:',
|
|
219
|
-
pass: 'env:SMTP_AUTH_PASS:',
|
|
220
|
-
},
|
|
205
|
+
auth: { user: 'env:SMTP_AUTH_USER:', pass: 'env:SMTP_AUTH_PASS:' },
|
|
221
206
|
},
|
|
222
207
|
},
|
|
223
|
-
valkey: {
|
|
224
|
-
port: 'env:VALKEY_PORT:int:6379',
|
|
225
|
-
host: 'env:VALKEY_HOST:127.0.0.1',
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
'www.default.net': {
|
|
230
|
-
'/': {
|
|
231
|
-
client: null,
|
|
232
|
-
runtime: 'nodejs',
|
|
233
|
-
apis: [],
|
|
234
|
-
origins: [],
|
|
235
|
-
proxy: [80, 443],
|
|
208
|
+
valkey: { port: 'env:VALKEY_PORT:int:6379', host: 'env:VALKEY_HOST:127.0.0.1' },
|
|
236
209
|
},
|
|
237
210
|
},
|
|
211
|
+
'www.default.net': { '/': { client: null, runtime: 'nodejs', apis: [], origins: [], proxy: [80, 443] } },
|
|
238
212
|
},
|
|
239
213
|
cron: {
|
|
240
214
|
records: {
|
|
@@ -23,14 +23,14 @@ spec:
|
|
|
23
23
|
spec:
|
|
24
24
|
containers:
|
|
25
25
|
- name: dd-cron-backup
|
|
26
|
-
image: underpost/underpost-engine:v3.2.
|
|
26
|
+
image: underpost/underpost-engine:v3.2.21
|
|
27
27
|
command:
|
|
28
28
|
- /bin/sh
|
|
29
29
|
- -c
|
|
30
30
|
- >
|
|
31
31
|
cd /home/dd/engine &&
|
|
32
32
|
node bin env dd-cron production &&
|
|
33
|
-
node bin cron dd-lampp,dd-cyberia,dd-core,dd-test backup --git --kubeadm
|
|
33
|
+
node bin cron dd-lampp,dd-cyberia,dd-core,dd-prototype,dd-test backup --git --kubeadm
|
|
34
34
|
volumeMounts:
|
|
35
35
|
- mountPath: /home/dd/engine
|
|
36
36
|
name: underpost-cron-container-volume
|
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-default-development-blue
|
|
20
|
-
image: underpost/underpost-engine:v3.2.
|
|
20
|
+
image: underpost/underpost-engine:v3.2.21
|
|
21
21
|
# resources:
|
|
22
22
|
# requests:
|
|
23
23
|
# memory: "124Ki"
|
|
@@ -98,7 +98,7 @@ spec:
|
|
|
98
98
|
spec:
|
|
99
99
|
containers:
|
|
100
100
|
- name: dd-default-development-green
|
|
101
|
-
image: underpost/underpost-engine:v3.2.
|
|
101
|
+
image: underpost/underpost-engine:v3.2.21
|
|
102
102
|
# resources:
|
|
103
103
|
# requests:
|
|
104
104
|
# memory: "124Ki"
|
package/package.json
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"main": "src/index.js",
|
|
4
4
|
"name": "underpost",
|
|
5
|
-
"version": "3.2.
|
|
5
|
+
"version": "3.2.21",
|
|
6
6
|
"description": "Underpost Platform — end-to-end CI/CD and application-delivery toolchain CLI. Covers bare metal, Kubernetes, K3s, kubeadm, LXD, container/image orchestration, secrets, databases, cron jobs, monitoring, SSH, runners, PWA + Workbox delivery, and release orchestration. Extensible via downstream CLIs.",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "node --max-old-space-size=8192 src/server",
|
|
9
9
|
"build": "node bin client",
|
|
10
10
|
"test": "NODE_ENV=test c8 mocha",
|
|
11
|
+
"test:monitor": "NODE_ENV=test c8 mocha test/deploy-monitor.test.js",
|
|
11
12
|
"dev": "NODE_ENV=development nodemon src/server",
|
|
12
13
|
"dev:container": "NODE_ENV=development node src/server",
|
|
13
14
|
"prod:container": "NODE_ENV=production node src/server",
|
|
@@ -45,18 +46,12 @@
|
|
|
45
46
|
"k3s",
|
|
46
47
|
"kubeadm",
|
|
47
48
|
"lxd",
|
|
48
|
-
"
|
|
49
|
+
"baremetal",
|
|
49
50
|
"container-orchestration",
|
|
50
51
|
"image-management",
|
|
51
52
|
"pwa",
|
|
52
53
|
"workbox",
|
|
53
|
-
"microservices"
|
|
54
|
-
"template",
|
|
55
|
-
"builder",
|
|
56
|
-
"engine",
|
|
57
|
-
"server",
|
|
58
|
-
"proxy",
|
|
59
|
-
"client"
|
|
54
|
+
"microservices"
|
|
60
55
|
],
|
|
61
56
|
"author": "https://github.com/underpostnet",
|
|
62
57
|
"license": "MIT",
|
|
@@ -78,12 +73,12 @@
|
|
|
78
73
|
"clipboardy": "^5.3.1",
|
|
79
74
|
"cloudinary": "^2.10.0",
|
|
80
75
|
"colors": "^1.4.0",
|
|
81
|
-
"commander": "^
|
|
76
|
+
"commander": "^15.0.0",
|
|
82
77
|
"compression": "^1.7.4",
|
|
83
78
|
"cookie-parser": "^1.4.7",
|
|
84
79
|
"cors": "^2.8.6",
|
|
85
80
|
"d3": "^7.9.0",
|
|
86
|
-
"dexie": "^4.
|
|
81
|
+
"dexie": "^4.4.3",
|
|
87
82
|
"dotenv": "^17.4.2",
|
|
88
83
|
"easymde": "^2.21.0",
|
|
89
84
|
"esbuild": "^0.28.0",
|
|
@@ -93,7 +88,7 @@
|
|
|
93
88
|
"express-rate-limit": "^8.5.2",
|
|
94
89
|
"express-slow-down": "^3.1.0",
|
|
95
90
|
"fast-json-stable-stringify": "^2.1.0",
|
|
96
|
-
"favicons": "^7.
|
|
91
|
+
"favicons": "^7.3.0",
|
|
97
92
|
"fs-extra": "^11.3.5",
|
|
98
93
|
"fullcalendar": "^6.1.15",
|
|
99
94
|
"helmet": "^8.2.0",
|
|
@@ -106,9 +101,9 @@
|
|
|
106
101
|
"mariadb": "^3.2.2",
|
|
107
102
|
"mocha": "^11.7.6",
|
|
108
103
|
"marked": "^18.0.4",
|
|
109
|
-
"mongoose": "^9.6.
|
|
104
|
+
"mongoose": "^9.6.3",
|
|
110
105
|
"morgan": "^1.10.0",
|
|
111
|
-
"nodemailer": "^8.0.
|
|
106
|
+
"nodemailer": "^8.0.10",
|
|
112
107
|
"nodemon": "^3.0.1",
|
|
113
108
|
"peer": "^1.0.2",
|
|
114
109
|
"peerjs": "^1.5.5",
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
|
|
2
|
+
#!/usr/bin/env bash
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
ENV=development
|
|
6
|
+
DEPLOY_ID=dd-test
|
|
7
|
+
IMAGE=underpost/wp:v3.2.14
|
|
8
|
+
USE_CERT=false # Set to true to use --cert, false to use --disable-update-proxy
|
|
9
|
+
USE_PULL_BUNDLE=false # Set to true to include --pull-bundle in start command, false to omit it
|
|
10
|
+
USE_TLS=false # Set to true to generate self-signed certs and expose via HTTPS
|
|
11
|
+
VERSIONS=green
|
|
12
|
+
|
|
13
|
+
# Parse --tls flag from script arguments
|
|
14
|
+
for arg in "$@"; do
|
|
15
|
+
case $arg in
|
|
16
|
+
--tls) USE_TLS=true ;;
|
|
17
|
+
esac
|
|
18
|
+
done
|
|
19
|
+
|
|
20
|
+
# Optional to concat in link cmd:
|
|
21
|
+
# underpost secret underpost --create-from-env
|
|
22
|
+
|
|
23
|
+
LINK_CMD="cd /home/dd,underpost clone underpostnet/pwa-microservices-template-private,cd /home/dd/pwa-microservices-template-private,npm install,npm link"
|
|
24
|
+
PROXY_FLAG=""
|
|
25
|
+
CLUSTER_FLAG=""
|
|
26
|
+
EXPOSE_FLAGS=""
|
|
27
|
+
|
|
28
|
+
node bin run build-cluster-deployment-manifests
|
|
29
|
+
node bin/build.template --update-private
|
|
30
|
+
|
|
31
|
+
if [ "$USE_PULL_BUNDLE" = true ]; then
|
|
32
|
+
DEPLOY_CMD="$LINK_CMD,underpost start --build --run --pull-bundle $DEPLOY_ID $ENV"
|
|
33
|
+
else
|
|
34
|
+
DEPLOY_CMD="$LINK_CMD,underpost start --build --run $DEPLOY_ID $ENV"
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
if [ "$USE_CERT" = true ]; then
|
|
38
|
+
PROXY_FLAG="--cert"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
if [ "$USE_TLS" = true ]; then
|
|
42
|
+
PROXY_FLAG="--self-signed"
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
node bin deploy $DEPLOY_ID $ENV $CLUSTER_FLAG --sync --build-manifest --image $IMAGE --timeout-response 300000ms --versions $VERSIONS --replicas 1 --cmd "$DEPLOY_CMD"
|
|
46
|
+
node bin deploy $DEPLOY_ID $ENV $CLUSTER_FLAG --disable-update-proxy $PROXY_FLAG
|
|
47
|
+
node bin monitor $DEPLOY_ID $ENV --ready-deployment --promote --timeout-response 300000ms --versions $VERSIONS --replicas 1
|
|
48
|
+
|
|
49
|
+
node bin run etc-hosts --deploy-id $DEPLOY_ID
|
|
50
|
+
|
|
51
|
+
# Generate self-signed TLS certs and create k8s TLS secrets for all hosts
|
|
52
|
+
if [ "$USE_TLS" = true ]; then
|
|
53
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
54
|
+
ENGINE_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
|
55
|
+
SSL_BASE="${ENGINE_DIR}/engine-private/ssl"
|
|
56
|
+
NAMESPACE=default
|
|
57
|
+
|
|
58
|
+
# Extract hosts from conf.server.json
|
|
59
|
+
HOSTS=$(node -e "
|
|
60
|
+
const conf = require('./engine-private/conf/${DEPLOY_ID}/conf.server.json');
|
|
61
|
+
console.log(Object.keys(conf).join(' '));
|
|
62
|
+
")
|
|
63
|
+
|
|
64
|
+
for HOST in $HOSTS; do
|
|
65
|
+
CERT_DIR="${SSL_BASE}/${HOST}"
|
|
66
|
+
mkdir -p "$CERT_DIR"
|
|
67
|
+
|
|
68
|
+
# Regenerate self-signed cert (idempotent — overwrites existing files)
|
|
69
|
+
bash "${SCRIPT_DIR}/ssl.sh" "$CERT_DIR" "$HOST"
|
|
70
|
+
|
|
71
|
+
NAME_SAFE="${HOST//[^a-zA-Z0-9_.-]/_}"
|
|
72
|
+
CERT_FILE="${CERT_DIR}/${NAME_SAFE}.pem"
|
|
73
|
+
KEY_FILE="${CERT_DIR}/${NAME_SAFE}-key.pem"
|
|
74
|
+
|
|
75
|
+
# Create / replace k8s TLS secret (name matches host, as referenced by HTTPProxy)
|
|
76
|
+
kubectl delete secret "$HOST" -n "$NAMESPACE" --ignore-not-found
|
|
77
|
+
kubectl create secret tls "$HOST" \
|
|
78
|
+
--cert="$CERT_FILE" \
|
|
79
|
+
--key="$KEY_FILE" \
|
|
80
|
+
-n "$NAMESPACE"
|
|
81
|
+
done
|
|
82
|
+
|
|
83
|
+
EXPOSE_FLAGS="--tls"
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
node bin deploy --expose --local-proxy $DEPLOY_ID $ENV $EXPOSE_FLAGS
|