Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
11 changes: 11 additions & 0 deletions .bp-config/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"COMPOSER_INSTALL_OPTIONS": [
"--no-dev --optimize-autoloader --no-progress --no-interaction"
],
"COMPOSER_VENDOR_DIR": "vendor",
"WEBDIR": "web",
"PHP_EXTENSIONS": ["bz2", "zlib", "curl", "mcrypt", "gd", "pdo", "pdo_mysql", "mbstring"],
"ADDITIONAL_PREPROCESS_CMDS": [
"$HOME/bootstrap.sh"
]
}
3 changes: 3 additions & 0 deletions .bp-config/php/php.ini.d/memory_limit.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 512M
49 changes: 17 additions & 32 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,23 @@
#!/bin/bash
set -euxo pipefail
set -euo pipefail

: ${ACCOUNT_NAME?} ${ACCOUNT_PASS?}
install_drupal() {
ACCOUNT_NAME=$(echo $VCAP_SERVICES | jq -r '.["user-provided"][] | select(.name == "secrets") | .credentials.ROOT_USER_NAME')
ACCOUNT_PASS=$(echo $VCAP_SERVICES | jq -r '.["user-provided"][] | select(.name == "secrets") | .credentials.ROOT_USER_PASS')

fail() {
echo FAIL $@
exit 1
}

bootstrap() {
creds=$(echo $VCAP_SERVICES | jq -r '.["aws-rds"][0].credentials')
[ $creds = "null" ] && fail "creds are null; need to bind database?"

db_type=mysql
db_user=$(echo $creds | jq -r '.username')
db_pass=$(echo $creds | jq -r '.password')
db_port=$(echo $creds | jq -r '.port')
db_host=$(echo $creds | jq -r '.host')
db_name=$(echo $creds | jq -r '.db_name')
: "${ACCOUNT_NAME:?Need and root user name for Drupal}"
: "${ACCOUNT_PASS:?Need and root user pass for Drupal}"

drupal site:install standard --root=$HOME/web --no-interaction \
--account-name=${ACCOUNT_NAME:-$(gen_cred ACCOUNT_NAME)} \
--account-pass=${ACCOUNT_PASS:-$(gen_cred ACCOUNT_PASS)} \
--langcode="en" \
--db-type=$db_type \
--db-user=$db_user \
--db-pass=$db_pass \
--db-port=$db_port \
--db-host=$db_host \
--db-name=$db_name
drupal site:install \
--root=$HOME/web \
--no-interaction \
--account-name="$ACCOUNT_NAME" \
--account-pass="$ACCOUNT_PASS" \
--langcode="en"
}

drush --root=$HOME/web core-status bootstrap | grep -q "Successful" || bootstrap

drush --root=$HOME/web pm-info flysystem_s3 --fields=Status | grep -q enabled ||
drush --root=$HOME/web pm-enable --yes flysystem_s3

if [ "$CF_INSTANCE_INDEX" == "0" ]; then
drupal --root=$HOME/web list | grep database > /dev/null || install_drupal
# load configs here
# drupal --root=$HOME/web config:import ...
fi
122 changes: 67 additions & 55 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,75 +1,87 @@
{
"name": "drupal/drupal",
"description": "Drupal is an open source content management platform powering millions of websites and applications.",
"name": "18f/nsf",
"description": "Project template for Drupal 8 projects with composer",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cmc333333 How about something like The National Science Foundation's beta site?

"type": "project",
"license": "GPL-2.0+",
"authors": [
{
"name": "",
"role": ""
}
],
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"require": {
"composer/installers": "^1.0.24",
"wikimedia/composer-merge-plugin": "^1.4",
"drush/drush": "^9.1",
"drupal/features": "^3.5",
"php": "^7.1.0",
"composer/installers": "^1.2",
"cweagans/composer-patches": "^1.6",
"drupal-composer/drupal-scaffold": "^2.2",
"drupal/brightcove": "^1.3",
"drupal/inline_entity_form": "^1.0@beta",
"drupal/time_formatter": "1.x-dev",
"drupal/entity_embed": "^1.0",
"drupal/console": "^1.0.2",
"drupal/core": "~8.4",
"drupal/ctools": "^3.0",
"drupal/embed": "^1.0",
"drupal/entity_browser": "^2.0",
"drupal/ctools": "^3.0",
"drupal/media_entity": "^1.7"
"drupal/features": "^3.5",
"drupal/flysystem_s3": "^1.0@alpha",
"drupal/inline_entity_form": "^1.0@beta",
"drupal/media_entity": "^1.7",
"drupal/time_formatter": "1.x-dev",
"drush/drush": "~8.0|^9.0.0-beta8",
"webflo/drupal-finder": "^1.0.0",
"webmozart/path-util": "^2.3"
},
"replace": {
"drupal/core": "^8.4"
"require-dev": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cmc333333 I share your inclination to remove these.

"behat/mink": "~1.7",
"behat/mink-goutte-driver": "~1.2",
"jcalderonzumba/gastonjs": "~1.0.2",
"jcalderonzumba/mink-phantomjs-driver": "~0.3.1",
"mikey179/vfsstream": "~1.2",
"phpunit/phpunit": ">=4.8.28 <5",
"symfony/css-selector": "~2.8|~3.0"
},
"conflict": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cmc333333 I'm surprised to see drupal/drupal under conflict; can you lend insight into why it's there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing -- and my understanding of this is definitely hazy, so apologies ahead of time. This all stems from cloud.gov using a different code generator (drupal-composer/drupal-project) than we had on nsf. The conflict directive in a composer file indicates that if any of these libraries are installed, this project's dependencies can't also be installed. That's important here because drupal/core and drupal/drupal shouldn't be installed together (there'd be namespace collisions).

"drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"preferred-install": "dist",
"autoloader-suffix": "Drupal8"
},
"extra": {
"_readme": [
"By default Drupal loads the autoloader from ./vendor/autoload.php.",
"To change the autoloader you can edit ./autoload.php.",
"This file specifies the packages.drupal.org repository.",
"You can read more about this composer repository at:",
"https://www.drupal.org/node/2718229"
],
"merge-plugin": {
"include": [
"core/composer.json",
"modules/brightcove/composer.json"
],
"recurse": false,
"replace": false,
"merge-extra": false
},
"installer-paths": {
"core": ["type:drupal-core"],
"modules/contrib/{$name}": ["type:drupal-module"],
"profiles/contrib/{$name}": ["type:drupal-profile"],
"themes/contrib/{$name}": ["type:drupal-theme"],
"drush/contrib/{$name}": ["type:drupal-drush"],
"modules/custom/{$name}": ["type:drupal-custom-module"],
"themes/custom/{$name}": ["type:drupal-custom-theme"]
}
"sort-packages": true
},
"autoload": {
"psr-4": {
"Drupal\\Core\\Composer\\": "core/lib/Drupal/Core/Composer"
}
"classmap": [
"scripts/composer/ScriptHandler.php"
]
},
"scripts": {
"pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
"post-autoload-dump": [
"Drupal\\Core\\Composer\\Composer::ensureHtaccess"
"drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
"pre-install-cmd": [
"DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
],
"pre-update-cmd": [
"DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
],
"post-package-install": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup",
"post-package-update": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup"
"post-install-cmd": [
"DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
],
"post-update-cmd": [
"DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
]
},
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
"extra": {
"installer-paths": {
"web/core": ["type:drupal-core"],
"web/libraries/{$name}": ["type:drupal-library"],
"web/modules/contrib/{$name}": ["type:drupal-module"],
"web/profiles/contrib/{$name}": ["type:drupal-profile"],
"web/themes/contrib/{$name}": ["type:drupal-theme"],
"web/drush/contrib/{$name}": ["type:drupal-drush"],
"web/modules/custom/{$name}": ["type:drupal-custom-module"],
"web/themes/custom/{$name}": ["type:drupal-custom-theme"]
}
]
}
}
Loading