@underpostnet/underpost 2.96.1 → 2.97.1
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/.dockerignore +1 -2
- package/.env.development +0 -3
- package/.env.production +0 -3
- package/.env.test +0 -3
- package/.prettierignore +1 -2
- package/README.md +31 -31
- package/baremetal/commission-workflows.json +94 -17
- package/bin/deploy.js +1 -1
- package/cli.md +75 -41
- package/conf.js +1 -0
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +4 -4
- package/package.json +3 -2
- package/packer/scripts/fuse-tar-root +3 -3
- package/scripts/disk-clean.sh +128 -187
- package/scripts/gpu-diag.sh +2 -2
- package/scripts/ip-info.sh +11 -11
- package/scripts/ipxe-setup.sh +197 -0
- package/scripts/maas-upload-boot-resource.sh +1 -1
- package/scripts/nvim.sh +1 -1
- package/scripts/packer-setup.sh +13 -13
- package/scripts/ports-ls.sh +31 -0
- package/scripts/quick-tftp.sh +19 -0
- package/scripts/rocky-setup.sh +2 -2
- package/scripts/rpmfusion-ffmpeg-setup.sh +4 -4
- package/scripts/ssl.sh +7 -7
- package/src/api/document/document.controller.js +15 -0
- package/src/api/document/document.model.js +44 -1
- package/src/api/document/document.router.js +2 -0
- package/src/api/document/document.service.js +398 -26
- package/src/cli/baremetal.js +2001 -463
- package/src/cli/cloud-init.js +354 -231
- package/src/cli/cluster.js +51 -53
- package/src/cli/db.js +22 -0
- package/src/cli/deploy.js +7 -3
- package/src/cli/image.js +1 -0
- package/src/cli/index.js +40 -37
- package/src/cli/lxd.js +3 -3
- package/src/cli/run.js +78 -12
- package/src/cli/ssh.js +1 -1
- package/src/client/components/core/Css.js +16 -2
- package/src/client/components/core/Input.js +3 -1
- package/src/client/components/core/Modal.js +125 -159
- package/src/client/components/core/Panel.js +436 -31
- package/src/client/components/core/PanelForm.js +222 -37
- package/src/client/components/core/SearchBox.js +801 -0
- package/src/client/components/core/Translate.js +11 -0
- package/src/client/services/document/document.service.js +42 -0
- package/src/index.js +1 -1
- package/src/server/dns.js +12 -6
- package/src/server/start.js +14 -6
|
@@ -188,6 +188,9 @@ const TranslateCore = {
|
|
|
188
188
|
Translate.Data['error-update-user'] = { en: 'error update user', es: 'error al actualizar el usuario' };
|
|
189
189
|
|
|
190
190
|
Translate.Data['edit'] = { en: 'Edit', es: 'Editar' };
|
|
191
|
+
Translate.Data['copy-share-link'] = { en: 'Copy share link', es: 'Copiar enlace compartido' };
|
|
192
|
+
Translate.Data['link-copied'] = { en: 'Link copied to clipboard', es: 'Enlace copiado al portapapeles' };
|
|
193
|
+
Translate.Data['error-copying-link'] = { en: 'Error copying link', es: 'Error al copiar enlace' };
|
|
191
194
|
Translate.Data['unconfirmed'] = { en: 'unconfirmed', es: 'No confirmado' };
|
|
192
195
|
Translate.Data['confirmed'] = { en: 'confirmed', es: 'Confirmado' };
|
|
193
196
|
Translate.Data['confirm'] = { en: 'confirm', es: 'confirmar' };
|
|
@@ -520,6 +523,14 @@ const TranslateCore = {
|
|
|
520
523
|
en: 'Data reloaded successfully.',
|
|
521
524
|
es: 'Datos recargados con éxito.',
|
|
522
525
|
};
|
|
526
|
+
Translate.Data['clear-file'] = {
|
|
527
|
+
en: 'Clear File',
|
|
528
|
+
es: 'Limpiar Archivos',
|
|
529
|
+
};
|
|
530
|
+
Translate.Data['require-title-and-content-or-file'] = {
|
|
531
|
+
en: 'Require title and content or file',
|
|
532
|
+
es: 'Requiere título y contenido o archivo',
|
|
533
|
+
};
|
|
523
534
|
},
|
|
524
535
|
};
|
|
525
536
|
|
|
@@ -92,6 +92,48 @@ const DocumentService = {
|
|
|
92
92
|
return reject(error);
|
|
93
93
|
}),
|
|
94
94
|
),
|
|
95
|
+
patch: (options = { id: '', action: '' }) =>
|
|
96
|
+
new Promise((resolve, reject) =>
|
|
97
|
+
fetch(getApiBaseUrl({ id: `${options.id}/${options.action}`, endpoint }), {
|
|
98
|
+
method: 'PATCH',
|
|
99
|
+
headers: headersFactory(),
|
|
100
|
+
credentials: 'include',
|
|
101
|
+
})
|
|
102
|
+
.then(async (res) => {
|
|
103
|
+
return await res.json();
|
|
104
|
+
})
|
|
105
|
+
.then((res) => {
|
|
106
|
+
logger.info(res);
|
|
107
|
+
return resolve(res);
|
|
108
|
+
})
|
|
109
|
+
.catch((error) => {
|
|
110
|
+
logger.error(error);
|
|
111
|
+
return reject(error);
|
|
112
|
+
}),
|
|
113
|
+
),
|
|
114
|
+
high: (options = { params: {} }) =>
|
|
115
|
+
new Promise((resolve, reject) => {
|
|
116
|
+
const url = new URL(getApiBaseUrl({ id: 'public/high', endpoint }));
|
|
117
|
+
if (options.params) {
|
|
118
|
+
Object.keys(options.params).forEach((key) => url.searchParams.append(key, options.params[key]));
|
|
119
|
+
}
|
|
120
|
+
fetch(url, {
|
|
121
|
+
method: 'GET',
|
|
122
|
+
headers: headersFactory(),
|
|
123
|
+
credentials: 'include',
|
|
124
|
+
})
|
|
125
|
+
.then(async (res) => {
|
|
126
|
+
return await res.json();
|
|
127
|
+
})
|
|
128
|
+
.then((res) => {
|
|
129
|
+
logger.info(res);
|
|
130
|
+
return resolve(res);
|
|
131
|
+
})
|
|
132
|
+
.catch((error) => {
|
|
133
|
+
logger.error(error);
|
|
134
|
+
return reject(error);
|
|
135
|
+
});
|
|
136
|
+
}),
|
|
95
137
|
};
|
|
96
138
|
|
|
97
139
|
export { DocumentService };
|
package/src/index.js
CHANGED
package/src/server/dns.js
CHANGED
|
@@ -36,7 +36,9 @@ class Dns {
|
|
|
36
36
|
static async getPublicIp() {
|
|
37
37
|
return await new Promise(async (resolve) => {
|
|
38
38
|
try {
|
|
39
|
-
return axios
|
|
39
|
+
return axios
|
|
40
|
+
.get(process.env.HTTP_PLAIN_IP_URL ? process.env.HTTP_PLAIN_IP_URL : 'https://api.ipify.org')
|
|
41
|
+
.then((response) => resolve(response.data));
|
|
40
42
|
} catch (error) {
|
|
41
43
|
logger.error('Error fetching public IP:', { error: error.message, stack: error.stack });
|
|
42
44
|
return resolve(null);
|
|
@@ -106,17 +108,17 @@ class Dns {
|
|
|
106
108
|
* @memberof DnsManager
|
|
107
109
|
*/
|
|
108
110
|
static setupNftables() {
|
|
109
|
-
shellExec(`sudo nft add table inet filter 2>/dev/null
|
|
111
|
+
shellExec(`sudo nft add table inet filter 2>/dev/null`, { silent: true });
|
|
110
112
|
shellExec(
|
|
111
|
-
`sudo nft add chain inet filter input '{ type filter hook input priority 0; policy accept; }' 2>/dev/null
|
|
113
|
+
`sudo nft add chain inet filter input '{ type filter hook input priority 0; policy accept; }' 2>/dev/null`,
|
|
112
114
|
{ silent: true },
|
|
113
115
|
);
|
|
114
116
|
shellExec(
|
|
115
|
-
`sudo nft add chain inet filter output '{ type filter hook output priority 0; policy accept; }' 2>/dev/null
|
|
117
|
+
`sudo nft add chain inet filter output '{ type filter hook output priority 0; policy accept; }' 2>/dev/null`,
|
|
116
118
|
{ silent: true },
|
|
117
119
|
);
|
|
118
120
|
shellExec(
|
|
119
|
-
`sudo nft add chain inet filter forward '{ type filter hook forward priority 0; policy accept; }' 2>/dev/null
|
|
121
|
+
`sudo nft add chain inet filter forward '{ type filter hook forward priority 0; policy accept; }' 2>/dev/null`,
|
|
120
122
|
{ silent: true },
|
|
121
123
|
);
|
|
122
124
|
}
|
|
@@ -403,6 +405,7 @@ class Dns {
|
|
|
403
405
|
* @property {boolean} [options.banEgressClear=false] - Clear all banned egress IPs.
|
|
404
406
|
* @property {boolean} [options.banBothAdd=false] - Ban IPs from both ingress and egress.
|
|
405
407
|
* @property {boolean} [options.banBothRemove=false] - Unban IPs from both ingress and egress.
|
|
408
|
+
* @property {boolean} [options.dhcp=false] - Get local DHCP IP instead of public IP.
|
|
406
409
|
* @property {boolean} [options.copy=false] - Copy the public IP to clipboard.
|
|
407
410
|
* @return {Promise<string|void>} The public IP if no ban/unban action is taken.
|
|
408
411
|
*/
|
|
@@ -420,6 +423,7 @@ class Dns {
|
|
|
420
423
|
banBothAdd: false,
|
|
421
424
|
banBothRemove: false,
|
|
422
425
|
copy: false,
|
|
426
|
+
dhcp: false,
|
|
423
427
|
},
|
|
424
428
|
) {
|
|
425
429
|
const ipList = ips
|
|
@@ -468,7 +472,9 @@ class Dns {
|
|
|
468
472
|
});
|
|
469
473
|
}
|
|
470
474
|
|
|
471
|
-
|
|
475
|
+
let ip;
|
|
476
|
+
if (options.dhcp) ip = Dns.getLocalIPv4Address();
|
|
477
|
+
else ip = await Dns.getPublicIp();
|
|
472
478
|
if (options.copy) return pbcopy(ip);
|
|
473
479
|
console.log(ip);
|
|
474
480
|
return ip;
|
package/src/server/start.js
CHANGED
|
@@ -117,20 +117,27 @@ class UnderpostStartUp {
|
|
|
117
117
|
* @param {Object} options - Options for the deployment.
|
|
118
118
|
* @param {boolean} options.build - Whether to build the deployment.
|
|
119
119
|
* @param {boolean} options.run - Whether to run the deployment.
|
|
120
|
+
* @param {boolean} options.underpostQuicklyInstall - Whether to use underpost quickly install.
|
|
120
121
|
*/
|
|
121
|
-
async callback(
|
|
122
|
+
async callback(
|
|
123
|
+
deployId = 'dd-default',
|
|
124
|
+
env = 'development',
|
|
125
|
+
options = { build: false, run: false, underpostQuicklyInstall: false },
|
|
126
|
+
) {
|
|
122
127
|
UnderpostRootEnv.API.set('container-status', `${deployId}-${env}-build-deployment`);
|
|
123
|
-
if (options.build === true) await UnderpostStartUp.API.build(deployId, env);
|
|
128
|
+
if (options.build === true) await UnderpostStartUp.API.build(deployId, env, options);
|
|
124
129
|
UnderpostRootEnv.API.set('container-status', `${deployId}-${env}-initializing-deployment`);
|
|
125
|
-
if (options.run === true) await UnderpostStartUp.API.run(deployId, env);
|
|
130
|
+
if (options.run === true) await UnderpostStartUp.API.run(deployId, env, options);
|
|
126
131
|
},
|
|
127
132
|
/**
|
|
128
133
|
* Run itc-scripts and builds client bundle.
|
|
129
134
|
* @param {string} deployId - The ID of the deployment.
|
|
130
135
|
* @param {string} env - The environment of the deployment.
|
|
136
|
+
* @param {Object} options - Options for the build.
|
|
137
|
+
* @param {boolean} options.underpostQuicklyInstall - Whether to use underpost quickly install.
|
|
131
138
|
* @memberof UnderpostStartUp
|
|
132
139
|
*/
|
|
133
|
-
async build(deployId = 'dd-default', env = 'development') {
|
|
140
|
+
async build(deployId = 'dd-default', env = 'development', options = { underpostQuicklyInstall: false }) {
|
|
134
141
|
const buildBasePath = `/home/dd`;
|
|
135
142
|
const repoName = `engine-${deployId.split('-')[1]}`;
|
|
136
143
|
shellExec(`cd ${buildBasePath} && underpost clone ${process.env.GITHUB_USERNAME}/${repoName}`);
|
|
@@ -140,7 +147,7 @@ class UnderpostStartUp {
|
|
|
140
147
|
shellExec(`cd ${buildBasePath}/engine && underpost clone ${process.env.GITHUB_USERNAME}/${repoName}-private`);
|
|
141
148
|
shellExec(`cd ${buildBasePath}/engine && sudo mv ./${repoName}-private ./engine-private`);
|
|
142
149
|
shellCd(`${buildBasePath}/engine`);
|
|
143
|
-
shellExec(`npm install`);
|
|
150
|
+
shellExec(options?.underpostQuicklyInstall ? `underpost install` : `npm install`);
|
|
144
151
|
shellExec(`node bin/deploy conf ${deployId} ${env}`);
|
|
145
152
|
if (fs.existsSync('./engine-private/itc-scripts')) {
|
|
146
153
|
const itcScripts = await fs.readdir('./engine-private/itc-scripts');
|
|
@@ -153,9 +160,10 @@ class UnderpostStartUp {
|
|
|
153
160
|
* Runs a deployment.
|
|
154
161
|
* @param {string} deployId - The ID of the deployment.
|
|
155
162
|
* @param {string} env - The environment of the deployment.
|
|
163
|
+
* @param {Object} options - Options for the run.
|
|
156
164
|
* @memberof UnderpostStartUp
|
|
157
165
|
*/
|
|
158
|
-
async run(deployId = 'dd-default', env = 'development') {
|
|
166
|
+
async run(deployId = 'dd-default', env = 'development', options = {}) {
|
|
159
167
|
const runCmd = env === 'production' ? 'run prod-img' : 'run dev-img';
|
|
160
168
|
if (fs.existsSync(`./engine-private/replica`)) {
|
|
161
169
|
const replicas = await fs.readdir(`./engine-private/replica`);
|