Local Development
Before You Begin
The example local environment configurations outlined below are based on Lando. To install Lando, follow the Lando installation instructions.
Depending on your role, you may only need a local backend environment, or you may instead prefer a local environment that can run both the backend and frontend. The following sections outline the steps to set up a local environment for each of these use cases.
Backend Only Setup
If you are creating a local environment for your Drupal backend only, you can use the default Pantheon recipe provided by Lando. For more information, see the Getting Started section of the Lando Pantheon Plugin documentation.
Combined Frontend and Backend Setup
- Create
.lando.ymlin the root of the project. - Copy the following config into
.lando.yml
name: %SITE_NAME%
recipe: pantheon
config:
framework: drupal9
site: %SITE_NAME%
id: %PANTHEON_SITE_ID%
proxy:
frontend:
- %SITE_NAME%-fe.lndo.site:%PORT-NUMBER%
excludes:
- frontend/node_modules
- node_modules
services:
frontend:
type: node:16
globals:
npm: latest
build:
- "npm install --prefix ./frontend"
port: %PORT-NUMBER%
ssl: true
scanner: false
tooling:
node:
service: frontend
npm:
service: frontend
cmd:
- "npm --prefix ./frontend"
yarn:
service: frontend
cmd:
- "yarn --cwd=/app/frontend"
Note: Replace %SITE-NAME%, %PANTHEON_SITE_ID%, and %PORT-NUMBER%, with
site name, site id and required port number for the frontend site.
- Clone the frontend code base into the
./frontenddirectory. You will most likely want to add this directory to your.gitignorefile for the project.cd frontend
git clone [email protected]:pantheon-systems/example-fe-site.git . - Consult
.env.exampleto create the required environment variables files for your frontend site. - Run
lando startto start the containers. - Install the Drupal site and select profiles like: pantheon_decoupled_umami_demo & pantheon_decoupled_profile.
- To start your frontend site, run
lando npm run develop. It will now be available at the URL specified in theproxysection of the.lando.ymlfile.