Skip to content

Commit c43430c

Browse files
damontgomerygrasmash
authored andcommitted
ACSF support for deploy step (acquia#18)
* ACSF support for deploy step * Deploy update to include .gitignore files and to use consistent tags. * ACSF Update for composer. Use drush as a dev dependency only. This resolves issues with ACSF. * Update ACSF related settings in settings.php and readme. * Update deploy:acsf:init to work without drush. included `-r ${deploy.dir}/docroot` * ACSF readme note about factory hooks.
1 parent eda0684 commit c43430c

File tree

6 files changed

+59
-58
lines changed

6 files changed

+59
-58
lines changed

template/build/core/phing/tasks/deploy.xml

+18-4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@
5151

5252
<target name="deploy:artifact:build" description="Generates a deploy-ready build in deploy.dir."
5353
depends="deploy:artifact:clean, deploy:artifact:copy, deploy:artifact:composer:install, deploy:artifact:profile:make, frontend:build, deploy:artifact:sanitize">
54+
<!-- If we are using ACSF, run the ACSF Deploy command. -->
55+
<if>
56+
<equals arg1="${hosting}" arg2="acsf"/>
57+
<then>
58+
<phingcall target="deploy:acsf:init"/>
59+
</then>
60+
</if>
5461
</target>
5562

5663
<target name="deploy:artifact:clean" description="Deletes the contents of the deploy dir.">
@@ -99,11 +106,13 @@
99106

100107
<!-- Copy required files from docroot. -->
101108
<copy todir="${deploy.dir}/docroot" overwrite="true">
102-
<fileset dir="${docroot}">
109+
<fileset dir="${docroot}" defaultexcludes="false">
103110
<!-- This should be similar to .gitigore. -->
104-
<include name="**"></include>
111+
<!-- We remove default excludes because they include .gitignore files we need, like the ACSF one. -->
112+
<include name="**" />
105113
<exclude name="**/local.*" />
106114
<exclude name=".gitkeep" />
115+
<exclude name=".DS_STORE" />
107116
<exclude name="core/**" />
108117
<exclude name="drush/contrib/**" />
109118
<exclude name="example.gitignore" />
@@ -113,8 +122,8 @@
113122
<exclude name="themes/contrib/**" />
114123
<exclude name="profiles/contrib/**" />
115124
<exclude name="modules/contrib/**" />
116-
<exclude name="**/node_modules/**"></exclude>
117-
<exclude name="**/bower_components/**"></exclude>
125+
<exclude name="**/node_modules/**" />
126+
<exclude name="**/bower_components/**" />
118127
</fileset>
119128
</copy>
120129

@@ -170,4 +179,9 @@
170179
</fileset>
171180
</delete>
172181
</target>
182+
183+
<target name="deploy:acsf:init" description="Re-initialize ACSF with the settings.php changes required for artifact.">
184+
<chmod file="${deploy.dir}/docroot/sites/default/settings.php" mode="0755" />
185+
<exec dir="${deploy.dir}/docroot" command="${drush.bin} --include=${deploy.dir}/docroot/modules/contrib/acsf/acsf_init acsf-init -r ${deploy.dir}/docroot -y" logoutput="true" checkreturn="true"/>
186+
</target>
173187
</project>

template/composer.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
],
1111
"require": {
1212
"composer/installers": "^1.0.20",
13-
"drush/drush": "dev-master",
1413
"drupal/acquia_connector": "8.1.*",
1514
"drupal/acsf": "~8.1",
1615
"drupal/core": "~8",
@@ -28,6 +27,7 @@
2827
"behat/mink-goutte-driver": "*",
2928
"behat/mink-selenium2-driver": "*",
3029
"behat/mink-browserkit-driver": "*",
30+
"drush/drush": "dev-master",
3131
"drupal/drupal-extension": "~3.0",
3232
"drupal/coder": "~8.2",
3333
"phpunit/phpunit": "4.6.*",
@@ -54,9 +54,6 @@
5454
"patches": {
5555
"drupal/core": {
5656
"Ignore front end vendor folders to improve directory search performance": "https://www.drupal.org/files/issues/ignore_front_end_vendor-2329453-116.patch"
57-
},
58-
"drupal/acsf": {
59-
"Allow custom settings.php": "https://www.drupal.org/files/issues/acsf-2706365-2.patch"
6057
}
6158
}
6259
},

template/composer.lock

+19-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

template/docroot/sites/default/settings.php

+6-25
Original file line numberDiff line numberDiff line change
@@ -712,32 +712,13 @@
712712
* Acquia Cloud settings.
713713
*/
714714
if ($is_ah_env && file_exists('/var/www/site-php')) {
715+
require "/var/www/site-php/{$_ENV['AH_SITE_GROUP']}/{$_ENV['AH_SITE_GROUP']}-settings.inc";
715716

716-
// This is ACSF. Below copied from acsf_init example settings.
717-
if ($is_acsf) {
718-
/**
719-
* A user who gets here is trying to visit a site that is not yet registered
720-
* with either the Site Factory or Hosting.
721-
*/
722-
723-
// Don't run any of this code if we are drush or a CLI script.
724-
if (function_exists('drush_main') || !\Drupal::hasContainer() || PHP_SAPI === 'cli') {
725-
if (!function_exists('drush_main')) {
726-
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
727-
}
728-
return;
729-
}
730-
}
731-
// This is ACE.
732-
else {
733-
require "/var/www/site-php/{$_ENV['AH_SITE_GROUP']}/{$_ENV['AH_SITE_GROUP']}-settings.inc";
734-
735-
// Store API Keys and things outside of version control.
736-
// @see settings/sample-secrets.settings.php for sample code.
737-
$secrets_file = sprintf('/mnt/gfs/%s.%s/secrets.settings.php', $_ENV['AH_SITE_GROUP'], $_ENV['AH_SITE_ENVIRONMENT']);
738-
if (file_exists($secrets_file)) {
739-
require $secrets_file;
740-
}
717+
// Store API Keys and things outside of version control.
718+
// @see settings/sample-secrets.settings.php for sample code.
719+
$secrets_file = sprintf('/mnt/gfs/%s.%s/secrets.settings.php', $_ENV['AH_SITE_GROUP'], $_ENV['AH_SITE_ENVIRONMENT']);
720+
if (file_exists($secrets_file)) {
721+
require $secrets_file;
741722
}
742723
}
743724

template/project.yml

+5
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,8 @@ drush:
2828
remote: ${acquia_subname}.test
2929
# The local environment against which all local drush commands are run.
3030
local: self
31+
32+
# Hosting environment flags.
33+
# Examples: acsf (Acquia Cloud Site Factory), ac (Acquia Cloud)
34+
# hosting: "acsf"
35+
# hosting: "ac"

template/readme/acsf-setup.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# ACSF Setup
22

33
To configure a project to run on ACSF, perform the following steps after initially setting up Bolt:
4-
4+
5+
1. Add a `hosting` variable set to `acsf` in `project.yml`
56
1. Execute `./bolt.sh acsf:init` from the project root.
67
1. Add the acsf module as a dependency to your installation profile.
8+
9+
## Factory Hooks and settings.php
10+
11+
Acquia Cloud Site Factory does not allow changes to `settings.php`. In order to make additions normally done with `settings.php`, factory hooks are used.
12+
13+
Please see the documentation below for reference.
14+
15+
[https://docs.acquia.com/site-factory/tiers/paas/workflow/hooks](https://docs.acquia.com/site-factory/tiers/paas/workflow/hooks)

0 commit comments

Comments
 (0)