Skip to content

Commit 70b82af

Browse files
authored
Merge pull request #49 from itk-dev/feature/drupal-9
Drupal 9 template
2 parents 9599bf6 + a2ea00a commit 70b82af

File tree

5 files changed

+1254
-0
lines changed

5 files changed

+1254
-0
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# @see https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/
2+
server {
3+
listen 80;
4+
server_name localhost;
5+
6+
root /app/web;
7+
8+
location = /favicon.ico {
9+
log_not_found off;
10+
access_log off;
11+
}
12+
13+
location = /robots.txt {
14+
allow all;
15+
log_not_found off;
16+
access_log off;
17+
}
18+
19+
# Very rarely should these ever be accessed outside of your lan
20+
location ~* \.(txt|log)$ {
21+
allow 192.168.0.0/16;
22+
deny all;
23+
}
24+
25+
location ~ \..*/.*\.php$ {
26+
return 403;
27+
}
28+
29+
location ~ ^/sites/.*/private/ {
30+
return 403;
31+
}
32+
33+
# Block access to scripts in site files directory
34+
location ~ ^/sites/[^/]+/files/.*\.php$ {
35+
deny all;
36+
}
37+
38+
# Allow "Well-Known URIs" as per RFC 5785
39+
location ~* ^/.well-known/ {
40+
allow all;
41+
}
42+
43+
# Block access to "hidden" files and directories whose names begin with a
44+
# period. This includes directories used by version control systems such
45+
# as Subversion or Git to store control files.
46+
location ~ (^|/)\. {
47+
return 403;
48+
}
49+
50+
location / {
51+
# try_files $uri @rewrite; # For Drupal <= 6
52+
try_files $uri /index.php?$query_string; # For Drupal >= 7
53+
}
54+
55+
location @rewrite {
56+
rewrite ^/(.*)$ /index.php?q=$1;
57+
}
58+
59+
# Don't allow direct access to PHP files in the vendor directory.
60+
location ~ /vendor/.*\.php$ {
61+
deny all;
62+
return 404;
63+
}
64+
65+
# In Drupal 8, we must also match new paths where the '.php' appears in
66+
# the middle, such as update.php/selection. The rule we use is strict,
67+
# and only allows this pattern with the update.php front controller.
68+
# This allows legacy path aliases in the form of
69+
# blog/index.php/legacy-path to continue to route to Drupal nodes. If
70+
# you do not have any paths like that, then you might prefer to use a
71+
# laxer rule, such as:
72+
# location ~ \.php(/|$) {
73+
# The laxer rule will continue to work if Drupal uses this new URL
74+
# pattern with front controllers other than update.php in a future
75+
# release.
76+
location ~ '\.php$|^/update.php' {
77+
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
78+
# Security note: If you're running a version of PHP older than the
79+
# latest 5.3, you should have "cgi.fix_pathinfo = 0;" in php.ini.
80+
# See http://serverfault.com/q/627903/94922 for details.
81+
include fastcgi_params;
82+
# Block httpoxy attacks. See https://httpoxy.org/.
83+
fastcgi_param HTTP_PROXY "";
84+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
85+
fastcgi_param PATH_INFO $fastcgi_path_info;
86+
fastcgi_param QUERY_STRING $query_string;
87+
fastcgi_intercept_errors on;
88+
fastcgi_pass phpfpm:9000;
89+
}
90+
91+
# Fighting with Styles? This little gem is amazing.
92+
# location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6
93+
location ~ ^/sites/.*/files/styles/ { # For Drupal >= 7
94+
try_files $uri @rewrite;
95+
}
96+
97+
# Handle private files through Drupal. Private file's path can come
98+
# with a language prefix.
99+
location ~ ^(/[a-z\-]+)?/system/files/ { # For Drupal >= 7
100+
try_files $uri /index.php?$query_string;
101+
}
102+
103+
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
104+
try_files $uri @rewrite;
105+
expires max;
106+
log_not_found off;
107+
}
108+
}

