Skip to content

Commit

Permalink
Merge branch 'main' into sql-import-drop
Browse files Browse the repository at this point in the history
  • Loading branch information
reynoldsalec authored May 9, 2024
2 parents 9e8a7f3 + 4b72dad commit d01f8a9
Show file tree
Hide file tree
Showing 21 changed files with 250 additions and 49 deletions.
25 changes: 24 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
## Unreleased
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})

## v3.21.0-beta.19 - [May 9, 2024](https://github.com/lando/core/releases/tag/v3.21.0-beta.19)

### New Features

* Added ability to autostart Docker Desktop for Windows from within WSL instances [#164](https://github.com/lando/core/pull/164)
* Improved method for locating and starting Docker Desktop on Windows [#164](https://github.com/lando/core/pull/164)
* Updated default Docker Compose version to `2.27.0`
* Updated default Docker Desktop version to `4.30.0`
* Updated default Docker Engine version to `26.1.1`
* Updated tested Docker Desktop range to `<=4.30`
* Updated tested Docker Engine range to `<27`
* Updated `sql-export.sh` to use `mariadb-dump` command (if available). [#148](https://github.com/lando/core/pull/148)
* Added `leia` tests for `sql-import.sh` and `sql-export.sh`

### Bug Fixes

* Fixed bug that caused Lando to be too impatient when starting Docker Desktop [#164](https://github.com/lando/core/pull/164)
* Fixed unclear error when cancelling certain prompts

### Internal

* Added `buildkit` as an alias for `buildx` in `l337` service `image` key
* Changed `download-x` to prefer `ipv4` [#165](https://github.com/lando/core/pull/165)
* Changed `rebuild` to `kill` instead of `stop`
* Improved error handling on `download-x` [#165](https://github.com/lando/core/pull/165)

## v3.21.0-beta.18 - [April 29, 2024](https://github.com/lando/core/releases/tag/v3.21.0-beta.18)

* Fixed bug that prevented password prompts from rendering
Expand Down
10 changes: 5 additions & 5 deletions components/l337-v4.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class L337ServiceV4 extends EventEmitter {
// set top level required stuff
this.id = id;
this.appRoot = appRoot;
this.buildx = true;
this.buildkit = true;
this.config = config;
this.context = context;
this.debug = debug;
Expand Down Expand Up @@ -208,8 +208,8 @@ class L337ServiceV4 extends EventEmitter {
// if we have a custom tag then set that
if (data.tag) this.tag = data.tag;

// finally make sure we honor buildx disabling
if (require('../utils/is-disabled')(data.buildx ?? this.buildx)) this.buildx = false;
// finally make sure we honor buildkit disabling
if (require('../utils/is-disabled')((data.buildkit || data.buildx) ?? this.buildkit)) this.buildkit = false;
}

// just pushes the compose data directly into our thing
Expand Down Expand Up @@ -467,7 +467,7 @@ class L337ServiceV4 extends EventEmitter {
this.sshKeys = [...new Set(this.sshKeys.concat(keys))];
}

// add/merge in ssh stuff for buildx
// add/merge in ssh stuff for buildkit
addSSH(ssh) {
// if ssh is explicitly true then that implies agent true and keys true
if (ssh === true) ssh = {agent: true, keys: true};
Expand Down Expand Up @@ -499,7 +499,7 @@ class L337ServiceV4 extends EventEmitter {
// set state
this.state = {IMAGE: 'BUILDING'};
// run with the appropriate builder
const success = this.buildx ? await bengine.buildx(imagefile, context) : await bengine.build(imagefile, context);
const success = this.buildkit ? await bengine.buildx(imagefile, context) : await bengine.build(imagefile, context); // eslint-disable-line max-len
// augment the success info
success.context = {imagefile, ...context};
// add the final compose data with the updated image tag on success
Expand Down
6 changes: 3 additions & 3 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ dockerSupportedVersions:
compose:
satisfies: "1.x.x || 2.x.x"
recommendUpdate: "<=2.24.6"
tested: "<=2.26.1"
tested: "<=2.27.0"
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.29.0"
tested: "<=4.30.0"
recommendUpdate: "<=4.28.0"
link:
darwin: https://docs.docker.com/desktop/install/mac-install/
win32: https://docs.docker.com/desktop/install/windows-install/
engine:
satisfies: ">=18 <27"
tested: "<=26.0.0"
tested: "<=26.1.1"
link:
linux: https://docs.docker.com/engine/install/debian/#install-using-the-convenience-script

Expand Down
8 changes: 4 additions & 4 deletions docs/lando-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Generally you will want to use a more specific service like `type: php` but this
* Using Docker Compose config from other projects
* Need a service not currently provided by Lando itself

It implements a super-set of the [Docker Compose Version 3 Spec](https://docs.docker.com/compose/compose-file/compose-file-v3/) and _usually_ requires some [slight tweaks](#caveats) of existing Docker Compose configuration to work correctly.
It implements a super-set of the [Docker Compose Version 3 Spec](https://docs.docker.com/compose/compose-file/) and _usually_ requires some [slight tweaks](#caveats) of existing Docker Compose configuration to work correctly.

Here is a birds-eye view of all its options:

Expand All @@ -27,7 +27,7 @@ services:
type: lando

# these directly map to docker compose things
# see: https://docs.docker.com/compose/compose-file/compose-file-v3/
# see: https://docs.docker.com/compose/compose-file/
# note that these are only available if you invoke the service directly
services: {}
networks: {}
Expand All @@ -51,7 +51,7 @@ services:
## Services, Networks, Volumes
These three: `services,` `networks` and `volumes` map directly to the [Docker Compose Version 3 Spec](https://docs.docker.com/compose/compose-file/compose-file-v3/) which means that the below is a valid Landofile:
These three: `services,` `networks` and `volumes` map directly to the [Docker Compose Version 3 Spec](https://docs.docker.com/compose/compose-file/) which means that the below is a valid Landofile:

**Landofile**
```yaml
Expand Down Expand Up @@ -351,7 +351,7 @@ Since [Lando 3.14.0](https://github.com/lando/lando/releases/tag/v3.14.0) servic

## Overrides

Lando services are just an abstraction layer on top of the [Docker compose v3 file format](https://docs.docker.com/compose/compose-file/compose-file-v3/). What this means is that behind the scenes your Landofile is being translated into a *SHLOAD* of *SUPERNASTY* looking `docker-compose` files which are then being used to power your app.
Lando services are just an abstraction layer on top of the [Docker compose v3 file format](https://docs.docker.com/compose/compose-file/). What this means is that behind the scenes your Landofile is being translated into a *SHLOAD* of *SUPERNASTY* looking `docker-compose` files which are then being used to power your app.

We give you access to the Docker Compose layer with the `overrides` key.

Expand Down
12 changes: 6 additions & 6 deletions docs/services/l337.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The `l337` service is the lowest level `api: 4` service and it implements **L**a

In high level terms it combines _service orchestration_ and _image specification_ into a single file format.

Specifically, it is a light superset around the [Docker Compose Version 3](https://docs.docker.com/compose/compose-file/compose-file-v3/) format that also uses the [Dockerfile](https://docs.docker.com/engine/reference/builder/) specification.
Specifically, it is a light superset around the [Docker Compose Version 3](https://docs.docker.com/compose/compose-file/) format that also uses the [Dockerfile](https://docs.docker.com/engine/reference/builder/) specification.

This means that you _should_ be able to paste Docker Compose and/or Dockerfile compatible contents into your Landofile, add `api: 4` to each service and have it "just work".

Expand Down Expand Up @@ -103,7 +103,7 @@ services:
image:
imagefile: "nginx:1.21"
tag: "pirog/nginx:1.21"
buildx: true
buildkit: true
ssh: false
args:
vibe: rising
Expand Down Expand Up @@ -194,7 +194,7 @@ services:

Array formatted `key=value` pairs are trimmed in both `key` and `value`. Args with no `value` are ignored as in `something` above.

### Buildx
### Buildkit

If _for some reason_ you prefer to use the old pre-BuildKit image builder you can toggle this to `false`.

Expand All @@ -205,13 +205,13 @@ services:
# use the legacy builder
example-1:
api: 4
buildx: false
buildkit: false
type: l337
image:
imagefile: nginx:1.21
```

Note that if you do `buildx: false` some image build features, specifically those in [Dockerfile 1.1.0+](https://docs.docker.com/build/dockerfile/release-notes/#110) and the [ssh](#ssh) features of this service, may not be available.
Note that if you do `buildkit: false` some image build features, specifically those in [Dockerfile 1.1.0+](https://docs.docker.com/build/dockerfile/release-notes/#110) and the [ssh](#ssh) features of this service, may not be available. You can also use `buildx` as an alias for `buildkit`. If you use both it will evaluate to `true` if either is `true`. Really just don't use both ;)!

You probably should just ignore this setting unless you have a well understood reason to do otherwise.

Expand Down Expand Up @@ -430,7 +430,7 @@ lando rebuild
Here are some additional notes on this feature:

* Passphrase protected keys can be used but only if added to your host `ssh-agent` _before_ image build
* This feature is not available if you set `buildx: false`
* This feature is not available if you set `buildkit: false`
* The keys/agent are only available when explicitly mounted in a `RUN` instruction they **DO NOT** end up in the resulting image

### Steps
Expand Down
45 changes: 45 additions & 0 deletions examples/l337/.lando.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,51 @@ services:
owner: "nginx:nginx"
permissions: "775"

# buildkit features
buildkit:
api: 4
type: l337
image:
buildkit: true
ssh: true
imagefile: |
# syntax=docker/dockerfile:1.7
ARG VERSION=bookworm
FROM alpine AS build-env
WORKDIR /app
RUN touch /app/me
FROM debian:$VERSION
ARG VERSION
RUN echo $VERSION > image_version
RUN <<EOF
apt-get update
apt-get install -y curl git
EOF
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
RUN --mount=type=ssh,id=keys git clone [email protected]:lando/lando.git /tmp/lando
RUN --mount=type=ssh,id=agent git clone [email protected]:lando/lando.git /tmp/more-lando
# these are not universally supported yet
# ADD --keep-git-dir=true https://github.com/moby/buildkit.git#v0.10.1 /buildkit
# ADD --checksum=sha256:24454f830cdb571e2c4ad15481119c43b3cafd48dd869a9b2945d1036d1dc68d https://mirrors.edge.kernel.org/pub/linux/kernel/Historic/linux-0.01.tar.gz /tmp
COPY * /tmp
COPY --from=build-env /app /app2
COPY --chown=55:mygroup file* /tmp/files
COPY --chown=bin file* /tmp/files2
COPY --chown=1 file* /tmp/files3
COPY --chown=10:11 file* /tmp/files3
COPY --chown=myuser:mygroup --chmod=644 file* /tmp/files4
CMD sleep infinity
context:
- source: "file1"
destination: "/file7"
owner: "nginx:nginx"
permissions: "775"

# build-arg features
build-args-1:
api: 4
Expand Down
21 changes: 16 additions & 5 deletions hooks/lando-autostart-engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ module.exports = async lando => {
const debug = require('../utils/debug-shim')(lando.log);
const tasks = [{
title: 'It seems Docker is not running, trying to start it up...',
retry: 25,
delay: 1000,
retry: {
tries: 25,
delay: 1000,
},
task: async (ctx, task) => {
// prompt for password if interactive and we dont have it
if (process.platform === 'linux' && lando.config.isInteractive) {
// Prompt for sudo password if interactive and not Docker Desktop WSL2 integration
if (
process.platform === 'linux'
&& lando.config.isInteractive
&& !require('../utils/is-wsl-interop')(lando.engine.daemon.docker)
) {
ctx.password = await task.prompt({
type: 'password',
name: 'password',
Expand All @@ -38,6 +44,11 @@ module.exports = async lando => {
}
},
}];
await lando.runTasks(tasks, {listrOptions: {exitOnError: true}});
await lando.runTasks(tasks, {
listrOptions: {exitOnError: true},
rendererOptions: {
pausedTimer: {condition: false},
},
});
}
};
1 change: 1 addition & 0 deletions hooks/lando-setup-build-engine-darwin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const semver = require('semver');
const {color} = require('listr2');

const buildIds = {
'4.30.0': '149282',
'4.29.0': '145265',
'4.28.0': '139021',
'4.27.2': '137060',
Expand Down
1 change: 1 addition & 0 deletions hooks/lando-setup-build-engine-win32.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {color} = require('listr2');
const {nanoid} = require('nanoid');

const buildIds = {
'4.30.0': '149282',
'4.29.0': '145265',
'4.28.0': '139021',
'4.27.2': '137060',
Expand Down
7 changes: 4 additions & 3 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ module.exports = class App {
*/
.then(() => this.events.emit('pre-rebuild'))
// Stop app.
.then(() => this.stop())
.then(() => this.stop(true))
// Uninstall app
.then(() => this.uninstall())
// Repull/build components.
Expand Down Expand Up @@ -526,9 +526,10 @@ module.exports = class App {
* @alias app.stop
* @fires pre_stop
* @fires post_stop
* @param {Boolean} kill - Kill instead of stop
* @return {Promise} A Promise.
*/
stop() {
stop(kill = false) {
// Stop it!
this.log.info('stopping app...');
return initAndReport(this, 'stop')
Expand All @@ -543,7 +544,7 @@ module.exports = class App {
.then(() => this.events.emit('pre-stop'))

// Stop components.
.then(() => this.engine.stop(this))
.then(() => this.engine.stop({...this, kill}))

/**
* Event that runs after an app stop.
Expand Down
7 changes: 6 additions & 1 deletion lib/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ exports.build = (compose, project, opts = {}) => {
*/
exports.getId = (compose, project, opts = {}) => buildShell('ps', project, compose, opts);

/*
* Run docker compose kill
*/
exports.kill = (compose, project, opts = {}) => buildShell('kill', project, compose, opts);

/*
* Run docker compose logs
*/
Expand Down Expand Up @@ -124,6 +129,6 @@ exports.run = (compose, project, opts = {}) => buildShell('exec', project, compo
exports.start = (compose, project, opts = {}) => buildShell('up', project, compose, opts);

/*
* Run docker compose kill
* Run docker compose stop
*/
exports.stop = (compose, project, opts = {}) => buildShell('stop', project, compose, opts);
Loading

0 comments on commit d01f8a9

Please sign in to comment.