Skip to main content

Create a Lando setup running Drupal 10.

The command you provided appears to be a Lando configuration command for initialising a new Lando environment for a Drupal 10 project. Following is a breakdown of the command and what it does:

# Initialize a new lando drupal using a vanilla Drupal 10 installation
lando init \
  --source remote \
  --remote-url https://www.drupal.org/download-latest/tar.gz \
  --remote-options="--strip-components 1" \
  --recipe drupal10 \
  --webroot web \
  --name py-ai

lando init: This is the Lando command to initialize a new Lando configuration.

--source remote: Specifies that you want to create a Lando configuration using a remote source.

--remote-url https://www.drupal.org/download-latest/tar.gz: Indicates the remote source URL from which to download the project. In this case, it's downloading the latest Drupal 10 release from drupal.org.

--remote-options="--strip-components 1": This option specifies additional options to be passed to the remote source. The --strip-components 1 option is used to remove the top-level directory when extracting the tar.gz archive, effectively extracting the Drupal files into the current directory.

--recipe drupal10: Specifies the recipe or configuration to use for the Lando environment. In this case, it's using the "drupal10" recipe, which is likely a predefined Lando configuration for Drupal 10 projects.

--webroot .: Sets the webroot directory for your Drupal installation. The . indicates the current directory, which means the Drupal files will be installed in the current directory.

--name py-ai: Assigns a name to the Lando environment. In this case, the environment is named "py-ai."

After running this lando init command, Lando will create a configuration file for your Drupal 10 environment based on the specified options. You can then proceed to use lando start to start the Lando environment and work on your Drupal project.

 

# Start the site

lando start

# Install a site local drush

lando composer require drush/drush

 

A different take

lando init \
   --source cwd \
   --recipe drupal10 \
   --webroot web \
   --name py-ai

 

# Create latest drupal10 project via composer
lando composer create-project drupal/recommended-project:10.0.x-dev@dev tmp && cp -r tmp/. . && rm -rf tmp

If the process times out, then add the following command

# Composer can timeout on install for some machines, if that happens, run the following command and then re-run the previous lando composer command:
lando composer config --global process-timeout 2000

Start it up

lando start

The lando start command is used in the context of Lando, a local development environment and DevOps tool for web developers. When you run lando start, it normally does the following:

  1. Start the Lando Environment
    If you've already configured a Lando environment for your project using a .lando.yml file, this command will start the Lando environment, making it ready for your development work.
  2. Provision Services
    Lando can define and provision services like web servers, databases, and more as specified in your project's .lando.yml configuration file. When you run lando start, it sets up and configures these services according to your project's needs.
  3. Environment Setup
    It prepares the development environment with the necessary configurations, dependencies, and settings to mimic your production environment. This can include setting environment variables, configuring web servers, and more.
  4. Start Services
    The command starts the various services (such as web servers, databases, and cache servers) required for your project to run. This is often a crucial step in the development process, as it ensures that your application can function properly during development.
  5. Display Environment Information
    Once the Lando environment is up and running, the command typically provides information about how to access your application locally, including URLs and ports.

 

Install a site local drush

lando composer require drush/drush

This is a Composer command. Composer is a dependency management tool for PHP. The composer require command is used to add a new package (in this case, Drush) to your project.
drush/drush is the package name, and it refers to the Drush project on Packagist (the default package repository for Composer).

 

Install drupal

lando drush site:install --db-url=mysql://py10:py10@database/py10 -y

--db-url=mysql://py10:py10@database/py10: This flag specifies the database connection URL. In this case, it's indicating that the Drupal site should use a MySQL database with the following details:

Username: py10
Password: py10
Database host: database
Database name: py10
-y: This is a Drush flag that indicates "yes" to any prompts, effectively automating the installation process.

It's important to note that this command is specific to a Drupal project set up within a Lando development environment. The --db-url flag should match the database configuration you have defined in your Lando configuration file (usually .lando.yml) for your Drupal project.

Before running this command, make sure you're in the root directory of your Drupal project within the Lando environment, and ensure that your Lando environment is up and running. This command will install a Drupal site using the specified database configuration.

 

List information about this app

lando info

When you run lando info, it provides information about the current Lando environment and the services configured for your project. This information is often helpful for developers to understand the state of their local development environment and how to access their web applications.

Here's what the lando info command typically provides:

  1. General Environment Information
    The name of the Lando environment.
    The project name.
    The current Lando configuration file (.lando.yml) used for the environment.
  2. Services and Ports
    A list of services defined in the Lando environment, such as web servers (e.g., Apache or Nginx), databases (e.g., MySQL, PostgreSQL), cache servers, and more.
    Information about the ports that these services are running on, which is useful for accessing your web application in a web browser.
  3. Access URLs
    URLs and access information for the web application(s) running in the Lando environment.
    This typically includes the local development URL where you can access your application in a web browser.
  4. Project Configuration
    Details about the Lando configuration specific to your project, as defined in the .lando.yml configuration file.
    Environment variables and other settings that may be important for your project.
  5. Links to Documentation
    Links to documentation and resources that can help you with using Lando and managing your local development environment.

Following is an example of this command

[ { service: 'appserver',
    urls:
     [ 'https://localhost:60716',
       'http://localhost:60717',
       'http://code-dev.lndo.site/',
       'https://code-dev.lndo.site/' ],
    type: 'php',
    healthy: true,
    via: 'apache',
    webroot: 'web',
    config: { php: '/Users/{name}/.lando/config/drupal10/php.ini' },
    version: '8.2',
    meUser: 'www-data',
    hasCerts: true,
    api: 3,
    hostnames: [ 'appserver.codedev.internal' ] },
  { service: 'database',
    urls: [],
    type: 'mysql',
    healthy: true,
    internal_connection: { host: 'database', port: '3306' },
    external_connection: { host: '127.0.0.1', port: '3325' },
    healthcheck: 'bash -c "[ -f /bitnami/mysql/.mysql_initialized ]"',
    creds: { database: 'd10', password: 'd10', user: 'd10' },
    config: { database: '/Users/{name}/.lando/config/drupal10/mysql.cnf' },
    version: '5.7',
    meUser: 'www-data',
    hasCerts: false,
    api: 3,
    hostnames: [ 'database.codedev.internal' ] },
  { service: 'phpmyadmin',
    urls: [ 'http://localhost:60715' ],
    type: 'phpmyadmin',
    healthy: true,
    backends: [ 'database' ],
    config: {},
    version: '5.1',
    meUser: 'www-data',
    hasCerts: false,
    api: 3,
    hostnames: [ 'phpmyadmin.codedev.internal' ] },
  { service: 'solr',
    urls: [],
    type: 'solr',
    healthy: true,
    core: 'lando',
    internal_connection: { host: 'solr', port: '8983' },
    external_connection: { host: '127.0.0.1', port: 'not forwarded' },
    healthcheck: 'curl http://localhost:8983/solr/lando/admin/ping',
    config: {},
    version: '7',
    meUser: 'solr',
    hasCerts: false,
    api: 3,
    hostnames: [ 'solr.codedev.internal' ] } ]

 

Related articles