diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1135c23..46aff01 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,6 @@ on: release: types: - published - - edited jobs: deploy: diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ca83fd..361c0be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ ## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }}) * Added default config values to the `.lando.yml` file after init. +* Updated globally installed Drush to `v8.5.0`. +* Added docs for setting up [Drupal CMS](https://drupal.org/docs/drupal-cms). +* Updated to [@lando/php@1.7.1](https://github.com/lando/php/releases/tag/v1.7.1). +* Updated to [@lando/mysql@1.5.0](https://github.com/lando/mysql/releases/tag/v1.5.0). ## v1.11.0 - [December 9, 2024](https://github.com/lando/drupal/releases/tag/v1.11.0) diff --git a/builders/_drupaly.js b/builders/_drupaly.js index e4a2ba0..24eee85 100644 --- a/builders/_drupaly.js +++ b/builders/_drupaly.js @@ -9,7 +9,7 @@ const utils = require('../lib/utils.js'); const warnings = require('../lib/warnings.js'); // "Constants" -const DRUSH8 = '8.4.8'; +const DRUSH8 = '8.5.0'; const DRUSH7 = '7.4.0'; // Tooling defaults diff --git a/builders/drupal-php.js b/builders/drupal-php.js index 3c5f549..a5d4f86 100644 --- a/builders/drupal-php.js +++ b/builders/drupal-php.js @@ -1,30 +1,31 @@ 'use strict'; -const _ = require('lodash'); -const fs = require('fs'); const path = require('path'); const landoPhpPath = path.join(__dirname, '../node_modules/@lando/php'); const LandoPhp = require(`${landoPhpPath}/builders/php.js`); -const loadScripts = options => { - const lando = _.get(options, '_app._lando'); - // Move the script to the confDir and make executable. - if (fs.existsSync(path.join(landoPhpPath, 'scripts'))) { - const confDir = path.join(lando.config.userConfRoot, 'scripts'); - const dest = lando.utils.moveConfig(path.join(landoPhpPath, 'scripts'), confDir); - lando.utils.makeExecutable(fs.readdirSync(dest), dest); - lando.log.debug('automoved scripts from %s to %s and set to mode 755', - path.join(landoPhpPath, 'scripts'), confDir); - } -}; - -// Builder +/** + * Drupal PHP builder class that extends Lando PHP builder. + * Uses the bundled version of @lando/php plugin instead of user's version. + * + * @module drupal-php + */ module.exports = { name: 'drupal-php', parent: '_appserver', + /** + * Builder function that returns the DrupalPhp class + * @param {Object} parent - Parent builder class + * @return {Class} DrupalPhp class extending LandoPhp builder + */ builder: parent => class DrupalPhp extends LandoPhp.builder(parent, LandoPhp.config) { + /** + * Create a new DrupalPhp instance + * @param {string} id - Service id + * @param {Object} options - Service options + * @param {Object} factory - App factory instance + */ constructor(id, options = {}, factory) { - loadScripts(options); options.nginxServiceType = 'drupal-nginx'; super(id, options, factory); } diff --git a/builders/drupal10.js b/builders/drupal10.js index 31a9999..c2f023d 100644 --- a/builders/drupal10.js +++ b/builders/drupal10.js @@ -27,7 +27,7 @@ module.exports = { // Set drush to false options.drush = false; - // Let's make sure we set appropripate default versions for things + // Let's make sure we set appropriate default versions for things // See: https://www.drupal.org/docs/system-requirements/database-server-requirements if (_.get(options, 'database') === 'mysql') { options.database = 'mysql:5.7'; diff --git a/builders/drupal6.js b/builders/drupal6.js index 4692fed..584558d 100644 --- a/builders/drupal6.js +++ b/builders/drupal6.js @@ -14,8 +14,9 @@ module.exports = { confSrc: path.resolve(__dirname, '..', 'config', 'drupal6'), defaultFiles: {}, php: '5.6', - // @NOTE: below seems to be the last known drush version that let you do - // drush si -y succesfully + // @NOTE: below seems to be the last known Drupal 6 compatible + // drush version that let you do drush si -y successfully. + // @see https://github.com/drush-ops/drush/issues/218#issuecomment-2580619527 drush: '8.4.5', }, builder: (parent, config) => class LandoDrupal6 extends parent { diff --git a/builders/drupal9.js b/builders/drupal9.js index d0b234a..82a7670 100644 --- a/builders/drupal9.js +++ b/builders/drupal9.js @@ -27,7 +27,7 @@ module.exports = { // Set drush to false options.drush = false; - // Let's make sure we set appropripate default versions for things + // Let's make sure we set appropriate default versions for things // See: https://www.drupal.org/docs/9/how-drupal-9-is-made-and-what-is-included/environment-requirements-of-drupal-9 if (_.get(options, 'database') === 'mysql') { options.database = 'mysql:5.7'; diff --git a/docs/config.md b/docs/config.md index 8ae697e..e6bde08 100644 --- a/docs/config.md +++ b/docs/config.md @@ -26,7 +26,11 @@ config: vhosts: SEE BELOW ``` -Note that if the above config options are not enough all Lando recipes can be further [extended and overriden](https://docs.lando.dev/landofile/recipes.html#extending-and-overriding-recipes). +Note that if the above config options are not enough, all Lando recipes can be further [extended and overriden](https://docs.lando.dev/landofile/recipes.html#extending-and-overriding-recipes). + +::: tip Applying Configuration Changes +After making changes to service configurations, you'll need to run `lando rebuild` for the changes to take effect. This rebuilds your app's services with the new configuration. +::: ## Choosing a Drupal version diff --git a/docs/getting-started.md b/docs/getting-started.md index 66e4658..874dbc1 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -46,6 +46,29 @@ lando drush site:install --db-url=mysql://drupal11:drupal11@database/drupal11 -y lando info ``` +```bash:no-line-numbers [DRUPAL CMS] +# Initialize a drupal11 recipe +mkdir my-drupalcms-app \ + && cd my-drupalcms-app \ + && lando init \ + --source cwd \ + --recipe drupal11 \ + --webroot web \ + --name my-drupalcms-app + +# Start the environment +lando start + +# Create latest Drupal CMS project via composer +lando composer create-project drupal/cms tmp && cp -r tmp/. . && rm -rf tmp + +# Install drupal +lando drush site:install recipes/drupal_cms_starter --db-url=mysql://drupal11:drupal11@database/drupal11 -y + +# List information about this app +lando info +``` + ```bash:no-line-numbers [DRUPAL 10] # Initialize a drupal10 recipe mkdir my-first-drupal10-app \ diff --git a/docs/guides/drupal-cms.md b/docs/guides/drupal-cms.md new file mode 100644 index 0000000..67fcb8e --- /dev/null +++ b/docs/guides/drupal-cms.md @@ -0,0 +1,175 @@ +--- +title: Installing Drupal CMS Locally with Lando +description: This guide will walk you through setting up Drupal CMS locally for development using Lando + +authors: + - name: Aaron Feledy + pic: https://avatars.githubusercontent.com/u/1000487 + link: https://x.com/aaronfeledy +--- + +# Installing Drupal CMS with Lando + +[Drupal CMS](https://drupal.org/drupal-cms) is a new product that puts the power of Drupal into the hands of marketers, designers and content creators. It's built on Drupal 11 and comes with smart defaults and AI-powered features to help you launch your site quickly. + +This guide will walk you through setting up Drupal CMS locally for development using Lando. + +
+TLDR; Quick Install Commands + +::: code-group + +```bash:no-line-numbers [Bash] +# Prompt for app name (or change this line to set it directly) +read -p "Enter your app name [my-drupalcms-app]: " APP_NAME +APP_NAME=${APP_NAME:-my-drupalcms-app} # Default if no input provided + +# Create and initialize project +mkdir $APP_NAME \ + && cd $APP_NAME \ + && lando init \ + --source cwd \ + --recipe drupal11 \ + --webroot web \ + --name $APP_NAME + +# Start environment and install Drupal CMS +lando start +lando composer create-project drupal/cms tmp && cp -r tmp/. . && rm -rf tmp +lando drush site:install recipes/drupal_cms_starter --db-url=mysql://drupal11:drupal11@database/drupal11 -y + +# Get site URL to login +lando drush user:login /admin/dashboard/welcome --uri="$(lando info -s appserver --path 'urls[1]' | tr -d '\n' | tr -d "'")" +``` + +```powershell:no-line-numbers [PowerShell] +# Prompt for app name (or change this line to set it directly) +$APP_NAME = Read-Host "Enter your app name [my-drupalcms-app]: " +if ([string]::IsNullOrWhiteSpace($APP_NAME)) { $APP_NAME = "my-drupalcms-app" } + +# Create and initialize project +mkdir $APP_NAME; ` +cd $APP_NAME; ` +lando init ` + --source cwd ` + --recipe drupal11 ` + --webroot web ` + --name $APP_NAME + +# Start environment and install Drupal CMS +lando start +lando composer create-project drupal/cms tmp; cp -r tmp/* .; rm -rf tmp +lando drush site:install recipes/drupal_cms_starter --db-url=mysql://drupal11:drupal11@database/drupal11 -y + +# Get the login link +lando drush user:login /admin/dashboard/welcome --uri="$(lando info -s appserver --path 'urls[1]' | tr -d '\n' | tr -d "'")" +``` + +::: + +
+ +## Prerequisites + +Before starting, you'll need: + +1. [Lando installed on your system](https://docs.lando.dev/getting-started/installation.html) +2. Basic familiarity with command line tools +3. A terminal application + +## Installation Steps + +1. **Create and enter project directory** + +First, we'll create a new directory for our Drupal CMS project files and navigate into it: + +```bash:no-line-numbers +mkdir my-drupalcms-app +cd my-drupalcms-app +``` + +2. **Initialize a new Lando app with Drupal 11 recipe** + +Now that we have our project directory, let's set up the Lando configuration. We'll use the `lando init` command to create a `.lando.yml` file that will define our development environment. We'll tell it to use the `drupal11` recipe since that's what Drupal CMS is built on, and specify that our web files will live in a 'web' directory: + +```bash:no-line-numbers +lando init \ + --source cwd \ + --recipe drupal11 \ + --webroot web \ + --name my-drupalcms-app +``` + +3. **Start the Lando environment** + +With the Lando configuration in place, start the development environment by running the command below. This +will take a few minutes the first time as Lando downloads and configures everything needed to host Drupal CMS locally: + +```bash:no-line-numbers +lando start +``` + +4. **Install Project Files via Composer** + +Now that the environment is running, we use Composer to download and install the Drupal CMS project files. + +```bash:no-line-numbers +lando composer create-project drupal/cms tmp && cp -r tmp/. . && rm -rf tmp +``` + +5. **Install Drupal** + +With the environment running and the project files in place, we need to configure Drupal to use Lando's database service, create the database, and run Drupal's installation process. Fortunately, Drush makes this easy with its `site:install` command: + +```bash:no-line-numbers +lando drush site:install recipes/drupal_cms_starter --db-url=mysql://drupal11:drupal11@database/drupal11 -y +``` + +## Post-Installation + +Now that Drupal CMS is installed and running, it's time to login. We'll use the `lando drush user:login` command to generate a one-time login link: + +```bash:no-line-numbers +lando drush user:login /admin/dashboard/welcome --uri="$(lando info -s appserver --path 'urls[1]' | tr -d '\n' | tr -d "'")" +``` + +2. Start exploring the [Drupal CMS interface](https://new.drupal.org/docs/drupal-cms/get-started/get-to-know-drupal-cms/getting-around-drupal-cms) and its features like: + - The Dashboard + - Content management tools + - Built-in SEO tools + - [Smart default recipes](https://new.drupal.org/docs/drupal-cms/get-started/get-to-know-drupal-cms/adding-functionality-with-smart-defaults) for common functionality + - [AI tools](https://new.drupal.org/docs/drupal-cms/get-to-know-drupal-cms/ai-tools-in-drupal-cms) for site administrators and content creators + +## Customizing Your Setup + +Lando's Drupal plugin offers many configuration options. You can customize: + +- PHP version +- Web server (Apache or Nginx) +- Database backend (MySQL, MariaDB, or PostgreSQL) +- Composer version +- And more + +For detailed configuration options, see the [Lando Drupal Plugin Configuration Documentation](https://docs.lando.dev/plugins/drupal/config.html). + +## Starting and Stopping + +- To stop your local environment: `lando stop` +- To start it again: `lando start` +- To rebuild the environment: `lando rebuild` + +## Next Steps + +Now that you have Drupal CMS running locally, you can: + +1. [Get familiar with the Drupal CMS features and interface](https://new.drupal.org/docs/drupal-cms/get-started/get-to-know-drupal-cms) + +## Troubleshooting + +If you encounter issues during installation: + +- Try running `lando rebuild -y` to rebuild your app with the latest configuration +- Check Lando's [troubleshooting guide](https://docs.lando.dev/help/troubleshooting.html) +- Join the [Lando Slack](https://www.launchpass.com/devwithlando) for community support + +Remember to check the [Drupal CMS documentation](https://drupal.org/docs/drupal-cms) for detailed information about working with Drupal CMS. diff --git a/examples/drupal11-nginx/README.md b/examples/drupal11-nginx/README.md index 89e3195..12fb3f1 100644 --- a/examples/drupal11-nginx/README.md +++ b/examples/drupal11-nginx/README.md @@ -44,9 +44,9 @@ lando exec appserver -- curl -IL appserver_nginx | grep Server | grep nginx cd nginx lando mysql -V | grep 8.0 -# Should be running sqlite 3.40 by default +# Should be running sqlite 3.45 by default cd nginx -lando php -r "print_r(SQLite3::version());" | grep versionString | grep 3.40 +lando php -r "print_r(SQLite3::version());" | grep versionString | tee >(cat 1>&2) | grep 3.45 # Should not enable xdebug by default cd nginx diff --git a/examples/drupal11/README.md b/examples/drupal11/README.md index 6317a2a..f791f10 100644 --- a/examples/drupal11/README.md +++ b/examples/drupal11/README.md @@ -44,9 +44,9 @@ lando exec appserver -- curl -IL localhost | grep Server | grep 2.4 cd drupal11 lando mysql -V | grep 8.0 -# Should be running sqlite 3.40 by default +# Should be running sqlite 3.45 by default cd drupal11 -lando php -r "print_r(SQLite3::version());" | grep versionString | grep 3.40 +lando php -r "print_r(SQLite3::version());" | grep versionString | tee >(cat 1>&2) | grep 3.45 # Should not enable xdebug by default cd drupal11 diff --git a/examples/drupal6/README.md b/examples/drupal6/README.md index 6da9df7..ad5fdb7 100644 --- a/examples/drupal6/README.md +++ b/examples/drupal6/README.md @@ -14,7 +14,7 @@ lando poweroff # Should initialize the latest D6 codebase rm -rf drupal6 && mkdir -p drupal6 && cd drupal6 -lando init --source remote --remote-url https://ftp.drupal.org/files/projects/drupal-6.38.tar.gz --remote-options="--strip-components 1" --recipe drupal6 --webroot . --name lando-drupal6 +lando init --source remote --remote-url https://ftp.drupal.org/files/projects/drupal-6.38.tar.gz --remote-options="--strip-components 1" --recipe drupal6 --webroot . --name lando-drupal6 --option "composer_version=2.2-latest" # Should start up successfully cd drupal6 @@ -54,7 +54,7 @@ lando mysql -udrupal6 -pdrupal6 drupal6 -e quit # Should use drush 8.4.5 by default cd drupal6 -lando drush version | grep "8.4.5" +lando drush version | tee >(cat 1>&2) | grep 8.4.5 # Should be able to install drupal cd drupal6 diff --git a/examples/drupal8/README.md b/examples/drupal8/README.md index 7837e14..98b5c71 100644 --- a/examples/drupal8/README.md +++ b/examples/drupal8/README.md @@ -59,9 +59,9 @@ lando php -m | grep xdebug || echo $? | grep 1 cd drupal8 lando mysql -udrupal8 -pdrupal8 drupal8 -e quit -# Should use drush 8.4.8 +# Should use drush 8.5.0 cd drupal8 -lando drush version | grep 8.4.8 +lando drush version | tee >(cat 1>&2) | grep 8.5.0 # Should be able to install drupal cd drupal8 diff --git a/netlify.toml b/netlify.toml index 75ab042..0b65fdc 100644 --- a/netlify.toml +++ b/netlify.toml @@ -10,7 +10,14 @@ [[context.deploy-preview.plugins]] package = "netlify-plugin-checklinks" [context.deploy-preview.plugins.inputs] - todoPatterns = [ "load", "CHANGELOG.html", "x.com", "twitter.com", "/v/" ] + todoPatterns = [ + "load", + "CHANGELOG.html", + "x.com", + "twitter.com", + "https://www.drupal.org", + "/v/" + ] skipPatterns = [ ".rss", ".gif", ".jpg" ] checkExternal = true @@ -40,6 +47,15 @@ output_path = "reports/lighthouse.html" # We need this so preview environments and the base site look ok on their own +[[redirects]] + from = "https://lando-drupal.netlify.app" + to = "https://lando-drupal.netlify.app/plugins/drupal/index.html" + status = 301 + force = true +[[redirects]] + from = "https://lando-drupal.netlify.app/*" + to = "https://docs.lando.dev/:splat" + status = 301 [[redirects]] from = "/" to = "/plugins/drupal" diff --git a/package-lock.json b/package-lock.json index a843a95..7f1ea1c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,13 +6,13 @@ "packages": { "": { "name": "@lando/drupal", - "version": "1.10.2", + "version": "1.11.0", "license": "GPL-3.0", "dependencies": { "@lando/mariadb": "^1.6.3", "@lando/mssql": "^1.4.3", - "@lando/mysql": "^1.4.4", - "@lando/php": "^1.6.3", + "@lando/mysql": "^1.5.0", + "@lando/php": "^1.7.1", "@lando/postgres": "^1.4.4", "lodash": "^4.17.21", "semver": "^7.5.4" @@ -1484,9 +1484,9 @@ "license": "MIT" }, "node_modules/@lando/mysql": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/@lando/mysql/-/mysql-1.4.4.tgz", - "integrity": "sha512-AmbCCj/Ifma5mobCGfkrQ1eEBkWNdxiJASSDhmsTc0ZnATPwJOyk9mjKNksMI3nsieP8VvRktdAVkj6LhfsWqA==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@lando/mysql/-/mysql-1.5.0.tgz", + "integrity": "sha512-0oR5/yEwbPywj4+QeQap8c1kO/l2kiU0iZ7JUVnZMQf/DyhgaladHAsw/auLuB9tBbj/WREn70M4qvGEtHM1CA==", "bundleDependencies": [ "lodash" ], @@ -1504,9 +1504,9 @@ "license": "MIT" }, "node_modules/@lando/php": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/@lando/php/-/php-1.6.3.tgz", - "integrity": "sha512-UIYJ5fh2hCTQDal17UxuT+8A+CvEEfnjNtrXObArsb1G4qXrJdwwF9G3boQ57L3aj8Y5eLSmgClBC1wMw4xOUw==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@lando/php/-/php-1.7.1.tgz", + "integrity": "sha512-yndqYlVy51k0GWVwbNas4MvY0mXTYyC9XJeUnyyx7kzX84j3TwnLt8/MYHXMaP6e/SsMp1nrb3Isi11NKYDrtg==", "bundleDependencies": [ "@lando/nginx", "lodash", diff --git a/package.json b/package.json index 7e72b64..ff7a36f 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,8 @@ "dependencies": { "@lando/mariadb": "^1.6.3", "@lando/mssql": "^1.4.3", - "@lando/mysql": "^1.4.4", - "@lando/php": "^1.6.3", + "@lando/mysql": "^1.5.0", + "@lando/php": "^1.7.1", "@lando/postgres": "^1.4.4", "lodash": "^4.17.21", "semver": "^7.5.4"