diff --git a/.gitignore b/.gitignore index 91b9cfece..31677f555 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ coverage/ # lando .lando/id +checksums.txt plugins/* !plugins/.gitkeep FATCORE diff --git a/CHANGELOG.md b/CHANGELOG.md index ff78d2c1f..fbb63df89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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` @@ -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 diff --git a/builders/_lando.js b/builders/_lando.js index f8d17e9a7..f9810f78a 100644 --- a/builders/_lando.js +++ b/builders/_lando.js @@ -45,7 +45,7 @@ module.exports = { refreshCerts = false, remoteFiles = {}, scripts = [], - scriptsDir = '', + scriptsDir = false, sport = '443', ssl = false, sslExpose = true, @@ -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'); @@ -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 = { diff --git a/checksums.txt b/checksums.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/config.yml b/config.yml index abbb1be3b..9d25a6bac 100644 --- a/config.yml +++ b/config.yml @@ -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 diff --git a/examples/setup-macos/README.md b/examples/setup-macos/README.md index 894e5a066..320a09faf 100644 --- a/examples/setup-macos/README.md +++ b/examples/setup-macos/README.md @@ -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 +``` diff --git a/hooks/lando-setup-build-engine-darwin.js b/hooks/lando-setup-build-engine-darwin.js index e416e6a81..6e1c0d256 100644 --- a/hooks/lando-setup-build-engine-darwin.js +++ b/hooks/lando-setup-build-engine-darwin.js @@ -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', diff --git a/hooks/lando-setup-build-engine-linux.js b/hooks/lando-setup-build-engine-linux.js index 670ed5478..8086b0ddb 100644 --- a/hooks/lando-setup-build-engine-linux.js +++ b/hooks/lando-setup-build-engine-linux.js @@ -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 diff --git a/hooks/lando-setup-build-engine-win32.js b/hooks/lando-setup-build-engine-win32.js index 710e8a458..18f73078a 100644 --- a/hooks/lando-setup-build-engine-win32.js +++ b/hooks/lando-setup-build-engine-win32.js @@ -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', diff --git a/hooks/lando-setup-build-engine-wsl.js b/hooks/lando-setup-build-engine-wsl.js index 9b6882ef0..bdc85b59d 100644 --- a/hooks/lando-setup-build-engine-wsl.js +++ b/hooks/lando-setup-build-engine-wsl.js @@ -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', diff --git a/hooks/lando-setup-orchestrator.js b/hooks/lando-setup-orchestrator.js index 7d6144780..d01dc7735 100644 --- a/hooks/lando-setup-orchestrator.js +++ b/hooks/lando-setup-orchestrator.js @@ -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}`; @@ -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': diff --git a/lib/daemon.js b/lib/daemon.js index b877960ea..938beff03 100644 --- a/lib/daemon.js +++ b/lib/daemon.js @@ -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'); @@ -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; @@ -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 @@ -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 @@ -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() { diff --git a/release-aliases/3-STABLE b/release-aliases/3-STABLE index ca6ec96f5..27a6879bb 100644 --- a/release-aliases/3-STABLE +++ b/release-aliases/3-STABLE @@ -1 +1 @@ -v3.23.23 +v3.23.24 diff --git a/scripts/install-docker-desktop.sh b/scripts/install-docker-desktop.sh index 50fcb2dd7..80440abbf 100755 --- a/scripts/install-docker-desktop.sh +++ b/scripts/install-docker-desktop.sh @@ -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" diff --git a/scripts/install-docker-engine.sh b/scripts/install-docker-engine.sh index f94aaad47..3aa19f69b 100755 --- a/scripts/install-docker-engine.sh +++ b/scripts/install-docker-engine.sh @@ -3,7 +3,7 @@ set -eo pipefail DEBUG=0 INSTALLER="get-docker.sh" -VERSION="27.3.1" +VERSION="27.5.0" OPTS= debug() { diff --git a/utils/get-compose-x.js b/utils/get-compose-x.js index 5a37f2756..ace77eda6 100644 --- a/utils/get-compose-x.js +++ b/utils/get-compose-x.js @@ -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': diff --git a/utils/get-config-defaults.js b/utils/get-config-defaults.js index e595e188d..99915172c 100644 --- a/utils/get-config-defaults.js +++ b/utils/get-config-defaults.js @@ -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: [],