Added files and updated readme
This commit is contained in:
parent
104925b251
commit
2924815f49
7 changed files with 108 additions and 0 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
vagrant/*
|
||||
.vagrant
|
||||
.ey_local_data
|
||||
.DS_Store
|
11
README.md
11
README.md
|
@ -1,2 +1,13 @@
|
|||
# vagrantwrapper
|
||||
A directory structure to support reuse of the vagrantpress vagrant setup
|
||||
|
||||
This is how the directory structure should be used:
|
||||
dev
|
||||
--> plugins
|
||||
Should contain any plugins that are required during development.
|
||||
--> puppet
|
||||
The puppet scripts for providing any custom puppet commands on top of vagrantpress.
|
||||
--> scripts
|
||||
Any scripts to run on the host.
|
||||
--> theme
|
||||
Your theme which your are developing which should be cloned into a subtree.
|
41
Vagrantfile
vendored
Normal file
41
Vagrantfile
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "trusty64"
|
||||
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
|
||||
|
||||
# allows running commands globally in shell for installed composer libraries
|
||||
config.vm.provision :shell, path: "vagrant/files/scripts/setup.sh"
|
||||
|
||||
# setup virtual hostname and provision local IP
|
||||
config.vm.hostname = "vagrantpress.dev"
|
||||
config.vm.network :private_network, :ip => "192.168.50.4"
|
||||
config.hostsupdater.aliases = %w{www.vagrantpress.dev}
|
||||
config.hostsupdater.remove_on_suspend = true
|
||||
|
||||
config.vm.provision :puppet do |puppet|
|
||||
puppet.manifests_path = "vagrant/puppet/manifests"
|
||||
puppet.module_path = "vagrant/puppet/modules"
|
||||
puppet.manifest_file = "setup.pp"
|
||||
end
|
||||
|
||||
config.vm.provision :puppet do |puppet|
|
||||
puppet.manifests_path = "vagrant/puppet/manifests"
|
||||
puppet.module_path = "vagrant/puppet/modules"
|
||||
puppet.manifest_file = "init.pp"
|
||||
puppet.options="--verbose --debug"
|
||||
end
|
||||
|
||||
config.vm.provision :puppet do |puppet|
|
||||
puppet.manifests_path = "dev/puppet/manifests"
|
||||
puppet.module_path = "dev/puppet/modules"
|
||||
puppet.manifest_file = "init.pp"
|
||||
end
|
||||
|
||||
# Fix for slow external network connections
|
||||
config.vm.provider :virtualbox do |vb|
|
||||
vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
|
||||
vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on']
|
||||
end
|
||||
end
|
1
dev/puppet/manifests/init.pp
Normal file
1
dev/puppet/manifests/init.pp
Normal file
|
@ -0,0 +1 @@
|
|||
class { 'custom::install': }
|
2
dev/puppet/modules/custom/files/save-db-changes.sh
Normal file
2
dev/puppet/modules/custom/files/save-db-changes.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
/usr/bin/mysqldump -u wordpress -pwordpress wordpress > /working/puppet/modules/custom/files/wordpress-backup.sql
|
46
dev/puppet/modules/custom/manifests/init.pp
Normal file
46
dev/puppet/modules/custom/manifests/init.pp
Normal file
|
@ -0,0 +1,46 @@
|
|||
class custom::install {
|
||||
|
||||
exec { 'wordpress_exists':
|
||||
command => '/bin/true',
|
||||
onlyif => '/usr/bin/test -e /vagrant/wordpress/wp-content/themes',
|
||||
}
|
||||
|
||||
# Create a symlink of theme folder
|
||||
file { '/vagrant/wordpress/wp-content/themes/test/':
|
||||
ensure => 'link',
|
||||
target => '/working/theme',
|
||||
require => Exec['wordpress_exists'],
|
||||
}
|
||||
|
||||
# Create a symlink of plugins folder
|
||||
file { '/vagrant/wordpress/wp-content/plugins/':
|
||||
ensure => 'link',
|
||||
target => '/working/plugins',
|
||||
force => true,
|
||||
require => Exec['wordpress_exists'],
|
||||
}
|
||||
|
||||
# Create a symlink of uploads folder
|
||||
file { '/vagrant/wordpress/wp-content/uploads/':
|
||||
ensure => 'link',
|
||||
target => '/working/puppet/modules/custom/files/uploads',
|
||||
force => true,
|
||||
require => Exec['wordpress_exists'],
|
||||
}
|
||||
|
||||
exec { 'npm install':
|
||||
command => '/usr/bin/npm install',
|
||||
cwd => '/working/theme/',
|
||||
require => File['/vagrant/wordpress/wp-content/themes/test/'],
|
||||
}
|
||||
|
||||
#file { '/tmp/wordpress-backup.sql':
|
||||
# source => 'puppet:///modules/custom/wordpress-backup.sql'
|
||||
#}
|
||||
|
||||
#exec { 'load-db':
|
||||
# command => '/usr/bin/mysql -u wordpress -pwordpress wordpress < /tmp/wordpress-backup.sql && touch /home/vagrant/db-updated',
|
||||
# creates => '/home/vagrant/db-updated',
|
||||
# require => File['/tmp/wordpress-backup.sql'],
|
||||
#}
|
||||
}
|
3
dev/scripts/save-db-host.sh
Normal file
3
dev/scripts/save-db-host.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
vagrant ssh -c "/working/puppet/modules/custom/files/save-db-changes.sh"
|
Loading…
Reference in a new issue