@florianpat/lando-core 3.23.7-compose → 3.23.22-test2
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/CHANGELOG.md +101 -1
- package/bin/lando +2 -0
- package/bin/lando.cmd +3 -0
- package/builders/_lando.js +2 -1
- package/components/l337-v4.js +2 -2
- package/config.yml +3 -2
- package/hooks/lando-autostart-engine.js +4 -25
- package/hooks/lando-run-setup.js +58 -0
- package/hooks/lando-setup-build-engine-darwin.js +13 -12
- package/hooks/lando-setup-build-engine-linux.js +14 -4
- package/hooks/lando-setup-build-engine-win32.js +27 -20
- package/hooks/lando-setup-build-engine-wsl.js +210 -0
- package/hooks/lando-setup-check.js +19 -0
- package/hooks/lando-setup-create-ca-wsl.js +34 -0
- package/hooks/lando-setup-create-ca.js +22 -23
- package/hooks/lando-setup-install-ca-darwin.js +5 -1
- package/hooks/lando-setup-install-ca-linux.js +4 -1
- package/hooks/lando-setup-install-ca-win32.js +5 -1
- package/hooks/lando-setup-install-ca-wsl.js +145 -0
- package/hooks/lando-setup-orchestrator.js +4 -4
- package/index.js +18 -12
- package/lib/app.js +2 -2
- package/lib/art.js +20 -8
- package/lib/compose.js +0 -3
- package/lib/daemon.js +79 -76
- package/lib/docker.js +2 -2
- package/lib/engine.js +10 -3
- package/lib/lando.js +2 -2
- package/lib/metrics.js +5 -3
- package/lib/updates.js +12 -2
- package/node_modules/nanoid/.devcontainer.json +23 -0
- package/node_modules/nanoid/README.md +517 -2
- package/node_modules/nanoid/async/index.browser.cjs +37 -2
- package/node_modules/nanoid/async/index.browser.js +37 -2
- package/node_modules/nanoid/async/index.cjs +38 -2
- package/node_modules/nanoid/async/index.js +38 -2
- package/node_modules/nanoid/async/index.native.js +33 -2
- package/node_modules/nanoid/index.browser.cjs +39 -1
- package/node_modules/nanoid/index.browser.js +39 -1
- package/node_modules/nanoid/index.cjs +42 -2
- package/node_modules/nanoid/index.js +42 -2
- package/node_modules/nanoid/non-secure/index.cjs +15 -2
- package/node_modules/nanoid/non-secure/index.js +15 -2
- package/node_modules/nanoid/package.json +1 -1
- package/node_modules/nanoid/url-alphabet/index.cjs +4 -0
- package/node_modules/nanoid/url-alphabet/index.js +4 -0
- package/package.json +7 -7
- package/plugins/networking/app.js +4 -2
- package/plugins/networking/index.js +19 -6
- package/plugins/proxy/builders/_proxy.js +1 -2
- package/release-aliases/3-EDGE +1 -1
- package/release-aliases/3-STABLE +1 -1
- package/renderers/dc2.js +2 -1
- package/scripts/add-to-group.sh +72 -0
- package/scripts/docker-engine-start.sh +15 -1
- package/scripts/install-docker-desktop.ps1 +11 -12
- package/scripts/install-system-ca-win32.ps1 +14 -14
- package/scripts/run-elevated.ps1 +2 -2
- package/scripts/semcompare.sh +142 -0
- package/scripts/wait-for-user.sh +1 -2
- package/tasks/destroy.js +3 -0
- package/tasks/info.js +2 -1
- package/tasks/init.js +35 -30
- package/tasks/rebuild.js +2 -8
- package/tasks/restart.js +2 -8
- package/tasks/setup.js +2 -2
- package/tasks/shellenv.js +2 -2
- package/tasks/start.js +2 -8
- package/tasks/stop.js +3 -0
- package/utils/build-config.js +2 -0
- package/utils/build-tooling-runner.js +2 -1
- package/utils/get-app.js +1 -1
- package/utils/get-bin-paths.js +2 -2
- package/utils/get-compose-x.js +1 -1
- package/utils/get-config-defaults.js +12 -7
- package/utils/get-docker-bin-path.js +6 -2
- package/utils/get-docker-desktop-x.js +21 -0
- package/utils/get-docker-x.js +3 -2
- package/utils/get-shellenv.js +1 -2
- package/utils/get-system-cas.js +25 -6
- package/utils/get-win32-envvar-from-wsl.js +7 -0
- package/utils/is-admin-user.js +9 -8
- package/utils/is-group-member.js +14 -7
- package/utils/is-wsl-interop.js +17 -4
- package/utils/run-elevated.js +9 -0
- package/utils/run-powershell-script.js +31 -5
- package/utils/run-tasks.js +3 -2
- package/utils/setup-metrics.js +10 -1
- package/utils/shutdown-os.js +8 -3
- package/utils/spawn-sync-stringer.js +1 -0
- package/utils/update-shell-profile.js +8 -7
- package/utils/validate-ca.js +31 -0
- package/utils/winpath-2-wslpath.js +6 -0
- package/utils/wslpath-2-winpath.js +6 -0
- package/hooks/lando-dep-check.js +0 -26
- package/lib/checksums.txt +0 -0
package/lib/art.js
CHANGED
|
@@ -300,7 +300,7 @@ exports.newContent = (type = 'guide') => [
|
|
|
300
300
|
'',
|
|
301
301
|
].join(os.EOL);
|
|
302
302
|
|
|
303
|
-
exports.setupHeader = (bengine = process.platform === 'linux' ? 'Engine' : 'Desktop') => `
|
|
303
|
+
exports.setupHeader = (bengine = process.landoPlatform === 'linux' || process.platform === 'linux' ? 'Engine' : 'Desktop') => `
|
|
304
304
|
${chalk.magenta(niceFont('Lando Setup!', 'Small Slant'))}
|
|
305
305
|
|
|
306
306
|
${chalk.bold('lando setup')} is a hidden convenience command to help you satisify the
|
|
@@ -322,16 +322,14 @@ or visit ${chalk.magenta('https://docs.lando.dev/cli/setup.html')}
|
|
|
322
322
|
/*
|
|
323
323
|
* Helper to show NO DOCKER error message
|
|
324
324
|
*/
|
|
325
|
-
exports.
|
|
326
|
-
${chalk.
|
|
325
|
+
exports.needsSetup = (dep = 'Docker Desktop') => `
|
|
326
|
+
${chalk.red(niceFont('U Need Setup!', 'Small Slant'))}
|
|
327
327
|
|
|
328
|
-
Lando
|
|
329
|
-
But ${chalk.bold('FEAR NOT')} because we have a special hidden convenience command called ${chalk.bold('lando setup')}
|
|
330
|
-
which will do the heavy lifting and set you right.
|
|
328
|
+
Lando encountered a setup error and does not have all the dependencies it needs to run!
|
|
331
329
|
|
|
332
|
-
Run ${chalk.bold('lando setup')} and when it completes try running Lando again.
|
|
330
|
+
Run ${chalk.bold('lando setup --debug')} and when it completes try running Lando again.
|
|
333
331
|
|
|
334
|
-
If you get
|
|
332
|
+
If you get another error or have any issues we recommend you post an issue on
|
|
335
333
|
GitHub or ping us in our Slack channel!
|
|
336
334
|
|
|
337
335
|
${chalk.magenta(`${figures.squareSmallFilled} Slack - https://launchpass.com/devwithlando`)}
|
|
@@ -401,6 +399,20 @@ exports.releaseChannel = (channel = 'stable') => {
|
|
|
401
399
|
}
|
|
402
400
|
};
|
|
403
401
|
|
|
402
|
+
/*
|
|
403
|
+
* Helper to show that setup is running
|
|
404
|
+
*/
|
|
405
|
+
exports.runningSetup = () => `
|
|
406
|
+
${chalk.yellow(niceFont('Running Setup!', 'Small Slant'))}
|
|
407
|
+
|
|
408
|
+
Lando has detected that it does not have ${chalk.bold('critical dependencies')} it needs to run.
|
|
409
|
+
But ${chalk.bold('FEAR NOT')} because we are trying to install them ${chalk.bold('right now')}!
|
|
410
|
+
|
|
411
|
+
This ${chalk.italic('may')} require your password or a restart so heads up.
|
|
412
|
+
|
|
413
|
+
If you cancel out you can run ${chalk.bold('lando setup')} to manually kick it off.
|
|
414
|
+
`;
|
|
415
|
+
|
|
404
416
|
/*
|
|
405
417
|
* Helper to show status of secret toggle
|
|
406
418
|
*/
|
package/lib/compose.js
CHANGED
|
@@ -161,9 +161,6 @@ exports.run = (compose, project, opts = {}) => {
|
|
|
161
161
|
} else if (opts.cmd[opts.cmd.length - 1] === '&') {
|
|
162
162
|
opts.cmd.pop();
|
|
163
163
|
opts.detach = true;
|
|
164
|
-
} else if (opts.cmd[opts.cmd.length - 1].endsWith('&')) {
|
|
165
|
-
opts.cmd[opts.cmd.length - 1] = opts.cmd[opts.cmd.length - 1].slice(0, -1).trim();
|
|
166
|
-
opts.detach = true;
|
|
167
164
|
}
|
|
168
165
|
}
|
|
169
166
|
|
package/lib/daemon.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// Modules
|
|
4
4
|
const _ = require('lodash');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const getDockerBinPath = require('../utils/get-docker-bin-path');
|
|
5
7
|
const os = require('os');
|
|
6
8
|
const path = require('path');
|
|
7
9
|
|
|
@@ -14,35 +16,29 @@ const Shell = require('./shell');
|
|
|
14
16
|
const shell = new Shell();
|
|
15
17
|
|
|
16
18
|
// Constants
|
|
17
|
-
const
|
|
19
|
+
const MACOS_BASE = '/Applications/Docker.app';
|
|
20
|
+
const WSL_DOCKER = '/Docker/host/bin/docker.exe';
|
|
18
21
|
|
|
19
22
|
/*
|
|
20
23
|
* Get services wrapper
|
|
21
24
|
*/
|
|
22
25
|
const buildDockerCmd = (cmd, scriptsDir, dockerBin) => {
|
|
23
26
|
const windowsStartScript = path.join(scriptsDir, 'docker-desktop-start.ps1');
|
|
24
|
-
switch (process.platform) {
|
|
27
|
+
switch (process.landoPlatform ?? process.platform) {
|
|
25
28
|
case 'darwin':
|
|
26
|
-
return ['open',
|
|
29
|
+
return ['open', MACOS_BASE];
|
|
27
30
|
case 'linux':
|
|
28
|
-
if (require('../utils/is-wsl-interop')(dockerBin)) {
|
|
29
|
-
// Docker Desktop WSL2 integration detected
|
|
30
|
-
return [
|
|
31
|
-
'powershell.exe', '-ExecutionPolicy', 'Bypass', '-File', `"${windowsStartScript}"`,
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
31
|
return [path.join(scriptsDir, `docker-engine-${cmd}.sh`)];
|
|
35
32
|
case 'win32':
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
];
|
|
33
|
+
case 'wsl':
|
|
34
|
+
return ['powershell.exe', '-ExecutionPolicy', 'Bypass', '-File', `"${windowsStartScript}"`];
|
|
39
35
|
}
|
|
40
36
|
};
|
|
41
37
|
|
|
42
38
|
/*
|
|
43
39
|
* Helper to build mac docker version get command
|
|
44
40
|
*/
|
|
45
|
-
const getMacProp = prop => shell.sh(['defaults', 'read', `${
|
|
41
|
+
const getMacProp = prop => shell.sh(['defaults', 'read', `${MACOS_BASE}/Contents/Info.plist`, prop])
|
|
46
42
|
.then(data => _.trim(data))
|
|
47
43
|
.catch(() => null);
|
|
48
44
|
|
|
@@ -57,11 +53,12 @@ module.exports = class LandoDaemon {
|
|
|
57
53
|
log = new Log(),
|
|
58
54
|
context = 'node',
|
|
59
55
|
compose = require('../utils/get-compose-x')(),
|
|
60
|
-
orchestratorVersion = '2.
|
|
56
|
+
orchestratorVersion = '2.30.3',
|
|
61
57
|
userConfRoot = path.join(os.homedir(), '.lando'),
|
|
62
58
|
) {
|
|
63
59
|
this.cache = cache;
|
|
64
60
|
this.compose = compose;
|
|
61
|
+
this.debug = require('../utils/debug-shim')(log);
|
|
65
62
|
this.orchestratorVersion = orchestratorVersion;
|
|
66
63
|
this.context = context;
|
|
67
64
|
this.docker = docker;
|
|
@@ -69,6 +66,7 @@ module.exports = class LandoDaemon {
|
|
|
69
66
|
this.log = log;
|
|
70
67
|
this.scriptsDir = path.join(userConfRoot, 'scripts');
|
|
71
68
|
this.isRunning = false;
|
|
69
|
+
this.platform = process.landoPlatform ?? process.platform;
|
|
72
70
|
};
|
|
73
71
|
|
|
74
72
|
/*
|
|
@@ -80,6 +78,12 @@ module.exports = class LandoDaemon {
|
|
|
80
78
|
* @return {Promise} A Promise.
|
|
81
79
|
*/
|
|
82
80
|
up(retry = true, password) {
|
|
81
|
+
const debug = require('../utils/debug-shim')(this.log);
|
|
82
|
+
|
|
83
|
+
// backwards compat
|
|
84
|
+
if (retry === true) retry = {max: 25, backoff: 1000};
|
|
85
|
+
else if (retry === false) retry = {max: 0};
|
|
86
|
+
|
|
83
87
|
/*
|
|
84
88
|
* Not officially documented event that allows you to do some things before
|
|
85
89
|
* the docker engine is booted up.
|
|
@@ -90,50 +94,42 @@ module.exports = class LandoDaemon {
|
|
|
90
94
|
return this.events.emit('pre-engine-up').then(() => {
|
|
91
95
|
// Automatically return true if we are in the GUI and on linux because
|
|
92
96
|
// this requires SUDO and because the daemon should always be running on nix
|
|
93
|
-
if (this.context !== 'node' &&
|
|
94
|
-
|
|
95
|
-
//
|
|
96
|
-
|
|
97
|
-
this.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
{debug, password}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
97
|
+
if (this.context !== 'node' && this.platform === 'linux') return Promise.resolve(true);
|
|
98
|
+
|
|
99
|
+
// retry func
|
|
100
|
+
const starter = async () => {
|
|
101
|
+
return await this.isUp().then(async isUp => {
|
|
102
|
+
if (isUp) return Promise.resolve();
|
|
103
|
+
|
|
104
|
+
try {
|
|
105
|
+
switch (this.platform) {
|
|
106
|
+
case 'darwin':
|
|
107
|
+
await require('../utils/run-command')('open', [MACOS_BASE], {debug: this.debug});
|
|
108
|
+
break;
|
|
109
|
+
case 'linux':
|
|
110
|
+
const lscript = path.join(this.scriptsDir, 'docker-engine-start.sh');
|
|
111
|
+
if (password) await require('../utils/run-elevated')([lscript], {debug, password});
|
|
112
|
+
else await require('../utils/run-command')(lscript, {debug});
|
|
113
|
+
break;
|
|
114
|
+
case 'win32':
|
|
115
|
+
case 'wsl':
|
|
116
|
+
const wscript = path.join(this.scriptsDir, 'docker-desktop-start.ps1');
|
|
117
|
+
await require('../utils/run-powershell-script')(wscript, undefined, {debug: this.debug});
|
|
118
|
+
await require('delay')(2000);
|
|
119
|
+
break;
|
|
113
120
|
}
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
121
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return
|
|
123
|
-
.catch(err => {
|
|
124
|
-
throw Error('Could not automatically start the Docker Daemon. Please manually start it to continue.');
|
|
125
|
-
})
|
|
126
|
-
// Likely need to retry until start command completes all good
|
|
127
|
-
.retry(() => this.isUp().then(isUp => (!isUp) ? Promise.reject() : Promise.resolve()), retryOpts)
|
|
128
|
-
// Fail if retry is no good
|
|
129
|
-
.catch(err => {
|
|
130
|
-
throw Error('Could not automatically start the Docker Daemon. Please manually start it to continue.');
|
|
131
|
-
})
|
|
132
|
-
// Engine is good!
|
|
133
|
-
.then(() => this.log.info('engine activated.'));
|
|
122
|
+
this.debug('build engine started but waiting to connect...');
|
|
123
|
+
return Promise.reject();
|
|
124
|
+
} catch (error) {
|
|
125
|
+
this.debug('could not start build engine with %o', error?.message);
|
|
126
|
+
this.debug('%j', error);
|
|
127
|
+
return Promise.reject(error);
|
|
134
128
|
}
|
|
135
129
|
});
|
|
136
|
-
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
return Promise.retry(starter, retry);
|
|
137
133
|
})
|
|
138
134
|
|
|
139
135
|
/*
|
|
@@ -158,11 +154,8 @@ module.exports = class LandoDaemon {
|
|
|
158
154
|
.then(() => {
|
|
159
155
|
// Automatically return true if we are in browsery context and on linux because
|
|
160
156
|
// this requires SUDO and because the daemon should always be running on nix
|
|
161
|
-
if (
|
|
162
|
-
|
|
163
|
-
&& process.platform === 'linux'
|
|
164
|
-
&& !require('../utils/is-wsl-interop')(this.docker)
|
|
165
|
-
) return Promise.resolve(true);
|
|
157
|
+
if (this.context !== 'node' && this.platform === 'linux') return Promise.resolve(true);
|
|
158
|
+
|
|
166
159
|
// Automatically return if we are on Windows or Darwin because we don't
|
|
167
160
|
// ever want to automatically turn the VM off since users might be using
|
|
168
161
|
// D4M/W for other things.
|
|
@@ -172,15 +165,15 @@ module.exports = class LandoDaemon {
|
|
|
172
165
|
//
|
|
173
166
|
// @todo: When/if we can run our own isolated docker daemon we can change
|
|
174
167
|
// this back.
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
) return Promise.resolve(true);
|
|
168
|
+
if (this.platform === 'darwin' || this.platform === 'win32' || this.platform === 'wsl') {
|
|
169
|
+
return Promise.resolve(true);
|
|
170
|
+
}
|
|
171
|
+
|
|
180
172
|
// Shut provider down if its status is running.
|
|
181
173
|
return this.isUp(this.log, this.cache, this.docker).then(isUp => {
|
|
182
174
|
if (isUp) return shell.sh(buildDockerCmd('stop', this.scriptsDir, this.docker), {mode: 'collect'});
|
|
183
175
|
})
|
|
176
|
+
|
|
184
177
|
// Wrap errors.
|
|
185
178
|
.catch(err => {
|
|
186
179
|
throw new Error(err, 'Error while shutting down.');
|
|
@@ -202,44 +195,54 @@ module.exports = class LandoDaemon {
|
|
|
202
195
|
* this means we also assume whatever necessary installation checks have been
|
|
203
196
|
* performed and dockers existence verified
|
|
204
197
|
*/
|
|
205
|
-
isUp(log = this.log, cache = this.cache, docker = this.docker) {
|
|
198
|
+
async isUp(log = this.log, cache = this.cache, docker = this.docker) {
|
|
206
199
|
// Auto return if cached and true
|
|
207
200
|
if (cache.get('engineup') === true) return Promise.resolve(true);
|
|
201
|
+
|
|
202
|
+
// on wsl lets rework docker to avoid perm issues on the socket?
|
|
203
|
+
if (this.platform === 'wsl' && fs.existsSync(WSL_DOCKER) ) docker = WSL_DOCKER;
|
|
204
|
+
|
|
208
205
|
// Return true if we get a zero response and cache the result
|
|
209
|
-
|
|
210
|
-
|
|
206
|
+
try {
|
|
207
|
+
await require('../utils/run-command')(docker, ['ps'], {debug: this.debug});
|
|
208
|
+
this.debug('engine is up.');
|
|
211
209
|
cache.set('engineup', true, {ttl: 5});
|
|
212
210
|
this.isRunning = true;
|
|
213
211
|
return Promise.resolve(true);
|
|
214
|
-
})
|
|
215
|
-
|
|
216
|
-
log.debug('engine is down with error %s', error.message);
|
|
212
|
+
} catch (error) {
|
|
213
|
+
this.debug('engine is down with error %s', error.message);
|
|
217
214
|
return Promise.resolve(false);
|
|
218
|
-
}
|
|
215
|
+
}
|
|
219
216
|
};
|
|
220
217
|
|
|
221
218
|
/*
|
|
222
219
|
* Helper to get the versions of the things we need
|
|
223
220
|
*/
|
|
224
|
-
getVersions() {
|
|
221
|
+
async getVersions() {
|
|
225
222
|
// presumably if we get this far orchestratorVersion is set and orchestratorBin exists
|
|
226
223
|
const versions = {compose: this.orchestratorVersion, desktop: false, engine: false};
|
|
227
224
|
// try to get either the desktop or engine
|
|
228
|
-
switch (
|
|
225
|
+
switch (this.platform) {
|
|
229
226
|
case 'darwin':
|
|
230
227
|
return getMacProp('CFBundleShortVersionString').then(version => ({...versions, desktop: version}));
|
|
231
228
|
case 'linux':
|
|
232
229
|
const cmd = [`"${this.docker}"`, 'version', '--format', '{{.Server.Version}}'];
|
|
233
230
|
return shell.sh(cmd).catch(() => '18.0.0').then(version => ({...versions, engine: version}));
|
|
234
231
|
case 'win32':
|
|
235
|
-
|
|
236
|
-
const componentsVersionFile =
|
|
232
|
+
case 'wsl':
|
|
233
|
+
const componentsVersionFile = this.platform === 'win32'
|
|
234
|
+
? path.resolve(getDockerBinPath('win32'), '..', 'componentsVersion.json') : '/Docker/host/componentsVersion.json';
|
|
235
|
+
|
|
236
|
+
// if cvf doesnt exist then just set it to something high and dont worry about it?
|
|
237
|
+
if (!fs.existsSync(componentsVersionFile)) {
|
|
238
|
+
versions.desktop = 'skip';
|
|
237
239
|
|
|
238
240
|
// If we found one, use it but allow for a fallback in case these keys change
|
|
239
|
-
|
|
241
|
+
} else {
|
|
240
242
|
const {appVersion, Version, Informational} = require(componentsVersionFile);
|
|
241
243
|
versions.desktop = appVersion ?? Version ?? Informational;
|
|
242
244
|
}
|
|
245
|
+
|
|
243
246
|
return Promise.resolve(versions);
|
|
244
247
|
}
|
|
245
248
|
};
|
package/lib/docker.js
CHANGED
|
@@ -69,7 +69,7 @@ module.exports = class Landerode extends Dockerode {
|
|
|
69
69
|
/*
|
|
70
70
|
* Returns a list of Lando containers
|
|
71
71
|
*/
|
|
72
|
-
list(options = {}, separator = '
|
|
72
|
+
list(options = {}, separator = '_') {
|
|
73
73
|
return this.listContainers(options)
|
|
74
74
|
// Filter out nulls and undefineds.
|
|
75
75
|
.filter(_.identity)
|
|
@@ -92,7 +92,7 @@ module.exports = class Landerode extends Dockerode {
|
|
|
92
92
|
// Filter by app name if an app name was given.
|
|
93
93
|
.then(containers => {
|
|
94
94
|
if (options.project) return _.filter(containers, c => c.app === options.project);
|
|
95
|
-
else if (options.app) return _.filter(containers, c => c.app === (options.app));
|
|
95
|
+
else if (options.app) return _.filter(containers, c => c.app === require('../utils/docker-composify')(options.app)); // eslint-disable-line max-len
|
|
96
96
|
return containers;
|
|
97
97
|
})
|
|
98
98
|
// Then finally filter by everything else
|
package/lib/engine.js
CHANGED
|
@@ -28,10 +28,13 @@ module.exports = class Engine {
|
|
|
28
28
|
this.dockerInstalled = this.daemon.docker !== false;
|
|
29
29
|
|
|
30
30
|
// set the compose separator
|
|
31
|
-
this.separator = _.get(config, 'orchestratorSeparator', '
|
|
31
|
+
this.separator = _.get(config, 'orchestratorSeparator', '_');
|
|
32
32
|
|
|
33
33
|
// Grab the supported ranges for our things
|
|
34
34
|
this.supportedVersions = config.dockerSupportedVersions;
|
|
35
|
+
|
|
36
|
+
// platform
|
|
37
|
+
this.platform = process.landoPlatform ?? process.platform;
|
|
35
38
|
};
|
|
36
39
|
|
|
37
40
|
/**
|
|
@@ -183,7 +186,7 @@ module.exports = class Engine {
|
|
|
183
186
|
.map((data, name) => _.merge({}, data, {name}))
|
|
184
187
|
.map(data => ([data.name, {
|
|
185
188
|
satisfies: data.satisfies || `${data.min} - ${data.max}`,
|
|
186
|
-
link: data.link[
|
|
189
|
+
link: data.link[this.platform],
|
|
187
190
|
tested: data.tested || 'x.x.x',
|
|
188
191
|
recommendUpdate: data.recommendUpdate || 'x.x.x',
|
|
189
192
|
}]))
|
|
@@ -193,9 +196,13 @@ module.exports = class Engine {
|
|
|
193
196
|
return this.daemon.getVersions().then(versions => {
|
|
194
197
|
// Remove the things we don't need depending on platform
|
|
195
198
|
// @TODO: Should daemon.getVersions just do this automatically?
|
|
196
|
-
if (
|
|
199
|
+
if (this.platform === 'linux') delete versions.desktop;
|
|
197
200
|
else delete versions.engine;
|
|
198
201
|
|
|
202
|
+
// handle skip
|
|
203
|
+
if (versions?.engine === 'skip') delete versions.engine;
|
|
204
|
+
if (versions?.desktop === 'skip') delete versions.desktop;
|
|
205
|
+
|
|
199
206
|
// do the version comparison
|
|
200
207
|
return _(versions).map((version, name) => {
|
|
201
208
|
const reqs = supportedVersions[name];
|
package/lib/lando.js
CHANGED
|
@@ -715,9 +715,9 @@ module.exports = class Lando {
|
|
|
715
715
|
|
|
716
716
|
const results = await Promise.all(options.tasks.map(async task => {
|
|
717
717
|
// break it up
|
|
718
|
-
const {canRun, comments, description, hasRun, requiresRestart, version} = require('../utils/parse-setup-task')(task); // eslint-disable-line max-len
|
|
718
|
+
const {id, canRun, comments, description, hasRun, requiresRestart, version} = require('../utils/parse-setup-task')(task); // eslint-disable-line max-len
|
|
719
719
|
// lets start optimistically
|
|
720
|
-
const status = {version, description, state: 'INSTALLED'};
|
|
720
|
+
const status = {version, description, id, state: 'INSTALLED'};
|
|
721
721
|
// and slowly spiral down
|
|
722
722
|
// @TODO: woiuld be great if hasRun could also return a "comment" eg
|
|
723
723
|
// "installed but slightly above desired range"
|
package/lib/metrics.js
CHANGED
|
@@ -41,16 +41,18 @@ module.exports = class Metrics {
|
|
|
41
41
|
const id = this.id;
|
|
42
42
|
// Attempt to sanitize merged data as much as possible
|
|
43
43
|
const send = cleanseData(_.merge({}, this.data, data, {action, created: new Date().toJSON()}));
|
|
44
|
-
// Log the attempt
|
|
45
|
-
log.verbose('reporting %s action to', action, this.endpoints);
|
|
46
|
-
log.debug('reported data', send);
|
|
47
44
|
// Start the reporting chain
|
|
48
45
|
return Promise.resolve(this.endpoints)
|
|
49
46
|
// Filter out any inactive endpoints
|
|
50
47
|
.filter(endpoint => endpoint.report)
|
|
51
48
|
// Get the client and report
|
|
52
49
|
.map(endpoint => {
|
|
50
|
+
// Log the attempt
|
|
51
|
+
log.verbose('reporting %s action to', action, this.endpoints);
|
|
52
|
+
log.debug('reporting data', send);
|
|
53
|
+
|
|
53
54
|
const agent = getAxios({baseURL: endpoint.url});
|
|
55
|
+
|
|
54
56
|
// Post the data
|
|
55
57
|
return agent.post('/metrics/v2/' + id, send).catch(error => {
|
|
56
58
|
const url = _.get(endpoint, 'url', 'unknown');
|
package/lib/updates.js
CHANGED
|
@@ -6,6 +6,7 @@ const get = require('lodash/get');
|
|
|
6
6
|
const getOctokit = require('../utils/get-octokit');
|
|
7
7
|
const os = require('os');
|
|
8
8
|
const path = require('path');
|
|
9
|
+
const remove = require('../utils/remove');
|
|
9
10
|
const semver = require('semver');
|
|
10
11
|
const uniqBy = require('lodash/uniqBy');
|
|
11
12
|
|
|
@@ -254,7 +255,16 @@ module.exports = class UpdateManager {
|
|
|
254
255
|
// refresh the "symlink"
|
|
255
256
|
require('../utils/link-bin')(this._cli.installPath, dest, {debug: this.debug});
|
|
256
257
|
|
|
257
|
-
//
|
|
258
|
+
// set a good default update messag
|
|
259
|
+
task.title = `Updated @lando/cli to ${version}`;
|
|
260
|
+
|
|
261
|
+
// if lando.exe exists on windows in the install path then remove it so the link has primacy
|
|
262
|
+
// in PATHEXT hierarchy
|
|
263
|
+
if (process.platform === 'win32' && fs.existsSync(path.join(this._cli.installPath, filename))) {
|
|
264
|
+
remove(path.join(this._cli.installPath, filename));
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// if link is not in PATH then attempt to add it
|
|
258
268
|
// @NOTE: feels sufficient to just check for `lando` since it _should_ exist in win and posix
|
|
259
269
|
if (!require('../utils/is-in-path')(path.join(this._cli.installPath, 'lando'))) {
|
|
260
270
|
const binPaths = require('../utils/get-bin-paths')(this._cli);
|
|
@@ -274,6 +284,7 @@ module.exports = class UpdateManager {
|
|
|
274
284
|
const rcFile = require('../utils/get-shell-profile')();
|
|
275
285
|
require('../utils/update-shell-profile')(rcFile, shellEnv);
|
|
276
286
|
this.debug('added %o to %o', shellEnv, rcFile);
|
|
287
|
+
task.title = `${task.title}. Start a new terminal session to use the updated ${color.bold(`lando`)}`;
|
|
277
288
|
|
|
278
289
|
// otherwis i guess do something else?
|
|
279
290
|
// @TODO: throw a warning?
|
|
@@ -281,7 +292,6 @@ module.exports = class UpdateManager {
|
|
|
281
292
|
}
|
|
282
293
|
|
|
283
294
|
// finish
|
|
284
|
-
task.title = `Updated @lando/cli to ${version}`;
|
|
285
295
|
resolve(data);
|
|
286
296
|
});
|
|
287
297
|
// handle errors
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"image": "localhost/ai-opensource:latest",
|
|
3
|
+
"forwardPorts": [],
|
|
4
|
+
"mounts": [
|
|
5
|
+
{
|
|
6
|
+
"source": "pnpm-store",
|
|
7
|
+
"target": "/home/ai/.local/share/pnpm/store",
|
|
8
|
+
"type": "volume"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"source": "shell-history",
|
|
12
|
+
"target": "/home/ai/.local/share/history/",
|
|
13
|
+
"type": "volume"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"workspaceMount": "",
|
|
17
|
+
"runArgs": [
|
|
18
|
+
"--userns=keep-id:uid=1000,gid=1000",
|
|
19
|
+
"--volume=${localWorkspaceFolder}:/workspaces/${localWorkspaceFolderBasename}:Z",
|
|
20
|
+
"--network=host",
|
|
21
|
+
"--ulimit=host"
|
|
22
|
+
]
|
|
23
|
+
}
|