The local development problem
Website development tools have come a long way over the past decade and if you are just getting started you can feel lost pretty quickly. To do something simple like spinning up a CMS and installing a few plugins comes with a handful or pre-requisites that may be out of your skill set and more suited for someone in devops. What tools do I need to use? Do I need a server? OMG I need to install linux, apache, mysql, and php? ... Sound familiar?
If you are like me you may have installed a LAMP (Linux Apache MySQL PHP) stack manually, or used a tool such as MAMP / XAMPP, to get stated. This sort of configuration can really clutter up your local machine and make it difficult when switching between projects that have different requirements. It also makes collaboration between yourself and other developers a bit more difficult. Surely you have heard the phrase "Well it works on my machine!".
Dare I say, never again!
What Lando does to solve this problem
Lando (opens new window) is a command line tool that simplifies the process of creating local development environments. Lando takes advantage of Docker to create re-usable containers where you services live, rather than having to install / configure each service on your local machine.
This sort of setup compartmentalizes your configuration and allows you to build a powerful network of services that more closely resemble production environments. Your local machine stays organized and you can focus on mastering your craft without all the fuss.
Getting started with Lando recipes
Docker? Is this really going to be less complicated? You bet! Lando makes the process of a scaffolding a development environment as easy as calling a single function from the terminal, or if you want a bit more control, populating a single configuration file with your desired settings.
Scaffold your development environment
Once you have met the prerequisites for running Lando you can scaffold an environment from a Lando recipe by calling the following function:
# Initialize Lando
lando init
# Follow the Prompts to select your recipe and configure the environment.
This provides you with a few popular boilerplate environments to choose from such as WordPress, Drupal, LAMP and others. This command essentially pre-populates a .lando.yml with the necessary defaults and tells Lando which Docker containers are needed to run the project.
Start your development environment
Now that your environment has been configured you can start all necessary containers by running the following function:
# Start Lando Containers
lando start
Boomshakalaka! Once running you will be provided with your local development url to start development.
Configure your project
As is customary with all CMS’s you will need to go through the installation process by visiting the url. All of the necessary database configuration information can be retrieved by running:
# Locate database connection information
lando info
Configure your CMS as needed to complete your installation and now you are up and running. Time to start coding! Pretty easy huh? 😃
Advanced Configuration
Lando offers a lot of flexibility with more advanced configurations that should suit most development needs. Below is a list of some of the additional features:
- XDebug
- Redis
- Memcache
- Varnish
- Localtunnel
- Mailhog
- Solr
Hopefully this article helps to simplify your development efforts. To learn more about Lando and how to use it for your local development workflow check out the documentation (opens new window) for more information.