Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Trellis 1.0.0 #19

Merged
merged 121 commits into from
Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
ac336ee
Add xdebug.remote_autostart to simplify xdebug sessions
nathanielks Apr 23, 2018
9d5b3c5
Update logrotate doc URL [ci skip]
retlehs Apr 24, 2018
6f2fff5
Update WP-CLI to 1.5.1.
Apr 25, 2018
e3dff5f
Update changelog. [ci skip]
Apr 25, 2018
db1bb74
Merge pull request #982 from greatislander/wp-cli-1.5.1
retlehs Apr 25, 2018
221ef60
Update geerlingguy.composer 1.6.1->1.7.0 (#983)
runofthemill Apr 27, 2018
51bf998
Update geerlingguy.ntp 1.5.2->1.6.0 (#984)
fullyint Apr 27, 2018
ee8c437
Enable nginx to start on boot (#980)
nathanielks Apr 27, 2018
67e2bc5
update changelog
nathanielks Apr 29, 2018
fdc35af
Merge branch 'master' into xdebug-autostart
nathanielks Apr 29, 2018
6ac097c
Merge pull request #985 from roots/xdebug-autostart
nathanielks Apr 29, 2018
38e3b7a
'yarn run' -> 'yarn' [ci skip]
retlehs May 3, 2018
c6b258e
Issue warning for all Ubuntu releases that are not Xenial (#986)
fullyint May 6, 2018
46d6a2a
Clarify that changelog entry indicates Trellis version (#987)
fullyint May 6, 2018
b556ccd
Validate python version on control machine (#988)
fullyint May 6, 2018
60b38c0
Common: Install `git` instead of `git-core`
tangrufus May 18, 2018
12dde2f
Merge pull request #989 from TangRufus/patch-2
swalkinshaw May 18, 2018
e3315fe
Add CSP frame-ancestors, make X-Frame-Options conditional (#977)
fullyint May 19, 2018
8aa18e9
Improve failed_when rule for Wordpress Installed check (#991)
fullyint May 20, 2018
c3e59f3
deploy.sh: Return non-zero exit code when misuse (#990)
tangrufus May 20, 2018
c068940
Skip Acme Challenge failure message for non-failed sites (#993)
fullyint May 20, 2018
30ae7fe
Bump Ansible version_tested_max to 2.5.3 (#981)
fullyint May 20, 2018
eb20979
Add option to enable FastCGI background updates (#962)
May 21, 2018
54a108e
Add quotes to nginx_cache_background_update value "on"
fullyint May 21, 2018
d52893c
Verify `wp-cli.phar` checksum
tangrufus Jun 3, 2018
e140c05
Merge pull request #996 from TangRufus/wp-cli-checksum
swalkinshaw Jun 3, 2018
571fa23
build-bedore: Checkout project source code to local temporary directory
tangrufus Jun 6, 2018
f578bc9
Change swap role
jasonheecs Jun 11, 2018
97e2671
Merge pull request #1001 from jasonheecs/update-swap-role
swalkinshaw Jun 11, 2018
63cf66f
Allow local configuration of vagrant_mount_type
biinari Jun 14, 2018
04041e9
Rubocop fixes for Vagrantfile
biinari Jun 14, 2018
6c0b8cb
Merge pull request #997 from TangRufus/checkout-to-temp
swalkinshaw Jun 14, 2018
861995a
Merge pull request #1003 from Fatsoma/feature/vagrant_mount_type
swalkinshaw Jun 16, 2018
b2415fa
Revert "build-before: Checkout project source code to local temporary…
swalkinshaw Jun 19, 2018
f03fa95
Merge pull request #1006 from roots/revert-997-checkout-to-temp
swalkinshaw Jun 19, 2018
1925b1c
update xdebug tunnel configuration: update ssh connections to allow t…
nathanielks Jun 25, 2018
c304a5f
update the changelog
nathanielks Jun 25, 2018
83401bd
Merge pull request #1007 from roots/update-xdebug-tunnel
swalkinshaw Jun 25, 2018
1c871b4
Disabling Xdebug requests in development
nathanielks Jun 26, 2018
4574763
Merge pull request #1008 from roots/disable-xdebug-remote
swalkinshaw Jun 26, 2018
ad47593
Re-enable xdebug remote
nathanielks Jun 26, 2018
760278c
Merge pull request #1009 from roots/re-enable-xdebug-remote
swalkinshaw Jun 26, 2018
9cebffe
Deploy: Remove obsoleted `git` remote checking
tangrufus Jul 2, 2018
d4c4bad
#1011 change name of swapfile ansible requirement to match updated na…
Jul 9, 2018
411981f
Merge pull request #1012 from statenweb/tersmitten-oefenweb-ansible-g…
swalkinshaw Jul 9, 2018
bf22d2d
Merge pull request #999 from TangRufus/deploy-git
swalkinshaw Aug 9, 2018
8bebf37
Update wp-cli to 2.0.0 and verify its PGP signature
tangrufus Aug 12, 2018
d85e67e
Add `--lock-never` to "Verify WP-CLI Phar Signature" task
tangrufus Aug 12, 2018
fc39721
Use `copy` instead of `synchronize`
tangrufus Aug 12, 2018
17c26fc
Merge pull request #1014 from TangRufus/wp-cli-gpg
swalkinshaw Aug 12, 2018
978e97f
Patreon
retlehs Aug 30, 2018
e661df1
Update wp-cli to 2.0.1
tangrufus Aug 31, 2018
b740f0e
Merge pull request #1019 from TangRufus/patch-2
retlehs Sep 1, 2018
d49acb3
Update README.md
retlehs Sep 3, 2018
30bc359
Allow customizing Nginx `worker_connections`
tangrufus Sep 30, 2018
537edff
Merge pull request #1021 from TangRufus/nginx-worker-connections
swalkinshaw Sep 30, 2018
fc26547
Merge remote-tracking branch 'upstream/master' into sync-with-original
dac514 Nov 1, 2018
d90a6b5
No longer necessary
dac514 Nov 1, 2018
7c393a4
#1027 make output_buffering optional (#1028)
matgargano Nov 11, 2018
61b1ed9
Update README.md
barryels Nov 14, 2018
186c99f
Merge pull request #1029 from barryels/patch-1
swalkinshaw Nov 14, 2018
4c69ace
Add CodeFirst
retlehs Nov 22, 2018
834966f
Update README.md
retlehs Nov 26, 2018
0771017
Update python version requirement
swalkinshaw Nov 24, 2018
e7f7ebb
Fix unicode reference
swalkinshaw Nov 24, 2018
5b9b658
Update iteritems usage
swalkinshaw Nov 24, 2018
8f265c1
Update logrotate
swalkinshaw Nov 25, 2018
046881a
Support Python 3 HTTP imports
swalkinshaw Dec 2, 2018
c67d78b
Update CHANGELOG
swalkinshaw Dec 2, 2018
d71840a
Merge pull request #1031 from roots/python3-support
swalkinshaw Dec 2, 2018
771d4ec
Python version compatibility fixes
swalkinshaw Dec 5, 2018
51bda7e
Add Python 3.6 to Travis
swalkinshaw Dec 5, 2018
d4c26a6
Merge pull request #1033 from roots/python-compat-fixes
swalkinshaw Dec 5, 2018
5699431
Remove ansible_python_interpreter in server.yml
swalkinshaw Dec 9, 2018
ace1bd7
Merge pull request #1036 from roots/python-compat-server-fix
swalkinshaw Dec 9, 2018
446afe4
Update Vagrant box to ubuntu-18.04
swalkinshaw May 20, 2018
d97c176
Remove invalid sshd macs
swalkinshaw May 20, 2018
4621471
Update Mariadb
swalkinshaw May 20, 2018
b757fcf
Python version compatibility
swalkinshaw May 20, 2018
c76ca56
Update Ubuntu version validation
swalkinshaw May 20, 2018
28e9850
Add CHANGELOG entry
swalkinshaw Dec 10, 2018
e2a5c95
Merge pull request #992 from roots/ubuntu-18.04
swalkinshaw Dec 12, 2018
ac4b511
Update README for 18.04
swalkinshaw Dec 12, 2018
ff496ae
Set ansible_python_interpreter in dev
swalkinshaw Dec 13, 2018
6317bd4
Merge pull request #1039 from roots/fix-ubuntu-bionic-python-interpreter
swalkinshaw Dec 13, 2018
df38788
Fix Python 3 compat error message
swalkinshaw Dec 13, 2018
d6f2411
Fix python 3 Ansible compatibility check
swalkinshaw Dec 13, 2018
8641ca9
Merge pull request #1040 from roots/fix-python-ansible-compat-check
swalkinshaw Dec 13, 2018
4587eca
Add Vagrant `ssh-config` to `~/.ssh/config` on `vagrant up`
retlehs Dec 13, 2018
8e22804
Merge pull request #1042 from roots/ssh-config-vagrant
retlehs Dec 13, 2018
30eafb1
Fix keys usage for Python 2/3 compat
swalkinshaw Dec 14, 2018
ec94e94
Don't force install Ansible Galaxy in dev
swalkinshaw Dec 14, 2018
fc86158
Ansible 2.7 compatibility
retlehs Dec 14, 2018
42eb0b9
Merge pull request #1045 from roots/bump-ansible-ver
retlehs Dec 14, 2018
9a26f30
Require Vagrant >= 2.1.0
retlehs Dec 14, 2018
acdafca
Merge pull request #1046 from roots/bump-vagrant-ver
retlehs Dec 14, 2018
c122be4
Allow overriding rollback variables
tangrufus Dec 14, 2018
d67ba0a
Merge pull request #1047 from TangRufus/rollback-vars
swalkinshaw Dec 15, 2018
fdd9b73
Add `vault_wordpress_env_defaults`
tangrufus Dec 16, 2018
cb57393
Merge pull request #1048 from TangRufus/vault_wordpress_env_defaults
swalkinshaw Dec 16, 2018
83f7163
Fix: `vault_wordpress_env_defaults` not populated during deploy
tangrufus Dec 17, 2018
00c4588
Merge pull request #1049 from TangRufus/patch-3
swalkinshaw Dec 17, 2018
56df5b5
Fix Vagrant trigger path
swalkinshaw Dec 18, 2018
f979bec
Merge pull request #1051 from roots/fix-vagrant-trigger-path
swalkinshaw Dec 18, 2018
c0bef6d
Update to PHP 7.3
retlehs Dec 19, 2018
d59eb8c
Enable ability to change users role `update_password` value (#767)
nathanielks Dec 20, 2018
44839e3
Merge branch 'master' into php-7.3
retlehs Dec 21, 2018
60975e0
Update README [ci skip]
retlehs Dec 21, 2018
3a2f25d
Merge pull request #1052 from roots/php-7.3
retlehs Dec 27, 2018
4251f86
Merge pull request #1044 from roots/dont-force-install-ansible-galaxy…
retlehs Dec 27, 2018
a5bc6e0
Use Ruby for ssh-config trigger
swalkinshaw Dec 20, 2018
79bab55
Merge pull request #1053 from roots/ssh-trigger-use-ruby-script
retlehs Dec 27, 2018
929d31f
1.0.0
retlehs Dec 27, 2018
32778c5
Hyper-V and SMB folder sync compatibility (#1035)
kalenjohnson Dec 27, 2018
cda4d06
Update CHANGELOG [ci skip]
retlehs Dec 27, 2018
bb7c756
Merge pull request #1055 from roots/1.0.0
swalkinshaw Dec 28, 2018
fb8ec64
Update sponsors [ci skip]
retlehs Jan 2, 2019
d8aaa8c
Merge branch 'upstream' into sync-with-original
Jan 4, 2019
105e9bc
Update EPUBCheck and PrinceXML roles
Jan 8, 2019
242fbe9
Add some useful wp-cli packages
Jan 8, 2019
ad6b19e
Activate wp-cli login plugin
Jan 8, 2019
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
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
language: python
python: 2.7
python:
- 2.7
- 3.6
sudo: false
cache: pip
install:
Expand Down
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
### HEAD
### 1.0.0: December 27th, 2018
* Hyper-V and SMB folder sync compatibility ([#1035](https://github.com/roots/trellis/pull/1035))
* Use Ruby script for ssh-config trigger ([#1053](https://github.com/roots/trellis/pull/1053))
* Update to PHP 7.3 ([#1052](https://github.com/roots/trellis/pull/1052))
* Enable per-user `update_password` behavior ([#767](https://github.com/roots/trellis/pull/767))
* Fix Vagrant trigger path ([#1051](https://github.com/roots/trellis/pull/1051))
* Fix: `vault_wordpress_env_defaults` not populated during deploy ([#1049](https://github.com/roots/trellis/pull/1049))
* Add `vault_wordpress_env_defaults` ([#1048](https://github.com/roots/trellis/pull/1048))
* Allow overriding rollback variables ([#1047](https://github.com/roots/trellis/pull/1047))
* Require Vagrant >= 2.1.0 ([#1046](https://github.com/roots/trellis/pull/1046))
* Bump Ansible `version_tested_max` to 2.7.5 ([#1045](https://github.com/roots/trellis/pull/1045))
* Add Vagrant `ssh-config` to `~/.ssh/config` on `vagrant up` ([#1042](https://github.com/roots/trellis/pull/1042))
* [BREAKING] Add Ubuntu 18.04 support and default to it ([#992](https://github.com/roots/trellis/pull/992))
* Python 3 support ([#1031](https://github.com/roots/trellis/pull/1031))
* Allow customizing Nginx `worker_connections` ([#1021](https://github.com/roots/trellis/pull/1021))
* Update wp-cli to 2.0.1 ([#1019](https://github.com/roots/trellis/pull/1019))
* [BREAKING] Update wp-cli to 2.0.0 and verify its PGP signature ([#1014](https://github.com/roots/trellis/pull/1014))
* Deploy: Remove obsoleted `git` remote checking ([#999](https://github.com/roots/trellis/pull/999))
* Update xdebug tunnel configuration ([#1007](https://github.com/roots/trellis/pull/1007))
* Verify `wp-cli.phar` checksum ([#996](https://github.com/roots/trellis/pull/996))
* Enable `fastcgi_cache_background_update` by default ([#962](https://github.com/roots/trellis/pull/962))
* Bump Ansible `version_tested_max` to 2.5.3 ([#981](https://github.com/roots/trellis/pull/981))
Expand Down
40 changes: 25 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,25 @@ Ansible playbooks for setting up a LEMP stack for WordPress.

- Local development environment with Vagrant
- High-performance production servers
- One-command deploys for your [Bedrock](https://roots.io/bedrock/)-based WordPress sites
- Zero-downtime deploys for your [Bedrock](https://roots.io/bedrock/)-based WordPress sites

## What's included

Trellis will configure a server with the following and more:

* Ubuntu 16.04 Xenial LTS
* Ubuntu 18.04 Bionic LTS
* Nginx (with optional FastCGI micro-caching)
* PHP 7.2
* PHP 7.3
* MariaDB (a drop-in MySQL replacement)
* SSL support (scores an A+ on the [Qualys SSL Labs Test](https://www.ssllabs.com/ssltest/))
* Let's Encrypt integration for free SSL certificates
* Let's Encrypt for free SSL certificates
* HTTP/2 support (requires SSL)
* Composer
* WP-CLI
* sSMTP (mail delivery)
* MailHog
* Memcached
* Fail2ban
* ferm
* Fail2ban and ferm

## Documentation

Expand All @@ -35,8 +34,9 @@ Full documentation is available at [https://roots.io/trellis/docs/](https://root

Make sure all dependencies have been installed before moving on:

* [Composer](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx)
* [Virtualbox](https://www.virtualbox.org/wiki/Downloads) >= 4.3.10
* [Vagrant](https://www.vagrantup.com/downloads.html) >= 2.0.1
* [Vagrant](https://www.vagrantup.com/downloads.html) >= 2.1.0

## Installation

Expand All @@ -53,24 +53,34 @@ example.com/ # → Root folder for the project

See a complete working example in the [roots-example-project.com repo](https://github.com/roots/roots-example-project.com).

1. Create a new project directory: `$ mkdir example.com && cd example.com`
2. Clone Trellis: `$ git clone --depth=1 [email protected]:roots/trellis.git && rm -rf trellis/.git`
3. Clone Bedrock: `$ git clone --depth=1 [email protected]:roots/bedrock.git site && rm -rf site/.git`
1. Create a new project directory:
```plain
$ mkdir example.com && cd example.com
```
2. Install Trellis:
```plain
$ git clone --depth=1 [email protected]:roots/trellis.git && rm -rf trellis/.git
```
3. Install Bedrock into the `site` directory:
```plain
$ composer create-project roots/bedrock site
```

Windows user? [Read the Windows docs](https://roots.io/trellis/docs/windows/) for slightly different installation instructions. VirtualBox is known to have poor performance in Windows — use VMware or [see some possible solutions](https://discourse.roots.io/t/virtualbox-performance-in-windows/3932).

## Local development setup

1. Configure your WordPress sites in `group_vars/development/wordpress_sites.yml` and in `group_vars/development/vault.yml`
2. Run `vagrant up`
2. Ensure you're in the trellis directory: `cd trellis`
3. Run `vagrant up`

[Read the local development docs](https://roots.io/trellis/docs/local-development-setup/) for more information.

## Remote server setup (staging/production)

For remote servers, installing Ansible locally is an additional requirement. See the [docs](https://roots.io/trellis/docs/remote-server-setup/#requirements) for more information.

A base Ubuntu 16.04 server is required for setting up remote servers. OS X users must have [passlib](http://pythonhosted.org/passlib/install.html#installation-instructions) installed.
A base Ubuntu 18.04 (Bionic) server is required for setting up remote servers. OS X users must have [passlib](http://pythonhosted.org/passlib/install.html#installation-instructions) installed.

1. Configure your WordPress sites in `group_vars/<environment>/wordpress_sites.yml` and in `group_vars/<environment>/vault.yml` (see the [Vault docs](https://roots.io/trellis/docs/vault/) for how to encrypt files containing passwords)
2. Add your server IP/hostnames to `hosts/<environment>`
Expand All @@ -92,11 +102,11 @@ A base Ubuntu 16.04 server is required for setting up remote servers. OS X users

Contributions are welcome from everyone. We have [contributing guidelines](https://github.com/roots/guidelines/blob/master/CONTRIBUTING.md) to help you get started.

## Gold sponsors
## Trellis sponsors

Help support our open-source development efforts by [contributing to Trellis on OpenCollective](https://opencollective.com/trellis).
Help support our open-source development efforts by [becoming a patron](https://www.patreon.com/rootsdev).

<a href="https://kinsta.com/?kaid=OFDHAJIXUDIV"><img src="https://roots.io/app/uploads/kinsta.svg" alt="Kinsta" width="200" height="150"></a> <a href="https://www.harnessup.com/"><img src="https://roots.io/app/uploads/harness-software.svg" alt="Harness Software" width="200" height="150"></a> <a href="https://k-m.com/"><img src="https://roots.io/app/uploads/km-digital.svg" alt="KM Digital" width="200" height="150"></a> <a href="https://themeisle.com/"><img src="https://roots.io/app/uploads/sponsor-themeisle.svg" alt="ThemeIsle" width="200" height="150"></a>
<a href="https://kinsta.com/?kaid=OFDHAJIXUDIV"><img src="https://cdn.roots.io/app/uploads/kinsta.svg" alt="Kinsta" width="200" height="150"></a> <a href="https://www.harnessup.com/"><img src="https://cdn.roots.io/app/uploads/harness-software.svg" alt="Harness Software" width="200" height="150"></a> <a href="https://k-m.com/"><img src="https://cdn.roots.io/app/uploads/km-digital.svg" alt="KM Digital" width="200" height="150"></a> <a href="https://www.itineris.co.uk/"><img src="https://cdn.roots.io/app/uploads/itineris.svg" alt="itineris" width="200" height="150"></a> <a href="https://www.hebergeurweb.ca"><img src="https://cdn.roots.io/app/uploads/hebergeurweb.svg" alt="Hébergement Web Québec" width="200" height="150"></a>

## Community

Expand Down
81 changes: 54 additions & 27 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

ANSIBLE_PATH = __dir__ # absolute path to Ansible directory on host machine
ANSIBLE_PATH_ON_VM = '/home/vagrant/trellis' # absolute path to Ansible directory on virtual machine
ANSIBLE_PATH_ON_VM = '/home/vagrant/trellis'.freeze # absolute path to Ansible directory on virtual machine

require File.join(ANSIBLE_PATH, 'lib', 'trellis', 'vagrant')
require File.join(ANSIBLE_PATH, 'lib', 'trellis', 'config')
Expand All @@ -19,7 +16,7 @@ ensure_plugins(vconfig.fetch('vagrant_plugins')) if vconfig.fetch('vagrant_insta

trellis_config = Trellis::Config.new(root_path: ANSIBLE_PATH)

Vagrant.require_version '>= 2.0.1'
Vagrant.require_version '>= 2.1.0'

Vagrant.configure('2') do |config|
config.vm.box = vconfig.fetch('vagrant_box')
Expand All @@ -29,7 +26,7 @@ Vagrant.configure('2') do |config|

# Fix for: "stdin: is not a tty"
# https://github.com/mitchellh/vagrant/issues/1673#issuecomment-28288042
config.ssh.shell = %{bash -c 'BASH_ENV=/etc/profile exec bash'}
config.ssh.shell = %(bash -c 'BASH_ENV=/etc/profile exec bash')

# Required for NFS to work
if vconfig.fetch('vagrant_ip') == 'dhcp'
Expand All @@ -39,7 +36,7 @@ Vagrant.configure('2') do |config|
config.hostmanager.ip_resolver = proc do |vm, _resolving_vm|
if cached_addresses[vm.name].nil?
if vm.communicate.ready?
vm.communicate.execute("hostname -I | cut -d ' ' -f 2") do |type, contents|
vm.communicate.execute("hostname -I | cut -d ' ' -f 2") do |_type, contents|
cached_addresses[vm.name] = contents.split("\n").first[/(\d+\.\d+\.\d+\.\d+)/, 1]
end
end
Expand Down Expand Up @@ -69,26 +66,36 @@ Vagrant.configure('2') do |config|

bin_path = File.join(ANSIBLE_PATH_ON_VM, 'bin')

if Vagrant::Util::Platform.wsl? || (Vagrant::Util::Platform.windows? and !Vagrant.has_plugin? 'vagrant-winnfsd')
vagrant_mount_type = vconfig.fetch('vagrant_mount_type')

extra_options = if vagrant_mount_type == 'smb'
{
smb_username: vconfig.fetch('vagrant_smb_username', 'vagrant'),
smb_password: vconfig.fetch('vagrant_smb_password', 'vagrant'),
}
else
{}
end

if vagrant_mount_type != 'nfs' || Vagrant::Util::Platform.wsl? || (Vagrant::Util::Platform.windows? && !Vagrant.has_plugin?('vagrant-winnfsd'))
vagrant_mount_type = nil if vagrant_mount_type == 'nfs'
trellis_config.wordpress_sites.each_pair do |name, site|
config.vm.synced_folder local_site_path(site), remote_site_path(name, site), owner: 'vagrant', group: 'www-data', mount_options: ['dmode=776', 'fmode=775']
config.vm.synced_folder local_site_path(site), remote_site_path(name, site), owner: 'vagrant', group: 'www-data', mount_options: mount_options(vagrant_mount_type, dmode: 776, fmode: 775), type: vagrant_mount_type, **extra_options
end

config.vm.synced_folder ANSIBLE_PATH, ANSIBLE_PATH_ON_VM, mount_options: ['dmode=755', 'fmode=644']
config.vm.synced_folder File.join(ANSIBLE_PATH, 'bin'), bin_path, mount_options: ['dmode=755', 'fmode=755']
config.vm.synced_folder ANSIBLE_PATH, ANSIBLE_PATH_ON_VM, mount_options: mount_options(vagrant_mount_type, dmode: 755, fmode: 644), type: vagrant_mount_type, **extra_options
config.vm.synced_folder File.join(ANSIBLE_PATH, 'bin'), bin_path, mount_options: mount_options(vagrant_mount_type, dmode: 755, fmode: 755), type: vagrant_mount_type, **extra_options
elsif !Vagrant.has_plugin?('vagrant-bindfs')
fail_with_message "vagrant-bindfs missing, please install the plugin with this command:\nvagrant plugin install vagrant-bindfs"
else
if !Vagrant.has_plugin? 'vagrant-bindfs'
fail_with_message "vagrant-bindfs missing, please install the plugin with this command:\nvagrant plugin install vagrant-bindfs"
else
trellis_config.wordpress_sites.each_pair do |name, site|
config.vm.synced_folder local_site_path(site), nfs_path(name), type: 'nfs'
config.bindfs.bind_folder nfs_path(name), remote_site_path(name, site), u: 'vagrant', g: 'www-data', o: 'nonempty'
end

config.vm.synced_folder ANSIBLE_PATH, '/ansible-nfs', type: 'nfs'
config.bindfs.bind_folder '/ansible-nfs', ANSIBLE_PATH_ON_VM, o: 'nonempty', p: '0644,a+D'
config.bindfs.bind_folder bin_path, bin_path, perms: '0755'
trellis_config.wordpress_sites.each_pair do |name, site|
config.vm.synced_folder local_site_path(site), nfs_path(name), type: 'nfs'
config.bindfs.bind_folder nfs_path(name), remote_site_path(name, site), u: 'vagrant', g: 'www-data', o: 'nonempty'
end

config.vm.synced_folder ANSIBLE_PATH, '/ansible-nfs', type: 'nfs'
config.bindfs.bind_folder '/ansible-nfs', ANSIBLE_PATH_ON_VM, o: 'nonempty', p: '0644,a+D'
config.bindfs.bind_folder bin_path, bin_path, perms: '0755'
end

vconfig.fetch('vagrant_synced_folders', []).each do |folder|
Expand Down Expand Up @@ -121,6 +128,7 @@ Vagrant.configure('2') do |config|
ansible.playbook = File.join(provisioning_path, 'dev.yml')
ansible.galaxy_role_file = File.join(provisioning_path, 'requirements.yml') unless vconfig.fetch('vagrant_skip_galaxy') || ENV['SKIP_GALAXY']
ansible.galaxy_roles_path = File.join(provisioning_path, 'vendor/roles')
ansible.galaxy_command = 'ansible-galaxy install --role-file=%{role_file} --roles-path=%{roles_path}'

ansible.groups = {
'web' => ['default'],
Expand All @@ -130,13 +138,23 @@ Vagrant.configure('2') do |config|
ansible.tags = ENV['ANSIBLE_TAGS']
ansible.extra_vars = { 'vagrant_version' => Vagrant::VERSION }

if vars = ENV['ANSIBLE_VARS']
if (vars = ENV['ANSIBLE_VARS'])
extra_vars = Hash[vars.split(',').map { |pair| pair.split('=') }]
ansible.extra_vars.merge!(extra_vars)
end

if !Vagrant::Util::Platform.windows?
config.trigger.after :up do |trigger|
# Add Vagrant ssh-config to ~/.ssh/config
trigger.info = "Adding vagrant ssh-config for #{main_hostname } to ~/.ssh/config"
trigger.ruby do
update_ssh_config(main_hostname)
end
end
end
end

# Virtualbox settings
# VirtualBox settings
config.vm.provider 'virtualbox' do |vb|
vb.name = config.vm.hostname
vb.customize ['modifyvm', :id, '--cpus', vconfig.fetch('vagrant_cpus')]
Expand All @@ -149,19 +167,28 @@ Vagrant.configure('2') do |config|
end

# VMware Workstation/Fusion settings
['vmware_fusion', 'vmware_workstation'].each do |provider|
config.vm.provider provider do |vmw, override|
%w(vmware_fusion vmware_workstation).each do |provider|
config.vm.provider provider do |vmw, _override|
vmw.name = config.vm.hostname
vmw.vmx['numvcpus'] = vconfig.fetch('vagrant_cpus')
vmw.vmx['memsize'] = vconfig.fetch('vagrant_memory')
end
end

# Parallels settings
config.vm.provider 'parallels' do |prl, override|
config.vm.provider 'parallels' do |prl, _override|
prl.name = config.vm.hostname
prl.cpus = vconfig.fetch('vagrant_cpus')
prl.memory = vconfig.fetch('vagrant_memory')
prl.update_guest_tools = true
end

# Hyper-V settings
config.vm.provider 'hyperv' do |h|
h.vmname = config.vm.hostname
h.cpus = vconfig.fetch('vagrant_cpus')
h.memory = vconfig.fetch('vagrant_memory')
h.enable_virtualization_extensions = true
h.linked_clone = true
end
end
7 changes: 4 additions & 3 deletions bin/xdebug-tunnel.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env bash

#!/bin/bash
show_usage() {
echo "
Usage: bin/xdebug-tunnel.sh <action> <host>
Expand All @@ -16,8 +15,10 @@ Examples:
"
}

ENABLE_TCP_FORWARDING=
if [[ $1 == "open" ]]; then
REMOTE_ENABLE=1
ENABLE_TCP_FORWARDING="-e sshd_allow_tcp_forwarding=yes"
elif [[ $1 == "close" ]]; then
REMOTE_ENABLE=0
else
Expand All @@ -39,4 +40,4 @@ if [[ -n $DEBUG ]]; then
PARAMS="$PARAMS ${VERBOSITY:--vvvv}"
fi

ansible-playbook xdebug-tunnel.yml $XDEBUG_ENABLE $SSH_HOST $PARAMS
ansible-playbook xdebug-tunnel.yml $XDEBUG_ENABLE $ENABLE_TCP_FORWARDING $SSH_HOST $PARAMS
4 changes: 2 additions & 2 deletions deploy-hooks/build-before.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# ---
# - name: Install npm dependencies
# command: yarn
# connection: local
# delegate_to: localhost
# args:
# chdir: "{{ project_local_path }}/web/app/themes/sage"
#
Expand All @@ -20,7 +20,7 @@
#
# - name: Compile assets for production
# command: yarn build:production
# connection: local
# delegate_to: localhost
# args:
# chdir: "{{ project_local_path }}/web/app/themes/sage"
#
Expand Down
4 changes: 2 additions & 2 deletions deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
remote_user: "{{ web_user }}"
pre_tasks:
- name: Ensure site is valid
connection: local
delegate_to: localhost
fail:
msg: "Site `{{ site | default('') }}` is not valid. Available sites to deploy: {{ wordpress_sites.keys() | join(', ') }}"
when: wordpress_sites[site | default('')] is not defined
- name: Ensure repo is valid
connection: local
delegate_to: localhost
fail:
msg: |
Invalid Git repository.
Expand Down
9 changes: 8 additions & 1 deletion dev.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
---
- name: "WordPress Server: Install LEMP Stack with PHP 7.2 and MariaDB MySQL"
- name: Set ansible_python_interpreter
hosts: web:&development
gather_facts: false
become: yes
roles:
- { role: python_interpreter, tags: [always] }

- name: "WordPress Server: Install LEMP Stack with PHP 7.3 and MariaDB MySQL"
hosts: web:&development
become: yes
remote_user: vagrant
Expand Down
2 changes: 1 addition & 1 deletion group_vars/all/helpers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ wordpress_env_defaults:
wp_siteurl: "{{ ssl_enabled | ternary('https', 'http') }}://{{ site_hosts_canonical | first }}/wp"
domain_current_site: "{{ site_hosts_canonical | first }}"

site_env: "{{ wordpress_env_defaults | combine(item.value.env | default({}), vault_wordpress_sites[item.key].env) }}"
site_env: "{{ wordpress_env_defaults | combine(vault_wordpress_env_defaults | default({}), item.value.env | default({}), vault_wordpress_sites[item.key].env) }}"
site_hosts_canonical: "{{ item.value.site_hosts | map(attribute='canonical') | list }}"
site_hosts_redirects: "{{ item.value.site_hosts | selectattr('redirects', 'defined') | sum(attribute='redirects', start=[]) | list }}"
site_hosts: "{{ site_hosts_canonical | union(site_hosts_redirects) }}"
Expand Down
6 changes: 5 additions & 1 deletion group_vars/all/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ apt_packages_custom:
ghostscript: "{{ apt_package_state }}"
imagemagick: "{{ apt_package_state }}"
poppler-utils: "{{ apt_package_state }}"
python-lxml: "{{ apt_package_state }}"
python3-lxml: "{{ apt_package_state }}"
unzip: "{{ apt_package_state }}"
nano: "{{ apt_package_state }}"
ccze: "{{ apt_package_state }}"
wp_cli_packages:
- aaemnnosttv/wp-cli-login-command
- runcommand/find-unused-themes
ntp_timezone: Etc/UTC
ntp_manage_config: true
www_root: /srv/www
Expand All @@ -30,4 +33,5 @@ raw_vars:
- vault_mysql_root_password
- vault_users.*.password
- vault_users.*.salt
- vault_wordpress_env_defaults
- vault_wordpress_sites
2 changes: 1 addition & 1 deletion group_vars/all/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ users:
web_user: web
web_group: www-data
web_sudoers:
- "/usr/sbin/service php7.2-fpm *"
- "/usr/sbin/service php7.3-fpm *"
Loading