Skip to content

Commit 65f1618

Browse files
author
Sebastian Siemssen
committed
Adding backend.
1 parent 6530d3c commit 65f1618

File tree

101 files changed

+7251
-496
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+7251
-496
lines changed

.amazeeio/htaccess-additional

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<IfModule mod_headers.c>
2+
<If "%{REQUEST_METHOD} = 'OPTIONS'" >
3+
Header always set Access-Control-Allow-Origin "*"
4+
Header always set Access-Control-Allow-Credentials "true"
5+
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS"
6+
Header always set Access-Control-Allow-Headers "Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,X-Cache-Hash"
7+
8+
# Tell the client this pre-flight info is valid for 20 days
9+
Header always set Access-Control-Max-Age "1728000"
10+
Header always set Content-Type "text/plain charset=UTF-8"
11+
Header always set Content-Length "0"
12+
<IfModule mod_rewrite.c>
13+
RedirectMatch 204 (.*)$
14+
</IfModule>
15+
16+
</If>
17+
18+
</IfModule>

.amazeeio/httpd-additional.conf

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<IfModule mod_headers.c>
2+
Header always set Access-Control-Allow-Origin "*"
3+
Header always set Access-Control-Allow-Credentials "true"
4+
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS"
5+
Header always set Access-Control-Allow-Headers "Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,X-Cache-Hash"
6+
</IfModule>

.amazeeio/nginx.conf

