Skip to content

Commit

Permalink
Add environment files
Browse files Browse the repository at this point in the history
  • Loading branch information
youthkee committed Jul 1, 2017
1 parent 7a2ab94 commit 662ecea
Show file tree
Hide file tree
Showing 489 changed files with 6,011 additions and 339 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
@@ -0,0 +1,13 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true

[{*.php,*.js,*.css}]
indent_style = tab
indent_size = 4
51 changes: 51 additions & 0 deletions .gitignore
@@ -0,0 +1,51 @@
.DS_Store
.ansible
.bundle
.envrc
.github/
.idea/
.travis.yml
.vagrant
npm-debug.log
package.box
playbook.retry
!*.gitignore
/wordpress/.editorconfig
/wordpress/.htaccess
/wordpress/index.php
/wordpress/license.txt
/wordpress/readme.html
/wordpress/sitemap.xml
/wordpress/sitemap.xml.gz
/wordpress/wp-activate.php
/wordpress/wp-blog-header.php
/wordpress/wp-comments-post.php
/wordpress/wp-config-sample.php
/wordpress/wp-config.php
/wordpress/wp-cron.php
/wordpress/wp-links-opml.php
/wordpress/wp-load.php
/wordpress/wp-login.php
/wordpress/wp-mail.php
/wordpress/wp-settings.php
/wordpress/wp-signup.php
/wordpress/wp-trackback.php
/wordpress/xmlrpc.php
/wordpress/wp-admin/
/wordpress/wp-content/advanced-cache.php
/wordpress/wp-content/backup-db/
/wordpress/wp-content/backups/
/wordpress/wp-content/blogs.dir/
/wordpress/wp-content/cache/
/wordpress/wp-content/languages/
/wordpress/wp-content/plugins/
#/wordpress/wp-content/themes/
/wordpress/wp-content/themes/index.php
/wordpress/wp-content/themes/twentyfifteen/
/wordpress/wp-content/themes/twentyseventeen/
/wordpress/wp-content/themes/twentysixteen/
/wordpress/wp-content/upgrade/
#/wordpress/wp-content/uploads/
/wordpress/wp-content/wp-cache-config.php
/wordpress/wp-content/index.php
/wordpress/wp-includes/
360 changes: 21 additions & 339 deletions LICENSE

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions Movefile
@@ -0,0 +1,47 @@
local:
vhost: "http://vccw.local"
wordpress_path: "/var/www/html" # use an absolute path here

database:
name: "wordpress"
user: "wordpress"
password: "wordpress"
host: "localhost"
charset: "utf8"

# paths: # you can customize wordpress internal paths
# wp_content: "wp-content"
# uploads: "wp-content/uploads"
# plugins: "wp-content/plugins"
# mu_plugins: "wp-content/mu-plugins"
# themes: "wp-content/themes"
# languages: "wp-content/languages"

production:
vhost: "http://example.com"
wordpress_path: "/var/www/your_site" # use an absolute path here

database:
name: "database_name"
user: "user"
password: "password"
host: "host"
port: "3308" # Use just in case you have exotic server config
mysqldump_options: "--max_allowed_packet=50MB" # Only available if using SSH

exclude:
- ".git/"
- ".gitignore"
- ".sass-cache/"
- "bin/"
- "tmp/*"
- "Gemfile*"
- "Movefile"
- "wp-config.php"
- "wp-content/*.sql"

ssh:
host: "host"
user: "user"
port: 22
rsync_options: --verbose
113 changes: 113 additions & 0 deletions Vagrantfile
@@ -0,0 +1,113 @@
# encoding: utf-8
# vim: ft=ruby expandtab shiftwidth=2 tabstop=2

require 'yaml'

Vagrant.require_version '>= 1.8.6'

Vagrant.configure(2) do |config|

vccw_version = '3.3.1';

_conf = YAML.load(
File.open(
File.join(File.dirname(__FILE__), 'provision/default.yml'),
File::RDONLY
).read
)

if File.exists?(File.join(ENV["HOME"], '.vccw/config.yml'))
_custom = YAML.load(
File.open(
File.join(ENV["HOME"], '.vccw/config.yml'),
File::RDONLY
).read
)
_conf.merge!(_custom) if _custom.is_a?(Hash)
end

if File.exists?(File.join(File.dirname(__FILE__), 'site.yml'))
_site = YAML.load(
File.open(
File.join(File.dirname(__FILE__), 'site.yml'),
File::RDONLY
).read
)
_conf.merge!(_site) if _site.is_a?(Hash)
end

# forcing config variables
_conf["vagrant_dir"] = "/vagrant"

config.vm.define _conf['hostname'] do |v|
end

config.vm.box = ENV['wp_box'] || _conf['wp_box']
config.vm.box_version = "<= 20161209"
config.ssh.forward_agent = true

config.vm.box_check_update = true

config.vm.hostname = _conf['hostname']
config.vm.network :private_network, ip: _conf['ip']

config.vm.synced_folder _conf['synced_folder'],
_conf['document_root'], :create => "true", :mount_options => ['dmode=755', 'fmode=644']

if Vagrant.has_plugin?('vagrant-hostsupdater')
config.hostsupdater.remove_on_suspend = true
end

if Vagrant.has_plugin?('vagrant-vbguest')
config.vbguest.auto_update = false
end

if File.exists?(File.join(File.dirname(__FILE__), 'provision-pre.sh')) then
config.vm.provision :shell, :path => File.join( File.dirname(__FILE__), 'provision-pre.sh' )
end

config.vm.provider :virtualbox do |vb|
vb.linked_clone = _conf['linked_clone']
vb.name = _conf['hostname']
vb.memory = _conf['memory'].to_i
vb.cpus = _conf['cpus'].to_i
if 1 < _conf['cpus'].to_i
vb.customize ['modifyvm', :id, '--ioapic', 'on']
end
vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on']
vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
end

config.vm.provision "ansible_local" do |ansible|
ansible.extra_vars = {
vccw: _conf
}
ansible.playbook = "provision/playbook.yml"
end

if File.exists?(File.join(ENV["HOME"], '.vccw/playbook-post.yml'))
config.vm.provision "ansible" do |ansible|
ansible.extra_vars = {
vccw: _conf
}
ansible.playbook = File.join(ENV["HOME"], '.vccw/playbook-post.yml')
end
end

if File.exists?(File.join(ENV["HOME"], '.vccw/provision-post.sh'))
config.vm.provision :shell, :privileged => false, :path => File.join(ENV["HOME"], '.vccw/provision-post.sh')
end

if File.exists?(File.join(File.dirname(__FILE__), 'playbook-post.yml')) then
config.vm.provision "ansible_local" do |ansible|
ansible.extra_vars = {
vccw: _conf
}
ansible.playbook = "playbook-post.yml"
end
end

if File.exists?(File.join(File.dirname(__FILE__), 'provision-post.sh')) then
config.vm.provision :shell, :privileged => false, :path => File.join( File.dirname(__FILE__), 'provision-post.sh' )
end
end
3 changes: 3 additions & 0 deletions ansible.cfg
@@ -0,0 +1,3 @@
[defaults]
hash_behaviour=merge
remote_tmp=/vagrant/.ansible/tmp
11 changes: 11 additions & 0 deletions provision-post.sh
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -ex

if [ -e /vagrant/wordpress.sql ]; then
sudo -u vagrant -- wp db import /vagrant/wordpress.sql
fi

cat << EOS > /vagrant/wp-cli.yml
path: wordpress
EOS

0 comments on commit 662ecea

Please sign in to comment.