Skip to content

platformsh-devrel/next-drupal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

NextJS + Drupal on Platform.sh

Adapting the steps in NextJS for Drupal Quickstart.

Reference issues:

  1. Create the local repo

    mkdir next-drupal
    cd next-drupal 
    git init
    git branch -m main
  2. Create the Drupal site

    composer create-project drupal/recommended-project drupal
  3. 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
  4. Edit .platform/routes.yaml

    Include the backend subdomain for the upstream and redirect routes. Also, rename the upstream from app to drupal.

    "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}/"
  5. Modify composer.json configuration

    Add 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"
            }
        },
    }
  6. Install drupal/next and Platform.sh modules

    cd drupal
    composer require drupal/next platformsh/config-reader drush/drush drupal/redis cweagans/composer-patches
  7. 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
  8. Update .platform.app.yaml

    *Remove build.flavor block, modify the hooks.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
  9. Update

    composer update
  10. Create GitHub repo

    gh repo create next-drupal
    git add .
    git commit -m "Initial Drupal site."
    git push origin main
  11. Create a project

    platform project:create --title next-drupal --region us-4.platform.sh --plan medium --environments 3 --storage 5 --default-branch main
  12. Integrate project with GitHub

    platform integration:add --type=github --project=PLATFORMSH_PROJECT_ID --token=GITHUB-USER-TOKEN --repository=USER/REPOSITORY

About

NextJS + Drupal on Platform.sh

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages