From c0ebe95329a3a968e28d5d6432e224dcc7fef530 Mon Sep 17 00:00:00 2001 From: Bec White Date: Fri, 8 May 2020 12:17:14 -0500 Subject: [PATCH 1/9] Remove Duplicity (https://linux.die.net/man/1/duplicity) since we don't use it, and our PPA cert is expired. --- drupalbox/drupalbox.yml | 1 - drupalbox/tests/duplicity_spec.rb | 18 --------------- .../roles/duplicity/defaults/main.yml | 11 ---------- .../roles/duplicity/tasks/configure.yml | 14 ------------ .../roles/duplicity/tasks/install.yml | 22 ------------------- provisioning/roles/duplicity/tasks/main.yml | 7 ------ .../roles/duplicity/templates/duply/conf.j2 | 5 ----- 7 files changed, 78 deletions(-) delete mode 100644 drupalbox/tests/duplicity_spec.rb delete mode 100644 provisioning/roles/duplicity/defaults/main.yml delete mode 100644 provisioning/roles/duplicity/tasks/configure.yml delete mode 100644 provisioning/roles/duplicity/tasks/install.yml delete mode 100644 provisioning/roles/duplicity/tasks/main.yml delete mode 100644 provisioning/roles/duplicity/templates/duply/conf.j2 diff --git a/drupalbox/drupalbox.yml b/drupalbox/drupalbox.yml index 583f808..c636354 100644 --- a/drupalbox/drupalbox.yml +++ b/drupalbox/drupalbox.yml @@ -47,5 +47,4 @@ - { role: phpmyadmin } - { role: nodejs } - { role: phantomjs } - - { role: duplicity } - { role: drupalbox } diff --git a/drupalbox/tests/duplicity_spec.rb b/drupalbox/tests/duplicity_spec.rb deleted file mode 100644 index 51bc088..0000000 --- a/drupalbox/tests/duplicity_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require_relative 'spec_helper.rb' - -describe ppa('duplicity-team/ppa') do - it { should exist } - it { should be_enabled } -end - -describe package('duplicity') do - it { should be_installed } -end - -describe package('duply') do - it { should be_installed } -end - -describe package('python-boto') do - it { should be_installed } -end diff --git a/provisioning/roles/duplicity/defaults/main.yml b/provisioning/roles/duplicity/defaults/main.yml deleted file mode 100644 index 91ef68d..0000000 --- a/provisioning/roles/duplicity/defaults/main.yml +++ /dev/null @@ -1,11 +0,0 @@ -duplicity_passphrase: ~ -duplicity_iam_key: ~ -duplicity_iam_secret: ~ -duplicity_s3_bucket: ~ -duplicity_profiles: - - alias: vagrant-files - s3_target: "s3://s3.amazonaws.com/{{ duplicity_s3_bucket }}/files" - s3_source: "/var/www/{{ hostname }}/web/sites/default/files" - - alias: vagrant-database - s3_target: "s3://s3.amazonaws.com/{{ duplicity_s3_bucket }}/database" - s3_source: "/var/www/{{ hostname }}/files/database" diff --git a/provisioning/roles/duplicity/tasks/configure.yml b/provisioning/roles/duplicity/tasks/configure.yml deleted file mode 100644 index b821358..0000000 --- a/provisioning/roles/duplicity/tasks/configure.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- name: Duplicity | Create Duply Dir - file: path=~/.duply/{{ item.alias }} - state=directory - recurse=true - with_items: "{{ duplicity_profiles }}" - tags: duplicity - -- name: Duplicity | Copy Duply Templates - template: src=duply/conf.j2 - dest=~/.duply/{{ item.alias }}/conf - mode=600 - with_items: "{{ duplicity_profiles }}" - tags: duplicity diff --git a/provisioning/roles/duplicity/tasks/install.yml b/provisioning/roles/duplicity/tasks/install.yml deleted file mode 100644 index 501fe93..0000000 --- a/provisioning/roles/duplicity/tasks/install.yml +++ /dev/null @@ -1,22 +0,0 @@ ---- -- name: Duplicity | Add PPA - become: yes - apt_repository: repo='ppa:duplicity-team/ppa' - state=present - tags: duplicity - -- name: Duplicity | Update apt cache - become: yes - apt: - update_cache: yes - tags: duplicity - -- name: Duplicity | Install System Packages - become: yes - apt: - pkg: - - duplicity - - duply - - python-boto - state: present - tags: duplicity diff --git a/provisioning/roles/duplicity/tasks/main.yml b/provisioning/roles/duplicity/tasks/main.yml deleted file mode 100644 index d22db20..0000000 --- a/provisioning/roles/duplicity/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- include: install.yml -- include: configure.yml - when: duplicity_passphrase|default(None) != None and - duplicity_iam_key|default(None) != None and - duplicity_iam_secret|default(None) != None and - duplicity_s3_bucket|default(None) != None diff --git a/provisioning/roles/duplicity/templates/duply/conf.j2 b/provisioning/roles/duplicity/templates/duply/conf.j2 deleted file mode 100644 index c33a9fe..0000000 --- a/provisioning/roles/duplicity/templates/duply/conf.j2 +++ /dev/null @@ -1,5 +0,0 @@ -GPG_PW='{{ duplicity_passphrase }}' -TARGET_USER="{{ duplicity_iam_key }}" -TARGET_PASS="{{ duplicity_iam_secret }}" -TARGET='{{ item.s3_target }}' -SOURCE='{{ item.s3_source }}' From d3be72beb70524e6d162f85bf1c8020b705500f6 Mon Sep 17 00:00:00 2001 From: agentrickard Date: Wed, 29 Jan 2020 16:12:36 -0500 Subject: [PATCH 2/9] Corrects installation errors caused by ruby versions. --- drupalbox/drupalbox.yml | 2 +- provisioning/vars/default/rvm.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drupalbox/drupalbox.yml b/drupalbox/drupalbox.yml index 78352e7..ccb1761 100644 --- a/drupalbox/drupalbox.yml +++ b/drupalbox/drupalbox.yml @@ -28,7 +28,7 @@ rvm1_user: vagrant rvm1_install_path: /home/vagrant/.rvm rvm1_rubies: - - 'ruby-2.3.1' + - 'ruby-2.5.2' - { role: memcached } - { role: mailhog } - { diff --git a/provisioning/vars/default/rvm.yml b/provisioning/vars/default/rvm.yml index d2e0ab6..3d79098 100644 --- a/provisioning/vars/default/rvm.yml +++ b/provisioning/vars/default/rvm.yml @@ -1,2 +1,2 @@ rvm1_rubies: - - 'ruby-2.1.3' + - 'ruby-2.5.2' From 8a85300ff02d2988196f3c5ba1c93b59f641900d Mon Sep 17 00:00:00 2001 From: Bec White Date: Fri, 8 May 2020 16:22:48 -0500 Subject: [PATCH 3/9] Update Ansible syntax. --- provisioning/roles/duplicity/tasks/install.yml | 2 +- provisioning/roles/mysql-server/tasks/main.yml | 2 +- provisioning/roles/phantomjs/tasks/main.yml | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/provisioning/roles/duplicity/tasks/install.yml b/provisioning/roles/duplicity/tasks/install.yml index e02911f..501fe93 100644 --- a/provisioning/roles/duplicity/tasks/install.yml +++ b/provisioning/roles/duplicity/tasks/install.yml @@ -18,5 +18,5 @@ - duplicity - duply - python-boto - state: installed + state: present tags: duplicity diff --git a/provisioning/roles/mysql-server/tasks/main.yml b/provisioning/roles/mysql-server/tasks/main.yml index c6618e8..9447e03 100644 --- a/provisioning/roles/mysql-server/tasks/main.yml +++ b/provisioning/roles/mysql-server/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: MySQL | Install Server become: yes - apt: pkg=mysql-server state=installed + apt: pkg=mysql-server state=present tags: mysql-server - name: MySQL | Update my.cnf diff --git a/provisioning/roles/phantomjs/tasks/main.yml b/provisioning/roles/phantomjs/tasks/main.yml index b7b3298..1c96098 100644 --- a/provisioning/roles/phantomjs/tasks/main.yml +++ b/provisioning/roles/phantomjs/tasks/main.yml @@ -2,15 +2,15 @@ - name: PhantomJS | Install firefox become: yes apt: pkg=iceweasel - state=installed + state=present update-cache=yes tags: phantomjs -- name: PhantonJS | Install fontconfig +- name: PhantomJS | Install fontconfig become: yes apt: pkg=fontconfig - state=installed - tags: phantonjs + state=present + tags: phantomjs - name: PhantomJS | Create home directory become: yes From 9dcc6ad3fec0277121dc6a286c78655b903efbf9 Mon Sep 17 00:00:00 2001 From: Bec White Date: Tue, 4 Feb 2020 17:03:45 -0600 Subject: [PATCH 4/9] Update ruby version used by serverspec. --- script/serverspec.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/serverspec.sh b/script/serverspec.sh index d8eab3d..c3f5e52 100644 --- a/script/serverspec.sh +++ b/script/serverspec.sh @@ -1,5 +1,5 @@ #!/bin/bash -export PATH="$PATH:/home/vagrant/.rvm/rubies/ruby-2.3.1/bin" +export PATH="$PATH:/home/vagrant/.rvm/rubies/ruby-2.5.2/bin" gem install bundler --no-ri --no-rdoc cd /tmp/tests bundle install --path=vendor From abd6b3a789dc3c32ee1fda4f3f435136a1303e6c Mon Sep 17 00:00:00 2001 From: Bec White Date: Tue, 4 Feb 2020 18:05:19 -0600 Subject: [PATCH 5/9] Don't install bundler (it's already provided by the rvm-installed ruby) --- script/serverspec.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/script/serverspec.sh b/script/serverspec.sh index c3f5e52..a62bed3 100644 --- a/script/serverspec.sh +++ b/script/serverspec.sh @@ -1,6 +1,5 @@ -#!/bin/bash +#!/bin/bash -x export PATH="$PATH:/home/vagrant/.rvm/rubies/ruby-2.5.2/bin" -gem install bundler --no-ri --no-rdoc cd /tmp/tests bundle install --path=vendor bundle exec rake spec From e3ddeee4528e2efce046f96907ffea1473e54f5f Mon Sep 17 00:00:00 2001 From: Bec White Date: Fri, 7 Feb 2020 19:31:17 -0600 Subject: [PATCH 6/9] Update how rvm is used by the serverspec.sh script. --- script/serverspec.sh | 17 +++++++++++++---- tests/Rakefile | 10 ++++++++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/script/serverspec.sh b/script/serverspec.sh index a62bed3..65a592f 100644 --- a/script/serverspec.sh +++ b/script/serverspec.sh @@ -1,5 +1,14 @@ -#!/bin/bash -x -export PATH="$PATH:/home/vagrant/.rvm/rubies/ruby-2.5.2/bin" -cd /tmp/tests +#!/bin/bash +# This script is run during the Packer build process. + +# Wherever the tests are expected to live. +tests_path="/tmp/tests" +specs_path="/tmp/tests/specs/*_spec.rb" + +# Load rvm into this session +[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" + +# Run serverspec +cd "$tests_path" bundle install --path=vendor -bundle exec rake spec +bundle exec rake spec["$specs_path"] diff --git a/tests/Rakefile b/tests/Rakefile index 544dbb1..cdb4aaf 100644 --- a/tests/Rakefile +++ b/tests/Rakefile @@ -1,6 +1,12 @@ require 'rake' require 'rspec/core/rake_task' -RSpec::Core::RakeTask.new(:spec) do |t| - t.pattern = '/tmp/tests/specs/*_spec.rb' +RSpec::Core::RakeTask.new(:spec, :spec_pattern) do |t, task_args| + if task_args[:spec_pattern].nil? || task_args[:spec_pattern].empty? + print " Missing spec file pattern. Run with:\r\n" + print " bundle exec rake spec[/path/to/*_spec.rb]\r\n" + exit + end + + t.pattern = task_args[:spec_pattern] end From 5f4975f0e12f94422d669cc2fc42472c215ed2e1 Mon Sep 17 00:00:00 2001 From: Bec White Date: Fri, 7 Feb 2020 20:10:09 -0600 Subject: [PATCH 7/9] Update development docs. --- README.md | 6 +++--- docs/Development-Workflow.md | 40 +++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9990ba1..d052390 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,14 @@ Devkit is a framework to build Vagrant boxes for our projects' development envir Build the current box with: ``` -$> make drupalbox +make drupalbox ``` Test the current box with: ``` -$> cd dev -$> vagrant up +cd dev +vagrant up ``` ## Development Requirements diff --git a/docs/Development-Workflow.md b/docs/Development-Workflow.md index 466ebdb..5fc520f 100644 --- a/docs/Development-Workflow.md +++ b/docs/Development-Workflow.md @@ -15,4 +15,42 @@ vagrant reload --provision-with test # Rebuild the box from scratch vagrant destroy vagrant up -``` \ No newline at end of file +``` + +There are a few things that are different between running the provisioning against a vagrant box and running the provisioning as part of the Packer workflow. The full Packer workflow can be run with Make: + +``` +make drupalbox +``` + +If this is successful, you can dd the resulting box to your local list of Vagrant boxes: + +``` +vagrant box add --name=test-drupalbox drupalbox_virtualbox.box +``` + +To spin up a Vagrant environment using this box: + +1. `cd` to the directory where you want to use the box (either an existing project, or a new, empty directory) +2. If you've run Vagrant here before, destroy the existing environment: + + ``` + vagrant destroy + ``` +2. If there's an existing `Vagrantfile`, update these lines: + + ``` + box.vm.box = "test-drupalbox" + box.vm.box_version = "*" + ``` +3. Otherwise, create a new Vagrantfile: + + ``` + vagrant init test-drupalbox + ``` +4. Spin up the box and ssh in: + + ``` + vagrant up + vagrant ssh + ``` From 9110a9afe8862c47b2faf9b1b8553e74cdf7872f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 29 Feb 2020 09:32:07 +0000 Subject: [PATCH 8/9] Bump rake from 10.1.1 to 12.3.3 in /tests Bumps [rake](https://github.com/ruby/rake) from 10.1.1 to 12.3.3. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/rake-10.1.1...v12.3.3) Signed-off-by: dependabot[bot] --- tests/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Gemfile.lock b/tests/Gemfile.lock index 806a96e..e75c42f 100644 --- a/tests/Gemfile.lock +++ b/tests/Gemfile.lock @@ -7,7 +7,7 @@ GEM net-ssh (>= 2.6.5) net-ssh (3.1.1) net-telnet (0.1.1) - rake (10.1.1) + rake (12.3.3) rspec (3.4.0) rspec-core (~> 3.4.0) rspec-expectations (~> 3.4.0) From 8b2ee327a461cce62d5f8995450f07a1aff1d855 Mon Sep 17 00:00:00 2001 From: Bec White Date: Fri, 8 May 2020 12:17:14 -0500 Subject: [PATCH 9/9] Remove Duplicity (https://linux.die.net/man/1/duplicity) since we don't use it, and our PPA cert is expired. --- drupalbox/drupalbox.yml | 1 - drupalbox/tests/duplicity_spec.rb | 18 --------------- .../roles/duplicity/defaults/main.yml | 11 ---------- .../roles/duplicity/tasks/configure.yml | 14 ------------ .../roles/duplicity/tasks/install.yml | 22 ------------------- provisioning/roles/duplicity/tasks/main.yml | 7 ------ .../roles/duplicity/templates/duply/conf.j2 | 5 ----- 7 files changed, 78 deletions(-) delete mode 100644 drupalbox/tests/duplicity_spec.rb delete mode 100644 provisioning/roles/duplicity/defaults/main.yml delete mode 100644 provisioning/roles/duplicity/tasks/configure.yml delete mode 100644 provisioning/roles/duplicity/tasks/install.yml delete mode 100644 provisioning/roles/duplicity/tasks/main.yml delete mode 100644 provisioning/roles/duplicity/templates/duply/conf.j2 diff --git a/drupalbox/drupalbox.yml b/drupalbox/drupalbox.yml index ccb1761..83d2662 100644 --- a/drupalbox/drupalbox.yml +++ b/drupalbox/drupalbox.yml @@ -52,5 +52,4 @@ - { role: phpmyadmin } - { role: nodejs } - { role: phantomjs } - - { role: duplicity } - { role: drupalbox } diff --git a/drupalbox/tests/duplicity_spec.rb b/drupalbox/tests/duplicity_spec.rb deleted file mode 100644 index 51bc088..0000000 --- a/drupalbox/tests/duplicity_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require_relative 'spec_helper.rb' - -describe ppa('duplicity-team/ppa') do - it { should exist } - it { should be_enabled } -end - -describe package('duplicity') do - it { should be_installed } -end - -describe package('duply') do - it { should be_installed } -end - -describe package('python-boto') do - it { should be_installed } -end diff --git a/provisioning/roles/duplicity/defaults/main.yml b/provisioning/roles/duplicity/defaults/main.yml deleted file mode 100644 index 91ef68d..0000000 --- a/provisioning/roles/duplicity/defaults/main.yml +++ /dev/null @@ -1,11 +0,0 @@ -duplicity_passphrase: ~ -duplicity_iam_key: ~ -duplicity_iam_secret: ~ -duplicity_s3_bucket: ~ -duplicity_profiles: - - alias: vagrant-files - s3_target: "s3://s3.amazonaws.com/{{ duplicity_s3_bucket }}/files" - s3_source: "/var/www/{{ hostname }}/web/sites/default/files" - - alias: vagrant-database - s3_target: "s3://s3.amazonaws.com/{{ duplicity_s3_bucket }}/database" - s3_source: "/var/www/{{ hostname }}/files/database" diff --git a/provisioning/roles/duplicity/tasks/configure.yml b/provisioning/roles/duplicity/tasks/configure.yml deleted file mode 100644 index b821358..0000000 --- a/provisioning/roles/duplicity/tasks/configure.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- name: Duplicity | Create Duply Dir - file: path=~/.duply/{{ item.alias }} - state=directory - recurse=true - with_items: "{{ duplicity_profiles }}" - tags: duplicity - -- name: Duplicity | Copy Duply Templates - template: src=duply/conf.j2 - dest=~/.duply/{{ item.alias }}/conf - mode=600 - with_items: "{{ duplicity_profiles }}" - tags: duplicity diff --git a/provisioning/roles/duplicity/tasks/install.yml b/provisioning/roles/duplicity/tasks/install.yml deleted file mode 100644 index 501fe93..0000000 --- a/provisioning/roles/duplicity/tasks/install.yml +++ /dev/null @@ -1,22 +0,0 @@ ---- -- name: Duplicity | Add PPA - become: yes - apt_repository: repo='ppa:duplicity-team/ppa' - state=present - tags: duplicity - -- name: Duplicity | Update apt cache - become: yes - apt: - update_cache: yes - tags: duplicity - -- name: Duplicity | Install System Packages - become: yes - apt: - pkg: - - duplicity - - duply - - python-boto - state: present - tags: duplicity diff --git a/provisioning/roles/duplicity/tasks/main.yml b/provisioning/roles/duplicity/tasks/main.yml deleted file mode 100644 index d22db20..0000000 --- a/provisioning/roles/duplicity/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- include: install.yml -- include: configure.yml - when: duplicity_passphrase|default(None) != None and - duplicity_iam_key|default(None) != None and - duplicity_iam_secret|default(None) != None and - duplicity_s3_bucket|default(None) != None diff --git a/provisioning/roles/duplicity/templates/duply/conf.j2 b/provisioning/roles/duplicity/templates/duply/conf.j2 deleted file mode 100644 index c33a9fe..0000000 --- a/provisioning/roles/duplicity/templates/duply/conf.j2 +++ /dev/null @@ -1,5 +0,0 @@ -GPG_PW='{{ duplicity_passphrase }}' -TARGET_USER="{{ duplicity_iam_key }}" -TARGET_PASS="{{ duplicity_iam_secret }}" -TARGET='{{ item.s3_target }}' -SOURCE='{{ item.s3_source }}'