drupallando

Two instances of the same project without sharing database data in Lando


I’m working on a Drupal project hosted on platform.sh.

I started to work locally with Lando but I messed things up a bit and I tried to create a second local Lando build for the same project to try some changes, keeping the fist project in it’s broken state.

The problem is that the second project seems to be using the same database as the first one. This might be related to caching but I don’t wand to lose local database data from the first project and I’m not sure I can safely Lando pull to get fresh database data from platform.sh for the second project.


Solution

  • TL;DR - change the name property in the .lando.yml file in your second project.

    Lando creates containers based on the name property you set up in your .lando.yml file (or .lando.upstream.yml if there's no .lando.yml file). If you created a second lando project but didnt change the name property, you end up using the same containers from the first project (which is what you're seeing). Stop lando in the second project (ie lando stop) and then change the name property in the .lando.yml file in the second project and then do lando start. Now lando should build new, separate containers for the second project based on the new name.