Lando - Two sites one configuration | Drupal 8

By kenneth, Fri, 08/23/2019 - 10:29

Authored on

Image
london

There are different ways to configure your local environment. Then you should use the option is more suitable for you, of course. Lately I’ve been working using lando in order to build all my local environments. I really love how they expose their main idea about lando:


The main idea behind Lando is a user should be able to clone a repository, run a single command and get everything they need to work on their site locally in a few minutes.https://lando.dev 

I faced different complex local configuration, where I need some extra containers and thankfully Lando provides you great documentation where you can check in order to configurare as you need to
https://docs.lando.dev/config/lando.html


Probably you already know that and you’re reading this because the article's title says that we can configure two sites in a single configuration or lando file to be precise, don’t you? Well yes!

It turns out this current site I have it locally configured by using lando. Back on Jun 23, 2019 I deployed the new looks and feel of this site: https://twitter.com/keboca/status/1142965574881959942


It used to be so different than what it looks right now:

keboca-legacy

The main challenge to me, actually I am still struggling with that until now. I haven’t migrate all features to the new site. Basically because I chose to rebuild my old site to a new Drupal 8 instance instead. Then sometimes I need to jump into my own legacy site and do some stuff.


Then I thought I could have both sites locally into a single lando file configuration by using Lando proxy: https://docs.lando.dev/config/proxy.html#usage
The I moved ahead and configure a new service and expose into lando, now I can run both sites locally into a single configuration.

Check how my ".local.yml" file looks like:

############$ cat .lando.yml 
name: keboca
recipe: drupal8
proxy:
  legacy:
    - legacy-keboca.lndo.site
services:
  legacy:
    type: php:7.1
    via: apache:2.4
    webroot: legacy
  node:
    type: node:latest
config:
  webroot: www
  drush: global:8.1.12
tooling:
  npm:
    service: node

Both sites running together:

both-keboca-sites


That said, I hope it helps you at some point somehow!
Happy coding!
 

Comments

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.