templates/drupal-9/.gitignore

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
# @see https://www.drupal.org/project/drupal/issues/3082958#comment-13433619
2+
# This file contains .gitignore rules that are often used with Drupal projects.
3+
# Because .gitignore is specific to your site and its deployment processes, you
4+
# may need to uncomment, add, or remove rules.
5+
#
6+
# To ignore all paths that composer manages when using this project template,
7+
# remove all double-hashed (##) lines.
8+
9+
10+
# Ignore configuration files that may contain sensitive information.
11+
#
12+
# Typically, settings.php and related files are not committed to the
13+
# repository because they contain information such as the database
14+
# credentials that could be used to compromise a site. Sometimes,
15+
# a settings.php might be committed to the repository if it reads
16+
# sensitive information from environment variables or other sources.
17+
# ------------------------------------------------------------------
18+
/web/sites/*/settings*.php
19+
/web/sites/*/services*.yml
20+
21+
# Ignore paths that contain user-generated content.
22+
/web/sites/*/files
23+
/web/sites/*/private
24+
25+
# Ignore SimpleTest multi-site environment.
26+
/web/sites/simpletest
27+
28+
29+
# Ignore custom modules managed by Composer.
30+
#
31+
# When a development team creates one or more custom modules that
32+
# are intended for use on more than one site, the typical strategy
33+
# is to register them in Packagist and give them the type
34+
# `drupal-custom-module` instead of `drupal-module`. This will cause
35+
# Composer to install them to the directory `modules/custom`.
36+
#
37+
# An alternate strategy for custom modules is to commit them
38+
# directly to the repository of the site where they are used. This
39+
# is commonly done with modules that are specific to just one site.
40+
#
41+
# Sites that have both Composer-managed custom modules and custom
42+
# modules that are committed directly to the repository may ignore
43+
# the `modules/custom` directory with the first rule shown below,
44+
# and then allow the locations to be committed on a case-by-case
45+
# basis by re-adding paths using `!` rules. A path that begins with
46+
# a `!` will allow a previously-ignored path to be added to the
47+
# repository. Note, however, that a path cannot be re-added if any
48+
# of its parent directories are excluded. This is why we use the
49+
# rule `/modules/custom/*` instead of `/modules/custom`.
50+
#
51+
# Sites that do not have any Composer-managed custom modules may
52+
# delete all of the `modules/custom` lines below.
53+
# ------------------------------------------------------------------
54+
/web/modules/custom/*
55+
#!/web/modules/custom/module_in_repo
56+
57+
58+
# Ignore directories generated by Composer
59+
#
60+
# See the "installer-paths" section in the top-level composer.json
61+
# file.
62+
# ------------------------------------------------------------------
63+
/drush/Commands/contrib/
64+
/web/core/
65+
/web/modules/contrib/
66+
/web/themes/contrib/
67+
/web/profiles/contrib/
68+
/web/libraries/
69+
70+
# Generally you should only ignore the root vendor directory. It's important
71+
# that core/assets/vendor and any other vendor directories within contrib or
72+
# custom module, theme, etc., are not ignored unless you purposely do so.
73+
/vendor/
74+
75+
# Ignore scaffold files
76+
#
77+
# Note that the scaffold plugin may be used to automatically manage
78+
# a site's .gitignore files. If the `vendor` directory is ignored,
79+
# then one or more .gitignore files will be written to also ignore
80+
# any file placed by scaffolding. To avoid the creation of
81+
# additional .gitignore files, add all of the scaffold file
82+
# locations to the top-level .gitignore file, as shown below.
83+
# ------------------------------------------------------------------
84+
/web/.csslintrc
85+
/web/.editorconfig
86+
/web/.eslintignore
87+
/web/.eslintrc.json
88+
/web/.gitattributes
89+
/web/.ht.router.php
90+
/web/.htaccess
91+
/web/INSTALL.txt
92+
/web/README.txt
93+
/web/autoload.php
94+
/web/example.gitignore
95+
/web/index.php
96+
/web/robots.txt
97+
/web/update.php
98+
/web/web.config
99+
/web/modules/README.txt
100+
/web/profiles/README.txt
101+
/web/sites/README.txt
102+
/web/sites/default/default.services.yml
103+
/web/sites/default/default.settings.php
104+
/web/sites/development.services.yml
105+
/web/sites/example.settings.local.php
106+
/web/sites/example.sites.php
107+
/web/themes/README.txt
108+
109+
110+
# Other common rules
111+
# ------------------
112+
# Ignore files generated by PhpStorm
113+
/.idea/
114+
115+
# Ignore .env files as they are personal
116+
#/.env
117+
118+
# ------------------------------------------------------------------------------
119+
120+
# @see https://github.com/github/gitignore/blob/e448b41613502a56c8124916874cf3b6b098d1ce/Drupal.gitignore
121+
# gitignore template for Drupal 8 projects
122+
#
123+
# earlier versions of Drupal are tracked in `community/PHP/`
124+
#
125+
# follows official upstream conventions:
126+
# https://www.drupal.org/docs/develop/using-composer
127+
128+
# Ignore configuration files that may contain sensitive information
129+
/web/sites/*/*settings*.php
130+
/web/sites/*/*services*.yml
131+
132+
# Ignore paths that may contain user-generated content
133+
/web/sites/*/files
134+
/web/sites/*/public
135+
/web/sites/*/private
136+
/web/sites/*/files-public
137+
/web/sites/*/files-private
138+
139+
# Ignore paths that may contain temporary files
140+
/web/sites/*/translations
141+
/web/sites/*/tmp
142+
/web/sites/*/cache
143+
144+
# Ignore drupal core (if not versioning drupal sources)
145+
/web/vendor
146+
/web/core
147+
/web/modules/README.txt
148+
/web/profiles/README.txt
149+
/web/sites/development.services.yml
150+
/web/sites/example.settings.local.php
151+
/web/sites/example.sites.php
152+
/web/sites/README.txt
153+
/web/themes/README.txt
154+
/web/.csslintrc
155+
/web/.editorconfig
156+
/web/.eslintignore
157+
/web/.eslintrc.json
158+
/web/.gitattributes
159+
/web/.htaccess
160+
/web/.ht.router.php
161+
/web/autoload.php
162+
/web/composer.json
163+
/web/composer.lock
164+
/web/example.gitignore
165+
/web/index.php
166+
/web/INSTALL.txt
167+
/web/LICENSE.txt
168+
/web/README.txt
169+
/web/robots.txt
170+
/web/update.php
171+
/web/web.config
172+
173+
# Ignore vendor dependencies and scripts
174+
/vendor
175+
/composer.phar
176+
/composer
177+
/robo.phar
178+
/robo
179+
/drush.phar
180+
/drush
181+
/drupal.phar
182+
/drupal
183+
184+
# ------------------------------------------------------------------------------
185+
186+
# We want all custom site settings in settings.local.php
187+
!/web/sites/*/settings*.php
188+
189+
# Ignore PhpStorm
190+
.idea
191+
192+
# Ignore private files
193+
private-files/
194+
195+
# Ignore VS-code
196+
.vscode
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
version: "3"
2+
3+
networks:
4+
frontend:
5+
external: true
6+
app:
7+
driver: bridge
8+
internal: true
9+
external: false
10+
11+
services:
12+
phpfpm:
13+
image: itkdev/php7.4-fpm:alpine
14+
restart: unless-stopped
15+
networks:
16+
- app
17+
- frontend
18+
environment:
19+
- PHP_MAX_EXECUTION_TIME=30
20+
- PHP_MEMORY_LIMIT=128M
21+
depends_on:
22+
- memcached
23+
volumes:
24+
- .:/app:delegated
25+
- drush-cache:/root/.drush
26+
27+
nginx:
28+
image: nginx:stable-alpine
29+
restart: unless-stopped
30+
networks:
31+
- app
32+
- frontend
33+
depends_on:
34+
- phpfpm
35+
ports:
36+
- '80'
37+
volumes:
38+
- ${PWD}/.docker/vhost.conf:/etc/nginx/conf.d/default.conf:ro
39+
- ./:/app:rw
40+
labels:
41+
- "traefik.enable=true"
42+
- "traefik.docker.network=frontend"
43+
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}-http.rule=Host(`${COMPOSE_SERVER_DOMAIN}`)"
44+
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}-http.entrypoints=web"
45+
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}-http.middlewares=redirect-to-https"
46+
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
47+
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(`${COMPOSE_SERVER_DOMAIN}`)"
48+
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.entrypoints=websecure"
49+
#- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.middlewares=ITKBasicAuth@file"
50+
51+
memcached:
52+
image: 'memcached:latest'
53+
restart: unless-stopped
54+
networks:
55+
- app
56+
ports:
57+
- '11211'
58+
environment:
59+
- MEMCACHED_CACHE_SIZE=64
60+
61+
drush:
62+
image: itkdev/drush6:latest
63+
networks:
64+
- app
65+
- frontend
66+
depends_on:
67+
- mariadb
68+
entrypoint:
69+
- drush
70+
volumes:
71+
- drush-cache:/root/.drush
72+
- ./:/app
73+
74+
# Drush cache volume to persist cache between runs.
75+
volumes:
76+
drush-cache:

0 commit comments

Comments
 (0)