From f1660031ac524302cbe8414053dbc23375b878be Mon Sep 17 00:00:00 2001 From: Andrea R Soper Date: Sat, 23 Jul 2016 17:15:58 -0500 Subject: [PATCH 1/7] Composer install while provisioning. We tell people to do it first anyway. With this, if it is already installed, then composer will have nothing to do and ansible will move happily along, but if I forget, I won't wonder wtf happened to the drupal. --- conf/vagrant/provisioning/roles/php/tasks/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/conf/vagrant/provisioning/roles/php/tasks/main.yml b/conf/vagrant/provisioning/roles/php/tasks/main.yml index e358caa..e750a8c 100644 --- a/conf/vagrant/provisioning/roles/php/tasks/main.yml +++ b/conf/vagrant/provisioning/roles/php/tasks/main.yml @@ -30,3 +30,8 @@ - /etc/php/5.6/apache2/php.ini - /etc/php/5.6/cli/php.ini tags: PHP + +- name: Composer install + composer: + command: install + working_dir: /var/www/{{ hostname }} From 2d223fc59ee8a4bde4d1190bc01edfeb280176e7 Mon Sep 17 00:00:00 2001 From: Bec White Date: Fri, 29 Jul 2016 11:06:47 -0500 Subject: [PATCH 2/7] Run composer install during Vagrant provisioning. --- conf/vagrant/Vagrantfile | 4 ++++ conf/vagrant/provisioning/roles/php/tasks/main.yml | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/conf/vagrant/Vagrantfile b/conf/vagrant/Vagrantfile index 3c450ad..7efd8ab 100644 --- a/conf/vagrant/Vagrantfile +++ b/conf/vagrant/Vagrantfile @@ -43,6 +43,10 @@ Vagrant.configure(2) do |config| end + config.vm.provision "shell", + inline: "composer self-update && su vagrant -c 'composer install --working-dir=/var/www/#{hostname}'" + end + config.vm.provision "ansible" do |ansible| ansible.playbook = "@playbook@" diff --git a/conf/vagrant/provisioning/roles/php/tasks/main.yml b/conf/vagrant/provisioning/roles/php/tasks/main.yml index e750a8c..e358caa 100644 --- a/conf/vagrant/provisioning/roles/php/tasks/main.yml +++ b/conf/vagrant/provisioning/roles/php/tasks/main.yml @@ -30,8 +30,3 @@ - /etc/php/5.6/apache2/php.ini - /etc/php/5.6/cli/php.ini tags: PHP - -- name: Composer install - composer: - command: install - working_dir: /var/www/{{ hostname }} From f5835a1d4d812855e811939a2949c20706f3eb84 Mon Sep 17 00:00:00 2001 From: Bec White Date: Thu, 4 Aug 2016 10:13:59 -0500 Subject: [PATCH 3/7] Fix syntax error. --- conf/vagrant/Vagrantfile | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/vagrant/Vagrantfile b/conf/vagrant/Vagrantfile index 7efd8ab..c32357b 100644 --- a/conf/vagrant/Vagrantfile +++ b/conf/vagrant/Vagrantfile @@ -45,7 +45,6 @@ Vagrant.configure(2) do |config| config.vm.provision "shell", inline: "composer self-update && su vagrant -c 'composer install --working-dir=/var/www/#{hostname}'" - end config.vm.provision "ansible" do |ansible| ansible.playbook = "@playbook@" From ebd81c1e1218dfba4bee23b5ac71f66cba7e7e48 Mon Sep 17 00:00:00 2001 From: Bec White Date: Thu, 4 Aug 2016 11:31:17 -0500 Subject: [PATCH 4/7] Run composer install on the host machine. --- conf/vagrant/Vagrantfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/conf/vagrant/Vagrantfile b/conf/vagrant/Vagrantfile index c32357b..d708c85 100644 --- a/conf/vagrant/Vagrantfile +++ b/conf/vagrant/Vagrantfile @@ -13,6 +13,11 @@ hostname = "#{project}.local" extra_hostnames = [] # end tunables +# Install composer dependencies from the host machine. +if ARGV[0] == 'up' or ARGV.include? '--provision' + system('composer install') +end + Vagrant.configure(2) do |config| config.hostmanager.enabled = true @@ -43,9 +48,6 @@ Vagrant.configure(2) do |config| end - config.vm.provision "shell", - inline: "composer self-update && su vagrant -c 'composer install --working-dir=/var/www/#{hostname}'" - config.vm.provision "ansible" do |ansible| ansible.playbook = "@playbook@" From 082e979292c1fb6ea7c7d6ce2c95b6b870b09569 Mon Sep 17 00:00:00 2001 From: Bec White Date: Wed, 24 Aug 2016 15:42:48 -0500 Subject: [PATCH 5/7] Use vagrant-triggers to run composer install before vagrant up and reload. --- conf/vagrant/Vagrantfile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/conf/vagrant/Vagrantfile b/conf/vagrant/Vagrantfile index d708c85..d95ea7a 100644 --- a/conf/vagrant/Vagrantfile +++ b/conf/vagrant/Vagrantfile @@ -1,7 +1,7 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -%w{ vagrant-hostmanager vagrant-auto_network }.each do |plugin| +%w{ vagrant-hostmanager vagrant-auto_network vagrant-triggers }.each do |plugin| unless Vagrant.has_plugin?(plugin) raise "#{plugin} plugin is not installed. Please install with: vagrant plugin install #{plugin}" end @@ -13,11 +13,6 @@ hostname = "#{project}.local" extra_hostnames = [] # end tunables -# Install composer dependencies from the host machine. -if ARGV[0] == 'up' or ARGV.include? '--provision' - system('composer install') -end - Vagrant.configure(2) do |config| config.hostmanager.enabled = true @@ -61,4 +56,8 @@ Vagrant.configure(2) do |config| } end + config.trigger.before [:up, :reload] do + run "composer install" + end + end From 4a36bf2735b1da1d271d5e09468733b760a3eeae Mon Sep 17 00:00:00 2001 From: Bec White Date: Wed, 24 Aug 2016 15:47:52 -0500 Subject: [PATCH 6/7] Add vagrant plugin dependencies to the README. --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ad78831..2970483 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,18 @@ # "The" Vagrant +Add a customizable vagrant environment into a project. + _Note: If you are instantiating a project, you likely want to start with [drupal-skeleton](https://github.com/palantirnet/drupal-skeleton)._ -Add a customizable vagrant environment into a project. +## Dependencies + +This Vagrant configuration requires the following plugins: + +* [vagrant-hostmanager](https://github.com/devopsgroup-io/vagrant-hostmanager) +* [vagrant-auto_network](https://github.com/oscar-stack/vagrant-auto_network) +* [vagrant-triggers](https://github.com/emyl/vagrant-triggers) + +## Installation ## Adding the-vagrant with composer From 4b8d1186f308a81c75c04e91d9d1cffd82472a68 Mon Sep 17 00:00:00 2001 From: Bec White Date: Thu, 1 Dec 2016 13:38:54 -0600 Subject: [PATCH 7/7] Ignore platform requirements when running composer install, since this command will run on the host, but the app 'platform' is actually the VM. --- conf/vagrant/Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/vagrant/Vagrantfile b/conf/vagrant/Vagrantfile index d95ea7a..a53489a 100644 --- a/conf/vagrant/Vagrantfile +++ b/conf/vagrant/Vagrantfile @@ -57,7 +57,7 @@ Vagrant.configure(2) do |config| end config.trigger.before [:up, :reload] do - run "composer install" + run "composer install --ignore-platform-reqs" end end