diff --git a/.blackfire.yml b/.blackfire.yml new file mode 100644 index 00000000..7dd1cd80 --- /dev/null +++ b/.blackfire.yml @@ -0,0 +1,146 @@ +tests: + 'The homepage should be fast': + path: + - '/' + assertions: + - 'main.wall_time <= 250ms' + 'Some Composer dependencies have known security issues and should be upgraded': + path: + - '/.*' + methods: + - ANY + command: '.*' + assertions: + - { label: null, expression: 'not has_vulnerable_dependencies()' } + exclude: { } + # 'You should enable twig cache in Drupal': + # path: + # - '/.*' + # methods: + # - ANY + # command: '.*' + # assertions: + # - { label: null, expression: 'metrics.drupal8.twig_cache.construct.count >= 1' } + # when: 'metrics.drupal8.installed.count > 0' + # exclude: { } + '"assert.active" is a dev_only feature and should be disabled in production': + path: + - '/.*' + methods: + - ANY + command: '.*' + assertions: + - { label: null, expression: 'runtime.configuration.assert_active === false' } + exclude: { } + # 'You should enable APCu for Drupal': + # path: + # - '/.*' + # methods: + # - ANY + # command: '.*' + # assertions: + # - { label: null, expression: 'metrics.drupal8.fast_cache.count > 0' } + # when: 'metrics.drupal8.installed.count > 0' + # exclude: { } + '"display_errors" should be disabled': + path: + - '/.*' + methods: + - ANY + command: '.*' + assertions: + - { label: null, expression: 'not is_configuration_enabled("display_errors")' } + exclude: { } + '"display_startup_errors" should not be enabled': + path: + - '/.*' + methods: + - ANY + command: '.*' + assertions: + - { label: null, expression: 'not is_configuration_enabled("display_startup_errors")' } + exclude: { } + '"max_execution_time" should be less than 30 seconds for Web requests': + path: + - '/.*' + methods: + - ANY + assertions: + - { label: null, expression: 'runtime.configuration.max_execution_time <= 30' } + exclude: { } + '"session.use_strict_mode" should be enabled': + path: + - '/.*' + methods: + - ANY + command: '.*' + assertions: + - { label: null, expression: 'runtime.configuration.session_use_strict_mode === true' } + exclude: { } + '"zend.detect_unicode" should be disabled as BOMs are not portable': + path: + - '/.*' + methods: + - ANY + command: '.*' + assertions: + - { label: null, expression: 'runtime.configuration.zend_detect_unicode === false' } + exclude: { } + # 'PHP Preloading should be configured': + # path: + # - '/.*' + # methods: + # - ANY + # command: '.*' + # assertions: + # - { label: null, expression: 'runtime.configuration.opcache_preload != ""' } + # when: 'is_extension_loaded("zend_opcache")' + # exclude: { } + 'The realpath cache ttl should be more than one hour in production': + path: + - '/.*' + methods: + - ANY + command: '.*' + assertions: + - { label: null, expression: 'runtime.configuration.realpath_cache_ttl >= 3600' } + exclude: { } + 'The session garbage collector should be disabled in production': + path: + - '/.*' + methods: + - ANY + command: '.*' + assertions: + - { label: null, expression: 'runtime.configuration.session_gc_probability === 0' } + exclude: { } + +scenarios: | + #!blackfire-player + + name "Drupal Scenarios" + + group homepages + visit url("/") + name "Homepage (English)" + expect status_code() == 200 + visit url("/es") + name "Homepage (Español)" + expect status_code() == 200 + + group articles + visit url("/en/articles") + name "Articles" + expect status_code() == 200 + + group admin_anonymous + visit url("/en/admin/content") + expect status_code() == 403 + visit url("/en/admin/structure") + expect status_code() == 403 + + scenario + name "Anonymous Visit" + include homepages + include articles + include admin_anonymous diff --git a/.ddev/config.yaml b/.ddev/config.yaml new file mode 100644 index 00000000..ff193b8a --- /dev/null +++ b/.ddev/config.yaml @@ -0,0 +1,207 @@ +name: api +type: drupal9 +docroot: web +php_version: "8.1" +webserver_type: nginx-fpm +router_http_port: "8000" +router_https_port: "8443" +xdebug_enabled: false +additional_hostnames: [] +additional_fqdns: [] +database: + type: mariadb + version: "10.3" +nfs_mount_enabled: false +mutagen_enabled: false +use_dns_when_possible: true +composer_version: "2" +web_environment: [] +nodejs_version: "16" + +# Key features of ddev's config.yaml: + +# name: # Name of the project, automatically provides +# http://projectname.ddev.site and https://projectname.ddev.site + +# type: # drupal6/7/8, backdrop, typo3, wordpress, php + +# docroot: # Relative path to the directory containing index.php. + +# php_version: "7.4" # PHP version to use, "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1" + +# You can explicitly specify the webimage but this +# is not recommended, as the images are often closely tied to ddev's' behavior, +# so this can break upgrades. + +# webimage: # nginx/php docker image. + +# database: +# type: # mysql, mariadb +# version: # database version, like "10.3" or "8.0" +# Note that mariadb_version or mysql_version from v1.18 and earlier +# will automatically be converted to this notation with just a "ddev config --auto" + +# router_http_port: # Port to be used for http (defaults to port 80) +# router_https_port: # Port for https (defaults to 443) + +# xdebug_enabled: false # Set to true to enable xdebug and "ddev start" or "ddev restart" +# Note that for most people the commands +# "ddev xdebug" to enable xdebug and "ddev xdebug off" to disable it work better, +# as leaving xdebug enabled all the time is a big performance hit. + +# xhprof_enabled: false # Set to true to enable xhprof and "ddev start" or "ddev restart" +# Note that for most people the commands +# "ddev xhprof" to enable xhprof and "ddev xhprof off" to disable it work better, +# as leaving xhprof enabled all the time is a big performance hit. + +# webserver_type: nginx-fpm # or apache-fpm + +# timezone: Europe/Berlin +# This is the timezone used in the containers and by PHP; +# it can be set to any valid timezone, +# see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones +# For example Europe/Dublin or MST7MDT + +# composer_root: +# Relative path to the composer root directory from the project root. This is +# the directory which contains the composer.json and where all Composer related +# commands are executed. + +# composer_version: "2" +# if composer_version:"2" it will use the most recent composer v2 +# It can also be set to "1", to get most recent composer v1 +# or "" for the default v2 created at release time. +# It can be set to any existing specific composer version. +# After first project 'ddev start' this will not be updated until it changes + +# nodejs_version: "16" +# change from the default system Node.js version to another supported version, like 12, 14, 17. +# Note that you can use 'ddev nvm' or nvm inside the web container to provide nearly any +# Node.js version, including v6, etc. + +# additional_hostnames: +# - somename +# - someothername +# would provide http and https URLs for "somename.ddev.site" +# and "someothername.ddev.site". + +# additional_fqdns: +# - example.com +# - sub1.example.com +# would provide http and https URLs for "example.com" and "sub1.example.com" +# Please take care with this because it can cause great confusion. + +# upload_dir: custom/upload/dir +# would set the destination path for ddev import-files to /custom/upload/dir + +# working_dir: +# web: /var/www/html +# db: /home +# would set the default working directory for the web and db services. +# These values specify the destination directory for ddev ssh and the +# directory in which commands passed into ddev exec are run. + +# omit_containers: [db, dba, ddev-ssh-agent] +# Currently only these containers are supported. Some containers can also be +# omitted globally in the ~/.ddev/global_config.yaml. Note that if you omit +# the "db" container, several standard features of ddev that access the +# database container will be unusable. In the global configuration it is also +# possible to omit ddev-router, but not here. + +# nfs_mount_enabled: false +# Great performance improvement but requires host configuration first. +# See https://ddev.readthedocs.io/en/stable/users/performance/#using-nfs-to-mount-the-project-into-the-container + +# mutagen_enabled: false +# Experimental performance improvement using mutagen asynchronous updates. +# See https://ddev.readthedocs.io/en/latest/users/performance/#using-mutagen + +# fail_on_hook_fail: False +# Decide whether 'ddev start' should be interrupted by a failing hook + +# host_https_port: "59002" +# The host port binding for https can be explicitly specified. It is +# dynamic unless otherwise specified. +# This is not used by most people, most people use the *router* instead +# of the localhost port. + +# host_webserver_port: "59001" +# The host port binding for the ddev-webserver can be explicitly specified. It is +# dynamic unless otherwise specified. +# This is not used by most people, most people use the *router* instead +# of the localhost port. + +# host_db_port: "59002" +# The host port binding for the ddev-dbserver can be explicitly specified. It is dynamic +# unless explicitly specified. + +# phpmyadmin_port: "8036" +# phpmyadmin_https_port: "8037" +# The PHPMyAdmin ports can be changed from the default 8036 and 8037 + +# host_phpmyadmin_port: "8036" +# The phpmyadmin (dba) port is not normally bound on the host at all, instead being routed +# through ddev-router, but it can be specified and bound. + +# mailhog_port: "8025" +# mailhog_https_port: "8026" +# The MailHog ports can be changed from the default 8025 and 8026 + +# host_mailhog_port: "8025" +# The mailhog port is not normally bound on the host at all, instead being routed +# through ddev-router, but it can be bound directly to localhost if specified here. + +# webimage_extra_packages: [php7.4-tidy, php-bcmath] +# Extra Debian packages that are needed in the webimage can be added here + +# dbimage_extra_packages: [telnet,netcat] +# Extra Debian packages that are needed in the dbimage can be added here + +# use_dns_when_possible: true +# If the host has internet access and the domain configured can +# successfully be looked up, DNS will be used for hostname resolution +# instead of editing /etc/hosts +# Defaults to true + +# project_tld: ddev.site +# The top-level domain used for project URLs +# The default "ddev.site" allows DNS lookup via a wildcard +# If you prefer you can change this to "ddev.local" to preserve +# pre-v1.9 behavior. + +# ngrok_args: --subdomain mysite --auth username:pass +# Provide extra flags to the "ngrok http" command, see +# https://ngrok.com/docs#http or run "ngrok http -h" + +# disable_settings_management: false +# If true, ddev will not create CMS-specific settings files like +# Drupal's settings.php/settings.ddev.php or TYPO3's AdditionalConfiguration.php +# In this case the user must provide all such settings. + +# You can inject environment variables into the web container with: +# web_environment: +# - SOMEENV=somevalue +# - SOMEOTHERENV=someothervalue + +# no_project_mount: false +# (Experimental) If true, ddev will not mount the project into the web container; +# the user is responsible for mounting it manually or via a script. +# This is to enable experimentation with alternate file mounting strategies. +# For advanced users only! + +# bind_all_interfaces: false +# If true, host ports will be bound on all network interfaces, +# not just the localhost interface. This means that ports +# will be available on the local network if the host firewall +# allows it. + +# Many ddev commands can be extended to run tasks before or after the +# ddev command is executed, for example "post-start", "post-import-db", +# "pre-composer", "post-composer" +# See https://ddev.readthedocs.io/en/stable/users/extending-commands/ for more +# information on the commands that can be extended and the tasks you can define +# for them. Example: +#hooks: +# post-import-db: +# - exec: drush cr +# - exec: drush updb diff --git a/.ddev/providers/platform.yaml b/.ddev/providers/platform.yaml new file mode 100755 index 00000000..19ce7501 --- /dev/null +++ b/.ddev/providers/platform.yaml @@ -0,0 +1,63 @@ +#ddev-generated +# Example Platform.sh provider configuration. + +# To use this configuration, + +# 1. Check out the site from platform.sh and then configure it with `ddev config`. You'll want to use `ddev start` and make sure the basic functionality is working. +# 2. Obtain and configure an API token. +# a. Login to the Platform.sh Dashboard and go to Account->API Tokens to create an API token for ddev to use. +# b. Add the API token to the `web_environment` section in your global ddev configuration at ~/.ddev/global_config.yaml: +# ```yaml +# web_environment: +# - PLATFORMSH_CLI_TOKEN=abcdeyourtoken +# ``` +# 3. `ddev restart` +# 4. Obtain your project id with `ddev exec platform`. The platform tool should show you all the information about your account and project. +# 5. In your project's .ddev/providers directory, copy platform.yaml.example to platform.yaml and edit the `project_id` and `environment_name`. +# 6. Run `ddev pull platform`. After you agree to the prompt, the current upstream database and files will be downloaded. +# 7. Optionally use `ddev push platform` to push local files and database to platform.sh. Note that `ddev push` is a command that can potentially damage your production site, so this is not recommended. + +# Debugging: Use `ddev exec platform` to see what platform.sh knows about +# your configuration and whether it's working correctly. + +environment_variables: + project_id: yourproject + environment: main + application: drupal + +auth_command: + command: | + set -eu -o pipefail + if [ -z "${PLATFORMSH_CLI_TOKEN:-}" ]; then echo "Please make sure you have set PLATFORMSH_CLI_TOKEN in ~/.ddev/global_config.yaml" && exit 1; fi + +db_pull_command: + command: | + set -x # You can enable bash debugging output by uncommenting + set -eu -o pipefail + ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible + platform db:dump --yes --gzip --file=/var/www/html/.ddev/.downloads/db.sql.gz --project="${project_id}" --environment="${environment}" --app="${application}" + +files_pull_command: + command: | + set -x # You can enable bash debugging output by uncommenting + set -eu -o pipefail + ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible + platform mount:download --yes --quiet --project="${project_id}" --environment="${environment}" --app="${application}" --mount=web/sites/default/files --target=/var/www/html/.ddev/.downloads/files + + +# push is a dangerous command. If not absolutely needed it's better to delete these lines. +db_push_command: + command: | + set -x # You can enable bash debugging output by uncommenting + set -eu -o pipefail + ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible + pushd /var/www/html/.ddev/.downloads >/dev/null; + gzip -dc db.sql.gz | platform db:sql --project="${project_id}" --environment="${environment}" + +# push is a dangerous command. If not absolutely needed it's better to delete these lines. +files_push_command: + command: | + set -x # You can enable bash debugging output by uncommenting + set -eu -o pipefail + ls "${DDEV_FILES_DIR}" >/dev/null # This just refreshes stale NFS if possible + platform mount:upload --yes --quiet --project="${project_id}" --environment="${environment}" --source="${DDEV_FILES_DIR}" --mount=web/sites/default/files diff --git a/.editorconfig b/.editorconfig index 686c443c..76b0d7c0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,3 +15,6 @@ insert_final_newline = true [composer.{json,lock}] indent_size = 4 + +[.platform.app.yaml] +indent_size = 4 diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml new file mode 100644 index 00000000..604f31cd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -0,0 +1,72 @@ +name: Bug report +description: If you've found a problem with the template, let us know so that we can update it for everyone. +labels: + - 'bug' +body: + - type: markdown + attributes: + value: | + Thanks for your interest in helping improve the Platform.sh templates! + Please fill in the fields below so we can understand what's going wrong. + + - type: textarea + attributes: + label: Describe the bug + description: A clear and concise description of what the bug is. + placeholder: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum eleifend diam non condimentum tincidunt. Vestibulum convallis eget ante dapibus eleifend. + validations: + required: true + + - type: textarea + attributes: + label: Include some logs + description: Any logs you can include will help us investigate the issue. + placeholder: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum eleifend diam non condimentum tincidunt. Vestibulum convallis eget ante dapibus eleifend. + validations: + required: true + + - type: textarea + attributes: + label: Reproducing + description: Help us reproduce what you're seeing. + placeholder: | + Steps to reproduce the behavior: + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + validations: + required: true + + - type: textarea + attributes: + label: Expected behavior + description: A clear and concise description of what you expected to happen. + placeholder: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum eleifend diam non condimentum tincidunt. Vestibulum convallis eget ante dapibus eleifend. + validations: + required: true + + - type: textarea + attributes: + label: Your environment + description: Give us as many details as you can about your environment, whether that's on Platform.sh (your configuration YAMLs), or locally (your OS, services, and local development tool). + placeholder: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum eleifend diam non condimentum tincidunt. Vestibulum convallis eget ante dapibus eleifend. + validations: + required: true + + - type: textarea + attributes: + label: Screenshots + description: If applicable, add screenshots to help explain your problem. + placeholder: A picture's worth a thousand words... + validations: + required: false + + - type: textarea + attributes: + label: Additional context + description: Optionally add any other information or screenshots that could help us understand and implement the change. + placeholder: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum eleifend diam non condimentum tincidunt. Vestibulum convallis eget ante dapibus eleifend. + validations: + required: false + \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yaml b/.github/ISSUE_TEMPLATE/config.yaml new file mode 100644 index 00000000..6391f6f4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yaml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Community Support + url: https://community.platform.sh/ + about: Please ask and answer questions here. + - name: Join us on Slack + url: https://chat.platform.sh/ + about: Ping the `@devrel_team`! diff --git a/.github/ISSUE_TEMPLATE/improvements.yaml b/.github/ISSUE_TEMPLATE/improvements.yaml new file mode 100644 index 00000000..0ba3aa5c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/improvements.yaml @@ -0,0 +1,41 @@ +name: Feature request +description: For changes to improve this template. +labels: + - 'feature request' +body: + - type: markdown + attributes: + value: | + Thanks for your interest in helping improve the Platform.sh templates! + Please fill in the fields below so we can understand what changes you'd like to see. + + - type: textarea + attributes: + label: What in this template can be improved or added as a feature? + description: Is your feature request related to a problem? Please describe. + placeholder: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + validations: + required: true + + - type: textarea + attributes: + label: What exactly should be updated? + description: | + - Share as much detail as you can to help us understand the suggestion. + - What do you expect as an outcome? + validations: + required: true + + - type: textarea + attributes: + label: How important is this feature to you? + description: Does this template lacking this feature block your work? + validations: + required: true + + - type: textarea + attributes: + label: Additional context + description: Optionally add any other information or screenshots that could help us understand and implement the change. + validations: + required: false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..b41bea1c --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,34 @@ +## Description +Please describe your changes in detail according to the information below + +## Related Issue +This project only accepts pull requests related to open issues. +- If suggesting a new feature or change, please discuss it in an issue first +- If fixing a bug, there should be an issue describing it with steps to reproduce it following the bug report guide +- If you're suggesting a feature, please follow the feature request guide by clicking on issues + +### Please drop a link to the issue here: + +## Motivation and Context +Why is this change required? What problem does it solve? + +## How Has This Been Tested? +Please describe in detail how you tested your changes. Include details of your testing environment, and the tests you ran to see how your change affects other areas of the code, etc. + +## Screenshots (if appropriate): + +## Types of changes +What types of changes does your code introduce? Put an `x` in all the boxes that apply: + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) + +## Checklist: + Go over all the following list, and put an `x` in all the boxes that apply. If you're unsure about what any of these mean, don't hesitate to ask. We're here to help! + +- [ ] I have read the contribution guide +- [ ] I have created an issue following the issue guide +- [ ] My code follows the code style of this project. +- [ ] My change requires a change to the documentation. +- [ ] I have updated the documentation accordingly. diff --git a/.lando.upstream.yml b/.lando.upstream.yml index 7df100db..09b952be 100644 --- a/.lando.upstream.yml +++ b/.lando.upstream.yml @@ -20,9 +20,9 @@ config: overrides: app: variables: - d8config: + drupalconfig: "system.file:path:temporary": "/tmp" - d8settings: + drupalsettings: "skip_permissions_hardening": 1 diff --git a/.platform.app.yaml b/.platform.app.yaml index b65f0b76..f9f48cc6 100644 --- a/.platform.app.yaml +++ b/.platform.app.yaml @@ -4,10 +4,10 @@ # See https://docs.platform.sh/configuration/app.html # The name of this app. Must be unique within a project. -name: 'app' +name: 'drupal' # The runtime the application uses. -type: 'php:8.1' +type: 'php:8.0' dependencies: php: @@ -18,6 +18,8 @@ runtime: extensions: - redis - sodium + - apcu + - blackfire # The relationships of the application with services or other applications. # @@ -64,7 +66,6 @@ mounts: # Configuration of the build of this application. build: - # Automatically run `composer install` on every build. flavor: composer # The hooks executed at various points in the lifecycle of the application. diff --git a/.platform/routes.yaml b/.platform/routes.yaml index 425c9629..69ba2fcd 100644 --- a/.platform/routes.yaml +++ b/.platform/routes.yaml @@ -5,7 +5,7 @@ "https://{default}/": type: upstream - upstream: "app:http" + upstream: "drupal:http" cache: enabled: true diff --git a/README.md b/README.md index 9debdb57..a3ca2039 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,788 @@ -# Drupal 9 for Platform.sh + +

