underpost 2.8.452 → 2.8.481
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 +6 -50
- package/.github/workflows/npmpkg.yml +67 -0
- package/.github/workflows/pwa-microservices-template.page.yml +2 -1
- package/.github/workflows/pwa-microservices-template.test.yml +2 -2
- package/Dockerfile +3 -3
- package/bin/build.js +32 -191
- package/bin/deploy.js +3 -19
- package/bin/file.js +13 -2
- package/bin/index.js +30 -3
- package/docker-compose.yml +1 -1
- package/package.json +12 -3
- package/src/cli/cluster.js +3 -3
- package/src/cli/db.js +148 -0
- package/src/cli/deploy.js +277 -0
- package/src/cli/image.js +21 -14
- package/src/cli/repository.js +11 -17
- package/src/cli/test.js +52 -1
- package/src/client/components/core/Auth.js +22 -4
- package/src/client/components/core/CommonJs.js +9 -0
- package/src/client/components/core/Modal.js +0 -1
- package/src/client/components/core/Translate.js +4 -0
- package/src/client/components/core/VanillaJs.js +0 -9
- package/src/client/components/core/Worker.js +34 -31
- package/src/index.js +17 -1
- package/src/server/conf.js +25 -15
- package/src/server/logger.js +1 -0
- package/src/server/network.js +16 -6
|
@@ -9,52 +9,6 @@ permissions:
|
|
|
9
9
|
packages: write
|
|
10
10
|
id-token: write
|
|
11
11
|
jobs:
|
|
12
|
-
pwa-microservices-template:
|
|
13
|
-
if: github.repository == 'underpostnet/engine' && startsWith(github.event.head_commit.message, 'ci(package-pwa-microservices-template)')
|
|
14
|
-
name: Update github repo package Jobs
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
permissions:
|
|
17
|
-
contents: write
|
|
18
|
-
packages: write
|
|
19
|
-
id-token: write
|
|
20
|
-
steps:
|
|
21
|
-
- uses: actions/checkout@v3
|
|
22
|
-
|
|
23
|
-
- uses: actions/setup-node@v4
|
|
24
|
-
with:
|
|
25
|
-
node-version: '23.x'
|
|
26
|
-
|
|
27
|
-
- name: Install dependencies
|
|
28
|
-
run: |
|
|
29
|
-
npm install
|
|
30
|
-
|
|
31
|
-
- name: Set git credentials
|
|
32
|
-
run: |
|
|
33
|
-
git config --global credential.helper ""
|
|
34
|
-
git config credential.helper ""
|
|
35
|
-
git config --global user.name 'underpostnet'
|
|
36
|
-
git config --global user.email 'development@underpost.net'
|
|
37
|
-
git config --global credential.interactive always
|
|
38
|
-
git config user.name 'underpostnet'
|
|
39
|
-
git config user.email 'development@underpost.net'
|
|
40
|
-
git config credential.interactive always
|
|
41
|
-
|
|
42
|
-
- name: Clone github package repository
|
|
43
|
-
run: |
|
|
44
|
-
cd .. && git clone https://github.com/underpostnet/pwa-microservices-template.git
|
|
45
|
-
cd engine
|
|
46
|
-
npm run update-template
|
|
47
|
-
cd ../pwa-microservices-template
|
|
48
|
-
git remote set-url origin git@github.com:underpostnet/pwa-microservices-template.git
|
|
49
|
-
git add .
|
|
50
|
-
git commit -m "ci(package-pwa-microservices-template-ghpkg): ⚙️ Update github repo package"
|
|
51
|
-
git push https://${{ secrets.GIT_AUTH_TOKEN }}@github.com/underpostnet/pwa-microservices-template.git
|
|
52
|
-
# cd ../engine
|
|
53
|
-
# git commit --allow-empty -m "ci(engine-core-repo-build): ⚙️ Update engine core repository"
|
|
54
|
-
# git commit --allow-empty -m "ci(engine-cyberia-repo-build): ⚙️ Update engine cyberia repository"
|
|
55
|
-
# git commit --allow-empty -m "ci(engine-lampp-repo-build): ⚙️ Update engine lampp repository"
|
|
56
|
-
# git push https://${{ secrets.GIT_AUTH_TOKEN }}@github.com/underpostnet/engine.git
|
|
57
|
-
|
|
58
12
|
pwa-microservices-template-ghpk:
|
|
59
13
|
if: github.repository == 'underpostnet/pwa-microservices-template' && startsWith(github.event.head_commit.message, 'ci(package-pwa-microservices-template-ghpkg)')
|
|
60
14
|
name: Update github repo package Jobs
|
|
@@ -87,13 +41,15 @@ jobs:
|
|
|
87
41
|
|
|
88
42
|
- name: Install dependencies and set repo configuration
|
|
89
43
|
run: |
|
|
90
|
-
npm install
|
|
44
|
+
npm install -g underpost
|
|
45
|
+
underpost config set GITHUB_TOKEN ${{ secrets.GIT_AUTH_TOKEN }}
|
|
46
|
+
underpost install
|
|
91
47
|
node ./bin/deploy rename-package @underpostnet/underpost
|
|
92
48
|
node ./bin/deploy set-repo underpostnet/pwa-microservices-template-ghpkg
|
|
93
49
|
|
|
94
50
|
- name: Clone github package repository
|
|
95
51
|
run: |
|
|
96
|
-
|
|
52
|
+
underpost clone --bare underpostnet/pwa-microservices-template-ghpkg
|
|
97
53
|
rm -rf ./.git
|
|
98
54
|
cp -rf -a ./pwa-microservices-template-ghpkg.git ./.git
|
|
99
55
|
rm -rf ./pwa-microservices-template-ghpkg.git
|
|
@@ -116,8 +72,8 @@ jobs:
|
|
|
116
72
|
git status
|
|
117
73
|
git remote set-url origin git@github.com:underpostnet/pwa-microservices-template-ghpkg.git
|
|
118
74
|
git add .
|
|
119
|
-
|
|
120
|
-
|
|
75
|
+
underpost cmt . ci package-pwa-microservices-template-ghpkg 'Update github repo package'
|
|
76
|
+
underpost push . underpostnet/pwa-microservices-template-ghpkg
|
|
121
77
|
|
|
122
78
|
# git clone --bare https://github.com/underpostnet/engine.git
|
|
123
79
|
# mkdir engine
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: Update npm repo package
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: ['master']
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: ['master']
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
packages: write
|
|
10
|
+
id-token: write
|
|
11
|
+
jobs:
|
|
12
|
+
pwa-microservices-template:
|
|
13
|
+
if: github.repository == 'underpostnet/engine' && startsWith(github.event.head_commit.message, 'ci(package-pwa-microservices-template)')
|
|
14
|
+
name: Update npm repo package Jobs
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
contents: write
|
|
18
|
+
packages: write
|
|
19
|
+
id-token: write
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v3
|
|
22
|
+
|
|
23
|
+
- uses: actions/setup-node@v4
|
|
24
|
+
with:
|
|
25
|
+
node-version: '23.x'
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: |
|
|
29
|
+
npm install -g underpost
|
|
30
|
+
underpost config set GITHUB_TOKEN ${{ secrets.GIT_AUTH_TOKEN }}
|
|
31
|
+
underpost install
|
|
32
|
+
|
|
33
|
+
- name: Set git credentials
|
|
34
|
+
run: |
|
|
35
|
+
git config --global credential.helper ""
|
|
36
|
+
git config credential.helper ""
|
|
37
|
+
git config --global user.name 'underpostnet'
|
|
38
|
+
git config --global user.email 'development@underpost.net'
|
|
39
|
+
git config --global credential.interactive always
|
|
40
|
+
git config user.name 'underpostnet'
|
|
41
|
+
git config user.email 'development@underpost.net'
|
|
42
|
+
git config credential.interactive always
|
|
43
|
+
|
|
44
|
+
- name: Clone github package repository
|
|
45
|
+
run: |
|
|
46
|
+
cd .. && underpost clone underpostnet/pwa-microservices-template
|
|
47
|
+
cd engine
|
|
48
|
+
npm run update-template
|
|
49
|
+
cd ../pwa-microservices-template
|
|
50
|
+
git remote set-url origin git@github.com:underpostnet/pwa-microservices-template.git
|
|
51
|
+
git add .
|
|
52
|
+
underpost cmt . ci package-pwa-microservices-template-ghpkg 'Update npm repo package'
|
|
53
|
+
underpost push . underpostnet/pwa-microservices-template
|
|
54
|
+
# cd ../engine
|
|
55
|
+
# git commit --allow-empty -m "ci(engine-core-repo-build): ⚙️ Update engine core repository"
|
|
56
|
+
# git commit --allow-empty -m "ci(engine-cyberia-repo-build): ⚙️ Update engine cyberia repository"
|
|
57
|
+
# git commit --allow-empty -m "ci(engine-lampp-repo-build): ⚙️ Update engine lampp repository"
|
|
58
|
+
# git push https://${{ secrets.GIT_AUTH_TOKEN }}@github.com/underpostnet/engine.git
|
|
59
|
+
|
|
60
|
+
# git clone --bare https://github.com/underpostnet/engine.git
|
|
61
|
+
# mkdir engine
|
|
62
|
+
# mv ./engine.git ./engine/.git
|
|
63
|
+
# cd engine
|
|
64
|
+
# git init
|
|
65
|
+
|
|
66
|
+
# git push -u origin https://${{ secrets.GIT_AUTH_TOKEN }}@github.com/underpostnet/pwa-microservices-template-ghpkg.git
|
|
67
|
+
# git push -u origin master
|
|
@@ -42,7 +42,8 @@ jobs:
|
|
|
42
42
|
|
|
43
43
|
- name: Build the site
|
|
44
44
|
run: |
|
|
45
|
-
npm install
|
|
45
|
+
npm install -g underpost
|
|
46
|
+
underpost install
|
|
46
47
|
node bin/deploy update-default-conf ghpkg
|
|
47
48
|
env-cmd -f .env.production node bin/deploy build-full-client github-pages underpostnet.github.io /pwa-microservices-template-ghpkg
|
|
48
49
|
# git lfs install
|
|
@@ -2,12 +2,12 @@ name: Test
|
|
|
2
2
|
on: [push]
|
|
3
3
|
jobs:
|
|
4
4
|
test:
|
|
5
|
-
if: (github.repository == 'underpostnet/pwa-microservices-template') || (github.repository == 'underpostnet/pwa-microservices-template-ghpkg')
|
|
5
|
+
# if: (github.repository == 'underpostnet/pwa-microservices-template') || (github.repository == 'underpostnet/pwa-microservices-template-ghpkg')
|
|
6
6
|
name: Node ${{ matrix.node }} on ${{ matrix.os }}
|
|
7
7
|
runs-on: ${{ matrix.os }}
|
|
8
8
|
strategy:
|
|
9
9
|
matrix:
|
|
10
|
-
node-version: [
|
|
10
|
+
node-version: [23.x]
|
|
11
11
|
os: [ubuntu-latest]
|
|
12
12
|
# os: [ubuntu-latest, windows-latest]
|
|
13
13
|
|
package/Dockerfile
CHANGED
|
@@ -4,7 +4,7 @@ FROM debian:${BASE_DEBIAN}
|
|
|
4
4
|
|
|
5
5
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
6
6
|
|
|
7
|
-
WORKDIR /
|
|
7
|
+
WORKDIR /home/dd
|
|
8
8
|
|
|
9
9
|
# Set root password to root, format is 'user:password'.
|
|
10
10
|
RUN echo 'root:root' | chpasswd
|
|
@@ -39,10 +39,10 @@ RUN npm --version
|
|
|
39
39
|
|
|
40
40
|
RUN npm install -g underpost
|
|
41
41
|
|
|
42
|
-
VOLUME [ "/
|
|
42
|
+
VOLUME [ "/home/dd/engine/logs" ]
|
|
43
43
|
|
|
44
44
|
EXPOSE 22
|
|
45
45
|
|
|
46
46
|
EXPOSE 4000-4004
|
|
47
47
|
|
|
48
|
-
CMD [ "underpost", "new", "
|
|
48
|
+
CMD [ "underpost", "new", "service" ]
|
package/bin/build.js
CHANGED
|
@@ -3,7 +3,7 @@ import { loggerFactory } from '../src/server/logger.js';
|
|
|
3
3
|
import { shellExec } from '../src/server/process.js';
|
|
4
4
|
import dotenv from 'dotenv';
|
|
5
5
|
import { getCapVariableName } from '../src/client/components/core/CommonJs.js';
|
|
6
|
-
import {
|
|
6
|
+
import { getPathsSSR } from '../src/server/conf.js';
|
|
7
7
|
|
|
8
8
|
const baseConfPath = './engine-private/conf/dd-cron/.env.production';
|
|
9
9
|
if (fs.existsSync(baseConfPath)) dotenv.config({ path: baseConfPath, override: true });
|
|
@@ -20,21 +20,13 @@ const logger = loggerFactory(import.meta);
|
|
|
20
20
|
const confName = process.argv[2];
|
|
21
21
|
const basePath = '../pwa-microservices-template';
|
|
22
22
|
const repoName = `engine-${confName.split('dd-')[1]}`;
|
|
23
|
-
const privateRepoName = `${repoName}-private`;
|
|
24
|
-
const privateRepoNameBackUp = `${repoName}-cron-backups`;
|
|
25
|
-
const gitPrivateUrl = `https://${process.env.GITHUB_TOKEN}@github.com/underpostnet/${privateRepoName}.git`;
|
|
26
|
-
const gitPrivateBackUpUrl = `https://${process.env.GITHUB_TOKEN}@github.com/underpostnet/${privateRepoNameBackUp}.git`;
|
|
27
23
|
|
|
28
24
|
logger.info('', {
|
|
29
25
|
confName,
|
|
30
26
|
repoName,
|
|
31
|
-
privateRepoName,
|
|
32
|
-
privateRepoNameBackUp,
|
|
33
27
|
basePath,
|
|
34
28
|
});
|
|
35
29
|
|
|
36
|
-
if (process.argv.includes('info')) process.exit(0);
|
|
37
|
-
|
|
38
30
|
if (process.argv.includes('clean')) {
|
|
39
31
|
if (fs.existsSync(`${basePath}/images`)) fs.copySync(`${basePath}/images`, `./images`);
|
|
40
32
|
shellExec(`cd ${basePath} && git checkout .`);
|
|
@@ -42,173 +34,40 @@ if (process.argv.includes('clean')) {
|
|
|
42
34
|
process.exit(0);
|
|
43
35
|
}
|
|
44
36
|
|
|
45
|
-
if (process.argv.includes('proxy')) {
|
|
46
|
-
const env = process.argv.includes('development') ? 'development' : 'production';
|
|
47
|
-
process.env.NODE_ENV = env;
|
|
48
|
-
process.env.PORT = process.env.NODE_ENV === 'development' ? 4000 : 3000;
|
|
49
|
-
process.argv[2] = 'proxy';
|
|
50
|
-
process.argv[3] = fs.readFileSync('./engine-private/deploy/dd-router', 'utf8').trim();
|
|
51
|
-
|
|
52
|
-
await Config.build();
|
|
53
|
-
process.env.NODE_ENV = 'production';
|
|
54
|
-
const router = buildPortProxyRouter(443, buildProxyRouter());
|
|
55
|
-
const confServer = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.server.json`, 'utf8'));
|
|
56
|
-
const confHosts = Object.keys(confServer);
|
|
57
|
-
|
|
58
|
-
for (const host of Object.keys(router)) {
|
|
59
|
-
if (!confHosts.find((_host) => host.match(_host))) {
|
|
60
|
-
delete router[host];
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const ports = Object.values(router).map((p) => p.split(':')[2]);
|
|
65
|
-
|
|
66
|
-
const fromPort = ports[0];
|
|
67
|
-
const toPort = ports[ports.length - 1];
|
|
68
|
-
|
|
69
|
-
logger.info('port range', { fromPort, toPort, router });
|
|
70
|
-
|
|
71
|
-
const deploymentYamlFilePath = `./engine-private/conf/${confName}/build/${env}/deployment.yaml`;
|
|
72
|
-
|
|
73
|
-
const deploymentYamlParts = fs.readFileSync(deploymentYamlFilePath, 'utf8').split('ports:');
|
|
74
|
-
deploymentYamlParts[1] =
|
|
75
|
-
buildKindPorts(fromPort, toPort) +
|
|
76
|
-
` type: LoadBalancer
|
|
77
|
-
`;
|
|
78
|
-
|
|
79
|
-
fs.writeFileSync(
|
|
80
|
-
deploymentYamlFilePath,
|
|
81
|
-
deploymentYamlParts.join(`ports:
|
|
82
|
-
`),
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
let proxyYaml = '';
|
|
86
|
-
let secretYaml = '';
|
|
87
|
-
|
|
88
|
-
for (const host of Object.keys(confServer)) {
|
|
89
|
-
if (env === 'production')
|
|
90
|
-
secretYaml += `
|
|
91
|
-
---
|
|
92
|
-
apiVersion: cert-manager.io/v1
|
|
93
|
-
kind: Certificate
|
|
94
|
-
metadata:
|
|
95
|
-
name: ${host}
|
|
96
|
-
spec:
|
|
97
|
-
commonName: ${host}
|
|
98
|
-
dnsNames:
|
|
99
|
-
- ${host}
|
|
100
|
-
issuerRef:
|
|
101
|
-
name: letsencrypt-prod
|
|
102
|
-
kind: ClusterIssuer
|
|
103
|
-
secretName: ${host}`;
|
|
104
|
-
|
|
105
|
-
const pathPortConditions = [];
|
|
106
|
-
for (const path of Object.keys(confServer[host])) {
|
|
107
|
-
const { peer } = confServer[host][path];
|
|
108
|
-
const port = parseInt(router[`${host}${path === '/' ? '' : path}`].split(':')[2]);
|
|
109
|
-
// logger.info('', { host, port, path });
|
|
110
|
-
pathPortConditions.push({
|
|
111
|
-
port,
|
|
112
|
-
path,
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
if (peer) {
|
|
116
|
-
// logger.info('', { host, port: port + 1, path: '/peer' });
|
|
117
|
-
pathPortConditions.push({
|
|
118
|
-
port: port + 1,
|
|
119
|
-
path: '/peer',
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// logger.info('', { host, pathPortConditions });
|
|
124
|
-
proxyYaml += `
|
|
125
|
-
---
|
|
126
|
-
apiVersion: projectcontour.io/v1
|
|
127
|
-
kind: HTTPProxy
|
|
128
|
-
metadata:
|
|
129
|
-
name: ${host}
|
|
130
|
-
spec:
|
|
131
|
-
virtualhost:
|
|
132
|
-
fqdn: ${host}${
|
|
133
|
-
env === 'development'
|
|
134
|
-
? ''
|
|
135
|
-
: `
|
|
136
|
-
tls:
|
|
137
|
-
secretName: ${host}`
|
|
138
|
-
}
|
|
139
|
-
routes:`;
|
|
140
|
-
for (const conditionObj of pathPortConditions) {
|
|
141
|
-
const { path, port } = conditionObj;
|
|
142
|
-
proxyYaml += `
|
|
143
|
-
- conditions:
|
|
144
|
-
- prefix: ${path}
|
|
145
|
-
enableWebsockets: true
|
|
146
|
-
services:
|
|
147
|
-
- name: ${confName}-${env}-service
|
|
148
|
-
port: ${port}`;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
const yamlPath = `./engine-private/conf/${confName}/build/${env}/proxy.yaml`;
|
|
152
|
-
fs.writeFileSync(yamlPath, proxyYaml, 'utf8');
|
|
153
|
-
if (env === 'production') {
|
|
154
|
-
const yamlPath = `./engine-private/conf/${confName}/build/${env}/secret.yaml`;
|
|
155
|
-
fs.writeFileSync(yamlPath, secretYaml, 'utf8');
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
process.exit(0);
|
|
159
|
-
}
|
|
160
37
|
if (process.argv.includes('conf')) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
` &&
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
shellExec(`cd ../${privateRepoNameBackUp} && git pull`);
|
|
184
|
-
}
|
|
185
|
-
const serverConf = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.server.json`, 'utf8'));
|
|
186
|
-
for (const host of Object.keys(serverConf)) {
|
|
187
|
-
for (let path of Object.keys(serverConf[host])) {
|
|
188
|
-
path = path.replaceAll('/', '-');
|
|
189
|
-
const toPath = `../${privateRepoNameBackUp}/${host}${path}`;
|
|
190
|
-
const fromPath = `./engine-private/cron-backups/${host}${path}`;
|
|
191
|
-
if (fs.existsSync(fromPath)) {
|
|
192
|
-
if (fs.existsSync(toPath)) fs.removeSync(toPath);
|
|
193
|
-
logger.info('Build', { fromPath, toPath });
|
|
194
|
-
fs.copySync(fromPath, toPath);
|
|
195
|
-
}
|
|
38
|
+
for (const _confName of (confName === 'dd'
|
|
39
|
+
? fs.readFileSync(`./engine-private/deploy/dd-router`, 'utf8')
|
|
40
|
+
: confName
|
|
41
|
+
).split(',')) {
|
|
42
|
+
const _repoName = `engine-${_confName.split('dd-')[1]}`;
|
|
43
|
+
const privateRepoName = `${_repoName}-private`;
|
|
44
|
+
const privateGitUri = `${process.env.GITHUB_USERNAME}/${privateRepoName}`;
|
|
45
|
+
|
|
46
|
+
if (!fs.existsSync(`../${privateRepoName}`)) {
|
|
47
|
+
shellExec(`cd .. && underpost clone ${privateGitUri}`, { silent: true });
|
|
48
|
+
} else {
|
|
49
|
+
shellExec(`cd ../${privateRepoName} && underpost pull . ${privateGitUri}`);
|
|
50
|
+
}
|
|
51
|
+
const toPath = `../${privateRepoName}/conf/${_confName}`;
|
|
52
|
+
fs.removeSync(toPath);
|
|
53
|
+
fs.mkdirSync(toPath, { recursive: true });
|
|
54
|
+
fs.copySync(`./engine-private/conf/${_confName}`, toPath);
|
|
55
|
+
if (fs.existsSync(`./engine-private/replica`)) {
|
|
56
|
+
const replicas = await fs.readdir(`./engine-private/replica`);
|
|
57
|
+
for (const replica of replicas)
|
|
58
|
+
if (replica.match(_confName))
|
|
59
|
+
fs.copySync(`./engine-private/replica/${replica}`, `../${privateRepoName}/replica/${replica}`);
|
|
196
60
|
}
|
|
61
|
+
shellExec(
|
|
62
|
+
`cd ../${privateRepoName}` +
|
|
63
|
+
` && git add .` +
|
|
64
|
+
` && underpost cmt . ci engine-core-conf 'Update ${_confName} conf'` +
|
|
65
|
+
` && underpost push . ${privateGitUri}`,
|
|
66
|
+
);
|
|
197
67
|
}
|
|
198
|
-
shellExec(
|
|
199
|
-
`cd ../${privateRepoNameBackUp}` +
|
|
200
|
-
` && git add .` +
|
|
201
|
-
` && git commit -m "ci(engine-core-cron-backups): ⚙️ Update ${confName} cron backups"` +
|
|
202
|
-
` && git push`,
|
|
203
|
-
);
|
|
204
68
|
process.exit(0);
|
|
205
69
|
}
|
|
206
70
|
|
|
207
|
-
if (process.argv.includes('test')) {
|
|
208
|
-
fs.mkdirSync(`${basePath}/engine-private/conf`, { recursive: true });
|
|
209
|
-
fs.copySync(`./engine-private/conf/${confName}`, `${basePath}/engine-private/conf/${confName}`);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
71
|
const { DefaultConf } = await import(`../conf.${confName}.js`);
|
|
213
72
|
|
|
214
73
|
{
|
|
@@ -294,27 +153,9 @@ const { DefaultConf } = await import(`../conf.${confName}.js`);
|
|
|
294
153
|
const env = process.argv.includes('development') ? 'development' : 'production';
|
|
295
154
|
const deploymentsFiles = ['Dockerfile', 'proxy.yaml', 'deployment.yaml', 'secret.yaml'];
|
|
296
155
|
// remove engine-private of .dockerignore for local testing
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (!fs.existsSync(`./manifests/deployment/${confName}-${env}`))
|
|
302
|
-
fs.mkdirSync(`./manifests/deployment/${confName}-${env}`);
|
|
303
|
-
|
|
304
|
-
for (const file of deploymentsFiles) {
|
|
305
|
-
if (fs.existsSync(`./engine-private/conf/${confName}/build/${env}/${file}`)) {
|
|
306
|
-
fs.copyFileSync(`./engine-private/conf/${confName}/build/${env}/${file}`, `${basePath}/${file}`);
|
|
307
|
-
fs.copyFileSync(
|
|
308
|
-
`./engine-private/conf/${confName}/build/${env}/${file}`,
|
|
309
|
-
`./manifests/deployment/${confName}-${env}/${file}`,
|
|
310
|
-
);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
} else {
|
|
314
|
-
for (const file of deploymentsFiles) {
|
|
315
|
-
if (fs.existsSync(`./manifests/deployment/${confName}-${env}/${file}`)) {
|
|
316
|
-
fs.copyFileSync(`./manifests/deployment/${confName}-${env}/${file}`, `${basePath}/${file}`);
|
|
317
|
-
}
|
|
156
|
+
for (const file of deploymentsFiles) {
|
|
157
|
+
if (fs.existsSync(`./manifests/deployment/${confName}-${env}/${file}`)) {
|
|
158
|
+
fs.copyFileSync(`./manifests/deployment/${confName}-${env}/${file}`, `${basePath}/${file}`);
|
|
318
159
|
}
|
|
319
160
|
}
|
|
320
161
|
}
|
package/bin/deploy.js
CHANGED
|
@@ -159,10 +159,6 @@ try {
|
|
|
159
159
|
}
|
|
160
160
|
break;
|
|
161
161
|
|
|
162
|
-
case 'remove-await-deploy': {
|
|
163
|
-
if (fs.existsSync(`./tmp/await-deploy`)) fs.remove(`./tmp/await-deploy`);
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
162
|
case 'new-nodejs-app':
|
|
167
163
|
{
|
|
168
164
|
const deployId = process.argv[3];
|
|
@@ -229,6 +225,7 @@ try {
|
|
|
229
225
|
break;
|
|
230
226
|
case 'build-full-client':
|
|
231
227
|
{
|
|
228
|
+
dotenv.config({ override: true });
|
|
232
229
|
if (!process.argv[3]) process.argv[3] = 'default';
|
|
233
230
|
const { deployId, folder } = loadConf(process.argv[3]);
|
|
234
231
|
|
|
@@ -254,20 +251,7 @@ try {
|
|
|
254
251
|
serverConf[host][path].replicas.map((replica) => buildReplicaId({ deployId, replica })),
|
|
255
252
|
);
|
|
256
253
|
|
|
257
|
-
shellExec(Cmd.replica(deployId, host, path));
|
|
258
|
-
}
|
|
259
|
-
if (serverConf[host][path].db) {
|
|
260
|
-
switch (serverConf[host][path].db.provider) {
|
|
261
|
-
case 'mariadb':
|
|
262
|
-
{
|
|
263
|
-
shellExec(`node bin/db ${host}${path} create ${deployId}`);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
break;
|
|
267
|
-
|
|
268
|
-
default:
|
|
269
|
-
break;
|
|
270
|
-
}
|
|
254
|
+
// shellExec(Cmd.replica(deployId, host, path));
|
|
271
255
|
}
|
|
272
256
|
}
|
|
273
257
|
}
|
|
@@ -276,7 +260,7 @@ try {
|
|
|
276
260
|
await buildClient();
|
|
277
261
|
|
|
278
262
|
for (const replicaDeployId of deployIdSingleReplicas) {
|
|
279
|
-
shellExec(Cmd.conf(replicaDeployId));
|
|
263
|
+
shellExec(Cmd.conf(replicaDeployId, process.env.NODE_ENV));
|
|
280
264
|
shellExec(Cmd.build(replicaDeployId));
|
|
281
265
|
}
|
|
282
266
|
}
|
package/bin/file.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
|
|
3
3
|
import { loggerFactory } from '../src/server/logger.js';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
cap,
|
|
6
|
+
getCapVariableName,
|
|
7
|
+
getDirname,
|
|
8
|
+
newInstance,
|
|
9
|
+
uniqueArray,
|
|
10
|
+
} from '../src/client/components/core/CommonJs.js';
|
|
5
11
|
import { shellCd, shellExec } from '../src/server/process.js';
|
|
6
12
|
import walk from 'ignore-walk';
|
|
7
13
|
import { validateTemplatePath } from '../src/server/conf.js';
|
|
@@ -81,10 +87,12 @@ try {
|
|
|
81
87
|
'.github/workflows/engine.core.ci.yml',
|
|
82
88
|
'.github/workflows/engine.cyberia.ci.yml',
|
|
83
89
|
'./manifests/deployment/dd-lampp-development',
|
|
90
|
+
'./manifests/deployment/dd-cyberia-development',
|
|
91
|
+
'./manifests/deployment/dd-core-development',
|
|
84
92
|
'bin/web3.js',
|
|
85
93
|
'bin/cyberia.js',
|
|
86
94
|
]) {
|
|
87
|
-
fs.removeSync('../pwa-microservices-template/' + deletePath);
|
|
95
|
+
if (fs.existsSync(deletePath)) fs.removeSync('../pwa-microservices-template/' + deletePath);
|
|
88
96
|
}
|
|
89
97
|
const originPackageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
|
|
90
98
|
const templatePackageJson = JSON.parse(fs.readFileSync('../pwa-microservices-template/package.json', 'utf8'));
|
|
@@ -102,6 +110,9 @@ try {
|
|
|
102
110
|
templatePackageJson.description = description;
|
|
103
111
|
templatePackageJson.scripts.dev = dev;
|
|
104
112
|
templatePackageJson.scripts.build = build;
|
|
113
|
+
templatePackageJson.keywords = uniqueArray(
|
|
114
|
+
['pwa', 'microservices', 'template', 'builder'].concat(templatePackageJson.keywords),
|
|
115
|
+
);
|
|
105
116
|
delete templatePackageJson.scripts['update-template'];
|
|
106
117
|
fs.writeFileSync(
|
|
107
118
|
'../pwa-microservices-template/package.json',
|
package/bin/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import fs from 'fs-extra';
|
|
|
9
9
|
import { commitData } from '../src/client/components/core/CommonJs.js';
|
|
10
10
|
import UnderpostScript from '../src/cli/script.js';
|
|
11
11
|
import { shellExec } from '../src/server/process.js';
|
|
12
|
+
import UnderpostDB from '../src/cli/db.js';
|
|
12
13
|
|
|
13
14
|
const npmRoot = getNpmRootPath();
|
|
14
15
|
const underpostRoot = `${npmRoot}/underpost/.env`;
|
|
@@ -96,6 +97,17 @@ program
|
|
|
96
97
|
})
|
|
97
98
|
.description('Manage cluster, for default initialization base kind cluster');
|
|
98
99
|
|
|
100
|
+
program
|
|
101
|
+
.command('deploy')
|
|
102
|
+
.argument('<deploy-list>', 'Deploy id list, e.g. default-a,default-b')
|
|
103
|
+
.argument('[env]', 'Optional environment, for default is development')
|
|
104
|
+
.option('--remove', 'Delete deployments and services')
|
|
105
|
+
.option('--sync', 'Sync deployments env, ports, and replicas')
|
|
106
|
+
.option('--info-router', 'Display router structure')
|
|
107
|
+
.option('--build-manifest', 'Build kind yaml manifests: deployments, services, proxy and secrets')
|
|
108
|
+
.description('Manage deployment, for default deploy development pods')
|
|
109
|
+
.action(Underpost.deploy.callback);
|
|
110
|
+
|
|
99
111
|
program
|
|
100
112
|
.command('secret')
|
|
101
113
|
.argument('<platform>', `Options: ${Object.keys(Underpost.secret)}`)
|
|
@@ -115,6 +127,7 @@ program
|
|
|
115
127
|
.command('dockerfile-node-script')
|
|
116
128
|
.argument('<deploy-id>', 'Deploy configuration id')
|
|
117
129
|
.argument('[env]', 'Optional environment, for default is development')
|
|
130
|
+
.option('--run', 'Run custom entry point script')
|
|
118
131
|
.description('Dockerfile custom node build script')
|
|
119
132
|
.action(Underpost.image.dockerfile.script);
|
|
120
133
|
|
|
@@ -134,12 +147,19 @@ program
|
|
|
134
147
|
|
|
135
148
|
program
|
|
136
149
|
.command('install')
|
|
137
|
-
.description('Fast import npm dependencies')
|
|
150
|
+
.description('Fast import underpost npm dependencies')
|
|
138
151
|
.action(() => {
|
|
139
152
|
fs.copySync(`${npmRoot}/underpost/node_modules`, './node_modules');
|
|
140
|
-
shellExec(`npm install --only=dev --ignore-scripts`);
|
|
141
153
|
});
|
|
142
154
|
|
|
155
|
+
program
|
|
156
|
+
.command('db')
|
|
157
|
+
.argument('<deploy-list>', 'Deploy id list, e.g. default-a,default-b')
|
|
158
|
+
.option('--import', 'Import container backups from repositories')
|
|
159
|
+
.option('--export', 'Export container backups to repositories')
|
|
160
|
+
.description('Manage databases')
|
|
161
|
+
.action(UnderpostDB.API.callback);
|
|
162
|
+
|
|
143
163
|
program
|
|
144
164
|
.command('script')
|
|
145
165
|
.argument('operator', `Options: ${Object.keys(UnderpostScript.API)}`)
|
|
@@ -150,6 +170,13 @@ program
|
|
|
150
170
|
)
|
|
151
171
|
.action((...args) => Underpost.script[args[0]](args[1], args[2]));
|
|
152
172
|
|
|
153
|
-
program
|
|
173
|
+
program
|
|
174
|
+
.command('test')
|
|
175
|
+
.argument('[deploy-list]', 'Deploy id list, e.g. default-a,default-b')
|
|
176
|
+
.description('Manage Test, for default run current underpost default test')
|
|
177
|
+
.option('--inside-container', 'Inside container execution context')
|
|
178
|
+
.option('--sh', 'Copy to clipboard, container entrypoint shell command')
|
|
179
|
+
.option('--logs', 'Display container logs')
|
|
180
|
+
.action(Underpost.test.callback);
|
|
154
181
|
|
|
155
182
|
program.parse();
|
package/docker-compose.yml
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"main": "src/index.js",
|
|
4
4
|
"name": "underpost",
|
|
5
|
-
"version": "2.8.
|
|
5
|
+
"version": "2.8.481",
|
|
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",
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
"url": "git+https://github.com/underpostnet/pwa-microservices-template.git"
|
|
33
33
|
},
|
|
34
34
|
"keywords": [
|
|
35
|
+
"pwa",
|
|
36
|
+
"microservices",
|
|
37
|
+
"template",
|
|
38
|
+
"builder",
|
|
35
39
|
"engine",
|
|
36
40
|
"server",
|
|
37
41
|
"proxy",
|
|
@@ -106,12 +110,17 @@
|
|
|
106
110
|
"uglify-js": "^3.17.4",
|
|
107
111
|
"validator": "^13.11.0",
|
|
108
112
|
"vanilla-jsoneditor": "^2.3.2",
|
|
109
|
-
"winston": "^3.11.0"
|
|
113
|
+
"winston": "^3.11.0",
|
|
114
|
+
"clean-jsdoc-theme": "^4.3.0",
|
|
115
|
+
"easy-json-schema": "^0.0.2-beta",
|
|
116
|
+
"mocha": "^10.8.2",
|
|
117
|
+
"plantuml": "^0.0.2",
|
|
118
|
+
"swagger-autogen": "^2.23.7"
|
|
110
119
|
},
|
|
111
120
|
"devDependencies": {
|
|
112
121
|
"clean-jsdoc-theme": "^4.3.0",
|
|
113
122
|
"easy-json-schema": "^0.0.2-beta",
|
|
114
|
-
"mocha": "^10.
|
|
123
|
+
"mocha": "^10.8.2",
|
|
115
124
|
"plantuml": "^0.0.2",
|
|
116
125
|
"swagger-autogen": "^2.23.7"
|
|
117
126
|
},
|