Thumbnail

Easy setup local dev with Lando and Platform.sh

Bien Vu

|

Lando is a Docker-based local development environment that grew out of Kalabox, a VirtualBox-based local dev tool for Drupal. Lando is much more flexible and lighter-weight than a virtual machine-based solution, and has direct support for a variety of systems including Drupal, Laravel, Backdrop, and WordPress.

There are numerous ways to put up a new Drupal or WordPress website locally to help with development, including using Xampp, Mamp, or Apache.
However, setting up and running the website locally for development will take some time and include numerous processes.

Fortunately, we currently have a program that can assist us in creating a simple configuration. We only need to follow a few command lines, and the tool will take care of the rest.

We must set up and adhere to each of the stages below in order to make it easy:

  • Install requires software
  • GET code From the Platform to your local
  • Setup site on local by Lando

 

Install requires software

1, Platform

Install Platform CLI

curl -fsS https://platform.sh/cli/installer | php

Test Platform:

platform

Once done, it will ask you for a login and you can see all login info below.

Platform CLI

 

2, Install Lando and Docker Desktop.

Install DMG via direct download (recommended)

  1. Download the latest .dmg package from GitHubopen in new window
  2. Mount the DMG by double-clicking it
  3. Double-click on the LandoInstaller.pkg
  4. Go through the setup workflow
  5. Enter your username and password when prompted

Install via HomeBrew on Mac

  1. Ensure homebrew is installed and up-to-date.
  2. Add the lando cask:
     brew install --cask lando

Install via CLI on Ubuntu

Make sure you have wget installed.

wget https://files.lando.dev/installer/lando-x64-stable.deb
sudo dpkg -i lando-x64-stable.deb

More information you can see here: https://docs.lando.dev/getting-started/installation.html

 

GET code From the Platform to your local

Get code from Platform:
There are 2 ways to pull code from Platform.sh are by git or Platform CLI (Make sure you have go to project you want to work.)

CLIGit

It will take a little time to get all code from the Platform to your local.

 

Setup site on local by Lando

The First step: Install the required packages.

You need to run composer to download all files we need to run the command to download all code require from the composer.json file.

lando composer install

Lando composer install

and take a cup of coffee to wait for it done.

 

The second step: Setup Lando on local

Setup Lando to run on local by command below:

lando start

Once done it will provide us the information to access the site on local like below:

Lando Start

 

The Third Step: Sync data from Platform to your local.

We need to define the env variable on Drush/sites/self.site.yml file like below:


prod define


Once done we can easy to get the database and file from Prod to the local by following step by step the command below:

lando drush --yes sql:drop
lando drush --yes sql-sync @prod @self
lando drush --yes rsync @prod:sites/default/files/ @self:sites/default/files
lando drush cr

when everything is finished, the website will run and we can develop on the local.

 
website run

We also can set up Lando with other platforms like Pantheon, Acquia...
 

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Comments

  • Allowed HTML tags: <em> <strong> <cite> <blockquote cite> <ul type> <ol start type> <li> <dl> <dt> <dd> <p>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
  • Use [gist:#####] where ##### is your gist number to embed the gist
    You may also include a specific file within a multi-file gist with [gist:####:my_file].

Spread the word