Commit ad0289e4 authored by Aldo's avatar Aldo

Initial commit

parents
<!--- Drupal VM is used by developers in a wide variety of circumstances. Please use this template when reporting issues or suggesting features so we can help you more efficiently. **Delete this section** and fill in the rest of the template below, deleting the commented sections -->
### Issue Type
<!--- Pick one below and delete the rest: -->
- Bug Report / Support Request
- Feature Idea
- Documentation Report
### Your Environment
<!--- Paste the output from the following command: `vagrant --version && echo "VirtualBox `vboxmanage --version`" && ansible --version` (paste it in the space between the three graves) -->
```
```
### Your OS
<!--- Pick one below and delete the rest: -->
- **macOS** (version)
- **Windows** (version)
- **Linux** (version)
### Full console output
<!--- If this is a Bug Report / Support Request, please copy the ENTIRE contents of your console (including the command that was run), paste it into a new Gist on https://gist.github.com, then paste the link to the gist here. -->
### Summary
<!--- Explain the problem briefly. If submitting a bug report or support request, PLEASE paste the entire error message you're getting. -->
# OS-specific files.
.DS_Store
# Editor and language files.
.idea/
.project/
.bundle/
# Ansible files.
*.retry
.galaxy_install_info
# Vagrant files.
.vagrant/
vagrant_ansible_inventory_default
# Drupal VM specific files.
local.config.yml
Vagrantfile.local
/config.yml
/docker-compose.yml
/drupal.make.yml
/scripts/
/drupal/
---
language: php
php: 7.2
services: docker
env:
global:
- CONFIG: tests/config.yml
MAKEFILE: example.drupal.make.yml
COMPOSERFILE: example.drupal.composer.json
HOSTNAME: drupalvm.test
MACHINE_NAME: drupalvm
IP: 192.168.88.88
DRUPALVM_DIR: /var/www/drupalvm
DRUSH_BIN: drush
TEST_INSTALLED_EXTRAS: true
CONTAINER_ID: dvm-test
matrix:
# Defaults - Ubuntu 18.04.
- type: defaults
distro: ubuntu1804
# Defaults - Debian 9.
- type: debian
distro: debian9
# Defaults - CentOS 7.
- type: centos
distro: centos7
local_config: tests/centos-7.config.yml
# PHP 7.3 - Ubuntu 18.04.
- type: defaults
distro: ubuntu1804
local_config: tests/ubuntu-18-php73.config.yml
DRUSH_BIN: "${DRUPALVM_DIR}/drupal/vendor/bin/drush"
TEST_INSTALLED_EXTRAS: false
# Nginx and Drush make file test - Ubuntu 16.04.
# - type: nginx-drush-make
# distro: ubuntu1604
# local_config: tests/ubuntu-16-nginx-drush-make.config.yml
# config_dir: /var/www/drupalvm/config
# TODO: See https://github.com/geerlingguy/drupal-vm/issues/1675
# PostgreSQL - Ubuntu 16.04.
# - type: postgresql
# distro: ubuntu1604
# local_config: tests/ubuntu-16-postgresql.config.yml
# config_dir: /var/www/drupalvm/config
# DRUSH_BIN: "${DRUPALVM_DIR}/drupal/vendor/bin/drush"
# TEST_INSTALLED_EXTRAS: false
before_install:
# Pull container.
- docker pull geerlingguy/docker-${distro}-ansible:latest
# Install lint tools.
- gem install rubocop
script:
# Vagrantfile syntax check.
- 'rubocop ./Vagrantfile ./lib/drupalvm --except LineLength,Eval,MutableConstant,BlockLength,MethodLength,ConditionalAssignment,AlignParameters'
# Run tests.
- composer run-tests
This diff is collapsed.
FROM geerlingguy/docker-debian9-ansible:latest
LABEL maintainer="Jeff Geerling"
# Copy provisioning directory, variable overrides, and scripts into container.
COPY ./ /etc/ansible/drupal-vm
COPY ./provisioning/docker/vars/docker-hub-overrides.yml /etc/ansible/drupal-vm/local.config.yml
COPY ./provisioning/docker/bin/* /usr/local/bin
# Provision Drupal VM inside Docker.
RUN ansible-playbook /etc/ansible/drupal-vm/provisioning/playbook.yml \
# Enable FPM. See https://github.com/geerlingguy/drupal-vm/issues/1366.
&& systemctl enable php7.2-fpm.service
EXPOSE 80 443 3306 8025
CMD ["/lib/systemd/systemd"]
The MIT License (MIT)
Copyright (c) 2015 Jeff Geerling
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This diff is collapsed.
# frozen_string_literal: true
# -*- mode: ruby -*-
# vi: set ft=ruby :
require_relative 'lib/drupalvm/vagrant'
# Absolute paths on the host machine.
host_drupalvm_dir = File.dirname(File.expand_path(__FILE__))
host_project_dir = ENV['DRUPALVM_PROJECT_ROOT'] || host_drupalvm_dir
host_config_dir = ENV['DRUPALVM_CONFIG_DIR'] ? "#{host_project_dir}/#{ENV['DRUPALVM_CONFIG_DIR']}" : host_project_dir
# Absolute paths on the guest machine.
guest_project_dir = '/vagrant'
guest_drupalvm_dir = ENV['DRUPALVM_DIR'] ? "/vagrant/#{ENV['DRUPALVM_DIR']}" : guest_project_dir
guest_config_dir = ENV['DRUPALVM_CONFIG_DIR'] ? "/vagrant/#{ENV['DRUPALVM_CONFIG_DIR']}" : guest_project_dir
drupalvm_env = ENV['DRUPALVM_ENV'] || 'vagrant'
default_config_file = "#{host_drupalvm_dir}/default.config.yml"
unless File.exist?(default_config_file)
raise_message "Configuration file not found! Expected in #{default_config_file}"
end
vconfig = load_config(
[
default_config_file,
"#{host_config_dir}/config.yml",
"#{host_config_dir}/#{drupalvm_env}.config.yml",
"#{host_config_dir}/local.config.yml"
]
)
provisioner = vconfig['force_ansible_local'] ? :ansible_local : vagrant_provisioner
if provisioner == :ansible
playbook = "#{host_drupalvm_dir}/provisioning/playbook.yml"
config_dir = host_config_dir
# Verify Ansible version requirement.
require_ansible_version ">= #{vconfig['drupalvm_ansible_version_min']}"
else
playbook = "#{guest_drupalvm_dir}/provisioning/playbook.yml"
config_dir = guest_config_dir
end
# Verify Vagrant version requirement.
Vagrant.require_version ">= #{vconfig['drupalvm_vagrant_version_min']}"
ensure_plugins(vconfig['vagrant_plugins'])
Vagrant.configure('2') do |config|
# Set the name of the VM. See: http://stackoverflow.com/a/17864388/100134
config.vm.define vconfig['vagrant_machine_name']
# Networking configuration.
config.vm.hostname = vconfig['vagrant_hostname']
config.vm.network :private_network,
ip: vconfig['vagrant_ip'],
auto_network: vconfig['vagrant_ip'] == '0.0.0.0' && Vagrant.has_plugin?('vagrant-auto_network')
unless vconfig['vagrant_public_ip'].empty?
config.vm.network :public_network,
ip: vconfig['vagrant_public_ip'] != '0.0.0.0' ? vconfig['vagrant_public_ip'] : nil
end
# SSH options.
config.ssh.insert_key = false
config.ssh.forward_agent = true
# Vagrant box.
config.vm.box = vconfig['vagrant_box']
# Display an introduction message after `vagrant up` and `vagrant provision`.
config.vm.post_up_message = vconfig.fetch('vagrant_post_up_message', get_default_post_up_message(vconfig))
# If a hostsfile manager plugin is installed, add all server names as aliases.
aliases = get_vhost_aliases(vconfig) - [config.vm.hostname]
if Vagrant.has_plugin?('vagrant-hostsupdater')
config.hostsupdater.aliases = aliases
elsif Vagrant.has_plugin?('vagrant-hostmanager')
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.aliases = aliases
end
# Sync the project root directory to /vagrant
unless vconfig['vagrant_synced_folders'].any? { |synced_folder| synced_folder['destination'] == '/vagrant' }
vconfig['vagrant_synced_folders'].push(
'local_path' => host_project_dir,
'destination' => '/vagrant'
)
end
# Synced folders.
vconfig['vagrant_synced_folders'].each do |synced_folder|
options = {
type: synced_folder.fetch('type', vconfig['vagrant_synced_folder_default_type']),
rsync__exclude: synced_folder['excluded_paths'],
rsync__args: ['--verbose', '--archive', '--delete', '-z', '--copy-links', '--chmod=ugo=rwX'],
id: synced_folder['id'],
create: synced_folder.fetch('create', false),
mount_options: synced_folder.fetch('mount_options', []),
nfs_udp: synced_folder.fetch('nfs_udp', false)
}
synced_folder.fetch('options_override', {}).each do |key, value|
options[key.to_sym] = value
end
config.vm.synced_folder synced_folder.fetch('local_path'), synced_folder.fetch('destination'), options
end
config.vm.provision 'drupalvm', type: provisioner do |ansible|
ansible.compatibility_mode = '2.0'
ansible.playbook = playbook
ansible.extra_vars = {
config_dir: config_dir,
drupalvm_env: drupalvm_env
}
ansible.raw_arguments = Shellwords.shellsplit(ENV['DRUPALVM_ANSIBLE_ARGS']) if ENV['DRUPALVM_ANSIBLE_ARGS']
ansible.tags = ENV['DRUPALVM_ANSIBLE_TAGS']
# Use pip to get the latest Ansible version when using ansible_local.
provisioner == :ansible_local && ansible.install_mode = 'pip'
end
# VMware Fusion.
config.vm.provider :vmware_fusion do |v, override|
# HGFS kernel module currently doesn't load correctly for native shares.
override.vm.synced_folder host_project_dir, '/vagrant', type: 'nfs'
v.gui = vconfig['vagrant_gui']
v.vmx['memsize'] = vconfig['vagrant_memory']
v.vmx['numvcpus'] = vconfig['vagrant_cpus']
end
# VirtualBox.
config.vm.provider :virtualbox do |v|
v.linked_clone = true
v.name = vconfig['vagrant_hostname']
v.memory = vconfig['vagrant_memory']
v.cpus = vconfig['vagrant_cpus']
v.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
v.customize ['modifyvm', :id, '--ioapic', 'on']