Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to Platform.sh! #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/web/profiles/contrib/

# Ignore sensitive information
/web/sites/*/settings.php
/web/sites/*/settings.local.php

# Ignore Drupal's file directory
Expand Down
125 changes: 125 additions & 0 deletions .platform.app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# This file describes an application. You can have multiple applications
# in the same project.
#
# See https://docs.platform.sh/user_guide/reference/platform-app-yaml.html

# The name of this app. Must be unique within a project.
name: 'app'

# The runtime the application uses.
type: 'php:7.4'

# The relationships of the application with services or other applications.
#
# The left-hand side is the name of the relationship as it will be exposed
# to the application in the PLATFORM_RELATIONSHIPS variable. The right-hand
# side is in the form `<service name>:<endpoint name>`.
relationships:
database: 'db:mysql'
redis: 'cache:redis'

# The size of the persistent disk of the application (in MB).
disk: 2048

# The 'mounts' describe writable, persistent filesystem mounts in the application.
mounts:
'/web/sites/default/files':
source: local
source_path: 'files'
'/tmp':
source: local
source_path: 'tmp'
'/private':
source: local
source_path: 'private'
'/.drush':
source: local
source_path: 'drush'
'/drush-backups':
source: local
source_path: 'drush-backups'
'/.console':
source: local
source_path: 'console'

# Configuration of the build of this application.
build:
flavor: composer

# The hooks executed at various points in the lifecycle of the application.
hooks:
# The build hook runs after Composer to finish preparing up your code.
build: |
set -e
bash install-redis.sh 4.3.0
# The deploy hook runs after your application has been deployed and started.
deploy: |
set -e
php ./drush/platformsh_generate_drush_yml.php
cd web
drush -y cache-rebuild
drush -y updatedb
drush -y config-import
# The configuration of app when it is exposed to the web.
web:
# Specific parameters for different URL prefixes.
locations:
'/':
# The folder from which to serve static assets, for this location.
#
# This is a filesystem path, relative to the application root.
root: 'web'

# How long to allow static assets from this location to be cached.
#
# Can be a time in seconds, or -1 for no caching. Times can be
# suffixed with "s" (seconds), "m" (minutes), "h" (hours), "d"
# (days), "w" (weeks), "M" (months, as 30 days) or "y" (years, as
# 365 days).
expires: 5m

# Whether to forward disallowed and missing resources from this
# location to the application.
#
# Can be true, false or a URI path string.
passthru: '/index.php'

# Deny access to static files in this location.
allow: false

# Rules for specific URI patterns.
rules:
# Allow access to common static files.
'\.(jpe?g|png|gif|svgz?|css|js|map|ico|bmp|eot|woff2?|otf|ttf)$':
allow: true
'^/robots\.txt$':
allow: true
'^/sitemap\.xml$':
allow: true

# Deny direct access to configuration files.
'^/sites/sites\.php$':
scripts: false
'^/sites/[^/]+/settings.*?\.php$':
scripts: false

'/sites/default/files':
# Allow access to all files in the public files directory.
allow: true
expires: 5m
passthru: '/index.php'
root: 'web/sites/default/files'

# Do not execute PHP scripts.
scripts: false

rules:
# Provide a longer TTL (2 weeks) for aggregated CSS and JS files.
'^/sites/default/files/(css|js)':
expires: 2w

# The configuration of scheduled execution.
crons:
drupal:
spec: '*/20 * * * *'
cmd: 'cd web ; drush core-cron'
18 changes: 18 additions & 0 deletions .platform/routes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

# The routes of the project.
#
# Each route describes how an incoming URL is going
# to be processed by Platform.sh.

"https://{default}/":
type: upstream
upstream: "app:http"
cache:
enabled: true

# Base the cache on the session cookie and custom Drupal cookies. Ignore all other cookies.
cookies: ['/^SS?ESS/', '/^Drupal.visitor/']

"https://www.{default}/":
type: redirect
to: "https://{default}/"
11 changes: 11 additions & 0 deletions .platform/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# The services of the project.
#
# Each service listed will be deployed
# to power your Platform.sh project.

db:
type: mariadb:10.4
disk: 2048

cache:
type: redis:5.0
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"drupal/core-composer-scaffold": "^8.8.0",
"drupalcommerce/demo_commerce": "dev-master",
"oomphinc/composer-installers-extender": "^1.1",
"platformsh/config-reader": "^2.3",
"webflo/drupal-finder": "^1.0.0",
"webmozart/path-util": "^2.3",
"zaporylie/composer-drupal-optimizations": "^1.0"
Expand Down
Loading