Skip to content

Commit

Permalink
Merge pull request #906 from platformsh/add-drupal11
Browse files Browse the repository at this point in the history
init Drupal 11 template
  • Loading branch information
chadwcarlson authored Nov 13, 2024
2 parents 991b62d + 2534e81 commit c1ccc85
Show file tree
Hide file tree
Showing 57 changed files with 4,288 additions and 0 deletions.
43 changes: 43 additions & 0 deletions project/drupal.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,46 @@ def platformify(self):
self.builddir) + self.composer_defaults(),
]

class Drupal11(RemoteProject):
major_version = "11.0"
remote = 'https://github.com/drupal/recommended-project.git'

def package_update_actions(self):
actions = super(Drupal11, self).package_update_actions()
return [
'cd {0} && composer config -g allow-plugins.composer/installers true --no-plugins'.format(
self.builddir),
'cd {0} && composer config allow-plugins.composer/installers true --no-plugins'.format(
self.builddir),
'cd {0} && composer config allow-plugins.drupal/core-composer-scaffold true --no-plugins'.format(
self.builddir),
'cd {0} && composer config allow-plugins.drupal/core-project-message true --no-plugins'.format(
self.builddir),
'cd {0} && composer config allow-plugins.cweagans/composer-patches true --no-plugins '.format(
self.builddir),
] + actions

@property
def update(self):
projectName = "drupal11"

def drupal11_modify_composer(composer):
"""
This change makes the template loadable via Composer (see https://github.com/platformsh-templates/drupal9/pull/33).
"""

composer['name'] = "platformsh/{0}".format(projectName)
composer['description'] = "This template builds Drupal 11 for Platform.sh based the \"Drupal Recommended\" Composer project."

return composer

return super(Drupal11, self).update + [
(self.modify_composer, [drupal11_modify_composer])
]

@property
def platformify(self):
return super(Drupal11, self).platformify + [
'cd {0} && composer require platformsh/config-reader drush/drush'.format(
self.builddir) + self.composer_defaults(),
]
34 changes: 34 additions & 0 deletions templates/drupal11/.platform.template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: 1

info:
id: platformsh/drupal11
name: Drupal 11
description: |
<p>This template builds Drupal 11 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.</p>
<p>Drupal is a flexible and extensible PHP-based CMS framework.</p>
class: starter
featured: true
tags:
- PHP
- Drupal
- CMS
- Symfony
related_blog_tags:
- Drupal
image: data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='186.52541' height='243.71308' viewBox='0 0 186.52541 243.71308'%3E%3Ctitle%3ERisorsa 85%3C/title%3E%3Cg id='Livello_2' data-name='Livello 2'%3E%3Cg id='Livello_1-2' data-name='Livello 1'%3E%3Cpath d='M131.64024,51.90954C114.49124,34.76866,98.12945,18.42858,93.26,0,88.39024,18.42858,72.02583,34.76866,54.8797,51.90954,29.16037,77.61263,0,106.7432,0,150.434a93.26271,93.26271,0,1,0,186.52541,0c0-43.688-29.158-72.8214-54.88517-98.52449M39.63956,172.16578c-5.71847-.19418-26.82308-36.57089,12.32937-75.303l25.90873,28.30088a2.21467,2.21467,0,0,1-.173,3.30485c-6.18245,6.34085-32.53369,32.7658-35.809,41.90292-.676,1.886-1.66339,1.81463-2.25619,1.79436M93.26283,220.1092a32.07521,32.07521,0,0,1-32.07544-32.07543A33.42322,33.42322,0,0,1,69.1821,166.8471c5.7836-7.07224,24.07643-26.96358,24.07643-26.96358s18.01279,20.18332,24.03326,26.89607a31.36794,31.36794,0,0,1,8.04647,21.25418A32.07551,32.07551,0,0,1,93.26283,220.1092m61.3923-52.015c-.69131,1.51192-2.25954,4.036-4.37617,4.113-3.77288.13741-4.176-1.79579-6.96465-5.92291-6.12235-9.06007-59.55167-64.89991-69.54517-75.69925-8.79026-9.49851-1.23783-16.195,2.26549-19.70431C80.42989,66.47768,93.25949,53.656,93.25949,53.656s38.25479,36.29607,54.19029,61.09626,10.44364,46.26024,7.20535,53.342' style='fill:%23009cde'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E
notes:
- heading: "Features"
content: |
PHP 8.3<br />
MariaDB 10.6<br />
Redis 7.2<br />
Drush included<br />
Automatic TLS certificates<br />
Composer-based build<br />
initialize:
repository: https://github.com/platformsh-templates/drupal11.git@master
config: null
files: []
profile: Drupal 11
81 changes: 81 additions & 0 deletions templates/drupal11/files/.blackfire.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
tests:
'The homepage should be fast':
path:
- '/'
assertions:
- 'main.wall_time <= 250ms'
'Some Composer dependencies have known security issues and should be upgraded':
path:
- '/.*'
assertions:
- { expression: 'not has_vulnerable_dependencies()' }
'"assert.active" is a dev_only feature and should be disabled in production':
path:
- '/.*'
assertions:
- { expression: 'runtime.configuration.assert_active === false' }
'"display_errors" should be disabled':
path:
- '/.*'
assertions:
- { expression: 'not is_configuration_enabled("display_errors")' }
'"display_startup_errors" should not be enabled':
path:
- '/.*'
assertions:
- { expression: 'not is_configuration_enabled("display_startup_errors")' }
'"max_execution_time" should be less than 30 seconds for Web requests':
path:
- '/.*'
assertions:
- { expression: 'runtime.configuration.max_execution_time <= 30' }
'"session.use_strict_mode" should be enabled':
path:
- '/.*'
assertions:
- { expression: 'runtime.configuration.session_use_strict_mode === true' }
'"zend.detect_unicode" should be disabled as BOMs are not portable':
path:
- '/.*'
assertions:
- { expression: 'runtime.configuration.zend_detect_unicode === false' }
'The realpath cache ttl should be more than one hour in production':
path:
- '/.*'
assertions:
- { expression: 'runtime.configuration.realpath_cache_ttl >= 3600' }
'The session garbage collector should be disabled in production':
path:
- '/.*'
assertions:
- { expression: 'runtime.configuration.session_gc_probability === 0' }

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
11 changes: 11 additions & 0 deletions templates/drupal11/files/.environment
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export RELATIONSHIPS_JSON="$(echo $PLATFORM_RELATIONSHIPS | base64 --decode)"

