I already told you about Lando a while ago… it was more of a cry from the heart to have found a simple solution to use Docker technology.
As I explained in my previous article, Lando is an overlay that makes it easy to use Docker Technology.
To put it simply, you have to see Docker as a modular tool where each brick is the component of your web server.
So you will need for example, to run a WordPress locally an Apache brick, a PHP brick and a Mariadb or Mysql brick.
Among these different bricks, there are different versions. For example PHP7.0 / PHP7.3 .
To develop soundly and avoid unpleasant surprises during production, it can be interesting to use during our developments the same software versions as those used by the server that will host the website in the end. In this way we reduce the risks of conflicts and errors.
Docker’s goal is to provide these different bricks and make them work together… except that…
Except that, as I said in my previous article, you have to set all this up… and have sysadmin knowledge that we don’t all have… fortunately Lando has arrived…
The hardest part of installing Lando is actually installing Docker which is quite simple if you are free like me, i.e. on a Linux distribution. It’s a bit more complicated if you’re trapped in a private system such as Windows or Mac OS. (For once we have something simpler under Ubuntu Linux… )
In short, Docker runs natively under Linux, you’ll have to add a virtual machine to install Docker on Windows or Mac OS.
Once Docker is installed, go to Lando’s website to install the overlay that will set all this to music.
I told you earlier that Lando was ignoring the complexity of Docker’s parameterization.
All the configuration of your development server will fit in a text file.
Let’s imagine that we want to create a WordPress site with the url https://mon-super-site.lndo.site.
Just create a folder on your machine where you have the write access and that you would name with the name you want: my-super-site.
In this folder we will add a .lando.yml file that will contain all the configuration of the server of our site:
That’s it, that’s all! Lando is ready to go! And you’re ready to develop!
Let’s decorate the .lando.yml:
- Line 1: A name for your development environment. This name will be used to build the url of your project.
- Line 2: “Recipe” means recipe in English. Lando has developed preconfigurations according to what you will do with it. Here is a WordPress recipe, it will install wp-cli. There are some for Pantheon, Drupal and more => Lando Recipe
- Line 3: a config block where you can specify your software versions
- Line 7: a Service block where we will list the services we want to see working. here PhpMyadmin and Mailhog
- Line 16: Composing is still practical when working in the PHP world.
- Line 19: This block is optional if you are working on a simple domain. It can be very useful when working on a Multisite WordPress subdomain for example.
- Line 22: maybe the nicest part… do some tasks just after importing a database… here we do via wp-cli a search & replace to adapt the urls and we disable the excellent WordPress WP-Rocket extension because the cache in dev… how to say 😉
This .lando.yml is quite simple and there is a multitude of other configurations and possibilities to best fit your needs.
Note that Lando is oriented for development and is strongly discouraged by its developers for a production
To run Lando for the first time, you have to do a `lando rebuild –y’.
At this point, it will create and download what it needs. This step can be long depending on your web connection but it will only be done once…
Then for the next launches a `lando start` in your terminal in your working directory will be enough.
Attention the WordPress recipe prepares lando technically to receive WordPress but does not install WordPress. You will perform this installation step as you are used to or by using my wp-cli method.
I use Local By Flywheel… it’s the same thing!
Hummm each solution has its advantages and disadvantages. When I decided to test and finally adopt Lando, Local By Flywheel was not available under Linux. This is no longer the case since the summer of 2019.
I (too) quickly tested Local By Flywheel and I couldn’t get a WP to work :-/ (note it too much).
The only thing Flywheel brings for my case is a GUI (Graphical User Interface) whereas Lando… it’s command-line… but sincerely to make lando start or `lando rebuild –y`? install an interface that will necessarily use machine resources… I didn’t see the point.