Adapting the steps in NextJS for Drupal Quickstart.
Reference issues:
- chapter-three/next-drupal#14 (closed)
- chapter-three/next-drupal#15 (open)
-
Create the local repo
mkdir next-drupal cd next-drupal git init git branch -m main
-
Create the Drupal site
composer create-project drupal/recommended-project drupal
-
Add shared Platform.sh configuration
mkdir .platform curl -s https://raw.githubusercontent.com/platformsh-templates/drupal9/master/.platform/routes.yaml >> .platform/routes.yaml curl -s https://raw.githubusercontent.com/platformsh-templates/drupal9/master/.platform/services.yaml >> .platform/services.yaml
-
Edit
.platform/routes.yaml
Include the
backend
subdomain for theupstream
andredirect
routes. Also, rename theupstream
fromapp
todrupal
."https://backend.{default}/": type: upstream upstream: "drupal:http" cache: enabled: true cookies: ['/^SS?ESS/', '/^Drupal.visitor/'] "https://www.backend.{default}/": type: redirect to: "https://backend.{default}/"
-
Modify
composer.json
configurationAdd the following to
extra
:"extra": { "patches": { "drupal/subrequests": { "Get same results on different request": "https://www.drupal.org/files/issues/2019-07-18/change_request_type-63049395-09.patch" }, "drupal/decoupled_router": { "Unable to resolve path on node in other language than default": "https://www.drupal.org/files/issues/2021-05-05/3111456-34.patch" } }, }
-
Install
drupal/next
and Platform.sh modulescd drupal composer require drupal/next platformsh/config-reader drush/drush drupal/redis cweagans/composer-patches
-
Get Platform.sh-specific files
Get application configuration
curl -s https://raw.githubusercontent.com/platformsh-templates/drupal9/master/.environment >> .environment curl -s https://raw.githubusercontent.com/platformsh-templates/drupal9/master/.platform.app.yaml >> .platform.app.yaml
Local dev & gitignore
curl -s https://raw.githubusercontent.com/platformsh-templates/drupal9/master/.gitignore >> .gitignore curl -s https://raw.githubusercontent.com/platformsh-templates/drupal9/master/.lando.upstream.yml >> .lando.upstream.yml
Drush
mkdir drush curl -s https://raw.githubusercontent.com/platformsh-templates/drupal9/master/drush/platformsh_generate_drush_yml.php >> drush/platformsh_generate_drush_yml.php
Drupal settings
curl -s https://raw.githubusercontent.com/platformsh-templates/drupal9/master/web/sites/default/settings.php >> web/sites/default/settings.php curl -s https://raw.githubusercontent.com/platformsh-templates/drupal9/master/web/sites/default/settings.platformsh.php >> web/sites/default/settings.platformsh.php
-
Update
.platform.app.yaml
*Remove
build.flavor
block, modify thehooks.build
attribute, and bump the PHP version in.platform.app.yaml
:type: 'php:8.1' hooks: build: | set -e composer install --ignore-platform-req=ext-sodium
-
Update
composer update
-
Create GitHub repo
gh repo create next-drupal git add . git commit -m "Initial Drupal site." git push origin main
-
Create a project
platform project:create --title next-drupal --region us-4.platform.sh --plan medium --environments 3 --storage 5 --default-branch main
-
Integrate project with GitHub
platform integration:add --type=github --project=PLATFORMSH_PROJECT_ID --token=GITHUB-USER-TOKEN --repository=USER/REPOSITORY