# Set database environment variables
export DB_HOST="$(echo $RELATIONSHIPS_JSON | jq -r '.mariadb[0].host')"
export DB_PORT="$(echo $RELATIONSHIPS_JSON | jq -r '.mariadb[0].port')"
export DB_PATH="$(echo $RELATIONSHIPS_JSON | jq -r '.mariadb[0].path')"
export DB_DATABASE="$DB_PATH"
export DB_USERNAME="$(echo $RELATIONSHIPS_JSON | jq -r '.mariadb[0].username')"
export DB_PASSWORD="$(echo $RELATIONSHIPS_JSON | jq -r '.mariadb[0].password')"
export DB_SCHEME="$(echo $RELATIONSHIPS_JSON | jq -r '.mariadb[0].scheme')"
export DATABASE_URL="${DB_SCHEME}://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_PATH}"
72 changes: 72 additions & 0 deletions templates/drupal11/files/.github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -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

8 changes: 8 additions & 0 deletions templates/drupal11/files/.github/ISSUE_TEMPLATE/config.yaml
Original file line number Diff line number Diff line change
@@ -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`!
41 changes: 41 additions & 0 deletions templates/drupal11/files/.github/ISSUE_TEMPLATE/improvements.yaml
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions templates/drupal11/files/.github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -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.
54 changes: 54 additions & 0 deletions templates/drupal11/files/.github/tests/vrt/template-paths.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* This is the default scenarios collection that will be used if there is not a theme-specific scenarios file in place
* for a given theme. You can copy this file and then name it `theme-paths.js`.
*
*/

/**
* Stores the scenarios for each page/endpoint that should be tested
* @type {{}}
*/
var scenarioPaths = {};

/**
* For each page/endpoint you want to test, create a new array entry that contains at least the keys/properties `label`
* and `path`.
*
* additional properties you can set for each scenario are documented here: https://github.com/garris/BackstopJS#advanced-scenarios
*
* However, do NOT set `referenceUrl` or `url` as those will be overridden
*
* `path` should assume the URL ends in a trailing slash. For example, if the page you want to test against is
* https://master-7rqtwti-fqfjrmtjbjta4.eu-3.platformsh.site/a/path/to/foo/bar/
* Then for `path` it should be "a/path/to/foo/bar/"
*
* @type {{path: string, label: string}[]}
*/
scenarioPaths.paths = [
{
"label": "Home",
"delay": 2000,
"removeSelectors": ['#block-umami-footer-promo img']
},
{
"label": "Forced 404",
"delay": 2000,
},
{
"label":"Vegan chocolate and nut brownies",
"path": "en/recipes/vegan-chocolate-and-nut-brownies/",
"delay": 2000,
},
{
"label": "Category: Healthy",
"path": "en/tags/healthy/",
"delay": 2000,
},
{
"label": "All Articles",
"path": "en/articles/",
"delay": 2000,
}
];

module.exports = scenarioPaths;
Loading

0 comments on commit c1ccc85

Please sign in to comment.