### Lando Setup Example: Skip Common Plugins and Run Non-interactively Source: https://github.com/lando/core/blob/main/docs/cli/setup.md This example demonstrates how to skip common Lando plugins, explicitly include the PHP and MySQL plugins, and run the setup process without user prompts. ```sh lando setup --skip-common-plugins --plugin @lando/php --plugin @lando/mysql --yes ``` -------------------------------- ### Start Lando Application Source: https://github.com/lando/core/blob/main/examples/lando-101/README.md Commands to set up and start a new Lando application for the Lando 101 example. Ensures a clean environment before starting. ```bash # Should poweroff lando poweroff # Should start up successfully mkdir -p lando-101 cd lando-101 cp ../.lando.yml .lando.yml echo "" > index.php lando start ``` -------------------------------- ### Initialize Project from Pantheon Interactively Source: https://github.com/lando/core/blob/main/docs/cli/init.md Starts an interactive setup process for a Pantheon site. This command assumes the 'pantheon' source is available and will prompt for further details. ```sh # Interactively pull a site from pantheon lando init --source pantheon ``` -------------------------------- ### Initialize Lando Project Interactively Source: https://github.com/lando/core/blob/main/docs/cli/init.md Use this command to start an interactive setup process for a new Lando project. It will guide you through the necessary configuration steps. ```sh # Interactively instantiate your code for use with lando lando init ``` -------------------------------- ### Lando Setup Example: Skip CA and Specify Docker Version Source: https://github.com/lando/core/blob/main/docs/cli/setup.md This example shows how to skip the Lando Certificate Authority installation, specify a particular version of Docker Desktop (4.31.0), and accept its End-User License Agreement during the setup process. ```sh lando setup --skip-install-ca --build-engine 4.31.0 --build-engine-accept-license ``` -------------------------------- ### Start Lando App (New Method) Source: https://github.com/lando/core/blob/main/docs/guides/updating-to-rc2.md To start a Lando app, navigate to the project directory and run the 'lando start' command. This is the new standard procedure. ```bash cd /path/to/MYAPP lando start ``` -------------------------------- ### Setup Lando Plugins Source: https://github.com/lando/core/blob/main/docs/help/updating.md If Lando services are not working, it might be due to using the 'slim' version without default plugins. Run this command to install necessary plugins. ```bash lando setup ``` -------------------------------- ### Lando Setup Command Usage Source: https://github.com/lando/core/blob/main/docs/cli/setup.md This shows the available options for the `lando setup` command. Use this to understand how to customize your Lando installation. ```sh lando setup [--build-engine ] [--build-engine-accept-license] [--orchestrator ] [--plugin ...] [--skip-common-plugins] [--skip-install-ca] [--yes] ``` -------------------------------- ### Initialize and Start Lando App Source: https://github.com/lando/core/blob/main/examples/sql-helpers/README.md Sets up a Lando environment for SQL helper scripts by copying configuration and test data, then starts the application. ```bash # Should init and start a lando app rm -rf sqlhelpers && mkdir -p sqlhelpers cp -rf .lando.sqlhelpers.yml sqlhelpers/.lando.yml cp -rf testdata1.sql sqlhelpers/testdata1.sql cp -rf testdata2.sql sqlhelpers/testdata2.sql cd sqlhelpers && lando start ``` -------------------------------- ### Run Lando Setup Source: https://github.com/lando/core/blob/main/examples/setup-linux/README.md Executes the Lando setup command with automatic confirmation and skips common plugin installations. This verifies the core setup process. ```bash # Should be able to run lando setup lando setup -y --skip-common-plugins ``` -------------------------------- ### Lando Setup Command Options Source: https://github.com/lando/core/blob/main/docs/cli/setup.md This lists the various options available for the `lando setup` command, including channel selection, clearing cache, debug mode, help, verbosity, build engine version, orchestrator version, plugin installation, skipping common plugins, skipping CA installation, and non-interactive mode. ```sh --channel Sets the update channel [array] [choices: "edge", "none", "stable"] ``` ```sh --clear Clears the lando tasks cache [boolean] ``` ```sh --debug Shows debug output [boolean] ``` ```sh --help Shows lando or delegated command help if applicable [boolean] ``` ```sh --verbose, -v Runs with extra verbosity [count] ``` ```sh --build-engine Sets the version of the build engine (docker-desktop) to install [string] [default: "4.32.0"] ``` ```sh --build-engine-accept-license Accepts the Docker Desktop license during install instead of later [boolean] [default: false] ``` ```sh --orchestrator Sets the version of the orchestrator (docker-compose) to install [string] [default: "2.27.1"] ``` ```sh --plugin Sets additional plugin(s) to install [array] [default: []] ``` ```sh --skip-common-plugins Disables the installation of common Lando plugins [boolean] [default: false] ``` ```sh --skip-install-ca Disables the installation of the Lando Certificate Authority (CA) [boolean] [default: false] ``` ```sh --yes, -y Runs non-interactively with all accepted default answers [boolean] [default: false] ``` -------------------------------- ### Lando Configuration with Build Steps and Events Source: https://github.com/lando/core/blob/main/docs/getting-started/what-it-do.md A comprehensive Landofile demonstrating build steps for services (including running scripts and composer installs), defining post-database import events, and setting up custom environment variables. This is for projects requiring automated setup and custom build processes. ```yaml name: my-app recipe: drupal9 config: php: '8.1' database: 'mysql:8.0' xdebug: true config: php: my-custom-php.ini events: post-db-import: - appserver: drush cc all -y proxy: pma: - pma-my-app.lndo.site services: appserver: build_as_root: - apt update -y && apt-get install vim -y - "/helpers/my-script-to-install-php-extension.sh memcached" build: - composer install overrides: environment: APP_LEVEL: dev TAYLOR: swift node: type: node:17 globals: gulp: latest frontend: type: node:17 command: yarn start build: - yarn pma: type: phpmyadmin hosts: - database tooling: yarn: service: node test: cmd: - appserver: composer test - frontend: yarn test ``` -------------------------------- ### Reinstall Buildx with Lando Setup Source: https://github.com/lando/core/blob/main/examples/setup-linux-buildx/README.md Runs the Lando setup command with the `-y` flag for automatic confirmation and `--skip-common-plugins` to focus on Buildx installation. This tests Lando's ability to reinstall Buildx. ```bash # Should be able to run lando setup and have it reinstall buildx lando setup -y --skip-common-plugins ``` -------------------------------- ### Start Lando Environment Source: https://github.com/lando/core/blob/main/examples/experimental/README.md Use this command to successfully start a Lando environment. ```bash # Should start successfully lando start ``` -------------------------------- ### Run Lando Setup Source: https://github.com/lando/core/blob/main/examples/setup-macos/README.md Execute the Lando setup command with specific flags to skip networking and common plugins. ```bash # Should be able to run lando setup lando setup -y --skip-networking --skip-common-plugins ``` -------------------------------- ### Display Lando Configuration Source: https://github.com/lando/core/blob/main/docs/cli/config.md Use this command to display the entire Lando configuration. No specific setup is required beyond having Lando installed. ```bash lando config ``` -------------------------------- ### Define Build Steps in Landofile Source: https://github.com/lando/core/blob/main/docs/services/lando-3.md Configure build steps for a service in the Landofile. These steps run on the first spin-up and can install dependencies or perform setup tasks. ```yaml services: appserver: api: 3 type: lando services: image: php:8.2-apache command: docker-php-entrypoint apache2-foreground build_as_root: - apt-get update -y && apt-get install -y libmemcached-dev - pecl install memcached - docker-php-ext-enable memcached run: - composer install node: api: 3 type: lando services: image: node:16 command: yarn dev build: - yarn run: - /helpers/some-helper-script.sh run_as_root: - echo "127.0.0.1 mysite.lndo.site" >> /etc/hosts ``` -------------------------------- ### Lando Build Steps: Single-line Script Example Source: https://github.com/lando/core/blob/main/docs/guides/updating-to-rc2.md Provides an example of a concise single-line shell command for Lando build steps. ```yaml run: - if [ ! -z $LANDO_MOUNT ]; then do-stuff; fi ``` -------------------------------- ### Start Application with Lando CLI Source: https://context7.com/lando/core/llms.txt Boots up all containers for your application. On first run, it builds containers; subsequent runs start existing ones. Use --debug for detailed logs or --clear to clear the tasks cache. ```bash lando start ``` ```bash lando start --debug ``` ```bash lando start -v -v -v ``` ```bash lando start --clear ``` -------------------------------- ### Start Lando Service Source: https://github.com/lando/core/blob/main/examples/events/README.md Initiates the Lando services. Ensure the 'test' directory is clean before starting. ```bash # Should start successfully rm -rf test lando start ``` -------------------------------- ### Lando Build Steps: Old Syntax Example Source: https://github.com/lando/core/blob/main/docs/guides/updating-to-rc2.md Illustrates the previous syntax for defining build steps in Lando configuration. ```yaml services: appserver: type: php build_as_root: - command1 install_dependencies_as_root: - command2 build: - command3 install_dependencies_as_me: - command4 run_as_root: - command5 extras: - command6 run: - command7 run_as_me - command8 ``` -------------------------------- ### Lando Build Steps: New Syntax Example Source: https://github.com/lando/core/blob/main/docs/guides/updating-to-rc2.md Demonstrates the updated and recommended syntax for Lando build steps, consolidating commands. ```yaml services: appserver: type: php build_as_root: - command1 - command2 build: - command3 - command4 run_as_root: - command5 - command6 run: - command7 - command8 ``` -------------------------------- ### Start Lando Application Source: https://github.com/lando/core/blob/main/docs/cli/start.md Use this command to boot up the containers required for your application development. The first execution will build all necessary containers, while subsequent runs will simply start the pre-built ones. ```sh lando start ``` -------------------------------- ### Start LAMP App with Lando Source: https://github.com/lando/core/blob/main/examples/networking/README.md Initializes and starts a LAMP application. Ensure the necessary files (index.php, apache.conf, .lando.yml) are present in the 'lamp' directory. ```bash rm -rf lamp && mkdir -p lamp cp -rf index.php lamp/index.php cp -rf apache.conf lamp/apache.conf cp -rf .lando.lamp.yml lamp/.lando.yml cd lamp && lando start ``` -------------------------------- ### Execute Multi-Command Tooling Source: https://github.com/lando/core/blob/main/docs/landofile/tooling.md Example of how to run the 'fire-everything' tooling command. ```bash lando fire-everything ``` -------------------------------- ### Complete Landofile Example for a Full-Featured Application Source: https://context7.com/lando/core/llms.txt A comprehensive Landofile example demonstrating the use of recipes, custom services, tooling, events, and proxy configuration for a typical web application. ```yaml name: my-full-app recipe: lamp config: php: '8.2' webroot: public database: mariadb:10.6 xdebug: true config: php: .lando/php.ini vhosts: .lando/apache.conf services: appserver: build: - composer install run: - php artisan key:generate --force || true overrides: environment: APP_ENV: local CACHE_DRIVER: redis QUEUE_CONNECTION: redis cache: type: redis:6 persist: true node: type: node:18 build: - npm ci scanner: false worker: type: php:8.2 command: php /app/artisan queue:work --tries=3 overrides: depends_on: - database - cache mailhog: type: mailhog hogfrom: - appserver proxy: appserver: - myapp.lndo.site mailhog: - mail.myapp.lndo.site tooling: artisan: service: appserver cmd: php artisan npm: service: node npx: service: node redis-cli: service: cache test: description: Run all tests cmd: - appserver: composer test - node: npm test build: description: Build frontend assets service: node cmd: npm run build fresh: description: Fresh database with seeds service: appserver cmd: php artisan migrate:fresh --seed events: post-start: - appserver: php artisan migrate --force post-db-import: - appserver: php artisan cache:clear ``` -------------------------------- ### Start Basic Lando App Source: https://github.com/lando/core/blob/main/examples/setup-linux/README.md Initiates a basic Lando application. This command verifies that Lando can successfully start and manage services for an application. ```bash # Should be able to start a basic app lando start ``` -------------------------------- ### Full Plugin Structure Example Source: https://github.com/lando/core/blob/main/docs/contrib/coder.md This outlines the various special files and directories that Lando can automatically load within a plugin. ```bash ./ |-- compose Services that get autoloaded first |-- lib Unit testable libraries that do not require the `lando` object |-- recipes Recipes that get autoloaded |-- scripts BASH or SH scripts that get injected into every container |-- services Services that get autoloaded last |-- sources Initialization sources that get autoloaded |-- tasks Tasks that get autoloaded |-- test Unit and functional tests |-- types Services that get autoloaded second |-- app.js Runs with the `lando` and `app` objects when an app is initialized |-- index.js Required, runs with the lando` object when plugin gets loaded ``` -------------------------------- ### Start Lando Services Source: https://github.com/lando/core/blob/main/examples/keys/README.md Commands to stop existing services, start new ones, and rebuild the project. ```bash lando poweroff lando start lando rebuild -y ``` -------------------------------- ### Start Lando App (Old Method) Source: https://github.com/lando/core/blob/main/docs/guides/updating-to-rc2.md This command was used to start a Lando app from the global registry. It is no longer supported. ```bash lando start MYAPP ``` -------------------------------- ### Start Lando Application Source: https://github.com/lando/core/blob/main/examples/badname/README.md Use these commands to power off any existing Lando services and then start the application. This is a prerequisite for testing. ```bash lando poweroff lando start ``` -------------------------------- ### Start LEMP App with Lando Source: https://github.com/lando/core/blob/main/examples/networking/README.md Initializes and starts a LEMP application. Ensure the necessary files (index.php, nginx.conf, .lando.yml) are present in the 'lemp' directory. ```bash rm -rf lemp && mkdir -p lemp cp -rf index.php lemp/index.php cp -rf nginx.conf lemp/nginx.conf cp -rf .lando.lemp.yml lemp/.lando.yml cd lemp && lando start ``` -------------------------------- ### Example Passthrough in Tasks Source: https://github.com/lando/core/blob/main/examples/tooling/README.md Check that example commands for tasks are correctly passed through and displayed in the help output. This aids users in understanding how to use the task. ```bash lando everything --help | grep "lando this is just for testing" ``` -------------------------------- ### Define Custom Tooling with Usage and Examples Source: https://github.com/lando/core/blob/main/docs/landofile/tooling.md Use `usage` and `examples` keys to provide additional help information for custom tooling commands in your `.lando.yml` file. `$0` is a placeholder for the binary name. ```yaml tooling: my-command: cmd: /app/args.sh service: node usage: $0 everything [thing|stuff] [arg2] [--word=] examples: - $0 everything thing - $0 everything stuff morestuff - $0 everything thing whatver --word yes options: word: passthrough: true alias: - w describe: Print what the word is positionals: arg1: describe: Uses arg1 type: string choices: - thing - stuff arg2: describe: Uses arg2 type: string ``` -------------------------------- ### Lando Exec Example: Environment and Greeting Source: https://github.com/lando/core/blob/main/docs/cli/exec.md Prints the environment variables and a greeting on 'my-service'. Note the use of quotes for commands with spaces. ```sh # Prints the environment and a wise greeting on my-service lando exec my-service -- "env && echo 'hello there!'" ``` -------------------------------- ### Initialize and Run a Basic LAMP Stack App Source: https://github.com/lando/core/blob/main/docs/getting-started/first-app.md Use this snippet to set up a simple 'Hello World' LAMP stack. It initializes the project, starts the services, and provides the URL to view the site. Remember to destroy the site when finished. ```bash # Create a new directory for this example and enter it mkdir hello && cd hello # And add a nice homepage echo "