+ + + +

- - Deploy on Platform.sh + +

-This template builds Drupal 9 using the "Drupal Recommended" Composer project. It is pre-configured to use MariaDB and Redis for caching. The Drupal installer will skip asking for database credentials as they are already provided. +

Deploy Drupal 9 on Platform.sh

+ +

+Contribute, request a feature, or check out our resources +
+
+Join our community       +Documentation       +Blog       +Report a bug       +Request a feature +

+

+ +

+ +Open issues +   + +Open PRs +   + +License +   +

+ +

+

+ +
+ +

+Contents +

+About       +Getting started       +Migrate       +Learn       +Contribute       +
+

+
+ +## About + +This template builds Drupal 9 using the "Drupal Recommended" Composer project. It is pre-configured to use MariaDB and Redis for caching. The Drupal installer will skip asking for database credentials as they are already provided. Drupal is a flexible and extensible PHP-based CMS framework. -## Features +### Features + +- PHP 8.0 +- MariaDB 10.4 +- Redis 6 +- Drush included +- Automatic TLS certificates +- Composer-based build + + +## Getting started + +### Deploy + +#### Quickstart + + +The quickest way to deploy this template on Platform.sh is by clicking the button below. +This will automatically create a new project and initialize the repository for you. + +

+ + Deploy on Platform.sh + +

+
+ + +#### Other deployment options + +For all of the other options below, clone this repository first: + +```bash +git clone https://github.com/platformsh-templates/drupal9 +``` + +If you're trying to deploy from GitHub, you can generate a copy of this repository first in your own namespace by clicking the [Use this template](https://github.com/platformsh-templates/drupal9/generate) button at the top of this page. + +Then you can clone a copy of it locally with `git clone git@github.com:YOUR_NAMESPACE/drupal9.git`. + + +
+Deploy directly to Platform.sh from the command line + + +1. Create a free trial: + + [Register for a 30 day free trial with Platform.sh](https://auth.api.platform.sh/register). When you have completed signup, select the **Create from scratch** project option. Give you project a name, and select a region where you would like it to be deployed. As for the *Production environment* option, make sure to match it to this repository's settings, or to what you have updated the default branch to locally. + +1. Install the Platform.sh CLI + + #### Linux/OSX + + ```bash + curl -sS https://platform.sh/cli/installer | php + ``` + + #### Windows + + ```bash + curl -f https://platform.sh/cli/installer -o cli-installer.php + php cli-installer.php + ``` + + You can verify the installation by logging in (`platformsh login`) and listing your projects (`platform project:list`). + +1. Set the project remote + + Find your `PROJECT_ID` by running the command `platform project:list` + + ```bash + +---------------+------------------------------------+------------------+---------------------------------+ + | ID | Title | Region | Organization | + +---------------+------------------------------------+------------------+---------------------------------+ + | PROJECT_ID | Your Project Name | xx-5.platform.sh | your-username | + +---------------+------------------------------------+------------------+---------------------------------+ + ``` + + Then from within your local copy, run the command `platform project:set-remote PROJECT_ID`. + +1. Push + + ```bash + git push platform DEFAULT_BRANCH + ``` + + +
+ +
+Integrate with a GitHub repo and deploy pull requests + + +1. Create a free trial: + + [Register for a 30 day free trial with Platform.sh](https://auth.api.platform.sh/register). When you have completed signup, select the **Create from scratch** project option. Give you project a name, and select a region where you would like it to be deployed. As for the *Production environment* option, make sure to match it to whatever you have set at `https://YOUR_NAMESPACE/nextjs-drupal`. + +1. Install the Platform.sh CLI + + #### Linux/OSX + + ```bash + curl -sS https://platform.sh/cli/installer | php + ``` + + #### Windows + + ```bash + curl -f https://platform.sh/cli/installer -o cli-installer.php + php cli-installer.php + ``` + + You can verify the installation by logging in (`platformsh login`) and listing your projects (`platform project:list`). + +1. Setup the integration: + + Consult the [GitHub integration documentation](https://docs.platform.sh/integrations/source/github.html#setup) to finish connecting your repository to a project on Platform.sh. You will need to create an Access token on GitHub to do so. + + +
+ +
+Integrate with a GitLab repo and deploy merge requests + + +1. Create a free trial: + + [Register for a 30 day free trial with Platform.sh](https://auth.api.platform.sh/register). When you have completed signup, select the **Create from scratch** project option. Give you project a name, and select a region where you would like it to be deployed. As for the *Production environment* option, make sure to match it to this repository's settings, or to what you have updated the default branch to locally. + +1. Install the Platform.sh CLI + + #### Linux/OSX + + ```bash + curl -sS https://platform.sh/cli/installer | php + ``` + + #### Windows + + ```bash + curl -f https://platform.sh/cli/installer -o cli-installer.php + php cli-installer.php + ``` + + You can verify the installation by logging in (`platformsh login`) and listing your projects (`platform project:list`). + +1. Create the repository -* PHP 8.1 -* MariaDB 10.4 -* Redis 5 -* Drush included -* Automatic TLS certificates -* Composer-based build + Create a new repository on GitLab, set it as a new remote for your local copy, and push to the default branch. -## Post-install +1. Setup the integration: + + Consult the [GitLab integration documentation](https://docs.platform.sh/integrations/source/gitlab.html#setup) to finish connecting a repository to a project on Platform.sh. You will need to create an Access token on GitLab to do so. + + +
+ +
+Integrate with a Bitbucket repo and deploy pull requests + + +1. Create a free trial: + + [Register for a 30 day free trial with Platform.sh](https://auth.api.platform.sh/register). When you have completed signup, select the **Create from scratch** project option. Give you project a name, and select a region where you would like it to be deployed. As for the *Production environment* option, make sure to match it to this repository's settings, or to what you have updated the default branch to locally. + +1. Install the Platform.sh CLI + + #### Linux/OSX + + ```bash + curl -sS https://platform.sh/cli/installer | php + ``` + + #### Windows + + ```bash + curl -f https://platform.sh/cli/installer -o cli-installer.php + php cli-installer.php + ``` + + You can verify the installation by logging in (`platformsh login`) and listing your projects (`platform project:list`). + +1. Create the repository + + Create a new repository on Bitbucket, set it as a new remote for your local copy, and push to the default branch. + +1. Setup the integration: + + Consult the [Bitbucket integration documentation](https://docs.platform.sh/integrations/source/bitbucket.html#setup) to finish connecting a repository to a project on Platform.sh. You will need to create an Access token on Bitbucket to do so. + + +
+ + + +### Post-install Run through the Drupal installer as normal. You will not be asked for database credentials as those are already provided. -## Customizations +### Local development + +This section provides instructions for running the `drupal9` template locally, connected to a live database instance on an active Platform.sh environment. + +In all cases for developing with Platform.sh, it's important to develop on an isolated environment - do not connect to data on your production environment when developing locally. +Each of the options below assume that you have already deployed this template to Platform.sh, as well as the following starting commands: + +```bash +$ platform get PROJECT_ID +$ cd project-name +$ platform environment:branch updates +``` + +
+Drupal: using ddev
+ +ddev provides an integration with Platform.sh that makes it simple to develop Drupal locally. Check the [providers documentation](https://ddev.readthedocs.io/en/latest/users/providers/platform/) for the most up-to-date information. + +In general, the steps are as follows: + +1. [Install ddev](https://ddev.readthedocs.io/en/stable/#installation). +1. A configuration file has already been provided at `.ddev/providers/platform.yaml`, so you should not need to run `ddev config`. +1. [Retrieve an API token](https://docs.platform.sh/development/cli/api-tokens.html#get-a-token) for your organization via the management console. +1. Update your dedev global configuration file to use the token you've just retrieved: + ```yaml + web_environment: + - PLATFORMSH_CLI_TOKEN=abcdeyourtoken` + ``` +1. Run `ddev restart`. +1. Get your project ID with `platform project:info`. If you have not already connected your local repo with the project (as is the case with a source integration, by default), you can run `platform project:list` to locate the project ID, and `platform project:set-remote PROJECT_ID` to configure Platform.sh locally. +1. Update the `.ddev/providers/platform.yaml` file for your current setup: + ```yaml + environment_variables: + project_id: PROJECT_ID + environment: CURRENT_ENVIRONMENT + application: drupal + ``` +1. Get the current environment's data with `ddev pull platform`. +1. When you have finished with your work, run `ddev stop` and `ddev poweroff`. + +
+
+Drupal: using Lando
+ +Lando supports PHP applications [configured to run on Platform.sh](https://docs.platform.sh/development/local/lando.html), and pulls from the same container registry Platform.sh uses on your remote environments during your local builds through its own [recipe and plugin](https://docs.lando.dev/platformsh/). + +1. [Install Lando](https://docs.lando.dev/getting-started/installation.html). +1. Make sure Docker is already running - Lando will attempt to start Docker for you, but it's best to have it running in the background before beginning. +1. Start your apps and services with the command `lando start`. +1. To get up-to-date data from your Platform.sh environment ([services *and* mounts](https://docs.lando.dev/platformsh/sync.html#pulling)), run the command `lando pull`. +1. If at any time you have updated your Platform.sh configuration files, run the command `lando rebuild`. +1. When you have finished with your work, run `lando stop` and `lando poweroff`. + +
+ + + +> **Note:** +> +> For many of the steps above, you may need to include the CLI flags `-p PROJECT_ID` and `-e ENVIRONMENT_ID` if you are not in the project directory or if the environment is associated with an existing pull request. + + +## Migrate + +The steps below outline the important steps for migrating your application to Platform.sh - adding the required configuration files and dependencies, for example. +Not every step will be applicable to each person's migration. +These steps actually assume the earliest starting point possible - that there is no code at all locally, and that this template repository will be rebuilt completely from scratch. + +- [Getting started](#getting-started-1) +- [Adding and updating files](#adding-and-updating-files) +- [Dependencies](#dependencies) +- [Deploying to Platform.sh](#deploying-to-platformsh) +- [Migrating your data](#migrating-your-data) +- [Next steps](#next-steps) + +If you already have code you'd like to migrate, feel free to focus on the steps most relevant to your application and skip the first section. + +### Getting started + +Assuming that your starting point is no local code, the steps below will setup a starting repository we can begin to make changes to to rebuild this template and migrate to Platform.sh. +If you already have a codebase you are trying to migrate, move onto the next step - [Adding and updating files](#adding-and-updating-files) - and substitute any reference to the default branch `main` with some other branch name. + + + +```bash +$ mkdir drupal9 && cd drupal9 +$ git init +$ git remote add upstream https://github.com/drupal/recommended-project.git +$ git branch -m main +$ git fetch --all --depth=2 +$ git fetch --all --tags +$ git merge --allow-unrelated-histories -X theirs 9.3.9 + +``` + + + +### Adding and updating files + +A small number of files need to be added to or modified in your repository at this point. +Some of them explicitly configure how the application is built and deployed on Platform.sh, while others simply modify files you may already have locally, in which case you will need to replicate those changes. + +Open the dropdown below to view all of the **Added** and **Updated** files you'll need to reproduce in your migration. + +
+View files
+ + + +| File | Purpose | +|:-----------|:--------| +| [`config/sync/.gitkeep`](config/sync/.gitkeep) | **Added** | +| [`web/sites/default/settings.php`](web/sites/default/settings.php) | **Updated:**

The Drupal settings file has been updated to import and use `web/sites/default/settings.platformsh.php`. | +| [`web/sites/default/settings.platformsh.php`](web/sites/default/settings.platformsh.php) | **Added:**

Contains Platform.sh-specific configuration, namely setting up the database connection to the MariaDB service and caching via Redis. | +| [`.environment`](.environment) | **Added:**

The `.environment` file is a convenient place to [set environment variables](https://docs.platform.sh/development/variables/set-variables.html#set-variables-via-script) relevant to your applications that may be dependent on the current environment. It is sourced before the start command is run, as the first step in the `deploy` and `post_deploy` hooks, and at the beginning of each session when you SSH into an application container. It is written in dash, so be aware of the differences to bash.

It can be used to set any environment variable, including ones that depend on Platform.sh-provided variables like `PLATFORM_RELATIONSHIPS` and `PLATFORM_ROUTES`, or to modify `PATH`. This file should not [produce output](https://docs.platform.sh/development/variables/set-variables.html#testing-environment-scripts).

Here, the Composer config and `PATH` are updated to allow executable app dependencies from Composer to be run from the path (i.e. `drush`). | +| [`.gitignore`](.gitignore) | **Added:**

A `.gitignore` file is not included in the upstream, so one has been added. | +| [`.platform.app.yaml`](.platform.app.yaml) | **Added:**

This file is required to define the build and deploy process for all application containers on Platform.sh. Within this file, the runtime version, relationships to service containers, and writable mounts are configured. It's also in this file that it is defined what dependencies are installed, when they are installed, and that package manager will be used to do so.

Take a look at the [Application](https://docs.platform.sh/configuration/app.html) documentation for more details about configuration. For more information about the sequence of events that lead from a build to deployment, see the [Build and deploy timeline documentation](https://docs.platform.sh/overview/build-deploy.html).

This template uses Composer 2 to install dependencies using the default `composer` [build flavor](https://docs.platform.sh/languages/php.html#build-flavor) prior to the `build` hook. Drush tasks are run during the `deploy` hook, and referenced again during the defined `cron` job. | +| [`drush/platformsh_generate_drush_yml.php`](drush/platformsh_generate_drush_yml.php) | **Added:**

This file has been included to generate the drush yaml configuration on every deployment. | +| [`.platform/services.yaml`](.platform/services.yaml) | **Added:**

Platform.sh provides a number of on-demand managed services that can easily be added to your projects. It's within this file that each service's version, name, resources, and additional configuration are set. See the [Services documentation](https://docs.platform.sh/configuration/services.html) for more details on configuration, version and service availability.

In this template, MariaDB and Redis have been configured. | +| [`.platform/routes.yaml`](.platform/routes.yaml) | **Added:**

This file is require to deploy on Platform.sh, as it defines how requests should be handled on the platform. It's within this file that redirects and basic caching can be configured. See the [Routes documentation](https://docs.platform.sh/configuration/routes.html) for more configuration details.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec molestie mauris ut magna laoreet tempor. | +| [`php.ini`](php.ini) | **Added:**

An initial `php.ini` file has also beed added. The settings are a result of performance testing and best practice recommendations coming from [Blackfire.io](https://blackfire.io). They will initialize Drupal with a number of good baseline performance settings for production applications, and complement many of the tests specified in [`.blackfire.yml`](.blackfire.yml). | +| [`.blackfire.yml`](.blackfire.yml) | **Added:**

This file has been added to help you get started using [Blackfire.io](https://blackfire.io) on your project. See [the Blackfire section below](#blackfireio-creating-a-continuous-observability-strategy) for more information on how to get started. | +| [`.lando.upstream.yml`](.lando.upstream.yml) | **Added:**

This file configures [Lando](https://docs.platform.sh/development/local/lando.html) as a local development option for this template. See the [Platform.sh Lando plugin documentation](https://docs.lando.dev/platformsh/) for more information about configuration and the [Local development](#local-development) section of this README for how to get started. | +| [`.ddev/providers/platform.yaml`](.ddev/providers/platform.yaml) | **Added:**

This file configures [ddev](https://ddev.readthedocs.io/en/latest/users/providers/platform/) as a local development option for this template. See the [Platform.sh ddev integration documentation](https://ddev.readthedocs.io/en/latest/users/providers/platform/) for more information about configuration and the [Local development](#local-development) section of this README for how to get started. Be sure to follow the instructions provided through the ddev CLI and in the comments section of that file to correctly configure ddev for your project. | + + + +
+ +### Dependencies and configuration + +Sometimes it is necessary to install additional dependencies to and modify the configuration of an upstream project to deploy on Platform.sh. +When it is, we do our best to keep these modifications to the minimum necessary. +Run the commands below to reproduce the dependencies in this template. + + + +```bash +$ composer require platformsh/config-reader drush/drush drupal/redis +$ composer config allow-plugins.composer/installers true --no-plugins +$ composer config allow-plugins.drupal/core-composer-scaffold true --no-plugins +$ composer config allow-plugins.drupal/core-project-message true --no-plugins +$ composer config allow-plugins.cweagans/composer-patches true --no-plugins + +``` + + + +### Deploying to Platform.sh + +Your repository now has all of the code it needs in order to deploy to Platform.sh. + + +
+Deploy directly to Platform.sh from the command line + + +1. Create a free trial: -The following changes have been made relative to Drupal 9 "Recommended" project as it is downloaded from Drupal.org or Packagist. If using this project as a reference for your own existing project, replicate the changes below to your project. + [Register for a 30 day free trial with Platform.sh](https://auth.api.platform.sh/register). When you have completed signup, select the **Create from scratch** project option. Give you project a name, and select a region where you would like it to be deployed. As for the *Production environment* option, make sure to match it to this repository's settings, or to what you have updated the default branch to locally. -* The `.platform.app.yaml`, `.platform/services.yaml`, and `.platform/routes.yaml` files have been added. These provide Platform.sh-specific configuration and are present in all projects on Platform.sh. You may customize them as you see fit. -* An additional Composer library, [`platformsh/config-reader`](https://github.com/platformsh/config-reader-php), has been added. It provides convenience wrappers for accessing the Platform.sh environment variables. -* Drush and Drupal Console have been pre-included in `composer.json`. You are free to remove one or both if you do not wish to use them. (Note that the default cron and deploy hooks make use of Drush commands, however.) -* A `.environment` file has been added, which allows executable app dependencies from Composer to be run from the path. -* The Drupal Redis module comes pre-installed. The placeholder module is not pre-installed, but it is enabled via `settings.platformsh.php` out of the box. -* The `settings.platformsh.php` file contains Platform.sh-specific code to map environment variables into Drupal configuration. You can add to it as needed. See the documentation for more examples of common snippets to include here. It uses the Config Reader library. -* The `settings.php` file has been heavily customized to only define those values needed for both Platform.sh and local development. It calls out to `settings.platformsh.php` if available. You can add additional values as documented in `default.settings.php` as desired. It is also setup such that when you install Drupal on Platform.sh the installer will not ask for database credentials as they will already be defined. +1. Install the Platform.sh CLI -## Migration + #### Linux/OSX -If you are looking to replicate the changes in this template to migrate your own Drupal 9 project, be sure to checkout the [Deploying Drupal 9 guide](https://docs.platform.sh/guides/drupal9/deploy.html) in the documentation as a reference. + ```bash + curl -sS https://platform.sh/cli/installer | php + ``` -## References + #### Windows + + ```bash + curl -f https://platform.sh/cli/installer -o cli-installer.php + php cli-installer.php + ``` + + You can verify the installation by logging in (`platformsh login`) and listing your projects (`platform project:list`). + +1. Set the project remote + + Find your `PROJECT_ID` by running the command `platform project:list` + + ```bash + +---------------+------------------------------------+------------------+---------------------------------+ + | ID | Title | Region | Organization | + +---------------+------------------------------------+------------------+---------------------------------+ + | PROJECT_ID | Your Project Name | xx-5.platform.sh | your-username | + +---------------+------------------------------------+------------------+---------------------------------+ + ``` + + Then from within your local copy, run the command `platform project:set-remote PROJECT_ID`. + +1. Push + + ```bash + git push platform DEFAULT_BRANCH + ``` + + +
+ +
+Integrate with a GitHub repo and deploy pull requests + + +1. Create a free trial: + + [Register for a 30 day free trial with Platform.sh](https://auth.api.platform.sh/register). When you have completed signup, select the **Create from scratch** project option. Give you project a name, and select a region where you would like it to be deployed. As for the *Production environment* option, make sure to match it to whatever you have set at `https://YOUR_NAMESPACE/nextjs-drupal`. + +1. Install the Platform.sh CLI + + #### Linux/OSX + + ```bash + curl -sS https://platform.sh/cli/installer | php + ``` + + #### Windows + + ```bash + curl -f https://platform.sh/cli/installer -o cli-installer.php + php cli-installer.php + ``` + + You can verify the installation by logging in (`platformsh login`) and listing your projects (`platform project:list`). + +1. Setup the integration: + + Consult the [GitHub integration documentation](https://docs.platform.sh/integrations/source/github.html#setup) to finish connecting your repository to a project on Platform.sh. You will need to create an Access token on GitHub to do so. + + +
+ +
+Integrate with a GitLab repo and deploy merge requests + + +1. Create a free trial: + + [Register for a 30 day free trial with Platform.sh](https://auth.api.platform.sh/register). When you have completed signup, select the **Create from scratch** project option. Give you project a name, and select a region where you would like it to be deployed. As for the *Production environment* option, make sure to match it to this repository's settings, or to what you have updated the default branch to locally. + +1. Install the Platform.sh CLI + + #### Linux/OSX + + ```bash + curl -sS https://platform.sh/cli/installer | php + ``` + + #### Windows + + ```bash + curl -f https://platform.sh/cli/installer -o cli-installer.php + php cli-installer.php + ``` + + You can verify the installation by logging in (`platformsh login`) and listing your projects (`platform project:list`). + +1. Create the repository + + Create a new repository on GitLab, set it as a new remote for your local copy, and push to the default branch. + +1. Setup the integration: + + Consult the [GitLab integration documentation](https://docs.platform.sh/integrations/source/gitlab.html#setup) to finish connecting a repository to a project on Platform.sh. You will need to create an Access token on GitLab to do so. + + +
+ +
+Integrate with a Bitbucket repo and deploy pull requests + + +1. Create a free trial: + + [Register for a 30 day free trial with Platform.sh](https://auth.api.platform.sh/register). When you have completed signup, select the **Create from scratch** project option. Give you project a name, and select a region where you would like it to be deployed. As for the *Production environment* option, make sure to match it to this repository's settings, or to what you have updated the default branch to locally. + +1. Install the Platform.sh CLI + + #### Linux/OSX + + ```bash + curl -sS https://platform.sh/cli/installer | php + ``` + + #### Windows + + ```bash + curl -f https://platform.sh/cli/installer -o cli-installer.php + php cli-installer.php + ``` + + You can verify the installation by logging in (`platformsh login`) and listing your projects (`platform project:list`). + +1. Create the repository + + Create a new repository on Bitbucket, set it as a new remote for your local copy, and push to the default branch. + +1. Setup the integration: + + Consult the [Bitbucket integration documentation](https://docs.platform.sh/integrations/source/bitbucket.html#setup) to finish connecting a repository to a project on Platform.sh. You will need to create an Access token on Bitbucket to do so. + + +
+ + + +### Migrating your data + + +If you are moving an existing site to Platform.sh, then in addition to code you also need to migrate your data. That means your database and your files. + +
+Importing the database
+ +First, obtain a database dump from your current site and save your dump file as `database.sql`. Then, import the database into your Platform.sh site using the CLI: + +```bash +platform sql -e main < database.sql +``` + +
+
+Importing files
+ +You first need to download your files from your current hosting environment. +The easiest way is likely with rsync, but consult your old host's documentation. + +The `platform mount:upload` command provides a straightforward way to upload an entire directory to your site at once to a `mount` defined in a `.platform.app.yaml` file. +Under the hood, it uses an SSH tunnel and rsync, so it is as efficient as possible. +(There is also a `platform mount:download` command you can use to download files later.) +Run the following from your local Git repository root (modifying the `--source` path if needed and setting `BRANCH_NAME` to the branch you are using). + +A few examples are listed below, but repeat for all directories that contain data you would like to migrate. + +```bash +$ platform mount:upload -e main --mount web/sites/default/files --source ./web/sites/default/files +$ platform mount:upload -e main --mount private --source ./private +``` + +Note that `rsync` is picky about its trailing slashes, so be sure to include those. + +
+ + + +### Next steps + +With your application now deployed on Platform.sh, things get more interesting. +Run the command `platform environment:branch new-feature` for your project, or open a trivial pull request off of your current branch. + +The resulting environment is an *exact* copy of production. +It contains identical infrastructure to what's been defined in your configuration files, and even includes data copied from your production environment in its services. +On this isolated environment, you're free to make any changes to your application you need to, and really test how they will behave on production. + +After that, here are a collection of additional resources you might find interesting as you continue with your migration to Platform.sh: + +- [Local development](#local-development) +- [Troubleshooting](#troubleshooting) +- [Adding a domain and going live](https://docs.platform.sh/domains/steps.html) +- [(CDN) Content Delivery Networks](https://docs.platform.sh/domains/cdn.html) +- [Performance and observability with Blackfire.io](https://docs.platform.sh/integrations/observability/blackfire.html) +- [Pricing](https://docs.platform.sh/overview/pricing.html) +- [Security and compliance](https://docs.platform.sh/security.html) + + +## Learn + +### Troubleshooting + + +
+Accessing logs
+ +After the environment has finished its deployment, you can investigate issues that occured on startup, `deploy` and `post_deploy` hooks, and generally at runtime using the CLI. Run the command: + +```bash +platform ssh +``` + +If you are running the command outside of a local copy of the project, you will need to include the `-p` (project) and/or `-e` (environment) flags as well. +Once you have connected to the container, [logs](https://docs.platform.sh/development/logs.html#container-logs) are available within `/var/log/` for you to investigate. + +
+ + +
+Rebuilding cache
+ +You may run into a database error after installing Drupal on your production environment initially. +To fix, SSH into the application container (`platform ssh`) and rebuild the cache using Drush: + +```bash +drush cache-rebuild +``` + +
+ + + + + +### Blackfire.io: creating a Continuous Observability Strategy + +This template includes a starting [`.blackfire.yml`](.blackfire.yml) file that can be used to enable [Application Performance Monitoring](https://blackfire.io/docs/monitoring-cookbooks/index), [Profiling](https://blackfire.io/docs/profiling-cookbooks/index), [Builds](https://blackfire.io/docs/builds-cookbooks/index) and [Performance Testing](https://blackfire.io/docs/testing-cookbooks/index) on your project. Platform.sh comes with Blackfire pre-installed on application containers, and [setting up requires minimal configuration](https://docs.platform.sh/integrations/observability/blackfire.html). + +* [What is Blackfire?](https://blackfire.io/docs/introduction) +* [Configuring Blackfire.io on a Platform.sh project](https://docs.platform.sh/integrations/observability/blackfire.html) +* [Blackfire.io Platform.sh documentation](https://blackfire.io/docs/integrations/paas/platformsh) +* [Profiling Cookbooks](https://blackfire.io/docs/profiling-cookbooks/index) +* [Monitoring Cookbooks](https://blackfire.io/docs/monitoring-cookbooks/index) +* [Testing Cookbooks](https://blackfire.io/docs/testing-cookbooks/index) +* [Using Builds](https://blackfire.io/docs/builds-cookbooks/index) +* [Configuring Integrations](https://blackfire.io/docs/integrations/index) + + +### Resources + + +- [Drupal](https://www.drupal.org/) +- [Drupal 9 on Platform.sh](https://docs.platform.sh/guides/drupal9/deploy.html) +- [Platform.sh PHP documentation](https://docs.platform.sh/languages/php.html) + + + +### Contact + +This template is maintained by the Platform.sh Developer Relations team, and they will be notified of all issues and pull requests you open here. + +- **Community:** Share your question with the community, or see if it's already been asked on our [Community site](https://community.platform.sh). +- **Slack:** If you haven't done so already, you can join Platform.sh's [public Slack](https://chat.platform.sh/) channels and ping the `@devrel_team` with any questions. + + +### About Platform.sh + +This template has been specifically designed to deploy on Platform.sh. + +
+What is Platform.sh?
+ +Platform.sh is a unified, secure, enterprise-grade platform for building, running and scaling web applications. We’re the leader in Fleet Ops: Everything you need to manage your fleet of websites and apps is available from the start. Because infrastructure and workflows are handled from the start, apps just work, so teams can focus on what really matters: making faster changes, collaborating confidently, and scaling responsibly. Whether managing a fleet of ten or ten thousand sites and apps, Platform.sh is the Developer- preferred solution that scales right. + +Our key features include: + +* **GitOps: Git as the source of truth** + + Every branch becomes a development environment, and nothing can change without a commit. + +* **Batteries included: Managed infrastructure** + + [Simple abstraction in YAML](https://docs.platform.sh/configuration/yaml.html) for [committing and configuring infrastructure](https://docs.platform.sh/overview/structure.html), fully managed patch updates, and 24 [runtimes](https://docs.platform.sh/languages.html) & [services](https://docs.platform.sh/configuration/services.html) that can be added with a single line of code. + +* **Instant cloning: Branch, merge, repeat** + + [Reusable builds](https://docs.platform.sh/overview/build-deploy.html) and automatically inherited production data provide true staging environments - experiment in isolation, test, then destroy or merge. + +* **FleetOps: Fleet management platform** + + Leverage our public API along with custom tools like [Source Operations](https://docs.platform.sh/configuration/app/source-operations.html) and [Activity Scripts](https://docs.platform.sh/integrations/activity.html) to [manage thousands of applications](https://youtu.be/MILHG9OqhmE) - their dependency updates, fresh content, and upstream code. + + +To find out more, check out the demo below and go to our [website](https://platform.sh/product/). + +
+

+The Platform.sh demo +

+ + +
+ + + +## Contributing + +

Help us keep top-notch templates!

+ +Every one of our templates is open source, and they're important resources for users trying to deploy to Platform.sh for the first time or better understand the platform. They act as getting started guides, but also contain a number of helpful tips and best practices when working with certain languages and frameworks. + +See something that's wrong with this template that needs to be fixed? Something in the documentation unclear or missing? Let us know! + +

+How to contribute +

+Report a bug       +Submit a feature request       +Open a pull request       +
+

+
+

+Need help? +

+Ask the Platform.sh Community       +Join us on Slack       +
+

+
+

Thanks to all of our amazing contributors!

+
+

+ + + +

+ +

+Made with contrib.rocks +

-* [Drupal](https://www.drupal.org/) -* [Drupal on Platform.sh](https://docs.platform.sh/frameworks/drupal8.html) -* [PHP on Platform.sh](https://docs.platform.sh/languages/php.html) +
diff --git a/composer.json b/composer.json index 69e50570..c56d9947 100644 --- a/composer.json +++ b/composer.json @@ -1,91 +1,97 @@ { - "name": "drupal/recommended-project", - "description": "Project template for Drupal 9 projects with a relocated document root", - "type": "project", - "license": "GPL-2.0-or-later", - "homepage": "https://www.drupal.org/project/drupal", - "support": { - "docs": "https://www.drupal.org/docs/user_guide/en/index.html", - "chat": "https://www.drupal.org/node/314178" - }, - "repositories": [ - { - "type": "composer", - "url": "https://packages.drupal.org/8" - } - ], - "require": { - "composer/installers": "^1.9", - "drupal/core-composer-scaffold": "^9.3", - "drupal/core-project-message": "^9.3", - "drupal/core-recommended": "^9.3", - "drupal/redis": "^1.5", - "drush/drush": "^11.0", - "platformsh/config-reader": "^2.4" - }, - "conflict": { - "drupal/drupal": "*" + "name": "platformsh/drupal-recommended-project", + "description": "This template builds Drupal 9 for Platform.sh based the \"Drupal Recommended\" Composer project.", + "type": "project", + "license": "GPL-2.0-or-later", + "homepage": "https://www.drupal.org/project/drupal", + "support": { + "docs": "https://www.drupal.org/docs/user_guide/en/index.html", + "chat": "https://www.drupal.org/node/314178" + }, + "repositories": [ + { + "type": "composer", + "url": "https://packages.drupal.org/8" + } + ], + "require": { + "composer/installers": "^1.9", + "drupal/core-composer-scaffold": "^9.3", + "drupal/core-project-message": "^9.3", + "drupal/core-recommended": "^9.3", + "drupal/redis": "^1.5", + "drush/drush": "^11.0", + "platformsh/config-reader": "^2.4" + }, + "conflict": { + "drupal/drupal": "*" + }, + "minimum-stability": "stable", + "prefer-stable": true, + "config": { + "sort-packages": true, + "allow-plugins": { + "composer/installers": true, + "drupal/core-composer-scaffold": true, + "drupal/core-project-message": true, + "cweagans/composer-patches": true + } + }, + "extra": { + "drupal-scaffold": { + "locations": { + "web-root": "web/" + } }, - "minimum-stability": "stable", - "prefer-stable": true, - "config": { - "sort-packages": true + "installer-paths": { + "web/core": [ + "type:drupal-core" + ], + "web/libraries/{$name}": [ + "type:drupal-library" + ], + "web/modules/contrib/{$name}": [ + "type:drupal-module" + ], + "web/profiles/contrib/{$name}": [ + "type:drupal-profile" + ], + "web/themes/contrib/{$name}": [ + "type:drupal-theme" + ], + "drush/Commands/contrib/{$name}": [ + "type:drupal-drush" + ], + "web/modules/custom/{$name}": [ + "type:drupal-custom-module" + ], + "web/profiles/custom/{$name}": [ + "type:drupal-custom-profile" + ], + "web/themes/custom/{$name}": [ + "type:drupal-custom-theme" + ] }, - "extra": { - "drupal-scaffold": { - "locations": { - "web-root": "web/" - } - }, - "installer-paths": { - "web/core": [ - "type:drupal-core" - ], - "web/libraries/{$name}": [ - "type:drupal-library" - ], - "web/modules/contrib/{$name}": [ - "type:drupal-module" - ], - "web/profiles/contrib/{$name}": [ - "type:drupal-profile" - ], - "web/themes/contrib/{$name}": [ - "type:drupal-theme" - ], - "drush/Commands/contrib/{$name}": [ - "type:drupal-drush" - ], - "web/modules/custom/{$name}": [ - "type:drupal-custom-module" - ], - "web/profiles/custom/{$name}": [ - "type:drupal-custom-profile" - ], - "web/themes/custom/{$name}": [ - "type:drupal-custom-theme" - ] - }, - "drupal-core-project-message": { - "include-keys": [ - "homepage", - "support" - ], - "post-create-project-cmd-message": [ - " ", - " Congratulations, you’ve installed the Drupal codebase ", - " from the drupal/recommended-project template! ", - " ", - "", - "Next steps:", - " * Install the site: https://www.drupal.org/docs/8/install", - " * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html", - " * Get support: https://www.drupal.org/support", - " * Get involved with the Drupal community:", - " https://www.drupal.org/getting-involved", - " * Remove the plugin that prints this message:", - " composer remove drupal/core-project-message" - ] - } + "drupal-core-project-message": { + "include-keys": [ + "homepage", + "support" + ], + "post-create-project-cmd-message": [ + " ", + " Congratulations, you\u2019ve installed the Drupal codebase ", + " from the drupal/recommended-project template! ", + " ", + "", + "Next steps:", + " * Install the site: https://www.drupal.org/docs/8/install", + " * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html", + " * Get support: https://www.drupal.org/support", + " * Get involved with the Drupal community:", + " https://www.drupal.org/getting-involved", + " * Remove the plugin that prints this message:", + " composer remove drupal/core-project-message" + ] } + } } diff --git a/composer.lock b/composer.lock index 4a433917..f449f82a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2f9b1555bacdc758faafe94078d7562b", + "content-hash": "d7f37677b44a3baf1aded2f0ca5c23b9", "packages": [ { "name": "asm89/stack-cors", @@ -6538,5 +6538,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } diff --git a/drush/platformsh_generate_drush_yml.php b/drush/platformsh_generate_drush_yml.php index 19f09554..9dbb98c1 100644 --- a/drush/platformsh_generate_drush_yml.php +++ b/drush/platformsh_generate_drush_yml.php @@ -31,7 +31,7 @@ function _platformsh_drush_site_url() { return [!$a['primary'], strpos($a['url'], 'https://') !== 0, strlen($a['url'])] <=> - [!$a['primary'], strpos($a['url'], 'https://') !== 0, strlen($b['url'])]; + [!$b['primary'], strpos($b['url'], 'https://') !== 0, strlen($b['url'])]; }); // Return the url of the first one. diff --git a/header.svg b/header.svg new file mode 100644 index 00000000..9e8219f5 --- /dev/null +++ b/header.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/php.ini b/php.ini new file mode 100644 index 00000000..b731f311 --- /dev/null +++ b/php.ini @@ -0,0 +1,14 @@ +assert.active = Off +display_errors = Off +display_startup_errors = Off +max_execution_time = 30 +session.use_strict_mode = On +zend.detect_unicode = Off +opcache.memory_consumption = 128 +opcache.interned_strings_buffer = 8 +opcache.max_accelerated_files = 4000 +opcache.revalidate_freq = 60 +opcache.fast_shutdown = 1 +opcache.enable_cli = 1 +realpath_cache_ttl = 3600 +session.gc_probability = 0 diff --git a/web/sites/default/settings.platformsh.php b/web/sites/default/settings.platformsh.php index 4f1abe58..2e5e583a 100644 --- a/web/sites/default/settings.platformsh.php +++ b/web/sites/default/settings.platformsh.php @@ -128,26 +128,26 @@ $parts = explode(':', $name); list($prefix, $key) = array_pad($parts, 3, null); switch ($prefix) { - // Variables that begin with `d8settings` or `drupal` get mapped + // Variables that begin with `drupalsettings` or `drupal` get mapped // to the $settings array verbatim, even if the value is an array. - // For example, a variable named d8settings:example-setting' with + // For example, a variable named drupalsettings:example-setting' with // value 'foo' becomes $settings['example-setting'] = 'foo'; case 'drupalsettings': case 'drupal': $settings[$key] = $value; break; - // Variables that begin with `d8config` get mapped to the $config + // Variables that begin with `drupalconfig` get mapped to the $config // array. Deeply nested variable names, with colon delimiters, // get mapped to deeply nested array elements. Array values // get added to the end just like a scalar. Variables without // both a config object name and property are skipped. - // Example: Variable `d8config:conf_file:prop` with value `foo` becomes + // Example: Variable `drupalconfig:conf_file:prop` with value `foo` becomes // $config['conf_file']['prop'] = 'foo'; - // Example: Variable `d8config:conf_file:prop:subprop` with value `foo` becomes + // Example: Variable `drupalconfig:conf_file:prop:subprop` with value `foo` becomes // $config['conf_file']['prop']['subprop'] = 'foo'; - // Example: Variable `d8config:conf_file:prop:subprop` with value ['foo' => 'bar'] becomes + // Example: Variable `drupalconfig:conf_file:prop:subprop` with value ['foo' => 'bar'] becomes // $config['conf_file']['prop']['subprop']['foo'] = 'bar'; - // Example: Variable `d8config:prop` is ignored. + // Example: Variable `drupalconfig:prop` is ignored. case 'drupalconfig': if (count($parts) > 2) { $temp = &$config[$key];