Lando configuration
Lando configuration
The basic Lando file for each site should contain enough for someone to run and work on the site with just a lando start
. This means it can contain stuff that is not always needed.
An example starter Lando file for a Drupal 10 site can be seen here https://gitlab.agile.coop/agile-public/lando/-/blob/master/d8/.lando.yml?ref_type=heads.
By default we include the following services:
appserver
=> The main Apache and PHP container.database
=> The MySQL / MariaDB database.mailhog
=> Mailhog for catching email.adminer
=> Adminer providing a GUI database browser.node
=> Node container for theming.
If projects include tests running JavaScript they may include a chromedriver
or other services necessary for testing the site.
Sites using Solr will have one or more solr
services.
The only services that are required to run a LAMP site are the appserver
and database
services. Although it's recommended that mailhog
is used to ensure any emails sent from the site are caught.
If you don't need / want any of the extra services, it's possible to use a Lando override file to disable services and tooling you don't need.
This can be done by creating a .lando.local.yml
file in the gitroot, ensuring this file has been git ignored. The adminer
and node
services can the be disabled with:
services:
adminer: disabled
node: disabled
Lando build steps
It's possible to install extra software into a Lando container using Build steps. This sort of thing can be hard to maintain and so, ideally, build scripts should be avoided, but sometimes it is necessary to install extra software to match the production environment.
If you need to add build scripts, please ensure there are comments to make it clear:
- Why this code is there.
- What it does.
- What would break if it wasn't there.
In some cases you may want to do more than 1 or 2 lines of build code. In these cases consider a well commented script added the a .lando
directory or consider using a custom Dockerfile.
XDebug and VSCode
If you use VSCode you'll need to add some extra config to get XDebug working.
For an example of how to get this setup, have a look at Zephyr.
Docker best practices
Docker takes up a lot of space as it caches everything. When you have lots of Lando sites setup on your computer it can use a lot of disk space and due Docker's indescrimate caching, much of this might not be needed any longer.
On Linux, if the Docker directory (\var\lib\docker
) is left on the root partition it can grow to the point where consumes all the available disk space. If not addresses this can cause Linux to crash and the only way to fix it will be to boot into a recovery shell and delete stuff to free up enough space to allow Linux to boot.
If you have a large enough disk the Docker directory can be mounted into it's own partition or it can be moved onto the \home
partition. See (Linux laptop setup)[./linux-laptop-setup.md] for more information on this.
Whatever you've done with the Docker directory, it will need regularly pruning. To clean up cached stuff run:
docker system prune --all
If this doesn't free up enough space it may be necessary to delete volumes as well.
To delete all the docker data, including volumes with databases on, and free up the most amount of space run:
docker system prune --all --volumes
Last updated: