Skip to content

Commit

Permalink
Merge pull request #316 from lando/dd-4371-edge
Browse files Browse the repository at this point in the history
Dd 4371 edge
  • Loading branch information
pirog authored Jan 15, 2025
2 parents 3d6d4ed + 930c4d7 commit 981123c
Show file tree
Hide file tree
Showing 17 changed files with 106 additions and 57 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ coverage/

# lando
.lando/id
checksums.txt
plugins/*
!plugins/.gitkeep
FATCORE
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})

### New Features

* Improved Docker Destkop autostart to use new `docker desktop start` if available
* Merged in improvements from `@lando/core@v3.23.24`

### Bug Fixes

* Fixed bug causing `--accept-license` flag to not work when installing Docker Desktop on macOS

### Internal

* Updated default Docker Desktop version to `4.37.1|2`
* Updated default Docker Engine version to `27.5.0`
* Updated default Docker Compose version to `2.31.0`
* Updated recommended Docker Desktop range to `>=4.37.0`
* Updated tested Docker Desktop range to `<=4.37`
* Updated tested Docker Compose range to `<=2.32`

## v3.24.0-beta.9 - [January 14, 2025](https://github.com/lando/core/releases/tag/v3.24.0-beta.9)

* Merged in improvements from `@lando/core@v3.23.23`
Expand Down Expand Up @@ -34,6 +52,10 @@
* Fixed bug causing auto setup to not correctly reset the orchestrator binary path
* Improved `lando init` so that it can auto setup if needed

## v3.23.24 - [January 14, 2025](https://github.com/lando/core/releases/tag/v3.23.24)

* Fixed bug causing service script moving to fail when receiving non-stringy inputs

## v3.23.23 - [January 14, 2025](https://github.com/lando/core/releases/tag/v3.23.23)

* Fixed bug causing service script loading collisions
Expand Down
8 changes: 5 additions & 3 deletions builders/_lando.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = {
refreshCerts = false,
remoteFiles = {},
scripts = [],
scriptsDir = '',
scriptsDir = false,
sport = '443',
ssl = false,
sslExpose = true,
Expand All @@ -72,7 +72,7 @@ module.exports = {
}

// normalize scripts dir if needed
if (!path.isAbsolute(scriptsDir)) scriptsDir = path.resolve(root, scriptsDir);
if (typeof scriptsDir === 'string' && !path.isAbsolute(scriptsDir)) scriptsDir = path.resolve(root, scriptsDir);

// Get some basic locations
const globalScriptsDir = path.join(userConfRoot, 'scripts');
Expand All @@ -87,7 +87,9 @@ module.exports = {
if (fs.existsSync(confSrc)) require('../utils/move-config')(confSrc, confDest);

// ditto for service helpers
if (fs.existsSync(scriptsDir)) require('../utils/move-config')(scriptsDir, serviceScriptsDir);
if (!require('../utils/is-disabled')(scriptsDir) && typeof scriptsDir === 'string' && fs.existsSync(scriptsDir)) {
require('../utils/move-config')(scriptsDir, serviceScriptsDir);
}

// Handle Environment
const environment = {
Expand Down
Empty file removed checksums.txt
Empty file.
8 changes: 4 additions & 4 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ dockerSupportedVersions:
compose:
satisfies: "1.x.x || 2.x.x"
recommendUpdate: "<=2.24.6"
tested: "<=2.30.99"
tested: "<=2.32.99"
link:
linux: https://docs.docker.com/compose/install/#install-compose-on-linux-systems
darwin: https://docs.docker.com/desktop/install/mac-install/
win32: https://docs.docker.com/desktop/install/windows-install/
desktop:
satisfies: ">=4.0.0 <5"
tested: "<=4.36.99"
recommendUpdate: "<=4.34.0"
tested: "<=4.37.99"
recommendUpdate: "<=4.36"
link:
darwin: https://docs.docker.com/desktop/install/mac-install/
win32: https://docs.docker.com/desktop/install/windows-install/
wsl: https://docs.docker.com/desktop/install/windows-install/
engine:
satisfies: ">=18 <28"
tested: "<=27.3.1"
tested: "<=27.5.99"
link:
linux: https://docs.docker.com/engine/install/debian/#install-using-the-convenience-script
1 change: 1 addition & 0 deletions examples/setup-macos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ stat ~/.lando/certs/LandoCA.crt

# Should have installed the Lando Development CA
security find-certificate -a -c "Lando Development CA" -p ~/Library/Keychains/login.keychain-db
```
3 changes: 3 additions & 0 deletions hooks/lando-setup-build-engine-darwin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const semver = require('semver');
const {color} = require('listr2');

const buildIds = {
'4.37.2': '179585',
'4.37.1': '178610',
'4.37.0': '178034',
'4.36.0': '175267',
'4.35.1': '173168',
'4.35.0': '172550',
Expand Down
1 change: 0 additions & 1 deletion hooks/lando-setup-build-engine-linux.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const downloadDockerEngine = (url = 'https://get.docker.com', {debug, task}) =>
});
});


module.exports = async (lando, options) => {
const debug = require('../utils/debug-shim')(lando.log);
// if build engine is set to false allow it to be skipped
Expand Down
2 changes: 2 additions & 0 deletions hooks/lando-setup-build-engine-win32.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const {color} = require('listr2');
const {nanoid} = require('nanoid');

const buildIds = {
'4.37.1': '178610',
'4.37.0': '178034',
'4.36.0': '175267',
'4.35.1': '173168',
'4.35.0': '172550',
Expand Down
2 changes: 2 additions & 0 deletions hooks/lando-setup-build-engine-wsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const {color} = require('listr2');
const {nanoid} = require('nanoid');

const buildIds = {
'4.37.1': '178610',
'4.37.0': '178034',
'4.36.0': '175267',
'4.35.1': '173168',
'4.35.0': '172550',
Expand Down
4 changes: 2 additions & 2 deletions hooks/lando-setup-orchestrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const path = require('path');
/*
* Helper to get docker compose v2 download url
*/
const getComposeDownloadUrl = (version = '2.30.3') => {
const getComposeDownloadUrl = (version = '2.31.0') => {
const mv = version.split('.')[0] > 1 ? '2' : '1';
const arch = process.arch === 'arm64' ? 'aarch64' : 'x86_64';
const toggle = `${process.platform}-${mv}`;
Expand All @@ -31,7 +31,7 @@ const getComposeDownloadUrl = (version = '2.30.3') => {
/*
* Helper to get docker compose v2 download destination
*/
const getComposeDownloadDest = (base, version = '2.30.3') => {
const getComposeDownloadDest = (base, version = '2.31.0') => {
switch (process.platform) {
case 'linux':
case 'darwin':
Expand Down
93 changes: 55 additions & 38 deletions lib/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const fs = require('fs');
const getDockerBinPath = require('../utils/get-docker-bin-path');
const os = require('os');
const path = require('path');
const semver = require('semver');

const Cache = require('./cache');
const Events = require('./events');
Expand Down Expand Up @@ -53,7 +54,7 @@ module.exports = class LandoDaemon {
log = new Log(),
context = 'node',
compose = require('../utils/get-compose-x')(),
orchestratorVersion = '2.30.3',
orchestratorVersion = '2.31.0',
userConfRoot = path.join(os.homedir(), '.lando'),
) {
this.cache = cache;
Expand All @@ -77,7 +78,7 @@ module.exports = class LandoDaemon {
* @fires post_engine_up
* @return {Promise} A Promise.
*/
up(retry = true, password) {
async up(retry = true, password) {
const debug = require('../utils/debug-shim')(this.log);

// backwards compat
Expand All @@ -91,48 +92,64 @@ module.exports = class LandoDaemon {
* @since 3.0.0
* @event pre_engine_up
*/
return this.events.emit('pre-engine-up').then(() => {
// Automatically return true if we are in the GUI and on linux because
// this requires SUDO and because the daemon should always be running on nix
if (this.context !== 'node' && this.platform === 'linux') return Promise.resolve(true);
await this.events.emit('pre-engine-up');

// Automatically return true if we are in the GUI and on linux because
// this requires SUDO and because the daemon should always be running on nix
if (this.context !== 'node' && this.platform === 'linux') return Promise.resolve(true);

// retry func
const starter = async () => {
return await this.isUp().then(async isUp => {
// if we are already up then we are done
if (isUp) return Promise.resolve();

try {
switch (this.platform) {
// docker engine
case 'linux': {
const lscript = path.join(this.scriptsDir, 'docker-engine-start.sh');
if (password) await require('../utils/run-elevated')([lscript], {debug, password});
else await require('../utils/run-command')(lscript, {debug});
break;
}

// docker desktop
case 'darwin': {
// get version information
const {desktop} = await this.getVersions();

// retry func
const starter = async () => {
return await this.isUp().then(async isUp => {
if (isUp) return Promise.resolve();
// if desktop version is >=4.37.1 then use docker desktop cli
if (semver.gte(desktop, '4.37.0', {includePrerelease: true, loose: true})) {
await require('../utils/run-command')(this.docker, ['desktop', 'start', '--timeout', '300'], {debug: this.debug});

try {
switch (this.platform) {
case 'darwin':
// otherwise mac fallback
} else {
await require('../utils/run-command')('open', [MACOS_BASE], {debug: this.debug});
break;
case 'linux': {
const lscript = path.join(this.scriptsDir, 'docker-engine-start.sh');
if (password) await require('../utils/run-elevated')([lscript], {debug, password});
else await require('../utils/run-command')(lscript, {debug});
break;
}
case 'win32':
case 'wsl': {
const wscript = path.join(this.scriptsDir, 'docker-desktop-start.ps1');
await require('../utils/run-powershell-script')(wscript, undefined, {debug: this.debug});
await require('delay')(2000);
break;
}
break;
}
case 'win32':
case 'wsl': {
const wscript = path.join(this.scriptsDir, 'docker-desktop-start.ps1');
await require('../utils/run-powershell-script')(wscript, undefined, {debug: this.debug});
await require('delay')(2000);
break;
}

this.debug('build engine started but waiting to connect...');
return Promise.reject();
} catch (error) {
this.debug('could not start build engine with %o', error?.message);
this.debug('%j', error);
return Promise.reject(error);
}
});
};

return Promise.retry(starter, retry);
})
this.debug('build engine started but waiting to connect...');
return Promise.reject();
} catch (error) {
this.debug('could not start build engine with %o', error?.message);
this.debug('%j', error);
return Promise.reject(error);
}
});
};

// try to start
await Promise.retry(starter, retry);

/*
* Not officially documented event that allows you to do some things after
Expand All @@ -141,7 +158,7 @@ module.exports = class LandoDaemon {
* @since 3.0.0
* @event post_engine_up
*/
.then(() => this.events.emit('post-engine-up'));
await this.events.emit('post-engine-up');
}

down() {
Expand Down
2 changes: 1 addition & 1 deletion release-aliases/3-STABLE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.23.23
v3.23.24
2 changes: 1 addition & 1 deletion scripts/install-docker-desktop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ debug "INSTALLER: $INSTALLER"
debug "USER: $USER"

# add accept license if set
if [ "${DEBUG}" == 1 ]; then OPTS="$OPTS --accept-license"; fi
if [ "${ACCEPT_LICENSE}" == 1 ]; then OPTS="$OPTS --accept-license"; fi

# run
hdiutil attach "$INSTALLER"
Expand Down
2 changes: 1 addition & 1 deletion scripts/install-docker-engine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -eo pipefail

DEBUG=0
INSTALLER="get-docker.sh"
VERSION="27.3.1"
VERSION="27.5.0"
OPTS=

debug() {
Expand Down
2 changes: 1 addition & 1 deletion utils/get-compose-x.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const getDockerBin = (bin, base, pathFallback = true) => {
}
};

module.exports = ({orchestratorVersion = '2.30.3', userConfRoot = os.tmpdir()} = {}) => {
module.exports = ({orchestratorVersion = '2.31.0', userConfRoot = os.tmpdir()} = {}) => {
const orchestratorBin = `docker-compose-v${orchestratorVersion}`;
switch (process.platform) {
case 'darwin':
Expand Down
10 changes: 5 additions & 5 deletions utils/get-config-defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ const os = require('os');
const getBuildEngineVersion = (platform = process.landoPlatform ?? process.platform) => {
switch (platform) {
case 'darwin':
return '4.36.0';
return '4.37.2';
case 'linux':
return '27.3.1';
return '27.5.0';
case 'win32':
return '4.36.0';
return '4.37.1';
case 'wsl':
return '4.36.0';
return '4.37.1';
}
};

// Default config
const defaultConfig = options => ({
orchestratorSeparator: '_',
orchestratorVersion: '2.30.3',
orchestratorVersion: '2.31.0',
configSources: [],
coreBase: path.resolve(__dirname, '..'),
disablePlugins: [],
Expand Down

0 comments on commit 981123c

Please sign in to comment.