Dec 10, 2020 Rebuild Lando containers. Lando rebuild -y. On a success rebuilt on Lando, it's time to install Drupal 8. Goto the local URL for your Drupal 8 website. Follow the steps in the Drupal installation Wizard. When the database page appears, use ‘drupal9‘ for the database name, username and password. Lando Setup with Drupal 9 Prerequisite for this is installation of lando in development machine are: Docker; Lando; This project also includes continuos integration of probo with drupal 9. Step 1: Clone this respository. Lando Setup with Drupal 9 Prerequisite for this is installation of lando in development machine are: Docker; Lando; This project also includes continuos integration of probo with drupal 9. Step 1: Clone this respository.
Drupal 9 Multisite setup in Lando The multisite feature in Drupal allows to effectively create and manage a fleet of websites where all the sites will share the same codebase while having separated databases, configurations, and assets. In this post, we will see how to setup a Drupal multisite setup locally using Lando with an assumption that you already have a master site setup using drupal9 recipe.Setup sites for multisite
The first thing we need to do is to configure the sites that we need. In this case, let's call the master site as the main
site and the other 2 sites which we will create are mojave
and yosemite
Step 1: Create the folders for the sites in web/sites/*
directory
web/sites/mojave
web/sites/yosemite
Step 2: Copy the default.settings.php
from web/sites/default
to the multisite directories as settings.php
Step 3: Copy the default.sites.php
to sites.php
and add entries for each of the multisite to make the main site aware of the sites.
Add db services to Lando file
Body outline drawing. Now that our files are setup, we will need databases for each of the sites. This will be handled via Lando by update the .lando.yml
file to add each database as new services.
Drupal 9.1.5. Note: We don't need to add the database service for the main site since it will use the default database
service.
Add proxy for site domain
Lando uses Traefix as a reverse proxy to make the routing and have clean URLs to point various ports inside of various services. So, by default if the app name is set to drupal
, we will get a nice URL like http://drupal.lndo.site
.
Now, to add the URLs for the other two sites we need update the .lando.yml file to make an proxy entry for each sites. Alternatively, you can update the default URL for the main site as well.
Note: The proxy URL must match the domain entered in the sites.php file.
Install the sites via UI
Now that the multisites are configured, we can start installing Drupal on each of the site. Below is the table to map the domain and database credentials for each site.
Site | URL | DB Username | DB Password | DB Name |
---|---|---|---|---|
Main | http://main.lndo.site | drupal | drupal | main |
Mojave | http://mojave.lndo.site | drupal | drupal | mojave |
Yosemite | http://yosemite.lndo.site | drupal | drupal | yosemite |
Lando Drupal 9 Full
If, the files directory is not created automatically then you will need to create one for each site and give the appropiate permissions for the directory.
Install the sites via Drush Aliases
Although, the sites are accesible via UI and browser, Drush access and setup is also important for development and deployment purposes. For this, we will need to setup the Drush aliases for each site so that we can access the sites right from the terminal.
Setup Drush aliases
To setup the Drush aliases, create a *.sites.yml
file in the PROJECTROOT/drush/sites/
directory. In our case, we will create a file called drupal.sites.yml
with the following content.
Once, this is is setup you can access the sites using Drush aliases. To check the aliases list run lando drush sa
whcih should give Jims uke songbook.
So, to access the 'mojave' site you can run lando drush @drupal.mojave status
Site Installation
Now, that the Drush aliases are setup we can install the sites using the Drush site-install
command and passing the sites directory name as the option.
Verify site settings & configuration
Once, the sites are installed & setup we can verify if the configurations and data is isolated for each site. To check enable different themes for each site, enable different modules and/or create few dummy contents for each site. You will notice that each of the sites configurations are not isolated. However, we would also like to use Drupal Configuration management for each site but that can be a separate post by itself.
Tl;dr
To add a new multisite
- Create a new directory under
web/sites
by the name of the site - Copy the
default.settings.php
fromweb/sites/default
to the multisite directories assettings.php
- Update
sites.php
to make an entry for the new site. - Add a new service to Lando file for the new site database
- Add a new proxy for the new site in the Lando file
- Run lando rebuild to create a the new database and update proxy
- Add new entry in the
*.sites.yml
for Drush alias - Install the site either by UI or using Drush alias.
malabya
Sat, 05/01/2021 – 20:30
Go to Source
Author:
This is part of our Drupal Installation Guide.
Setting up an environment for developing with Drupal 9 in Windows can be a challenge. We recommend two options for those who need access to the codebase (required for Theme and Module Development trainings).
Jump to a Drupal 9 Installation Method (Windows Only):
Method 1: AMPPS
Method 2: Docksal/Lando
Method 1: AMPPS
This method is simpler to install, and has little base requirements. If you already have Acquia Dev Desktop, make sure you turn it off before installing AMPPS.
1. Download and run the installer: http://www.ampps.com/downloads
2. Installation doesn't require any changes to default options. You may choose to install in the root folder (i.e. c:Ampps) so it's easier to navigate in command-line.
3. When finished, you can go ahead and add a new App of type Drupal. Make sure you select 9 (should be the default version). You can fill in user credentials and click to install. Verify you have a working Drupal 9 site.
Setting up command line utilities with AMPPS
Although AMPPS is easy to install and setup a Drupal codebase, it doesn't come with out-of-the-box command line utilities. But we can easily add them:
1. Open Start Menu and type 'Environment.' You should see an entry for editing System Environment variables.
Lando Drupal 9 Database
2. Click on Environment Variables. Find a variable under 'User variables for [username]' called 'Path' and click 'Edit..'
3. Under the next screen, add this line on your Path variable (if you installed Ampps in a different folder, change this to the right one): 'C:Program FilesAmppsphp'.
4. This step will allow you to run any binaries present in that folder, the most important being 'php'. Now open a new CMD prompt and type the following to install Composer.
5. Test this by running 'composer' command, which should give you Composer's help page.
6. Next, type the following commands in the same prompt, to install Drush Launcher:
7. You can test by running 'drush' command, which should return a message saying Drush Launcher didn't find a Drupal installation. Drush needs to be installed using composer in each project:
8. Run 'drush status' and confirm it is working. You should have a fully functional Development Environment with Drupal 9.
Make sure you have a good code editor such as Notepad++, Atom, or Visual Studio Code (all free to use).
Method 2: Docksal/Lando
Docksal and Lando are two similar utilities that are more difficult to install but provide a more stable and flexible environment. They operate on top of a virtualized Linux container, powered by Docker. You must have virtualization enabled in the BIOS and WSL activated on your Windows, hence this method is considered more advanced, but once you set it up you have a better environment for working in projects.
1. Install Docker Desktop for Windows: https://docs.docker.com/docker-for-windows/install/
2. Install Lando or Docksal.
Note: Docksal has an alternative installation method using VirtualBox instead of Docker, which you can read about in the link above.
Note 2: Another popular solution for Windows you can read about and try is DrupalVM: https://www.drupalvm.com/ (Advanced)