+271
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
### Nginx configuration for Drupal 7 and 8. This configuration makes use of
2+
### drush (http:///drupal.org/project/drush) for site maintenance
3+
### and like tasks:
4+
###
5+
### 1. Run the cronjobs.
6+
### 2. Run the DB and code updates: drush up or drush upc followed by
7+
### drush updb to run any DB updates required by the code upgrades
8+
### that were performed.
9+
### 3. Disabling of xmlrpc.xml and update.php: all updates are now
10+
### handled through drush.
11+
12+
## If ssl terminator had ssl, we're passing that on
13+
if ($http_x_forwarded_proto = 'https') {
14+
set $fastcgi_https "on";
15+
}
16+
17+
## rewriting /index.php to / because after https://www.drupal.org/node/2599326
18+
## autocomplete URLs are forced to go to index.php
19+
rewrite ^/index.php / last;
20+
21+
## The 'default' location.
22+
location / {
23+
24+
25+
if ($request_method = 'OPTIONS') {
26+
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
27+
add_header 'Access-Control-Allow-Credentials' 'true' always;
28+
add_header 'Access-Control-Allow-Methods' 'POST, GET, OPTIONS' always;
29+
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,X-Cache-Hash' always;
30+
31+
### Tell client that this pre-flight info is valid for 20 days
32+
add_header 'Access-Control-Max-Age' 1728000;
33+
add_header 'Content-Type' 'text/plain charset=UTF-8';
34+
add_header 'Content-Length' 0;
35+
return 204;
36+
}
37+
38+
## Disallow access to any dot files
39+
location ~ /\. {
40+
deny all;
41+
access_log off;
42+
log_not_found off;
43+
}
44+
45+
## Replicate the Apache <FilesMatch> directive of Drupal standard
46+
## .htaccess. Disable access to any code files. Return a 404 to curtail
47+
## information disclosure. Hide also the text files.
48+
location ~* ^(?:.+\.(?:htaccess|make|txt|yml|md||engine|inc|info|install|module|profile|po|pot|sh|.*sql|test|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl)$ {
49+
deny all;
50+
access_log off;
51+
log_not_found off;
52+
}
53+
54+
## Expiring per default for two weeks, Drupal will overwrite that if necessary
55+
expires 2w;
56+
57+
## First we try the URI and relay to the /index.php?q=$escaped_uri&$args if not found.
58+
try_files $uri @drupal;
59+
}
60+
61+
########### Security measures ##########
62+
63+
## Restrict access to the strictly necessary PHP files. Reducing the
64+
## scope for exploits. Handling of PHP code and the Drupal event loop.
65+
location @drupal {
66+
## Include the FastCGI config.
67+
include generic-configs.d/fastcgi_drupal.conf;
68+
69+
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
70+
add_header 'Access-Control-Allow-Credentials' 'true' always;
71+
add_header 'Access-Control-Allow-Methods' 'POST, GET, OPTIONS' always;
72+
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,X-Cache-Hash' always;
73+
74+
75+
# Adding args to query string.
76+
fastcgi_param QUERY_STRING $args;
77+
78+
## If a special xdebug php-fpm is exiting for this site, we check if the cookie or the parameters
79+
## contain the string 'xdebug'.
80+
81+
## Requests with a cookie that contains "xdebug" are sent to the
82+
## php-fpm that runs xdebug.
83+
if ($http_cookie ~* "xdebug") {
84+
fastcgi_pass unix:/var/run/php-fpm-drupal-xdebug.sock;
85+
break;
86+
}
87+
88+
## Requests with a parameter that contains "xdebug" are sent to the
89+
## php-fpm that runs xdebug.
90+
if ($args ~* "xdebug") {
91+
fastcgi_pass unix:/var/run/php-fpm-drupal-xdebug.sock;
92+
break;
93+
}
94+
95+
96+
fastcgi_pass unix:/var/run/php-fpm-drupal.sock;
97+
98+
## @TODO Phase2: Learn more about MicroCache with Auth, as we have
99+
## varnish most probably not necessary
100+
## FCGI microcache for authenticated users also.
101+
#include apps/drupal/microcache_fcgi_auth.conf;
102+
103+
## @TODO need to test that more indept.
104+
## Filefield Upload progress
105+
## http://drupal.org/project/filefield_nginx_progress support
106+
## through the NginxUploadProgress modules.
107+
##track_uploads uploads 60s;
108+
}
109+
110+
## Trying to access private files directly returns a 404.
111+
location /sites/default/files/private/ {
112+
internal;
113+
}
114+
115+
## Disallow access to patches directory.
116+
location ^~ /patches {
117+
deny all;
118+
access_log off;
119+
log_not_found off;
120+
}
121+
122+
## Disallow access to backup directory.
123+
location ^~ /backup {
124+
deny all;
125+
access_log off;
126+
log_not_found off;
127+
}
128+
129+
## Disallow access to vagrant directory.
130+
location ^~ /vagrant {
131+
deny all;
132+
access_log off;
133+
log_not_found off;
134+
}
135+
136+
## Disallow access to /core/vendor.
137+
location ^~ /core/vendor {
138+
deny all;
139+
access_log off;
140+
log_not_found off;
141+
}
142+
143+
## Disallow access to /vendor.
144+
location ^~ /vendor {
145+
deny all;
146+
access_log off;
147+
log_not_found off;
148+
}
149+
150+
## Disable access logs for robots.txt.
151+
location = /robots.txt {
152+
access_log off;
153+
## Add support for the robotstxt module
154+
## http://drupal.org/project/robotstxt.
155+
try_files $uri @drupal;
156+
}
157+
158+
location = /humans.txt {
159+
access_log off;
160+
## Add support for the humanstxt module
161+
## http://drupal.org/project/humanstxt.
162+
try_files $uri @drupal;
163+
}
164+
165+
## Support for favicon. Return an 1x1 transparent GIF if it doesn't
166+
## exist.
167+
location = /favicon.ico {
168+
expires 30d;
169+
try_files /favicon.ico @empty;
170+
}
171+
172+
## Return an in memory 1x1 transparent GIF.
173+
location @empty {
174+
expires 30d;
175+
empty_gif;
176+
}
177+
178+
# Any other attempt to access PHP files does not have access.
179+
location ~* ^.+\.php$ {
180+
deny all;
181+
}
182+
183+
### Directives for installing drupal.
184+
location = /install.php {
185+
## If a special xdebug php-fpm is exiting for this site, we check if the cookie or the parameters
186+
## contain the string 'xdebug'.
187+
188+
## Requests with a cookie that contains "xdebug" are sent to the
189+
## php-fpm that runs xdebug.
190+
if ($http_cookie ~* "xdebug") {
191+
fastcgi_pass unix:/var/run/php-fpm-drupal-xdebug.sock;
192+
break;
193+
}
194+
## Requests with a parameter that contains "xdebug" are sent to the
195+
## php-fpm that runs xdebug.
196+
if ($args ~* "xdebug") {
197+
fastcgi_pass unix:/var/run/php-fpm-drupal-xdebug.sock;
198+
break;
199+
}
200+
fastcgi_pass unix:/var/run/php-fpm-drupal.sock;
201+
}
202+
### Directives for installing drupal.
203+
location = /core/install.php {
204+
## If a special xdebug php-fpm is exiting for this site, we check if the cookie or the parameters
205+
## contain the string 'xdebug'.
206+
207+
## Requests with a cookie that contains "xdebug" are sent to the
208+
## php-fpm that runs xdebug.
209+
if ($http_cookie ~* "xdebug") {
210+
fastcgi_pass unix:/var/run/php-fpm-drupal-xdebug.sock;
211+
break;
212+
}
213+
## Requests with a parameter that contains "xdebug" are sent to the
214+
## php-fpm that runs xdebug.
215+
if ($args ~* "xdebug") {
216+
fastcgi_pass unix:/var/run/php-fpm-drupal-xdebug.sock;
217+
break;
218+
}
219+
fastcgi_pass unix:/var/run/php-fpm-drupal.sock;
220+
}
221+
222+
## PHP FPM status
223+
### The configuration for the status pages of php-fpm. As described in
224+
### http://www.php.net/manual/en/install.fpm.configuration.php.
225+
226+
### php-fpm provides a status and a heartbeat page that is served through the web server.
227+
### Here's an example configuration for them.
228+
229+
## The status page is at /fpm-status. Only local access is
230+
## allowed. Non authorized access returns a 404 through the error_page
231+
## directive.
232+
location = /fpm-status {
233+
if ($dont_show_fpm_status) {
234+
return 404;
235+
}
236+
fastcgi_pass unix:/var/run/php-fpm-drupal.sock;
237+
}
238+
239+
## The ping page is at /ping and returns the string configured at the php-fpm level.
240+
## Also only local network connections (loopback and LAN) are permitted.
241+
location = /ping {
242+
if ($dont_show_fpm_status) {
243+
return 404;
244+
}
245+
fastcgi_pass unix:/var/run/php-fpm-drupal.sock;
246+
}
247+
248+
## Nginx status
249+
### The configuration for Nginx status page. As described in
250+
### http://wiki.nginx.org/HttpStubStatusModule.
251+
252+
### php-fpm provides a status and a heartbeat page that is served through the web server.
253+
### Here's an example configuration for them.
254+
255+
## Get the nginx status.
256+
location /nginx_status {
257+
if ($dont_show_nginx_status) {
258+
return 404;
259+
}
260+
stub_status on;
261+
access_log off;
262+
}
263+
264+
## Access to some admin scripts
265+
location ^~ /amazeeio/admin {
266+
alias /usr/local/lib/amazeeadmin;
267+
try_files $uri /index.php =404;
268+
include fastcgi_params;
269+
fastcgi_param SCRIPT_FILENAME $request_filename;
270+
fastcgi_pass unix:/var/run/php-fpm-drupal.sock;
271+
}

.gitignore

-9
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,3 @@
1212
.yarn
1313
npm-debug.log
1414
yarn-error.log
15-
16-
# Generated stuff
17-
coverage
18-
dlls
19-
build
20-
node_modules
21-
npm-debug.log
22-
graphql.schema.json
23-
graphql.config.json

backend/.gitignore

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Ignore directories generated by Composer
2+
drush/contrib
3+
vendor
4+
web/core
5+
web/modules/contrib
6+
web/themes/contrib
7+
web/profiles/contrib
8+
web/libraries
9+
10+
# Ignore configuration files that may contain environment-sensitive information.
11+
web/sites/*/local.settings.php
12+
web/sites/*/local.services.yml
13+
14+
# Ignore Drupal's file directory
15+
web/sites/*/files
16+
web/sites/*/private
17+
18+
# We absolutely don't want to have the .sass-cache in git.
19+
.sass-cache
20+
21+
# Ignore .map files
22+
*.css.map
23+
css/map
24+
25+
# Ignore css files from custom themes
26+
/web/themes/*/css/*.*

backend/composer.json

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "fubhy/drupal-decoupled-app",
3+
"description": "A demo project for showcasing decoupled Drupal with React.",
4+
"type": "project",
5+
"repositories": [
6+
{
7+
"type": "composer",
8+
"url": "https://packages.drupal.org/8"
9+
}
10+
],
11+
"require": {
12+
"composer/installers": "^1.0.20",
13+
"drupal-composer/drupal-scaffold": "^2.0.1",
14+
"cweagans/composer-patches": "~1.0",
15+
"drupal/core": "~8.0",
16+
"drush/drush": "~8.0",
17+
"drupal/console": "~1.0",
18+
"drupal/graphql": "3.x-dev"
19+
},
20+
"conflict": {
21+
"drupal/drupal": "*"
22+
},
23+
"minimum-stability": "dev",
24+
"prefer-stable": true,
25+
"autoload": {
26+
"classmap": [
27+
"scripts/composer/ScriptHandler.php"
28+
]
29+
},
30+
"scripts": {
31+
"drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
32+
"post-install-cmd": [
33+
"DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
34+
],
35+
"post-update-cmd": [
36+
"DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
37+
]
38+
},
39+
"extra": {
40+
"installer-paths": {
41+
"web/core": ["type:drupal-core"],
42+
"web/modules/contrib/{$name}": ["type:drupal-module"],
43+
"web/profiles/contrib/{$name}": ["type:drupal-profile"],
44+
"web/libraries/{$name}": ["type:drupal-library"],
45+
"web/themes/contrib/{$name}": ["type:drupal-theme"],
46+
"drush/contrib/{$name}": ["type:drupal-drush"]
47+
},
48+
"composer-exit-on-patch-failure": true
49+
}
50+
}

0 commit comments

Comments
 (0)