@jacebenson/jsn 4.3.7-dev.24 → 4.3.7-dev.26
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/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { confirmDelete, formatRecordForDisplay, getStringField, interactiveList,
|
|
|
3
3
|
import { FormatAuto } from '../output.js';
|
|
4
4
|
import { declareCapabilities } from '../capabilities.js';
|
|
5
5
|
import { resolveRecord, unwrapSysId } from '../resolve-record.js';
|
|
6
|
-
import { detectDocker, installDockerMidServer, validateMidCredentials } from '../midserver-install.js';
|
|
6
|
+
import { detectDocker, defaultRun, installDockerMidServer, validateMidCredentials } from '../midserver-install.js';
|
|
7
7
|
|
|
8
8
|
const AGENT_TABLE = 'ecc_agent';
|
|
9
9
|
const QUEUE_TABLE = 'ecc_queue';
|
|
@@ -250,6 +250,7 @@ export function midserversCmd(wrap) {
|
|
|
250
250
|
]
|
|
251
251
|
: dockerStatus.installed && dockerStatus.compose
|
|
252
252
|
? [
|
|
253
|
+
{ name: 'Run with sudo', value: 'sudo' },
|
|
253
254
|
{ name: 'Prepare files now, run Docker later', value: 'prepare' },
|
|
254
255
|
{ name: 'Direct install (not available yet)', value: 'direct' },
|
|
255
256
|
]
|
|
@@ -267,8 +268,13 @@ export function midserversCmd(wrap) {
|
|
|
267
268
|
name,
|
|
268
269
|
releaseName: credentials.releaseName,
|
|
269
270
|
directory: argv.directory,
|
|
270
|
-
runNow:
|
|
271
|
+
runNow: false,
|
|
271
272
|
});
|
|
273
|
+
if (installMethod === 'sudo') {
|
|
274
|
+
defaultRun('sudo', ['systemctl', 'start', 'docker']);
|
|
275
|
+
defaultRun('sudo', ['docker', 'compose', '-f', installation.composePath, 'up', '-d'], { cwd: installation.installDir });
|
|
276
|
+
installation.prepared = false;
|
|
277
|
+
}
|
|
272
278
|
if (installation.prepared) {
|
|
273
279
|
app.ok(installation, { summary: `Prepared MID Server files in ${installation.installDir}. Run: ${installation.runCommand}` });
|
|
274
280
|
return;
|
package/src/midserver-install.js
CHANGED
|
@@ -28,7 +28,8 @@ export function normalizeMidName(name) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export function buildMidRecipeUrl(releaseName) {
|
|
31
|
-
const
|
|
31
|
+
const matches = [...String(releaseName).matchAll(/(\d{4})-(\d{2})-(\d{2})|(\d{2})-(\d{2})-(\d{4})/g)];
|
|
32
|
+
const match = matches.at(-1);
|
|
32
33
|
if (!match) throw new Error(`MID release name has no build date: ${releaseName}`);
|
|
33
34
|
const year = match[1] || match[6];
|
|
34
35
|
const month = match[2] || match[4];
|
|
@@ -131,7 +132,10 @@ export async function installDockerMidServer({
|
|
|
131
132
|
fs.rmSync(persistedRecipeDir, { recursive: true, force: true });
|
|
132
133
|
fs.cpSync(recipeDir, persistedRecipeDir, { recursive: true });
|
|
133
134
|
fs.writeFileSync(composePath, composeFile({ serviceName }), { mode: 0o600 });
|
|
134
|
-
fs.
|
|
135
|
+
fs.chmodSync(composePath, 0o600);
|
|
136
|
+
const envPath = path.join(installDir, '.env');
|
|
137
|
+
fs.writeFileSync(envPath, envFile({ instanceURL, username, password, displayName, releaseName }), { mode: 0o600 });
|
|
138
|
+
fs.chmodSync(envPath, 0o600);
|
|
135
139
|
if (!dockerAvailable || !runNow) {
|
|
136
140
|
return {
|
|
137
141
|
name: displayName,
|