underpost 3.2.3 → 3.2.5
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/publish.ci.yml +21 -9
- package/CHANGELOG.md +28 -1
- package/CLI-HELP.md +1 -1
- package/README.md +2 -2
- package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +3 -5
- package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +3 -5
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +2 -2
- package/package.json +1 -1
- package/src/cli/release.js +1 -1
- package/src/cli/run.js +7 -2
- package/src/index.js +1 -1
- package/src/server/backup.js +1 -2
- package/src/server/conf.js +24 -9
- package/src/server/cron.js +8 -11
- package/src/server/dns.js +2 -1
|
@@ -3,17 +3,27 @@ on:
|
|
|
3
3
|
push:
|
|
4
4
|
tags:
|
|
5
5
|
- 'v*'
|
|
6
|
+
permissions:
|
|
7
|
+
contents: write
|
|
8
|
+
packages: write
|
|
9
|
+
id-token: write
|
|
6
10
|
jobs:
|
|
7
11
|
build-and-publish:
|
|
8
12
|
# prevents this action from running on forks
|
|
9
13
|
if: github.repository == 'underpostnet/pwa-microservices-template'
|
|
10
14
|
runs-on: ubuntu-latest
|
|
11
15
|
permissions:
|
|
12
|
-
contents:
|
|
16
|
+
contents: write
|
|
17
|
+
packages: write
|
|
13
18
|
id-token: write
|
|
14
19
|
steps:
|
|
15
20
|
- uses: actions/checkout@v6
|
|
16
21
|
|
|
22
|
+
- name: Install required packages
|
|
23
|
+
run: |
|
|
24
|
+
sudo apt-get update -y
|
|
25
|
+
sudo apt-get install -y sudo tar gzip bzip2 git curl
|
|
26
|
+
|
|
17
27
|
- uses: actions/setup-node@v6
|
|
18
28
|
with:
|
|
19
29
|
node-version: '24.x'
|
|
@@ -27,12 +37,21 @@ jobs:
|
|
|
27
37
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
28
38
|
run: npm publish --provenance --access public
|
|
29
39
|
|
|
40
|
+
- name: Dispatch release CD
|
|
41
|
+
run: |
|
|
42
|
+
curl -s -f -X POST \
|
|
43
|
+
-H "Accept: application/vnd.github.v3+json" \
|
|
44
|
+
-H "Authorization: token ${{ secrets.GIT_AUTH_TOKEN }}" \
|
|
45
|
+
"https://api.github.com/repos/underpostnet/pwa-microservices-template/actions/workflows/release.cd.yml/dispatches" \
|
|
46
|
+
-d '{"ref":"master"}'
|
|
47
|
+
|
|
30
48
|
build-and-publish-ghpkg:
|
|
31
49
|
# prevents this action from running on forks
|
|
32
50
|
if: github.repository == 'underpostnet/pwa-microservices-template-ghpkg'
|
|
33
51
|
runs-on: ubuntu-latest
|
|
34
52
|
permissions:
|
|
35
|
-
contents:
|
|
53
|
+
contents: write
|
|
54
|
+
packages: write
|
|
36
55
|
id-token: write
|
|
37
56
|
steps:
|
|
38
57
|
- uses: actions/checkout@v6
|
|
@@ -66,10 +85,3 @@ jobs:
|
|
|
66
85
|
npm publish
|
|
67
86
|
env:
|
|
68
87
|
NODE_AUTH_TOKEN: ${{ secrets.GIT_AUTH_TOKEN }}
|
|
69
|
-
|
|
70
|
-
# Release deploy — triggers release.cd.yml after Docker build succeeds
|
|
71
|
-
deploy-release:
|
|
72
|
-
needs: build-and-publish
|
|
73
|
-
if: always() && needs.build-and-publish.result == 'success'
|
|
74
|
-
uses: ./.github/workflows/release.cd.yml
|
|
75
|
-
secrets: inherit
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 2026-04-
|
|
3
|
+
## 2026-04-16
|
|
4
|
+
|
|
5
|
+
### cli-run
|
|
6
|
+
|
|
7
|
+
- Refactor cron command execution to improve flag handling and streamline deployment options ([1773b8e12](https://github.com/underpostnet/engine/commit/1773b8e12d1edccd99d21b231c47bbea647e9772))
|
|
8
|
+
- Add shellExec command for database operations in deployment process ([9de52cb7d](https://github.com/underpostnet/engine/commit/9de52cb7d69e2fe2a8e515e8bfb23a615c0974a6))
|
|
9
|
+
|
|
10
|
+
### cli-cron
|
|
11
|
+
|
|
12
|
+
- Enhance cron job commands with git option and streamline backup operations ([170c77ff4](https://github.com/underpostnet/engine/commit/170c77ff499712bce2fe443719c29528c52610e5))
|
|
13
|
+
- Refactor cron job commands to use 'underpost' CLI and remove secret run step ([e51cd0231](https://github.com/underpostnet/engine/commit/e51cd023195ef8855b36418b4076812ef677baaf))
|
|
14
|
+
- Refactor streamline cron deployment handling and add deploy-id resolver ([bb81fe80b](https://github.com/underpostnet/engine/commit/bb81fe80bcb6b7aa30604d65d0357b2e3e5e10ee))
|
|
15
|
+
|
|
16
|
+
### github-actions
|
|
17
|
+
|
|
18
|
+
- Fix sudo usage in package installation step ([8545a8e88](https://github.com/underpostnet/engine/commit/8545a8e88e10443d754bcadb1772c3e1acb369f9))
|
|
19
|
+
|
|
20
|
+
## New release v:3.2.4 (2026-04-15)
|
|
21
|
+
|
|
22
|
+
### cli-cron
|
|
23
|
+
|
|
24
|
+
- Update underpost container environment path for volume mount ([8fdfb5416](https://github.com/underpostnet/engine/commit/8fdfb54165f4ef7379fccbeb20e5c476320bc1f6))
|
|
25
|
+
|
|
26
|
+
### github-actions
|
|
27
|
+
|
|
28
|
+
- Add dispatch step for release CD in publish workflow ([8dc0e3ccd](https://github.com/underpostnet/engine/commit/8dc0e3ccd1a578f776edf215428d08640b44c3d1))
|
|
29
|
+
|
|
30
|
+
## New release v:3.2.3 (2026-04-15)
|
|
4
31
|
|
|
5
32
|
### cli-cron
|
|
6
33
|
|
package/CLI-HELP.md
CHANGED
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
<div align="center">
|
|
18
18
|
|
|
19
|
-
[](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.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.ci.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [](https://www.npmjs.com/package/underpost) [](https://socket.dev/npm/package/underpost/overview/3.2.5) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](https://www.npmjs.com/package/underpost)
|
|
20
20
|
|
|
21
21
|
</div>
|
|
22
22
|
|
|
@@ -61,7 +61,7 @@ npm run dev
|
|
|
61
61
|
<a target="_top" href="https://www.nexodev.org/docs?cid=src">See Docs here.</a>
|
|
62
62
|
|
|
63
63
|
<!-- cli-index-start -->
|
|
64
|
-
## underpost ci/cd cli v3.2.
|
|
64
|
+
## underpost ci/cd cli v3.2.5
|
|
65
65
|
|
|
66
66
|
### Usage: `underpost [options] [command]`
|
|
67
67
|
```
|
|
@@ -23,21 +23,19 @@ 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.5
|
|
27
27
|
command:
|
|
28
28
|
- /bin/sh
|
|
29
29
|
- -c
|
|
30
30
|
- >
|
|
31
31
|
cd /home/dd/engine &&
|
|
32
|
-
node bin run secret &&
|
|
33
32
|
node bin env dd-cron production &&
|
|
34
|
-
node bin cron
|
|
33
|
+
node bin cron dd-lampp,dd-cyberia,dd-core,dd-test backup --git --kubeadm
|
|
35
34
|
volumeMounts:
|
|
36
35
|
- mountPath: /home/dd/engine
|
|
37
36
|
name: underpost-cron-container-volume
|
|
38
|
-
- mountPath: /usr/lib/node_modules/underpost
|
|
37
|
+
- mountPath: /usr/lib/node_modules/underpost
|
|
39
38
|
name: underpost-share-env
|
|
40
|
-
subPath: .env
|
|
41
39
|
volumes:
|
|
42
40
|
- hostPath:
|
|
43
41
|
path: /home/dd/engine
|
|
@@ -23,21 +23,19 @@ spec:
|
|
|
23
23
|
spec:
|
|
24
24
|
containers:
|
|
25
25
|
- name: dd-cron-dns
|
|
26
|
-
image: underpost/underpost-engine:v3.2.
|
|
26
|
+
image: underpost/underpost-engine:v3.2.5
|
|
27
27
|
command:
|
|
28
28
|
- /bin/sh
|
|
29
29
|
- -c
|
|
30
30
|
- >
|
|
31
31
|
cd /home/dd/engine &&
|
|
32
|
-
node bin run secret &&
|
|
33
32
|
node bin env dd-cron production &&
|
|
34
|
-
node bin cron --git --
|
|
33
|
+
node bin cron dd-cron dns --git --kubeadm
|
|
35
34
|
volumeMounts:
|
|
36
35
|
- mountPath: /home/dd/engine
|
|
37
36
|
name: underpost-cron-container-volume
|
|
38
|
-
- mountPath: /usr/lib/node_modules/underpost
|
|
37
|
+
- mountPath: /usr/lib/node_modules/underpost
|
|
39
38
|
name: underpost-share-env
|
|
40
|
-
subPath: .env
|
|
41
39
|
volumes:
|
|
42
40
|
- hostPath:
|
|
43
41
|
path: /home/dd/engine
|
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-default-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v3.2.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v3.2.5
|
|
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:v3.2.
|
|
103
|
+
image: localhost/rockylinux9-underpost:v3.2.5
|
|
104
104
|
# resources:
|
|
105
105
|
# requests:
|
|
106
106
|
# memory: "124Ki"
|
|
@@ -20,7 +20,7 @@ spec:
|
|
|
20
20
|
spec:
|
|
21
21
|
containers:
|
|
22
22
|
- name: dd-test-development-blue
|
|
23
|
-
image: localhost/rockylinux9-underpost:v3.2.
|
|
23
|
+
image: localhost/rockylinux9-underpost:v3.2.5
|
|
24
24
|
envFrom:
|
|
25
25
|
- secretRef:
|
|
26
26
|
name: underpost-config
|
|
@@ -112,7 +112,7 @@ spec:
|
|
|
112
112
|
spec:
|
|
113
113
|
containers:
|
|
114
114
|
- name: dd-test-development-green
|
|
115
|
-
image: localhost/rockylinux9-underpost:v3.2.
|
|
115
|
+
image: localhost/rockylinux9-underpost:v3.2.5
|
|
116
116
|
envFrom:
|
|
117
117
|
- secretRef:
|
|
118
118
|
name: underpost-config
|
package/package.json
CHANGED
package/src/cli/release.js
CHANGED
|
@@ -148,7 +148,7 @@ class UnderpostRelease {
|
|
|
148
148
|
shellExec(`node bin new --deploy-id dd-default`);
|
|
149
149
|
console.log(fs.existsSync(`./engine-private/conf/dd-default`));
|
|
150
150
|
shellExec(`sudo rm -rf ./engine-private/conf/dd-default`);
|
|
151
|
-
shellExec(`node bin cron --
|
|
151
|
+
shellExec(`node bin cron --kubeadm --setup-start --git`); // --apply
|
|
152
152
|
shellExec(`node bin cmt --changelog-build`);
|
|
153
153
|
},
|
|
154
154
|
|
package/src/cli/run.js
CHANGED
|
@@ -654,6 +654,7 @@ echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com
|
|
|
654
654
|
const env = options.dev ? 'development' : 'production';
|
|
655
655
|
const baseCommand = options.dev ? 'node bin' : 'underpost';
|
|
656
656
|
const baseClusterCommand = options.dev ? ' --dev' : '';
|
|
657
|
+
const clusterFlag = options.k3s ? ' --k3s' : options.kind ? ' --kind' : ' --kubeadm';
|
|
657
658
|
const defaultPath = [
|
|
658
659
|
'dd-default',
|
|
659
660
|
options.replicas,
|
|
@@ -674,7 +675,8 @@ echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com
|
|
|
674
675
|
if (!validVersion) throw new Error('Version mismatch');
|
|
675
676
|
}
|
|
676
677
|
if (options.timezone !== 'none') shellExec(`${baseCommand} run${baseClusterCommand} tz`);
|
|
677
|
-
if (options.deployIdCronJobs !== 'none')
|
|
678
|
+
if (options.deployIdCronJobs !== 'none')
|
|
679
|
+
shellExec(`node bin cron${baseClusterCommand}${clusterFlag} --setup-start --git --apply`);
|
|
678
680
|
}
|
|
679
681
|
|
|
680
682
|
const currentTraffic = isDeployRunnerContext(path, options)
|
|
@@ -687,7 +689,6 @@ echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com
|
|
|
687
689
|
const cmdString = options.cmd
|
|
688
690
|
? ' --cmd ' + (options.cmd.find((c) => c.match('"')) ? '"' + options.cmd + '"' : "'" + options.cmd + "'")
|
|
689
691
|
: '';
|
|
690
|
-
const clusterFlag = options.k3s ? ' --k3s' : options.kind ? ' --kind' : ' --kubeadm';
|
|
691
692
|
const gitCleanFlag = options.gitClean ? ' --git-clean' : '';
|
|
692
693
|
|
|
693
694
|
shellExec(
|
|
@@ -699,6 +700,10 @@ echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com
|
|
|
699
700
|
);
|
|
700
701
|
|
|
701
702
|
if (isDeployRunnerContext(path, options)) {
|
|
703
|
+
// Backup app/services repositories with repo-backup configured
|
|
704
|
+
shellExec(
|
|
705
|
+
`${baseCommand} db ${deployId} ${clusterFlag}${baseClusterCommand} --repo-backup --primary-pod --git --force-clone --preserveUUID ${options.namespace ? ` --ns ${options.namespace}` : ''}`,
|
|
706
|
+
);
|
|
702
707
|
shellExec(
|
|
703
708
|
`${baseCommand} deploy${clusterFlag}${cmdString} --replicas ${replicas} --disable-update-proxy ${deployId} ${env} --versions ${versions}${
|
|
704
709
|
options.namespace ? ` --namespace ${options.namespace}` : ''
|
package/src/index.js
CHANGED
package/src/server/backup.js
CHANGED
|
@@ -50,8 +50,7 @@ class BackUp {
|
|
|
50
50
|
for (const _deployId of deployList.split(',')) {
|
|
51
51
|
const deployId = _deployId.trim();
|
|
52
52
|
if (!deployId) continue;
|
|
53
|
-
|
|
54
|
-
const dbCommand = `node bin db ${options.git ? '--git --force-clone ' : ''}--export --primary-pod${clusterFlag} ${deployId}`;
|
|
53
|
+
const dbCommand = `node bin db ${options.git ? '--git --force-clone ' : ''}--export --primary-pod --preserveUUID${clusterFlag} ${deployId}`;
|
|
55
54
|
const repoCommand = `node bin db --repo-backup${clusterFlag} ${deployId}`;
|
|
56
55
|
|
|
57
56
|
// Pass GITHUB_TOKEN and GITHUB_USERNAME ephemerally through the SSH command
|
package/src/server/conf.js
CHANGED
|
@@ -148,6 +148,23 @@ const getConfFolder = (deployId) => {
|
|
|
148
148
|
: `./engine-private/conf/${deployId}`;
|
|
149
149
|
};
|
|
150
150
|
|
|
151
|
+
/**
|
|
152
|
+
* Reads `engine-private/deploy/dd.cron` and returns the deploy-id string,
|
|
153
|
+
* or `null` if the file does not exist or is empty.
|
|
154
|
+
*
|
|
155
|
+
* @method cronDeployIdResolve
|
|
156
|
+
* @returns {string|null} The deploy-id from dd.cron, or null.
|
|
157
|
+
* @memberof ServerConfBuilder
|
|
158
|
+
*/
|
|
159
|
+
const cronDeployIdResolve = () => {
|
|
160
|
+
const cronDeployFile = './engine-private/deploy/dd.cron';
|
|
161
|
+
if (fs.existsSync(cronDeployFile)) {
|
|
162
|
+
const id = fs.readFileSync(cronDeployFile, 'utf8').trim();
|
|
163
|
+
return id || null;
|
|
164
|
+
}
|
|
165
|
+
return null;
|
|
166
|
+
};
|
|
167
|
+
|
|
151
168
|
/**
|
|
152
169
|
* Loads the deployment-specific `.env` file referenced by `engine-private/deploy/dd.cron`
|
|
153
170
|
* into `process.env`. Uses `NODE_ENV` to select the environment variant
|
|
@@ -162,15 +179,12 @@ function loadCronDeployEnv() {
|
|
|
162
179
|
const envName = process.env.NODE_ENV || 'production';
|
|
163
180
|
|
|
164
181
|
// 1) Load dd.cron env (takes full precedence)
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
167
|
-
const
|
|
168
|
-
if (
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
const cronEnv = dotenv.parse(fs.readFileSync(cronEnvPath, 'utf8'));
|
|
172
|
-
process.env = { ...process.env, ...cronEnv };
|
|
173
|
-
}
|
|
182
|
+
const cronDeployId = cronDeployIdResolve();
|
|
183
|
+
if (cronDeployId) {
|
|
184
|
+
const cronEnvPath = `./engine-private/conf/${cronDeployId}/.env.${envName}`;
|
|
185
|
+
if (fs.existsSync(cronEnvPath)) {
|
|
186
|
+
const cronEnv = dotenv.parse(fs.readFileSync(cronEnvPath, 'utf8'));
|
|
187
|
+
process.env = { ...process.env, ...cronEnv };
|
|
174
188
|
}
|
|
175
189
|
}
|
|
176
190
|
|
|
@@ -1776,4 +1790,5 @@ export {
|
|
|
1776
1790
|
readConfJson,
|
|
1777
1791
|
DEFAULT_DEPLOY_ID,
|
|
1778
1792
|
loadCronDeployEnv,
|
|
1793
|
+
cronDeployIdResolve,
|
|
1779
1794
|
};
|
package/src/server/cron.js
CHANGED
|
@@ -16,7 +16,7 @@ const volumeHostPath = '/home/dd';
|
|
|
16
16
|
const enginePath = '/home/dd/engine';
|
|
17
17
|
const cronVolumeName = 'underpost-cron-container-volume';
|
|
18
18
|
const shareEnvVolumeName = 'underpost-share-env';
|
|
19
|
-
const
|
|
19
|
+
const underpostContainerEnvDir = '/usr/lib/node_modules/underpost';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Generates a Kubernetes CronJob YAML manifest string.
|
|
@@ -64,11 +64,11 @@ const cronJobYamlFactory = ({
|
|
|
64
64
|
.replace(/^-|-$/g, '')
|
|
65
65
|
.substring(0, 52);
|
|
66
66
|
|
|
67
|
-
const cronBin = dev ? 'node bin' : 'underpost';
|
|
67
|
+
const cronBin = 'node bin'; // dev ? 'node bin' : 'underpost';
|
|
68
68
|
const flags = `${git ? '--git ' : ''}${dev ? '--dev ' : ''}${dryRun ? '--dry-run ' : ''}${k3s ? '--k3s ' : ''}${kind ? '--kind ' : ''}${kubeadm ? '--kubeadm ' : ''}`;
|
|
69
|
-
const commands = [`cd ${enginePath}
|
|
69
|
+
const commands = [`cd ${enginePath}`]; // `node bin run secret`
|
|
70
70
|
if (cmd) commands.push(cmd);
|
|
71
|
-
commands.push(`${cronBin} cron ${
|
|
71
|
+
commands.push(`${cronBin} cron ${deployList} ${jobList} ${flags}`);
|
|
72
72
|
const fullCommand = commands.join(' &&\n ');
|
|
73
73
|
|
|
74
74
|
return `apiVersion: batch/v1
|
|
@@ -105,9 +105,8 @@ spec:
|
|
|
105
105
|
volumeMounts:
|
|
106
106
|
- mountPath: ${enginePath}
|
|
107
107
|
name: ${cronVolumeName}
|
|
108
|
-
- mountPath: ${
|
|
108
|
+
- mountPath: ${underpostContainerEnvDir}
|
|
109
109
|
name: ${shareEnvVolumeName}
|
|
110
|
-
subPath: .env
|
|
111
110
|
volumes:
|
|
112
111
|
- hostPath:
|
|
113
112
|
path: ${enginePath}
|
|
@@ -273,17 +272,15 @@ class UnderpostCron {
|
|
|
273
272
|
logger.warn(`package.json not found for deploy-id: ${deployId}`, { path: packageJsonPath });
|
|
274
273
|
}
|
|
275
274
|
|
|
276
|
-
// Generate and apply cron job manifests for this deploy-id
|
|
277
|
-
const hasExplicitCluster = options.k3s || options.kind || options.kubeadm;
|
|
278
275
|
await Underpost.cron.generateK8sCronJobs({
|
|
279
276
|
deployId,
|
|
280
277
|
namespace: options.namespace,
|
|
281
278
|
image: options.image,
|
|
282
279
|
apply: options.apply,
|
|
283
280
|
createJobNow: options.createJobNow,
|
|
284
|
-
git: options.git
|
|
285
|
-
dev: options.dev
|
|
286
|
-
kubeadm:
|
|
281
|
+
git: !!options.git,
|
|
282
|
+
dev: !!options.dev,
|
|
283
|
+
kubeadm: !!options.kubeadm,
|
|
287
284
|
cmd: options.cmd || `node bin env ${deployId} production`,
|
|
288
285
|
k3s: !!options.k3s,
|
|
289
286
|
kind: !!options.kind,
|
package/src/server/dns.js
CHANGED