underpost 2.6.3 → 2.7.2
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 +13 -13
- package/.env.development +7 -7
- package/.env.production +7 -7
- package/.env.test +7 -7
- package/.github/workflows/publish.yml +26 -0
- package/.nycrc +9 -9
- package/.prettierignore +12 -12
- package/.prettierrc +9 -9
- package/.vscode/extensions.json +72 -72
- package/.vscode/settings.json +100 -99
- package/AUTHORS.md +10 -0
- package/CHANGELOG.md +91 -0
- package/Dockerfile +89 -89
- package/LICENSE +21 -21
- package/README.md +96 -96
- package/bin/db.js +172 -119
- package/bin/deploy.js +582 -626
- package/bin/dns.js +1 -1
- package/bin/file.js +92 -92
- package/bin/index.js +53 -34
- package/bin/install.js +398 -357
- package/bin/shortcut.js +44 -44
- package/bin/ssl.js +65 -61
- package/bin/util.js +182 -182
- package/bin/vs.js +35 -35
- package/conf.js +251 -249
- package/docker-compose.yml +67 -67
- package/jsconfig.json +7 -7
- package/jsdoc.json +32 -32
- package/nodemon.json +6 -6
- package/package.json +137 -128
- package/prometheus.yml +36 -36
- package/setup.sh +24 -24
- package/src/api/core/core.controller.js +69 -69
- package/src/api/core/core.model.js +11 -11
- package/src/api/core/core.router.js +23 -23
- package/src/api/core/core.service.js +29 -29
- package/src/api/crypto/crypto.controller.js +51 -51
- package/src/api/crypto/crypto.model.js +23 -23
- package/src/api/crypto/crypto.router.js +20 -20
- package/src/api/crypto/crypto.service.js +64 -64
- package/src/api/default/default.controller.js +69 -69
- package/src/api/default/default.model.js +20 -20
- package/src/api/default/default.router.js +23 -23
- package/src/api/default/default.service.js +31 -31
- package/src/api/file/file.controller.js +53 -51
- package/src/api/file/file.model.js +19 -19
- package/src/api/file/file.router.js +21 -20
- package/src/api/file/file.service.js +76 -70
- package/src/api/instance/instance.controller.js +69 -69
- package/src/api/instance/instance.model.js +36 -36
- package/src/api/instance/instance.router.js +33 -33
- package/src/api/instance/instance.service.js +48 -48
- package/src/api/test/test.controller.js +59 -59
- package/src/api/test/test.model.js +14 -14
- package/src/api/test/test.router.js +21 -21
- package/src/api/test/test.service.js +35 -35
- package/src/api/user/user.build.js +16 -0
- package/src/api/user/user.controller.js +70 -70
- package/src/api/user/user.model.js +65 -65
- package/src/api/user/user.router.js +345 -345
- package/src/api/user/user.service.js +479 -479
- package/src/api.js +23 -23
- package/src/client/Default.index.js +40 -40
- package/src/client/components/core/Account.js +290 -290
- package/src/client/components/core/AgGrid.js +160 -160
- package/src/client/components/core/Auth.js +19 -19
- package/src/client/components/core/Badge.js +32 -32
- package/src/client/components/core/BlockChain.js +41 -41
- package/src/client/components/core/Blog.js +9 -9
- package/src/client/components/core/BtnIcon.js +101 -94
- package/src/client/components/core/CalendarCore.js +458 -319
- package/src/client/components/core/Chat.js +64 -64
- package/src/client/components/core/ColorPalette.js +5267 -5267
- package/src/client/components/core/CommonJs.js +735 -732
- package/src/client/components/core/Content.js +193 -49
- package/src/client/components/core/Css.js +1064 -1027
- package/src/client/components/core/CssCore.js +817 -796
- package/src/client/components/core/D3Chart.js +44 -44
- package/src/client/components/core/Docs.js +229 -229
- package/src/client/components/core/DropDown.js +164 -164
- package/src/client/components/core/EventsUI.js +46 -54
- package/src/client/components/core/FileExplorer.js +699 -624
- package/src/client/components/core/FullScreen.js +45 -45
- package/src/client/components/core/Input.js +346 -259
- package/src/client/components/core/JoyStick.js +77 -77
- package/src/client/components/core/Keyboard.js +73 -73
- package/src/client/components/core/LoadingAnimation.js +179 -157
- package/src/client/components/core/LogIn.js +187 -181
- package/src/client/components/core/LogOut.js +58 -52
- package/src/client/components/core/Logger.js +26 -26
- package/src/client/components/core/Modal.js +1612 -1596
- package/src/client/components/core/NotificationManager.js +84 -84
- package/src/client/components/core/Panel.js +613 -413
- package/src/client/components/core/PanelForm.js +468 -0
- package/src/client/components/core/Polyhedron.js +162 -162
- package/src/client/components/core/Recover.js +204 -204
- package/src/client/components/core/Responsive.js +53 -53
- package/src/client/components/core/RichText.js +51 -27
- package/src/client/components/core/Router.js +76 -77
- package/src/client/components/core/Scroll.js +34 -0
- package/src/client/components/core/SignUp.js +125 -125
- package/src/client/components/core/SocketIo.js +72 -72
- package/src/client/components/core/Stream.js +113 -113
- package/src/client/components/core/ToggleSwitch.js +87 -87
- package/src/client/components/core/ToolTip.js +26 -26
- package/src/client/components/core/Translate.js +437 -408
- package/src/client/components/core/Validator.js +100 -100
- package/src/client/components/core/VanillaJs.js +460 -457
- package/src/client/components/core/Wallet.js +106 -106
- package/src/client/components/core/Webhook.js +25 -25
- package/src/client/components/core/Worker.js +272 -272
- package/src/client/components/default/CommonDefault.js +29 -29
- package/src/client/components/default/CssDefault.js +13 -13
- package/src/client/components/default/ElementsDefault.js +38 -38
- package/src/client/components/default/LogInDefault.js +41 -41
- package/src/client/components/default/LogOutDefault.js +28 -28
- package/src/client/components/default/MenuDefault.js +389 -389
- package/src/client/components/default/RoutesDefault.js +48 -48
- package/src/client/components/default/SettingsDefault.js +16 -16
- package/src/client/components/default/SignUpDefault.js +9 -9
- package/src/client/components/default/SocketIoDefault.js +54 -54
- package/src/client/components/default/TranslateDefault.js +7 -7
- package/src/client/public/default/assets/mailer/api-user-check.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-invalid-token.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-recover.png +0 -0
- package/src/client/public/default/browserconfig.xml +11 -11
- package/src/client/public/default/manifest.webmanifest +68 -68
- package/src/client/public/default/plantuml/client-conf.svg +1 -0
- package/src/client/public/default/plantuml/client-schema.svg +1 -0
- package/src/client/public/default/plantuml/cron-conf.svg +1 -0
- package/src/client/public/default/plantuml/cron-schema.svg +1 -0
- package/src/client/public/default/plantuml/server-conf.svg +1 -0
- package/src/client/public/default/plantuml/server-schema.svg +1 -0
- package/src/client/public/default/plantuml/ssr-conf.svg +1 -0
- package/src/client/public/default/plantuml/ssr-schema.svg +1 -0
- package/src/client/public/default/sitemap +147 -147
- package/src/client/public/default/yandex-browser-manifest.json +8 -8
- package/src/client/public/doc/sitemap +147 -147
- package/src/client/public/test/sitemap +147 -147
- package/src/client/services/core/core.service.js +170 -152
- package/src/client/services/crypto/crypto.service.js +70 -70
- package/src/client/services/default/default.management.js +345 -345
- package/src/client/services/default/default.service.js +89 -89
- package/src/client/services/file/file.service.js +70 -70
- package/src/client/services/instance/instance.management.js +74 -74
- package/src/client/services/instance/instance.service.js +89 -89
- package/src/client/services/test/test.service.js +70 -70
- package/src/client/services/user/user.management.js +50 -50
- package/src/client/services/user/user.service.js +89 -89
- package/src/client/ssr/Render.js +16 -16
- package/src/client/ssr/body-components/CacheControl.js +114 -113
- package/src/client/ssr/body-components/DefaultSplashScreen.js +79 -79
- package/src/client/ssr/email-components/DefaultRecoverEmail.js +21 -21
- package/src/client/ssr/email-components/DefaultVerifyEmail.js +17 -17
- package/src/client/ssr/head-components/Css.js +241 -241
- package/src/client/ssr/head-components/DefaultScripts.js +3 -3
- package/src/client/ssr/head-components/Microdata.js +11 -11
- package/src/client/ssr/head-components/Production.js +1 -1
- package/src/client/ssr/head-components/PwaDefault.js +59 -59
- package/src/client/ssr/head-components/Seo.js +14 -14
- package/src/client/sw/default.sw.js +201 -201
- package/src/client/sw/template.sw.js +84 -84
- package/src/client.build.js +22 -22
- package/src/client.dev.js +21 -21
- package/src/cron.js +25 -25
- package/src/db/DataBaseProvider.js +34 -34
- package/src/db/mariadb/MariaDB.js +33 -33
- package/src/db/mongo/MongooseDB.js +46 -46
- package/src/dns.js +22 -22
- package/src/index.js +42 -0
- package/src/mailer/EmailRender.js +69 -69
- package/src/mailer/MailerProvider.js +96 -96
- package/src/proxy.js +22 -22
- package/src/runtime/lampp/Lampp.js +69 -44
- package/src/runtime/nginx/Nginx.js +3 -3
- package/src/runtime/xampp/Xampp.js +49 -49
- package/src/server/auth.js +235 -204
- package/src/server/backup.js +101 -84
- package/src/server/client-build-live.js +72 -72
- package/src/server/client-build.js +705 -699
- package/src/server/client-dev-server.js +60 -58
- package/src/server/client-formatted.js +48 -48
- package/src/server/client-icons.js +149 -150
- package/src/server/conf.js +860 -611
- package/src/server/dns.js +98 -87
- package/src/server/downloader.js +42 -42
- package/src/server/logger.js +180 -135
- package/src/server/network.js +122 -122
- package/src/server/peer.js +33 -33
- package/src/server/process.js +66 -66
- package/src/server/prompt-optimizer.js +28 -0
- package/src/server/proxy.js +118 -118
- package/src/server/runtime.js +444 -393
- package/src/server/ssl.js +109 -107
- package/src/server.js +25 -25
- package/src/ws/IoInterface.js +45 -45
- package/src/ws/IoServer.js +39 -39
- package/src/ws/core/channels/core.ws.chat.js +23 -23
- package/src/ws/core/channels/core.ws.mailer.js +35 -35
- package/src/ws/core/channels/core.ws.stream.js +31 -31
- package/src/ws/core/core.ws.connection.js +28 -28
- package/src/ws/core/core.ws.emit.js +14 -14
- package/src/ws/core/core.ws.server.js +24 -24
- package/src/ws/core/management/core.ws.chat.js +8 -8
- package/src/ws/core/management/core.ws.mailer.js +16 -16
- package/src/ws/core/management/core.ws.stream.js +8 -8
- package/src/ws/default/channels/default.ws.main.js +16 -16
- package/src/ws/default/default.ws.connection.js +22 -22
- package/src/ws/default/default.ws.emit.js +14 -14
- package/src/ws/default/default.ws.server.js +20 -20
- package/src/ws/default/management/default.ws.main.js +8 -8
- package/startup.js +11 -11
- package/supervisord-openssh-server.conf +4 -4
- package/test/api.test.js +60 -60
- package/bin/help.js +0 -110
package/bin/install.js
CHANGED
|
@@ -1,357 +1,398 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import AdmZip from 'adm-zip';
|
|
3
|
-
import axios from 'axios';
|
|
4
|
-
import { Downloader } from '../src/server/downloader.js';
|
|
5
|
-
import { getRootDirectory, shellCd, shellExec } from '../src/server/process.js';
|
|
6
|
-
import { loggerFactory } from '../src/server/logger.js';
|
|
7
|
-
import { s4 } from '../src/client/components/core/CommonJs.js';
|
|
8
|
-
|
|
9
|
-
const logger = loggerFactory(import.meta);
|
|
10
|
-
|
|
11
|
-
logger.info('argv', process.argv);
|
|
12
|
-
|
|
13
|
-
const [exe, dir, os, program, hostPath = '', deployId] = process.argv;
|
|
14
|
-
const [host, path = ''] = hostPath.split('/');
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
let cmd;
|
|
18
|
-
switch (program) {
|
|
19
|
-
case '
|
|
20
|
-
switch (os) {
|
|
21
|
-
case 'windows':
|
|
22
|
-
|
|
23
|
-
const urlDownload =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
'utf8'
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
RewriteRule ^
|
|
177
|
-
|
|
178
|
-
RewriteCond %{REQUEST_FILENAME}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
const urlDownload =
|
|
289
|
-
const folderPath = `./engine-private/setup`;
|
|
290
|
-
if (!fs.existsSync(folderPath)) fs.mkdirSync(folderPath, { recursive: true });
|
|
291
|
-
const fullPath = `${folderPath}/${urlDownload.split('/').pop()}`;
|
|
292
|
-
logger.info('destination', fullPath);
|
|
293
|
-
if (!fs.existsSync(fullPath)) await Downloader(urlDownload, fullPath);
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
})
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import AdmZip from 'adm-zip';
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
import { Downloader } from '../src/server/downloader.js';
|
|
5
|
+
import { getRootDirectory, shellCd, shellExec } from '../src/server/process.js';
|
|
6
|
+
import { loggerFactory } from '../src/server/logger.js';
|
|
7
|
+
import { s4 } from '../src/client/components/core/CommonJs.js';
|
|
8
|
+
|
|
9
|
+
const logger = loggerFactory(import.meta);
|
|
10
|
+
|
|
11
|
+
logger.info('argv', process.argv);
|
|
12
|
+
|
|
13
|
+
const [exe, dir, os, program, hostPath = '', deployId] = process.argv;
|
|
14
|
+
const [host, path = ''] = hostPath.split('/');
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
let cmd;
|
|
18
|
+
switch (program) {
|
|
19
|
+
case 'lab':
|
|
20
|
+
switch (os) {
|
|
21
|
+
case 'windows':
|
|
22
|
+
{
|
|
23
|
+
const urlDownload = 'https://github.com/underpostnet/lab.git';
|
|
24
|
+
// const folderPath = `./lab`;
|
|
25
|
+
// if (!fs.existsSync(folderPath)) fs.mkdirSync(folderPath, { recursive: true });
|
|
26
|
+
shellExec(`git clone ${urlDownload}`);
|
|
27
|
+
const dependencies = [
|
|
28
|
+
'transformers',
|
|
29
|
+
'tensorflow',
|
|
30
|
+
'torch',
|
|
31
|
+
'torchaudio',
|
|
32
|
+
'torchvision',
|
|
33
|
+
'diffusers',
|
|
34
|
+
'nvidia-cuda-runtime-cu11',
|
|
35
|
+
'torchrec-nightly',
|
|
36
|
+
'matplotlib',
|
|
37
|
+
'scikit-learn',
|
|
38
|
+
'numpy',
|
|
39
|
+
'pandas',
|
|
40
|
+
];
|
|
41
|
+
for (const dependencie of dependencies) {
|
|
42
|
+
shellExec(`pip install ${dependencie}`);
|
|
43
|
+
shellExec(`conda install ${dependencie}`);
|
|
44
|
+
}
|
|
45
|
+
shellExec(`conda install -c anaconda cudatoolkit`);
|
|
46
|
+
shellExec(`conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia`);
|
|
47
|
+
|
|
48
|
+
shellExec(`conda create --name cuda_env`);
|
|
49
|
+
shellExec(`conda activate cuda_env`);
|
|
50
|
+
|
|
51
|
+
shellExec(`conda config --append channels conda-forge`);
|
|
52
|
+
shellExec(`conda config --append channels nvidia`);
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
|
|
56
|
+
default:
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
break;
|
|
60
|
+
case 'certbot':
|
|
61
|
+
switch (os) {
|
|
62
|
+
case 'windows':
|
|
63
|
+
await (async () => {
|
|
64
|
+
const urlDownload =
|
|
65
|
+
'https://github.com/certbot/certbot/releases/latest/download/certbot-beta-installer-win_amd64_signed.exe';
|
|
66
|
+
const folderPath = `./engine-private/setup`;
|
|
67
|
+
if (!fs.existsSync(folderPath)) fs.mkdirSync(folderPath, { recursive: true });
|
|
68
|
+
const fullPath = `${folderPath}/${urlDownload.split('/').pop()}`;
|
|
69
|
+
logger.info('destination', fullPath);
|
|
70
|
+
if (!fs.existsSync(fullPath)) await Downloader(urlDownload, fullPath);
|
|
71
|
+
cmd = `PowerShell Start-Process -FilePath "${fullPath}" -ArgumentList "/S" -Wait`;
|
|
72
|
+
shellExec(cmd);
|
|
73
|
+
})();
|
|
74
|
+
break;
|
|
75
|
+
default:
|
|
76
|
+
throw new Error(`Os not found: ${os} for program ${program}`);
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
79
|
+
case 'xampp':
|
|
80
|
+
switch (os) {
|
|
81
|
+
case 'windows':
|
|
82
|
+
await (async () => {
|
|
83
|
+
const versions = {
|
|
84
|
+
'7.4.13-0':
|
|
85
|
+
'https://ufpr.dl.sourceforge.net/project/xampp/XAMPP%20Windows/7.4.13/xampp-windows-x64-7.4.13-0-VC15-installer.exe',
|
|
86
|
+
'7.4.13-1':
|
|
87
|
+
'https://ufpr.dl.sourceforge.net/project/xampp/XAMPP%20Windows/7.4.13/xampp-portable-windows-x64-7.4.13-1-VC15-installer.exe',
|
|
88
|
+
'8.0.28':
|
|
89
|
+
'https://sitsa.dl.sourceforge.net/project/xampp/XAMPP%20Windows/8.0.28/xampp-windows-x64-8.0.28-0-VS16-installer.exe',
|
|
90
|
+
};
|
|
91
|
+
const urlDownload = versions['7.4.13-1'];
|
|
92
|
+
const folderPath = `./engine-private/setup`;
|
|
93
|
+
if (!fs.existsSync(folderPath)) fs.mkdirSync(folderPath, { recursive: true });
|
|
94
|
+
const fullPath = `${folderPath}/${urlDownload.split('/').pop()}`;
|
|
95
|
+
logger.info('destination', fullPath);
|
|
96
|
+
if (!fs.existsSync(fullPath)) await Downloader(urlDownload, fullPath);
|
|
97
|
+
cmd = `${getRootDirectory()}${fullPath.slice(1)} --mode unattended`;
|
|
98
|
+
if (!fs.existsSync(`C:/xampp/apache`)) shellExec(cmd);
|
|
99
|
+
fs.writeFileSync(
|
|
100
|
+
`C:/xampp/apache/conf/httpd.template.conf`,
|
|
101
|
+
fs.readFileSync(`C:/xampp/apache/conf/httpd.conf`, 'utf8'),
|
|
102
|
+
'utf8',
|
|
103
|
+
);
|
|
104
|
+
fs.writeFileSync(
|
|
105
|
+
`C:/xampp/apache/conf/extra/httpd-ssl.template.conf`,
|
|
106
|
+
fs.readFileSync(`C:/xampp/apache/conf/extra/httpd-ssl.conf`, 'utf8'),
|
|
107
|
+
'utf8',
|
|
108
|
+
);
|
|
109
|
+
fs.writeFileSync(`C:/xampp/.gitignore`, `/htdocs`, 'utf8');
|
|
110
|
+
shellCd(`c:/xampp`);
|
|
111
|
+
shellExec(`git init && git add . && git commit -m "update"`);
|
|
112
|
+
shellCd(getRootDirectory());
|
|
113
|
+
})();
|
|
114
|
+
break;
|
|
115
|
+
default:
|
|
116
|
+
throw new Error(`Os not found: ${os} for program ${program}`);
|
|
117
|
+
}
|
|
118
|
+
break;
|
|
119
|
+
case 'docker':
|
|
120
|
+
switch (os) {
|
|
121
|
+
case 'windows':
|
|
122
|
+
await (async () => {
|
|
123
|
+
const urlDownload = `https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe`;
|
|
124
|
+
const folderPath = `./engine-private/setup`;
|
|
125
|
+
if (!fs.existsSync(folderPath)) fs.mkdirSync(folderPath, { recursive: true });
|
|
126
|
+
const fullPath = `${folderPath}/${urlDownload.split('/').pop()}`;
|
|
127
|
+
logger.info('destination', fullPath);
|
|
128
|
+
if (!fs.existsSync(fullPath)) await Downloader(urlDownload, fullPath);
|
|
129
|
+
logger.warn('You must have WSL, install with the following command', `wsl --install`);
|
|
130
|
+
cmd = `${getRootDirectory()}${fullPath.slice(1)} install --quiet --accept-license`;
|
|
131
|
+
if (!fs.existsSync(`C:/Program Files/Docker/Docker`)) shellExec(cmd);
|
|
132
|
+
})();
|
|
133
|
+
break;
|
|
134
|
+
|
|
135
|
+
default:
|
|
136
|
+
throw new Error(`Os not found: ${os} for program ${program}`);
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
case 'wordpress':
|
|
140
|
+
await (async () => {
|
|
141
|
+
const urlDownload = `https://wordpress.org/latest.zip`;
|
|
142
|
+
const folderPath = `./engine-private/setup`;
|
|
143
|
+
if (!fs.existsSync(folderPath)) fs.mkdirSync(folderPath, { recursive: true });
|
|
144
|
+
const fullPath = `${folderPath}/${urlDownload.split('/').pop()}`;
|
|
145
|
+
logger.info('destination', fullPath);
|
|
146
|
+
if (!fs.existsSync(fullPath)) await Downloader(urlDownload, fullPath);
|
|
147
|
+
const confServer = JSON.parse(
|
|
148
|
+
fs.readFileSync(
|
|
149
|
+
deployId ? `./engine-private/conf/${deployId}/conf.server.json` : `./conf/conf.server.json`,
|
|
150
|
+
'utf8',
|
|
151
|
+
),
|
|
152
|
+
);
|
|
153
|
+
const { directory, db } = confServer[host][`/${path}`];
|
|
154
|
+
logger.info('client found', confServer[host][`/${path}`]);
|
|
155
|
+
const zipTargetPath = directory ? directory : `./public/${path ? `${host}/${path}` : host}`;
|
|
156
|
+
if (!fs.existsSync(zipTargetPath)) fs.mkdirSync(zipTargetPath, { recursive: true });
|
|
157
|
+
const tmpFolderExtract = s4() + s4();
|
|
158
|
+
fs.mkdirSync(`./public/${tmpFolderExtract}`, { recursive: true });
|
|
159
|
+
logger.info(`Please wait, zip extract to`, zipTargetPath);
|
|
160
|
+
new AdmZip(fullPath).extractAllTo(/*target path*/ `./public/${tmpFolderExtract}`, /*overwrite*/ true);
|
|
161
|
+
fs.moveSync(`./public/${tmpFolderExtract}/wordpress`, zipTargetPath, { overwrite: true });
|
|
162
|
+
// https://wordpress.org/documentation/article/htaccess/
|
|
163
|
+
// https://github.com/chimurai/http-proxy-middleware/issues/785
|
|
164
|
+
let htaccess = ``;
|
|
165
|
+
if (host.split('.')[2]) {
|
|
166
|
+
// sub domain
|
|
167
|
+
htaccess += `# BEGIN WordPress Multisite
|
|
168
|
+
# Using subdomain network type: https://wordpress.org/documentation/article/htaccess/#multisite
|
|
169
|
+
|
|
170
|
+
RewriteEngine On
|
|
171
|
+
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
|
172
|
+
RewriteBase /
|
|
173
|
+
RewriteRule ^index\.php$ - [L]
|
|
174
|
+
|
|
175
|
+
# add a trailing slash to /wp-admin
|
|
176
|
+
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
|
|
177
|
+
|
|
178
|
+
RewriteCond %{REQUEST_FILENAME} -f [OR]
|
|
179
|
+
RewriteCond %{REQUEST_FILENAME} -d
|
|
180
|
+
RewriteRule ^ - [L]
|
|
181
|
+
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
|
|
182
|
+
RewriteRule ^(.*\.php)$ $1 [L]
|
|
183
|
+
RewriteRule . index.php [L]
|
|
184
|
+
|
|
185
|
+
# END WordPress Multisite
|
|
186
|
+
`;
|
|
187
|
+
} else if (path) {
|
|
188
|
+
// sub folder
|
|
189
|
+
htaccess += `# BEGIN WordPress Multisite
|
|
190
|
+
# Using subfolder network type: https://wordpress.org/documentation/article/htaccess/#multisite
|
|
191
|
+
|
|
192
|
+
RewriteEngine On
|
|
193
|
+
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
|
194
|
+
RewriteBase /
|
|
195
|
+
RewriteRule ^index\.php$ - [L]
|
|
196
|
+
|
|
197
|
+
# add a trailing slash to /wp-admin
|
|
198
|
+
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
|
|
199
|
+
|
|
200
|
+
RewriteCond %{REQUEST_FILENAME} -f [OR]
|
|
201
|
+
RewriteCond %{REQUEST_FILENAME} -d
|
|
202
|
+
RewriteRule ^ - [L]
|
|
203
|
+
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
|
|
204
|
+
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
|
|
205
|
+
RewriteRule . index.php [L]
|
|
206
|
+
|
|
207
|
+
# END WordPress Multisite
|
|
208
|
+
`;
|
|
209
|
+
} else {
|
|
210
|
+
// main domain
|
|
211
|
+
htaccess += `
|
|
212
|
+
# BEGIN WordPress
|
|
213
|
+
|
|
214
|
+
RewriteEngine On
|
|
215
|
+
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
|
216
|
+
RewriteBase /
|
|
217
|
+
RewriteRule ^index\.php$ - [L]
|
|
218
|
+
RewriteCond %{REQUEST_FILENAME} !-f
|
|
219
|
+
RewriteCond %{REQUEST_FILENAME} !-d
|
|
220
|
+
RewriteRule . /index.php [L]
|
|
221
|
+
|
|
222
|
+
# END WordPress
|
|
223
|
+
`;
|
|
224
|
+
}
|
|
225
|
+
// fs.writeFileSync(`${zipTargetPath}/.htaccess`, htaccess, 'utf8');
|
|
226
|
+
const secretKeyResult = await axios.get(`https://api.wordpress.org/secret-key/1.1/salt/`);
|
|
227
|
+
logger.info('wordpress secret Key Result', secretKeyResult.data);
|
|
228
|
+
fs.writeFileSync(
|
|
229
|
+
`${zipTargetPath}/wp-config.php`,
|
|
230
|
+
fs
|
|
231
|
+
.readFileSync(`${zipTargetPath}/wp-config-sample.php`, 'utf8')
|
|
232
|
+
.replaceAll(`define( 'AUTH_KEY', 'put your unique phrase here' );`, '')
|
|
233
|
+
.replaceAll(`define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );`, '')
|
|
234
|
+
.replaceAll(`define( 'LOGGED_IN_KEY', 'put your unique phrase here' );`, '')
|
|
235
|
+
.replaceAll(`define( 'NONCE_KEY', 'put your unique phrase here' );`, '')
|
|
236
|
+
.replaceAll(`define( 'AUTH_SALT', 'put your unique phrase here' );`, '')
|
|
237
|
+
.replaceAll(`define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );`, '')
|
|
238
|
+
.replaceAll(`define( 'LOGGED_IN_SALT', 'put your unique phrase here' );`, '')
|
|
239
|
+
.replaceAll(`define( 'NONCE_SALT', 'put your unique phrase here' );`, '')
|
|
240
|
+
.replaceAll(
|
|
241
|
+
`/**#@-*/`,
|
|
242
|
+
`${secretKeyResult.data}
|
|
243
|
+
|
|
244
|
+
/**#@-*/`,
|
|
245
|
+
)
|
|
246
|
+
.replaceAll('database_name_here', db.name)
|
|
247
|
+
.replaceAll('username_here', db.user)
|
|
248
|
+
.replaceAll('password_here', db.password)
|
|
249
|
+
.replaceAll(`$table_prefix = 'wp_';`, `$table_prefix = 'wp_${db.name}_';`),
|
|
250
|
+
'utf8',
|
|
251
|
+
);
|
|
252
|
+
const rootDirectory = getRootDirectory();
|
|
253
|
+
shellCd(zipTargetPath);
|
|
254
|
+
shellExec(`git init && git add . && git commit -m "update"`);
|
|
255
|
+
shellCd(rootDirectory);
|
|
256
|
+
fs.rmSync(`./public/${tmpFolderExtract}`, { recursive: true, force: true });
|
|
257
|
+
const wpHtaccess = `
|
|
258
|
+
# BEGIN WordPress
|
|
259
|
+
<IfModule mod_rewrite.c>
|
|
260
|
+
RewriteEngine On
|
|
261
|
+
RewriteRule ^index\.php$ - [L]
|
|
262
|
+
RewriteCond $1 ^(index\.php)?$ [OR]
|
|
263
|
+
# RewriteCond $1 \.(gif|jpg|png|ico|css|js|php)$ [NC,OR]
|
|
264
|
+
RewriteCond $1 \.(.*) [NC,OR]
|
|
265
|
+
RewriteCond %{REQUEST_FILENAME} -f [OR]
|
|
266
|
+
RewriteCond %{REQUEST_FILENAME} -d
|
|
267
|
+
RewriteRule ^(.*)$ - [S=1]
|
|
268
|
+
RewriteRule . /index.php [L]
|
|
269
|
+
</IfModule>
|
|
270
|
+
# END wordpress
|
|
271
|
+
`;
|
|
272
|
+
})();
|
|
273
|
+
break;
|
|
274
|
+
case 'nginx':
|
|
275
|
+
// https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mariadb-php-lemp-stack-on-debian-10
|
|
276
|
+
// https://github.com/pothi/wordpress-nginx/
|
|
277
|
+
// https://github.com/digitalocean/nginxconfig.io
|
|
278
|
+
break;
|
|
279
|
+
case 'mongodb':
|
|
280
|
+
switch (os) {
|
|
281
|
+
case 'windows':
|
|
282
|
+
await (async () => {
|
|
283
|
+
const versions = {
|
|
284
|
+
'6.0': 'https://fastdl.mongodb.org/windows/mongodb-windows-x86_64-6.0.11-signed.msi',
|
|
285
|
+
'7.0': `https://fastdl.mongodb.org/windows/mongodb-windows-x86_64-7.0.3-signed.msi`,
|
|
286
|
+
};
|
|
287
|
+
const version = '6.0';
|
|
288
|
+
const urlDownload = versions[version];
|
|
289
|
+
const folderPath = `./engine-private/setup`;
|
|
290
|
+
if (!fs.existsSync(folderPath)) fs.mkdirSync(folderPath, { recursive: true });
|
|
291
|
+
const fullPath = `${folderPath}/${urlDownload.split('/').pop()}`;
|
|
292
|
+
logger.info('destination', fullPath);
|
|
293
|
+
if (!fs.existsSync(fullPath)) await Downloader(urlDownload, fullPath);
|
|
294
|
+
// https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-windows-unattended/
|
|
295
|
+
// msiexec.exe /i <path_to_package> [/quiet][/passive][/q{n|b|r|f}]
|
|
296
|
+
// /quiet - quiet mode (there is no user interaction)
|
|
297
|
+
// /passive - unattended mode (the installation shows only a progress bar)
|
|
298
|
+
// /q - set the UI level:
|
|
299
|
+
// n - no UI
|
|
300
|
+
// n+ - no UI except for a modal dialog box displayed at the end.
|
|
301
|
+
// b - basic UI
|
|
302
|
+
// b+ - basic UI with a modal dialog box displayed at the end. The modal box is not displayed if the user cancels the installation. Use qb+! or qb!+ to hide the [ Cancel ] button.
|
|
303
|
+
// b- - basic UI with no modal dialog boxes. Please note that /qb+- is not a supported UI level. Use qb-! or qb!- to hide the [ Cancel ] button.
|
|
304
|
+
// r - reduced UI
|
|
305
|
+
// f - full UI
|
|
306
|
+
// cmd = `msiexec.exe /i ${getRootDirectory()}${fullPath.slice(1)} /qn`;
|
|
307
|
+
shellCd(`${getRootDirectory()}${folderPath.slice(1)}`);
|
|
308
|
+
cmd = `msiexec.exe /i ${urlDownload.split('/').pop()} ^ SHOULD_INSTALL_COMPASS="1" /qn`;
|
|
309
|
+
if (!fs.existsSync(`C:/Program Files/MongoDB/Server`)) shellExec(cmd);
|
|
310
|
+
const dbPath = `c:/mongodb/data`;
|
|
311
|
+
if (!fs.existsSync(dbPath)) fs.mkdirSync(dbPath, { recursive: true });
|
|
312
|
+
// https://www.mongodb.com/docs/v6.0/tutorial/install-mongodb-on-windows/
|
|
313
|
+
// https://medium.com/stackfame/run-mongodb-as-a-service-in-windows-b0acd3a4b712
|
|
314
|
+
// shellCd(`C:/Program Files/MongoDB/Server/${version}/bin/`);
|
|
315
|
+
// shellExec(`mongos.exe --dbpath="${dbPath}"`);
|
|
316
|
+
// shellExec(`"C:/Program Files/MongoDB/Server/${version}/bin/mongos.exe" --dbpath "${dbPath}"`);
|
|
317
|
+
})();
|
|
318
|
+
break;
|
|
319
|
+
|
|
320
|
+
default:
|
|
321
|
+
throw new Error(`Os not found: ${os} for program ${program}`);
|
|
322
|
+
}
|
|
323
|
+
break;
|
|
324
|
+
case 'mongodb-op-cli':
|
|
325
|
+
switch (os) {
|
|
326
|
+
case 'windows':
|
|
327
|
+
await (async () => {
|
|
328
|
+
// https://www.mongodb.com/try/download/mongocli
|
|
329
|
+
const urlDownload = `https://fastdl.mongodb.org/mongocli/mongocli_1.31.0_windows_x86_64.msi`;
|
|
330
|
+
const folderPath = `./engine-private/setup`;
|
|
331
|
+
if (!fs.existsSync(folderPath)) fs.mkdirSync(folderPath, { recursive: true });
|
|
332
|
+
const fullPath = `${folderPath}/${urlDownload.split('/').pop()}`;
|
|
333
|
+
logger.info('destination', fullPath);
|
|
334
|
+
if (!fs.existsSync(fullPath)) await Downloader(urlDownload, fullPath);
|
|
335
|
+
shellCd(`${getRootDirectory()}${folderPath.slice(1)}`);
|
|
336
|
+
cmd = `msiexec.exe /i ${urlDownload.split('/').pop()} /qn`;
|
|
337
|
+
shellExec(cmd);
|
|
338
|
+
})();
|
|
339
|
+
break;
|
|
340
|
+
|
|
341
|
+
default:
|
|
342
|
+
throw new Error(`Os not found: ${os} for program ${program}`);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
break;
|
|
346
|
+
case 'mongodb-op-tools':
|
|
347
|
+
switch (os) {
|
|
348
|
+
case 'windows':
|
|
349
|
+
await (async () => {
|
|
350
|
+
// env export import
|
|
351
|
+
// https://www.mongodb.com/try/download/database-tools
|
|
352
|
+
const urlDownload = `https://fastdl.mongodb.org/tools/db/mongodb-database-tools-windows-x86_64-100.9.3.msi`;
|
|
353
|
+
const folderPath = `./engine-private/setup`;
|
|
354
|
+
if (!fs.existsSync(folderPath)) fs.mkdirSync(folderPath, { recursive: true });
|
|
355
|
+
const fullPath = `${folderPath}/${urlDownload.split('/').pop()}`;
|
|
356
|
+
logger.info('destination', fullPath);
|
|
357
|
+
if (!fs.existsSync(fullPath)) await Downloader(urlDownload, fullPath);
|
|
358
|
+
shellCd(`${getRootDirectory()}${folderPath.slice(1)}`);
|
|
359
|
+
cmd = `msiexec.exe /i ${urlDownload.split('/').pop()} /qn`;
|
|
360
|
+
shellExec(cmd);
|
|
361
|
+
})();
|
|
362
|
+
break;
|
|
363
|
+
|
|
364
|
+
default:
|
|
365
|
+
throw new Error(`Os not found: ${os} for program ${program}`);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
break;
|
|
369
|
+
case 'mongodb-shell':
|
|
370
|
+
switch (os) {
|
|
371
|
+
case 'windows':
|
|
372
|
+
await (async () => {
|
|
373
|
+
// https://www.mongodb.com/try/download/shell
|
|
374
|
+
const urlDownload = `https://downloads.mongodb.com/compass/mongosh-2.1.0-x64.msi`;
|
|
375
|
+
const folderPath = `./engine-private/setup`;
|
|
376
|
+
if (!fs.existsSync(folderPath)) fs.mkdirSync(folderPath, { recursive: true });
|
|
377
|
+
const fullPath = `${folderPath}/${urlDownload.split('/').pop()}`;
|
|
378
|
+
logger.info('destination', fullPath);
|
|
379
|
+
if (!fs.existsSync(fullPath)) await Downloader(urlDownload, fullPath);
|
|
380
|
+
shellCd(`${getRootDirectory()}${folderPath.slice(1)}`);
|
|
381
|
+
cmd = `msiexec.exe /i ${urlDownload.split('/').pop()} /qn`;
|
|
382
|
+
shellExec(cmd);
|
|
383
|
+
})();
|
|
384
|
+
break;
|
|
385
|
+
|
|
386
|
+
default:
|
|
387
|
+
throw new Error(`Os not found: ${os} for program ${program}`);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
break;
|
|
391
|
+
|
|
392
|
+
default:
|
|
393
|
+
throw new Error(`Program not found: ${program}`);
|
|
394
|
+
}
|
|
395
|
+
logger.info(`end install ${program} on ${os}`);
|
|
396
|
+
} catch (error) {
|
|
397
|
+
logger.error(error, error.stack);
|
|
398
|
+
}
|