Lando says hellooo what have we here?

" > index.html # Initialize a basic LAMP stack using the cwd as the source lando init \ --source cwd \ --recipe lamp \ --webroot . \ --name hello-lando # Check out the Landofile it created for you cat .lando.yml # Start it up lando start # Check out the commands you can run lando # Visit the site in your browser: https://hello-lando.lndo.site # Destroy the site lando destroy -y ``` -------------------------------- ### Install Multiple Lando Plugins Source: https://github.com/lando/core/blob/main/docs/cli/plugin-add.md This command allows for the installation of multiple Lando plugins simultaneously. List each plugin name and version separated by spaces. ```sh lando plugin-add @lando/php@1.2.0 @lando/node ``` -------------------------------- ### Execute Consolidated Command Source: https://github.com/lando/core/blob/main/docs/landofile/tooling.md Example of how to run the 'update-deps' tooling command defined previously. ```bash lando update-deps ``` -------------------------------- ### Install Lando Plugin from Local Source Source: https://github.com/lando/core/blob/main/docs/cli/plugin-add.md Install a Lando plugin directly from a local file path. This is useful for testing local plugin development. ```sh lando plugin-add @lando/php@file:~/my-php-plugin ``` -------------------------------- ### Start and Verify All Lando Containers Source: https://github.com/lando/core/blob/main/examples/restart/README.md Starts all Lando containers and verifies that exactly 4 containers labeled with 'io.lando.container=TRUE' are running. This ensures all services are active. ```bash lando start docker ps --filter label=io.lando.container=TRUE -q | wc -l | grep 4 ``` -------------------------------- ### Install Orbstack with Homebrew Source: https://github.com/lando/core/blob/main/docs/guides/how-do-i-use-orbstack.md Install Orbstack using Homebrew. Lando checks for the Docker CLI's presence, not necessarily Docker Desktop running. ```bash brew install orbstack ``` -------------------------------- ### Verify PHP Installation and Configuration Source: https://github.com/lando/core/blob/main/examples/tooling/README.md Check the PHP version, loaded modules, and run a simple PHP script to verify the environment. ```bash lando php -v lando php -m lando php -r "phpinfo();" ``` -------------------------------- ### Start Lando and Power Off Source: https://github.com/lando/core/blob/main/examples/storage/README.md Use these commands to ensure a clean Lando environment before starting. This involves removing any existing shared directories and powering off Lando. ```bash rm -rf shared lando poweroff lando start ``` -------------------------------- ### Install a Lando Plugin by Name and Version Source: https://github.com/lando/core/blob/main/docs/cli/plugin-add.md Use this command to install a specific version of a Lando plugin. Ensure the plugin name and version are accurate. ```sh lando plugin-add @lando/php@1.2.0 ``` -------------------------------- ### Initialize and Run a Vanilla Drupal 9 App Source: https://github.com/lando/core/blob/main/docs/getting-started/first-app.md This snippet shows how to initialize a new Lando project using a remote Drupal 9 archive. It includes steps for installing Drush and Drupal itself. Ensure you have Composer installed locally for the Drush requirement. ```bash # Create a new directory for this example and enter it mkdir drupal9 && cd drupal9 # Initialize a new lando drupal using vanilla Drupal 9 lando init \ --source remote \ --remote-url https://www.drupal.org/download-latest/tar.gz \ --remote-options="--strip-components 1" \ --recipe drupal9 \ --webroot . \ --name hello-drupal9 # Start the site lando start # Install a site local drush lando composer require drush/drush # Install drupal lando drush site:install --db-url=mysql://drupal9:drupal9@database/drupal9 -y # Check out your new site! https://hello-drupal9.lndo.site # Log in as admin with Drush lando drush uli -l https://hello-drupal9.lndo.site # Destroy it lando destroy -y ``` -------------------------------- ### Get Docker Version (Windows) Source: https://github.com/lando/core/blob/main/examples/setup-windows/README.md Retrieves the version of the Docker executable installed on the system. ```powershell & "$env:ProgramFiles\Docker\Docker\resources\bin\docker.exe" --version ``` -------------------------------- ### Basic Landofile Configuration Source: https://github.com/lando/core/blob/main/docs/config/performance.md This configuration excludes the 'vendor' directory and runs 'composer install' during application startup. ```yaml name: my-app recipe: drupal8 excludes: - vendor services: appserver: build: - composer install ``` -------------------------------- ### Lando Init - Recipe Selection Source: https://github.com/lando/core/blob/main/docs/lando-101/lando-init.md Users select a pre-configured recipe that defines the application's environment stack. For this example, the LAMP recipe is chosen. ```bash ? What recipe do you want to use? (Move arrow keys) ❯ lamp laravel lemp mean pantheon platformsh wordpress (Move up and down to reveal more choices) ``` -------------------------------- ### Install Private Lando Plugin with Authentication and Registry Source: https://github.com/lando/core/blob/main/docs/cli/plugin-add.md Install a private Lando plugin by providing authentication credentials and specifying the private registry URL. The '--auth' flag takes the token, and '--registry' specifies the source. ```sh lando plugin-add @myorg/php --auth "$TOKEN" --registry https://npm.pkg.github.com ``` -------------------------------- ### Verify Buildx Reinstallation Source: https://github.com/lando/core/blob/main/examples/setup-linux-buildx/README.md Checks the installed version of Docker Buildx again after running `lando setup`. This confirms that Buildx has been successfully reinstalled by Lando. ```bash # Should have buildx installed again docker buildx version ``` -------------------------------- ### Install Multiple Plugins with Private Registry and Scope Source: https://github.com/lando/core/blob/main/docs/cli/plugin-add.md Install multiple Lando plugins, including private ones, from a specific registry. Use '--auth' for authentication and '--scope' to define the organization and registry for private plugins. ```sh lando plugin-add @lando/php @myorg/mysql --auth "//npm.pkg.github.com/:_authToken=$TOKEN" --scope myorg:registry=https://npm.pkg.github.com ``` -------------------------------- ### Initialize Local Project with Pantheon Recipe Source: https://github.com/lando/core/blob/main/docs/cli/init.md Initializes a project using the 'pantheon' recipe from the local codebase. This is a straightforward setup for projects already containing the necessary files. ```sh # Set up a local repo with the pantheon recipe lando init --recipe pantheon ``` -------------------------------- ### Leia Test Structure Example Source: https://github.com/lando/core/blob/main/docs/contrib/development.md Markdown structure for Leia end-to-end tests. Headers define test phases: setup, verification, and teardown. ```md Start up tests -------------- # Should start up successfully lando start Verification commands --------------------- # Should be able to connect to all mariadb relationships lando mariadb main -e "show tables;" Destroy tests ------------- # Should be able to destroy our app lando destroy -y ``` -------------------------------- ### Get Docker Compose Version (Windows) Source: https://github.com/lando/core/blob/main/examples/setup-windows/README.md Finds and displays the version of the Docker Compose executable installed within the Lando bin directory. ```powershell # Should have installed Docker Compose Get-ChildItem -Path "$HOME/.lando/bin" -Filter "docker-compose-v2*" -Recurse | ForEach-Object { & $_.FullName version } ``` -------------------------------- ### Basic Landofile Structure Source: https://context7.com/lando/core/llms.txt This example demonstrates the fundamental structure of a `.lando.yml` file, including defining the application name, selecting a recipe, configuring services like PHP, database, and Redis, setting up proxy URLs, defining custom tooling commands, and configuring event hooks. ```yaml # Basic Landofile structure name: my-awesome-app # Use a pre-built recipe as starting point recipe: lamp config: php: '8.2' webroot: public database: mariadb:10.6 xdebug: true config: php: config/php.ini vhosts: config/apache.conf # Add additional services services: cache: type: redis:6 persist: true node: type: node:18 build: - npm install mailhog: type: mailhog # Configure proxy URLs proxy: appserver: - myapp.lndo.site - "*.myapp.lndo.site" mailhog: - mail.myapp.lndo.site # Add custom tooling commands tooling: npm: service: node redis-cli: service: cache test: service: appserver cmd: composer test # Configure events events: post-start: - appserver: composer install - node: npm run build ``` -------------------------------- ### Start Lando with Default Orchestrator Source: https://github.com/lando/core/blob/main/docs/config/orchestrator.md Initiates the Lando application using the default Docker Compose orchestrator version configured for Lando. ```bash # start my app with the default orchestrator version lando start ``` -------------------------------- ### Output Lando Info as JSON Source: https://github.com/lando/core/blob/main/examples/info/README.md Use the '--format json' flag to get 'lando info' output in JSON format. Verify the output starts with a JSON array. ```bash lando info --format json | grep "^["{\""" ``` ```bash lando info --deep --format json | grep "^["{\""" ``` -------------------------------- ### Lando SSH Execute Command as User Source: https://github.com/lando/core/blob/main/docs/cli/ssh.md Execute a command on a specific service as a specific user. This example updates package lists and installs vim on the 'appserver' service as the 'root' user. ```bash lando ssh --service appserver --user root --command "apt-get update && apt install vim -y" ``` -------------------------------- ### Lando CLI Command Usage Source: https://github.com/lando/core/blob/main/docs/cli/index.md This displays the general usage and available commands for the Lando CLI. It outlines common operations like starting, stopping, and configuring applications, along with their options and examples. ```sh Usage: lando [args] [options] Commands: lando config Displays the lando configuration lando destroy Destroys your app lando info Prints info about your app lando init Initializes code for use with lando lando list Lists all running lando apps and containers lando logs Displays logs for your app lando poweroff Spins down all lando related containers lando rebuild Rebuilds your app from scratch, preserving data lando restart Restarts your app lando share Shares your local site publicly lando ssh Drops into a shell on a service, runs commands lando start Starts your app lando stop Stops your app lando update Updates lando lando version Displays the lando version Options: --channel Sets the update channel [array] [choices: "edge", "none", "stable"] --clear Clears the lando tasks cache [boolean] --debug Shows debug output [boolean] --help Shows lando or delegated command help if applicable [boolean] --verbose, -v Runs with extra verbosity [count] Examples: lando start Run lando start lando rebuild --help Get help about using the lando rebuild command lando destroy -y --debug Run lando destroy non-interactively and with maximum verbosity lando --clear Clear the lando tasks cache You need at least one command before moving on ``` -------------------------------- ### Advanced Lando Configuration with Custom Services and Tooling Source: https://github.com/lando/core/blob/main/docs/getting-started/what-it-do.md An advanced Landofile example that includes custom database configuration, PHP settings, proxy configurations, and defines Node.js services with global packages and tooling. This is for complex applications needing specific service setups. ```yaml name: my-app recipe: drupal9 config: database: 'mysql:8.0' php: '8.1' xdebug: true config: php: my-custom-php.ini proxy: pma: - pma-my-app.lndo.site services: node: type: node:17 globals: gulp: latest pma: type: phpmyadmin hosts: - database tooling: yarn: service: node ``` -------------------------------- ### Initialize Lando Project Source: https://context7.com/lando/core/llms.txt The `lando init` command sets up a new Lando project by creating a `.lando.yml` file. It supports interactive initialization, using existing code, cloning from Git repositories (including GitHub with authentication), and specifying recipe options. ```bash # Interactive initialization lando init ``` ```bash # Initialize using current working directory code lando init --source cwd --recipe lamp --name my-app --webroot . ``` ```bash # Clone from a remote Git repository lando init --source remote --remote-url https://github.com/drupal/drupal.git --recipe drupal9 ``` ```bash # Clone from GitHub with authentication lando init \ --source github \ --recipe drupal9 \ --github-auth "$MY_GITHUB_TOKEN" \ --github-repo git@github.com:myuser/myrepo.git \ --name my-drupal-site ``` ```bash # Initialize with specific recipe options lando init --source cwd \ --recipe lamp \ --option php=8.2 \ --option database=mariadb \ --name my-app ``` -------------------------------- ### Verify Buildx Installation Source: https://github.com/lando/core/blob/main/examples/setup-linux-buildx/README.md Checks the installed version of Docker Buildx. This command should succeed if Buildx is installed and accessible. ```bash # Should have buildx installed by default on GitHub runners docker buildx version ``` -------------------------------- ### Initialize Drupal 7 Project from Current Directory Source: https://github.com/lando/core/blob/main/docs/cli/init.md Sets up a Drupal 7 project using code from the current working directory. This command specifies the source, recipe, application name, webroot, and requests a full Lando file dump. ```sh # Spit out a full Drupal 7 Landofile using code from your current working directory lando init --source cwd --recipe drupal7 --name d7-hotsauce --webroot . --full ``` -------------------------------- ### Workaround PHP Tool Install Order Source: https://github.com/lando/core/blob/main/docs/guides/lando-corporate-network-tips.md Disable automatic PHP tool installation and manually install them after your custom certificate is in place to avoid SSL errors during build. ```yaml services: appserver: composer_version: false # Prevent automatic composer install build_as_root: - cp /app/yourcert.crt /usr/local/share/ca-certificates/ - chmod 644 /usr/local/share/ca-certificates/yourcert.crt - update-ca-certificates - /etc/lando/service/helpers/install-composer.sh # Install composer after cert ``` -------------------------------- ### Install Dependencies within a Service Container Source: https://github.com/lando/core/blob/main/docs/landofile/tooling.md Use `lando ssh` to access a service container, investigate installed tools, and install new dependencies. It's recommended to add these dependencies to the build process for persistence. ```bash # SSH into the appserver lando ssh -s appserver # Explore whether grunt is installed which grunt # not installed # Add grunt npm install -g grunt-cli # Exit the appserver container exit # Add grunt to the tooling in your .lando.yml ``` -------------------------------- ### Lando Build Steps: Multi-line Script Example Source: https://github.com/lando/core/blob/main/docs/guides/updating-to-rc2.md Shows how to use multi-line shell scripts within Lando build steps for complex logic. ```yaml run: - | if [ ! -z $LANDO_MOUNT ]; then do something some other command fi ``` -------------------------------- ### Initialize Project from GitHub Repository Source: https://github.com/lando/core/blob/main/docs/cli/init.md Initializes a project using the 'mean' recipe by pulling code from a GitHub repository. Requires a GitHub authentication token and repository URL. ```sh # Pull code from GitHub and set it up as a mean recipe lando init \ --source github \ --recipe mean \ --github-auth "$MY_GITHUB_TOKEN" \ --github-repo git@github.com:lando/lando.git \ --name my-awesome-app ``` -------------------------------- ### Verify Docker Compose Installation Source: https://github.com/lando/core/blob/main/examples/setup-macos/README.md Confirm the installation of Docker Compose v2 by executing its version command. ```bash # Should have installed Docker Compose find ~/.lando/bin -type f -name 'docker-compose-v2*' -exec {} version \; ``` -------------------------------- ### Verify Lando Service Startup (Manual) Source: https://github.com/lando/core/blob/main/examples/yaml/README.md Execute commands within the Lando service to verify correct startup and environment variable loading based on '@type' configuration. Assumes 'manual' type configuration. ```bash # Should load/import based on @type if provided lando exec manual -- stat /tmp/i-ran lando exec manual -- env | grep VIBE | grep rising lando exec manual -- env | grep CAPTAIN | grep kirk ``` -------------------------------- ### Verify Lando Development CA Installation Source: https://github.com/lando/core/blob/main/examples/setup-macos/README.md Confirm that the Lando Development CA certificate has been installed in the macOS keychain. ```bash # Should have installed the Lando Development CA security find-certificate -a -c "Lando Development CA" -p ~/Library/Keychains/login.keychain-db ``` -------------------------------- ### Verify Docker Desktop Installation Source: https://github.com/lando/core/blob/main/examples/setup-macos/README.md Check if Docker Desktop has been installed by verifying the existence of its application file and its version. ```bash # Should have installed Docker Desktop stat /Applications/Docker.app docker --version ``` -------------------------------- ### Configure apt-get Proxy in .lando.yml Source: https://github.com/lando/core/blob/main/docs/guides/lando-corporate-network-tips.md Add a `build-as-root` command to your `.lando.yml` to copy a custom apt configuration file, enabling `apt-get` to use the specified proxy. ```yaml build_as_root: - cp /app/.lando/config/apt.conf /etc/apt/apt.conf ``` -------------------------------- ### Verify Docker Installation Source: https://github.com/lando/core/blob/main/examples/setup-linux/README.md Checks if Docker Engine and Docker Compose (v2) are installed and accessible by running their version commands. ```bash # Should have installed Docker Engine docker version docker info ``` ```bash # Should have installed Docker Compose find ~/.lando/bin -type f -name 'docker-compose-v2*' -exec {} version \; ``` -------------------------------- ### Verify Docker Desktop Installation (Windows) Source: https://github.com/lando/core/blob/main/examples/setup-windows/README.md Checks if Docker Desktop is installed in the default Program Files directory on Windows. ```powershell # Should have installed Docker Desktop Test-Path "$env:ProgramFiles\Docker\Docker\Docker Desktop.exe" ``` -------------------------------- ### Lando Init Command Options Source: https://github.com/lando/core/blob/main/docs/cli/init.md Lists the available options for the `lando init` command, including their purpose, choices, and types. These options allow customization of project initialization. ```sh --channel Sets the update channel [array] [choices: "edge", "none", "stable"] --clear Clears the lando tasks cache [boolean] --debug Shows debug output [boolean] --help Shows lando or delegated command help if applicable [boolean] --verbose, -v Runs with extra verbosity [count] --full Dump a lower level lando file [boolean] [default: false] --github-auth Uses a GitHub personal access token [string] --github-repo Uses the GitHub git url [string] --name The name of the app [string] --option, -o Merge additional KEY=VALUE pairs into your recipes config [array] --recipe, -r The recipe with which to initialize the app [string] [choices: "none"] --remote-options Passes options into either the git clone or archive extract command [string] [default: ""] --remote-url Uses the URL of your git repo or archive, only works when you set source to remote [string] --source, --src The location of your apps code [string] [choices: "cwd", "github", "remote"] --webroot Specify the webroot relative to app root [string] --yes, -y Auto answer yes to prompts [boolean] [default: false] ``` -------------------------------- ### Install Dependency in Container Only Source: https://github.com/lando/core/blob/main/docs/config/performance.md Use this command to install a Composer dependency that will only appear within the Lando container, not on your host machine. ```bash lando composer require pirog/my-module ``` -------------------------------- ### Lando Recipe Init Interface Example Source: https://github.com/lando/core/blob/main/docs/contrib/coder.md Implements the Lando init interface for a custom recipe, defining overrides, options, and build steps. Use this to customize the `lando init` process for a specific recipe. ```js module.exports = { name: 'pantheon', overrides: { name: { when: answers => { answers.name = answers['pantheon-site']; return false; }, }, webroot: { when: () => false, }, }, options: lando => ({ 'pantheon-auth': { describe: 'A Pantheon machine token', string: true, interactive: { type: 'list', choices: getTokens(lando.config.home, lando.cache.get(pantheonTokenCache)), message: 'Select a Pantheon account', when: answers => showTokenList(answers.recipe, lando.cache.get(pantheonTokenCache)), weight: 510, }, }, }), sources: [], build: (options, lando) => {}, }; ``` -------------------------------- ### Install Dependency on Host Only Source: https://github.com/lando/core/blob/main/docs/config/performance.md Use this command to install a Composer dependency that will only appear on your host machine, not within the Lando container. ```bash composer require pirog/my-module ``` -------------------------------- ### Start Lando Service Source: https://github.com/lando/core/blob/main/examples/lando-v4/README.md Starts the Lando service successfully. Ensure SSH agent is running and keys are added before execution. ```bash eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_rsa lando poweroff lando start ``` -------------------------------- ### apt.conf for Proxy Configuration Source: https://github.com/lando/core/blob/main/docs/guides/lando-corporate-network-tips.md Create an `apt.conf` file to define the proxy settings for `apt-get` within a container. This file should be copied into the container as part of the build process. ```text Acquire::http::Proxy "http://host.docker.internal:9000"; ``` -------------------------------- ### Initialize Project from Remote Git Repository with Pantheon Recipe Source: https://github.com/lando/core/blob/main/docs/cli/init.md Sets up a Pantheon project using code from a custom remote Git repository. This command specifies the source as 'remote' and provides the URL to the Git repository. ```sh # Set up a pantheon site but use code from a custom git repo lando init --source remote --remote-url https://my.git.repo/.git --recipe pantheon ``` -------------------------------- ### Install Latest Lando Core Package Source: https://github.com/lando/core/blob/main/docs/contrib/development.md Use this command to install the most recent stable version of the @lando/core package from the npm registry. ```bash npm install @lando/core ``` -------------------------------- ### Install Lando Plugin from GitHub Branch Source: https://github.com/lando/core/blob/main/docs/cli/plugin-add.md Install a Lando plugin from a specific branch of a GitHub repository. The format is 'username/repository#branch'. ```sh lando plugin-add lando/node#main ``` -------------------------------- ### Start and Power Off Lando Services Source: https://github.com/lando/core/blob/main/examples/command/README.md Use these commands to shut down any running Lando services and then start them up again. This is useful for ensuring a clean state. ```bash # Should start successfully lando poweroff lando start ``` -------------------------------- ### Lando Init Command Usage Source: https://github.com/lando/core/blob/main/docs/cli/init.md This shows the general usage and available options for the lando init command. Use this to understand the full range of parameters you can pass. ```sh lando init [--name ] [--recipe ] [--source ] [--full] [--github-auth==] [--github-repo==] [--option=...] [--remote-options=] [--remote-url=] [--webroot=] [--yes] [--other-plugin-provided-options...] ``` -------------------------------- ### Lando Init - Webroot Prompt Source: https://github.com/lando/core/blob/main/docs/lando-101/lando-init.md This prompt asks for the location of the webroot relative to the project's root directory. Leaving it as the default `.` indicates the webroot is in the current directory. ```bash ? Where is your webroot relative to the init destination? (.) ``` -------------------------------- ### Test Custom Docker Compose Installation Source: https://github.com/lando/core/blob/main/examples/orchestrator/README.md This verifies the installation of a custom Docker Compose version when specified via the --orchestrator flag. ```bash lando setup -y --skip-common-plugins --orchestrator="2.19.1" LANDO_ORCHESTRATOR_VERSION="2.19.1" lando config --path orchestratorVersion --format json | tr -d '"' | grep "2.19.1" LANDO_ORCHESTRATOR_VERSION="2.19.1" lando start LANDO_ORCHESTRATOR_VERSION="2.19.1" lando start -vvv 2>&1 | grep ".lando/bin/docker-compose-v2.19.1" ``` -------------------------------- ### Initialize Lando from GitHub Source Source: https://github.com/lando/core/blob/main/examples/init-github/README.md Use this command to clone code from a GitHub repository and initialize a Lando project. Ensure your GITHUB_PAT and GITHUB_KEY_NAME environment variables are set. ```bash mkdir -p github && cd github rm -rf ~/.lando/scripts lando init --source github --recipe none --github-auth="$GITHUB_PAT" --github-repo="git@github.com:lando/lando.git" --github-key-name="$GITHUB_KEY_NAME" --yes ``` -------------------------------- ### Remove Docker Engine Source: https://github.com/lando/core/blob/main/examples/setup-linux/README.md Removes Docker CE and related components. This is a prerequisite for a clean Lando installation. It also verifies that Docker Desktop is not installed. ```bash # Should be able to uninstall docker engine succesfully sudo apt-get remove docker-ce docker-ce-cli containerd.io sudo apt-get autoremove -y dpkg -l | grep docker-desktop || echo $? ``` -------------------------------- ### Test Default Docker Compose Installation Source: https://github.com/lando/core/blob/main/examples/orchestrator/README.md This command sequence verifies that Lando installs and uses the default Docker Compose version specified in the configuration. ```bash lando setup -y --skip-common-plugins lando start "$HOME/.lando/bin/docker-compose-v$(lando config --path orchestratorVersion --format json | tr -d '"')" --version lando start -vvv 2>&1 | grep ".lando/bin/docker-compose-v$(lando config --path orchestratorVersion --format json | tr -d '"')" ``` -------------------------------- ### Install Latest Lando Core Pre-release Package Source: https://github.com/lando/core/blob/main/docs/contrib/development.md Use this command to install the most recent pre-release version of the @lando/core package, which is tagged as 'edge' on npm. ```bash npm install @lando/core@edge ``` -------------------------------- ### Compare PHP Command Execution Methods Source: https://github.com/lando/core/blob/main/docs/landofile/tooling.md Demonstrates the difference in complexity between executing a PHP command using Docker directly, Lando SSH, and the simplified Lando tooling. ```bash # OMG WHYYYYY docker exec -it mysite_appserver_1 /bin/sh -c "/usr/local/bin/php -r 'phpinfo();'" # Hmm ok that's a bit better lando ssh -c "php -r 'phpinfo();'" # Oh so nice! lando php -r "phpinfo();" ``` -------------------------------- ### Lando pwd command example Source: https://github.com/lando/core/blob/main/docs/services/l337.md Demonstrates how the 'lando pwd' command reflects the current directory within the container, based on the auto-discovered app mount. ```bash lando pwd # /home cd subdir && lando pwd # /home/subdir ``` -------------------------------- ### Verify Entrypoint from Script File Source: https://github.com/lando/core/blob/main/examples/entrypoint/README.md Tests if an entrypoint can be successfully loaded from a script file and executed within the 'web1' service. ```bash lando exec web1 -- stat /tmp/test lando exec web1 -- curl http://localhost:3000/example | grep "this is an example" ``` -------------------------------- ### Lando Init - Initial Prompt Source: https://github.com/lando/core/blob/main/docs/lando-101/lando-init.md The first prompt in `lando init` asks for the location of the application's codebase. ```bash gff ~/code/lando-ops/guides-example-code/introduction-to-lando/lando-init () └─ ∴ lando init ? From where should we get your app's codebase? current working directory github pantheon platformsh ❯ remote git repo or archive ``` -------------------------------- ### Initialize Lando from Remote with Options Source: https://github.com/lando/core/blob/main/docs/cli/init.md These examples demonstrate how to pass specific options to the Git clone or archive extraction process when initializing from a remote source. Note the use of '=' for `--remote-options`. ```sh lando init \ --source remote \ --remote-url https://github.com/drupal/drupal.git \ --remote-options="--branch 7.x --depth 1" ``` ```sh lando init \ --source remote \ --remote-url https://www.drupal.org/download-latest/tar.gz \ --remote-options="--strip-components=1" ``` -------------------------------- ### Initialize and Bootstrap Lando Application Source: https://github.com/lando/core/blob/main/README.md Use this snippet to initialize a Lando application and bootstrap it to a specified level. It's essential for setting up the development environment before running tasks. ```javascript const Lando = require('@lando/core'); const lando = new Lando(config); // bootstrap and go return lando.bootstrap(bsLevel).then(lando => { lando.getApp().init().then(() => cli.run(getTasks(config, cli.argv()), config)); }); ``` -------------------------------- ### Lando Build Steps: Explicitly Using /app as Mount Source: https://github.com/lando/core/blob/main/docs/guides/updating-to-rc2.md Shows how to explicitly use '/app' as the mount point when $LANDO_MOUNT is needed and might be overridden. ```yaml events: post-start: - appserver: cd /app && command-that-def-needs-to-be-run-from-here ``` -------------------------------- ### Example Docker Network Output Source: https://github.com/lando/core/blob/main/docs/guides/external-access.md This is an example of the output from `docker network ls`, showing a Lando network named `d7dev_default` for a project named `d7dev`. ```text NETWORK ID NAME DRIVER SCOPE d9526b32d92c d7dev_default bridge local ```