Skip to content

Instantly share code, notes, and snippets.

View oxyc's full-sized avatar

oxyc

View GitHub Profile
@oxyc
oxyc / drupal-project-composer-create.log
Created June 6, 2016 16:09
composer create-project drupal-composer/drupal-project:8.x-dev foo --stability dev --no-progress --profile --prefer-dist -vvv
Running 467ece15edfbaf5e2aafd12b287e1915d813b155 (2016-04-19 10:53:24) with PHP 5.6.18 on Darwin / 15.3.0
[4.8MB/0.02s] Checked CA file /private/var/folders/d8/8h53d56x645c5p32t6_44l_40000gn/T/composer-cacert-bcf331364fef73d53e4368ba519a6c3fcb21ea7836c3d8efad4ec32731e8152a.pem: valid
[5.3MB/0.03s] Downloading https://packagist.org/packages.json
[5.3MB/0.89s] Writing /Users/cindy/.composer/cache/repo/https---packagist.org/packages.json into cache
[5.6MB/0.90s] Downloading https://packagist.org/p/provider-2013%24d852dde3da4d7e4755b5e71acda84d5b6319d6c939a19036698969f737bb5847.json
[10.5MB/3.17s] Writing /Users/cindy/.composer/cache/repo/https---packagist.org/p-provider-2013.json into cache
[10.6MB/3.17s] Downloading https://packagist.org/p/provider-2014%24e1ddd27149550d653669a426c8c2b6d34d041117910ea0f46ef54ebe185c6638.json
[21.5MB/5.86s] Writing /Users/cindy/.composer/cache/repo/https---packagist.org/p-provider-2014.json into cache
[21.0MB/5.89s] Downloading https://packagist.org/p/provider-2015%2413e8fcdb96db
@oxyc
oxyc / composer.md
Last active June 4, 2016 16:57
a note on performance

A note on build time performance

Opting for composer based installs will most likely increase your VM's time to provision considerably. There are a couple of ways you can improve this.

Install vagrant-cachier plugin

If you manage multiple VM's on your computer, you can use the vagrant-cachier plugin to share Composer's package cache across all of them.

  1. Install the plugin on your host computer: vagrant plugin install vagrant-cachier
  2. Create a Vagrantfile.local next to your config.yml with the following:
@oxyc
oxyc / composer.md.diff
Created June 4, 2016 16:48
a note on performance
diff --git a/docs/deployment/composer.md b/docs/deployment/composer.md
index d00a28b..10b60ea 100644
--- a/docs/deployment/composer.md
+++ b/docs/deployment/composer.md
@@ -46,3 +46,34 @@ drupal_composer_dependencies:
drupal_core_path: "{{ drupal_composer_install_dir }}/web"
```
+
+## A note on build time performance
---
# If you need to run multiple instances of Drupal VM, set a unique hostname,
# machine name, and IP address for each instance.
vagrant_hostname: drupalvm.dev
vagrant_machine_name: drupalvm
vagrant_ip: 192.168.88.88
# A list of synced folders, with the keys 'local_path', 'destination', and
# a 'type' of [nfs|rsync|smb] (leave empty for slow native shares). See
# http://docs.drupalvm.com/en/latest/extras/syncing-folders/ for more info.
@oxyc
oxyc / sa
Created May 16, 2016 02:46
f
==> drupalvm: Installing Ansible.
==> drupalvm: Collecting ansible
==> drupalvm: /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
==> drupalvm: SNIMissingWarning
==> drupalvm: /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest

Drupal VM allows you to run extra shell scripts and ansible task files in the beginning and at the end of the provisioning process, in case you need to do extra setup, further configure the VM, or install extra software outside the purview of Drupal VM.

Shell scripts

To use an extra script, configure the path to the script (relative to provisioning/playbook.yml) in config.yml:

pre_provision_scripts:
  - "../scripts/pre-provision.sh"
post_provision_scripts:

Drupal VM allows you to run extra shell scripts and ansible task files in the beginning and at the end of the provisioning process, in case you need to do extra setup, further configure the VM, or install extra software outside the purview of Drupal VM.

Shell scripts

To use an extra script, configure the path to the script (relative to provisioning/playbook.yml) in config.yml:

pre_provision_scripts:
  - "../scripts/pre-provision.sh"
post_provision_scripts:

Drupal VM allows you to run extra shell scripts and ansible task files in the beginning and at the end of the provisioning process, in case you need to do extra setup, further configure the VM, or install extra software outside the purview of Drupal VM.

Shell scripts

To use an extra script, configure the path to the script (relative to provisioning/playbook.yml) in config.yml:

pre_provision_scripts:
  - "../scripts/pre-provision.sh"
post_provision_scripts:

To make it easier bringing in Drupal VM updates to an existing project, you might consider a slightly more complex setup. Instead of mixing your project's files with Drupal VM's configuration files, you can separate the two with the help of a delegating Vagrantfile.

Add Drupal VM to your project

There are many ways you can provide the Drupal VM code and we will go through how to configure things both if you're using composer and if you're not.

Drupal VM as a composer dependency

Currently Drupal VM does not identify itself as composer package but you can still add it as a custom package. Add the package to the repositories array in composer.json

@oxyc
oxyc / foo.patch
Created May 13, 2016 13:20
decoupled drupal vm
diff --git a/Vagrantfile b/Vagrantfile
index ffac056..0c22b93 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -2,6 +2,16 @@
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = '2'
+# Absolute paths on the host machine.
+host_drupalvm_dir = File.dirname(File.expand_path(__FILE__))