vagrant-yarrs-and-yamls 0.8.3 → 0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +13 -5
  2. data/Gemfile +2 -0
  3. data/README.md +58 -11
  4. data/Yarrs.example.yaml +20 -0
  5. data/example.Vagrantfile +2 -8
  6. data/lib/scripts/apache2.sh +34 -0
  7. data/lib/scripts/apache2_ssl.sh +24 -0
  8. data/lib/scripts/base.sh +32 -0
  9. data/lib/scripts/composer.sh +28 -0
  10. data/lib/scripts/deploy.sh +38 -0
  11. data/lib/scripts/deploy_init.sh +11 -0
  12. data/lib/scripts/export_vars.sh +16 -0
  13. data/lib/scripts/git.sh +11 -0
  14. data/lib/scripts/hhvm.sh +33 -0
  15. data/lib/scripts/install-nodejs-modules.sh +19 -0
  16. data/lib/scripts/mariadb.sh +35 -0
  17. data/lib/scripts/mysql-create-databases.sh +19 -0
  18. data/lib/scripts/mysql.sh +28 -0
  19. data/lib/scripts/mysql_client.sh +22 -0
  20. data/lib/scripts/newrelic_php.sh +37 -0
  21. data/lib/scripts/nginx.sh +26 -0
  22. data/lib/scripts/nginx_site.sh +27 -0
  23. data/lib/scripts/nodejs.sh +24 -0
  24. data/lib/scripts/nvm.sh +30 -0
  25. data/lib/scripts/permissions.sh +18 -0
  26. data/lib/scripts/php.sh +25 -0
  27. data/lib/scripts/php_configure.sh +18 -0
  28. data/lib/scripts/php_xdebug.sh +18 -0
  29. data/lib/scripts/phpbrew.sh +11 -0
  30. data/lib/scripts/postfix.sh +13 -0
  31. data/lib/scripts/pubkeys.sh +35 -0
  32. data/lib/scripts/rvm.sh +35 -0
  33. data/lib/scripts/test.sh +48 -0
  34. data/lib/scripts/tz.sh +8 -0
  35. data/lib/scripts/wp_env.sh +16 -0
  36. data/lib/scripts/wpcli.sh +27 -0
  37. data/lib/templates/apache2.conf +151 -0
  38. data/lib/templates/apache2_vhost_http.conf +8 -0
  39. data/lib/templates/apache2_vhost_https.conf +16 -0
  40. data/lib/templates/apache2_vhost_redirect_http.conf +17 -0
  41. data/lib/templates/apache2_vhost_redirect_https.conf +18 -0
  42. data/lib/templates/gitconfig.conf +32 -0
  43. data/lib/templates/logrotate.conf +14 -0
  44. data/lib/templates/nginx.conf +56 -0
  45. data/lib/templates/nginx_vhost.erb +45 -0
  46. data/lib/templates/proxy_params.conf +3 -0
  47. data/lib/templates/xdebug.ini +6 -0
  48. data/lib/vagrant-yarrs-and-yamls/api.rb +423 -0
  49. data/lib/vagrant-yarrs-and-yamls/plugin.rb +4 -48
  50. data/lib/vagrant-yarrs-and-yamls/version.rb +1 -1
  51. data/vagrant-yarrs-and-yamls.gemspec +1 -1
  52. metadata +51 -8
  53. data/example.Vagrantfile.yml +0 -8
  54. data/lib/vagrant-yarrs-and-yamls/v1.rb +0 -234
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a918ed74556c378afe57f8a1a8d807944bacbfa3
4
- data.tar.gz: 46859a0fd042be964bf93ce46b087500b60a45c8
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MzAwNzA5MDhlZGNiYTg0MWRlMTgzZmIxZGMyMWNiMjcwN2FlYjcwMA==
5
+ data.tar.gz: !binary |-
6
+ MTY2YjNjZGM3OTc5YzAxNDk5NDRhZTZhNDY4YzEwOTM3YmY3MDE5Zg==
5
7
  SHA512:
6
- metadata.gz: 2daa3e9d815ebc968534704992dba35fa2d35ffbfe9cb24c126ca9b699b6e9a3818eca9865a6c02a66814c966614bdf31f7fafa1666450dec69d7517a48461c1
7
- data.tar.gz: 1d7dd82e506b350390207f47b6ddce504b2e2558a6431fddc7b0038c7e0674fa8e397ff8f22514d92f2defa198c6850d6a65cdff9b2a4da45b5b9db5d7f0d91c
8
+ metadata.gz: !binary |-
9
+ MWRmMjFjZGMxZDVlYTk5YzEzZGJlMjE2NDJkMTAxNGE3Y2M3NmFjM2RkYWVl
10
+ MTkyYWY1OGNmMDA2ZTc5YWE0MGVmMzhlZjQyMTdlMGNmMTJiZTI5NzAzYWU5
11
+ NWIwZjUwMDkwMDVmNTZjMTUyZDBkOGZhNzllYzBlMjk1MTQ4MWQ=
12
+ data.tar.gz: !binary |-
13
+ NTNkZGE5MTI0NDg1YWIxZmUzNjFjMmNiNDk5NGQ3NTc5ZjI2OTRhNjVkMjY3
14
+ M2VjNzk2ZmEwYzdjOTY4NGUxZTYxMjMxZWIyYmEwZjQ2NGJkOTVhNmRhZDA0
15
+ NmRhYzA5M2JmZjc2M2Q4MWQ0NDA4ODk0YWY0M2YzMDZjNTU5ZGQ=
data/Gemfile CHANGED
@@ -8,6 +8,8 @@ end
8
8
 
9
9
  group :plugins do
10
10
  gem "vagrant-yarrs-and-yamls", path: "."
11
+ gem "vagrant-pristine"
12
+ gem "vagrant-hostsupdater"
11
13
  gem "vagrant-digitalocean"
12
14
  gem "vagrant-aws"
13
15
  end
data/README.md CHANGED
@@ -1,24 +1,71 @@
1
- # Yarrs And Yamls
1
+ # Yarrs & Yamls
2
2
 
3
3
  ## Installation
4
4
 
5
5
  `vagrant plugin install vagrant-yarrs-and-yamls`
6
6
 
7
- ## Usage
7
+ Start a new vagrant project
8
+ `vagrant init`
8
9
 
9
- Replace your Vagrantfile with:
10
+ Update an existing vagrant project
11
+ `vagrant --yamls`
12
+
13
+ Executing one of the above commands, your Vagrantfile should look like this now:
10
14
  ```
11
15
  Vagrant.configure(2) do |config|
12
- yarrs_and_yamls(config)
16
+ # Advanced use:
17
+ # yarrs('Yarrs.yaml', config) do |hostname, settings|
18
+ # end
19
+
20
+ # Regular use:
21
+ yarrs('Yarrs.yaml', config)
13
22
  end
14
23
  ```
15
24
 
16
- Create a new file named `Vagrantfile.yml`
25
+ Create a new file named `Yarrs.yaml`
26
+ ```
27
+ # Yarrs.yaml accepts all values that normally go in Vagrantfile.
28
+ #
29
+ # For more information and examples, please see the online documentation at
30
+ # https://github.com/ptahdunbar/yarrs-and-yamls
31
+ ---
32
+ boxes:
33
+ - hostname: vagrant
34
+ box: ubuntu/trusty64
35
+ ip: "10.10.10.100"
36
+ update: true
37
+ nodejs: true
38
+ php:
39
+ - xdebug
40
+ - composer
41
+ - wp
42
+ databases:
43
+ - foo
44
+ - bar
45
+ synced_folders:
46
+ - host: "."
47
+ guest: "/var/www"
48
+ # type: "nfs"
49
+ owner: "www-data"
50
+ group: "www-data"
51
+ mount_options:
52
+ - dmode=775
53
+ - fmode=667
54
+ rsync__args:
55
+ - "--verbose"
56
+ - "--archive"
57
+ - "--delete"
58
+ - "-z"
59
+ rsync__exclude:
60
+ - ".env.production"
61
+ - ".env.production_network"
62
+ provision:
63
+ - path: provision/apache2.sh
64
+ variables:
65
+ - key: FOO
66
+ value: bar
67
+ ```
17
68
 
18
- ## Contributing
69
+ That's it! Boot up your environment:
19
70
 
20
- 1. Fork it
21
- 2. Create your feature branch (`git checkout -b my-new-feature`)
22
- 3. Commit your changes (`git commit -am 'Add some feature'`)
23
- 4. Push to the branch (`git push origin my-new-feature`)
24
- 5. Create new Pull Request
71
+ ```vagrant up```
@@ -0,0 +1,20 @@
1
+ # Yarrs.yaml accepts all values that normally go in Vagrantfile.
2
+ #
3
+ # For more information and examples, please see the online documentation at
4
+ # https://github.com/ptahdunbar/yarrs-and-yamls
5
+ ---
6
+ boxes:
7
+ - hostname: vagrant
8
+ box: ubuntu/trusty64
9
+ ip: "10.10.10.100"
10
+ synced_folders:
11
+ - host: "."
12
+ guest: "/var/www"
13
+ # type: "nfs"
14
+ owner: "www-data"
15
+ group: "www-data"
16
+ mount_options:
17
+ - dmode=775
18
+ - fmode=667
19
+ provision:
20
+ - path: script.sh
data/example.Vagrantfile CHANGED
@@ -1,16 +1,10 @@
1
1
  # -*- mode: ruby -*-
2
2
  # vi: set ft=ruby :
3
3
 
4
- # All Vagrant configuration is done below. The "2" in Vagrant.configure
5
- # configures the configuration version (we support older styles for
6
- # backwards compatibility). Please don't change it unless you know what
7
- # you're doing.
8
4
  Vagrant.configure(2) do |config|
9
- yarrs_and_yamls(config) do |hostname, settings|
5
+ yarrs_and_yamls('Vagrantfile.yaml', config) do |hostname, settings|
10
6
  config.vm.define hostname do |node|
11
- #
12
- # Add your settings to Vagrantfile.yml
13
- #
7
+ ## Add your configuration to Vagrantfile.yml
14
8
  end
15
9
  end
16
10
  end
@@ -0,0 +1,34 @@
1
+ #!/bin/sh
2
+
3
+ echo "apache2.sh: provisioning starts"
4
+
5
+ # install
6
+ if ! which apache > /dev/null 2>&1; then
7
+ sudo apt-get install -y apache2 apache2-mpm-worker apache2-utils libapache2-mod-log-slow libapache2-mod-php5 libapache2-mod-upload-progress libapache2-mod-fcgid
8
+ sudo apt-get install -y libapache2-mod-geoip
9
+ sudo a2enmod actions alias rewrite ssl
10
+ fi
11
+
12
+ # check if not installed
13
+ if ! which apache2ctl > /dev/null 2>&1; then
14
+ echo "apache2.sh: apache2 failed to install :/" 1>&2
15
+ exit 1
16
+ fi
17
+
18
+ # remove any preexisting active sites
19
+ rm /etc/apache2/sites-enabled/* > /dev/null 2>&1
20
+
21
+ sudo rm /etc/apache2/apache2.conf
22
+
23
+ # Link up config files
24
+ ln -sf /var/www/provision/templates/apache2.conf /etc/apache2/apache2.conf
25
+
26
+ sudo service apache2 restart
27
+
28
+ echo "apache2.sh: -+-+-+- software versions:"
29
+ apache2ctl -v
30
+
31
+ echo "apache2.sh: -+-+-+- service status:"
32
+ service apache2 status
33
+
34
+ echo "apache2.sh: provisioning ends"
@@ -0,0 +1,24 @@
1
+ #!/bin/sh
2
+
3
+ echo "apache2_ssl.sh: provisioning starts"
4
+
5
+ SSL_PATH=/var/www/provision/ssl
6
+ LOCAL_PATH=/etc/apache2/ssl/
7
+
8
+ sudo a2enmod ssl
9
+ mkdir -p $LOCAL_PATH
10
+
11
+ # Check if keys exists
12
+ if [ ! -f $LOCAL_PATH/intermediate.crt ]; then
13
+ ln -s $SSL_PATH/intermediate.crt $LOCAL_PATH
14
+ fi
15
+
16
+ if [ ! -f $LOCAL_PATH/public.crt ]; then
17
+ ln -s $SSL_PATH/public.crt $LOCAL_PATH
18
+ fi
19
+
20
+ if [ ! -f $LOCAL_PATH/private.key ]; then
21
+ ln -s $SSL_PATH/private.key $LOCAL_PATH
22
+ fi
23
+
24
+ echo "apache2_ssl.sh: provisioning ends"
@@ -0,0 +1,32 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ TIMESTAMP=/vagrant_provisioned_at
6
+
7
+ echo "base.sh: provisioning starts"
8
+ touch $TIMESTAMP && echo $(date) > $TIMESTAMP
9
+
10
+ # update once a day (every 24 hours).
11
+ # if [ ! -e $TIMESTAMP ]; then
12
+ apt-get update -y -qq > /dev/null
13
+ # touch $TIMESTAMP
14
+ echo $(date) > $TIMESTAMP
15
+ # fi
16
+
17
+ # tools
18
+ apt-get install -y ntp
19
+ apt-get install -y cachefilesd
20
+ echo "RUN=yes" > /etc/default/cachefilesd
21
+ apt-get install -y language-pack-en-base language-pack-en
22
+
23
+ # utils
24
+ apt-get install -y python-software-properties python-setuptools debconf-utils
25
+ apt-get install -y libsasl2-2 ca-certificates libsasl2-modules
26
+ apt-get install -y vim htop curl tmux firefox
27
+
28
+ # Setup sudo to allow no-password sudo for "admin"
29
+
30
+ dpkg --configure -a > /dev/null 2>&1
31
+
32
+ echo "base.sh: provisioning ends"
@@ -0,0 +1,28 @@
1
+ #!/bin/sh
2
+
3
+ echo "composer.sh: provisioning starts"
4
+
5
+ # check prereq
6
+ if ! which php > /dev/null 2>&1; then
7
+ echo "composer.sh: php not installed :/" 1>&2
8
+ exit 1
9
+ fi
10
+
11
+ # install
12
+ if ! which composer > /dev/null 2>&1; then
13
+ curl -sS https://getcomposer.org/installer | php
14
+ sudo mv composer.phar /usr/local/bin/composer
15
+ sudo chown root: /usr/local/bin/composer
16
+ sudo chmod +x /usr/local/bin/composer
17
+ fi
18
+
19
+ # check if not installed
20
+ if ! which composer > /dev/null 2>&1; then
21
+ echo "composer.sh: composer failed to install :/" 1>&2
22
+ exit 1
23
+ fi
24
+
25
+ echo "composer.sh: -+-+-+- software versions:"
26
+ composer --version
27
+
28
+ echo "composer.sh: provisioning ends"
@@ -0,0 +1,38 @@
1
+ #!/bin/sh
2
+
3
+ echo "deploy.sh: provisioning starts"
4
+
5
+ if ! which mysql > /dev/null 2>&1; then
6
+ echo "deploy.sh: Abort. mysql not installed :/" 1>&2
7
+ exit 1
8
+ fi
9
+
10
+ if ! which apache2ctl > /dev/null 2>&1; then
11
+ echo "deploy.sh: Abort. apache2 not installed :/" 1>&2
12
+ exit 1
13
+ fi
14
+
15
+ # Link up vhost file
16
+ ln -sf /var/www/provision/templates/apache2_vhost_http.conf /etc/apache2/sites-enabled/000-http-default.conf
17
+
18
+ sudo service apache2 restart
19
+
20
+ # reset root mysql password
21
+ mysqladmin -uroot password root > /dev/null 2>&1
22
+
23
+ # allow remote login to database.
24
+ sudo sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
25
+
26
+ if test -d "/home/vagrant"; then
27
+ echo "deploy.sh: Setting up vagrant mysql user" 1>&2
28
+ mysql -uroot -proot -e "CREATE USER 'vagrant'@'localhost' IDENTIFIED BY '';" > /dev/null 2>&1
29
+ mysql -uroot -proot -e "CREATE USER 'vagrant'@'%' IDENTIFIED BY '';" > /dev/null 2>&1
30
+ mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'vagrant'@'localhost' WITH GRANT OPTION;" > /dev/null 2>&1
31
+ mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'vagrant'@'%' WITH GRANT OPTION;" > /dev/null 2>&1
32
+ mysql -uroot -proot -e "FLUSH PRIVILEGES;" > /dev/null 2>&1
33
+
34
+ echo "<?php phpinfo();" > /var/www/web/phpinfo.php
35
+ fi
36
+
37
+
38
+ echo "deploy.sh: provisioning ends"
@@ -0,0 +1,11 @@
1
+ #!/bin/sh
2
+
3
+ echo "DevOps provisioning: deploy_init.sh"
4
+
5
+ # Learn more: https://developer.github.com/guides/managing-deploy-keys/
6
+
7
+ useradd deploy -m
8
+ mkdir /home/deploy/.ssh
9
+ chown -R deploy:deploy /home/deploy/.ssh
10
+ chmod 700 /home/deploy/.ssh
11
+ chmod 600 /home/deploy/.ssh/authorized_keys
@@ -0,0 +1,16 @@
1
+ #!/bin/sh
2
+
3
+ # Exit if no args are passed in
4
+ [ -z $1 ] && exit
5
+
6
+ echo "export_vars.sh: provisioning starts"
7
+
8
+ KEY=$1
9
+ VALUE=$2
10
+
11
+ echo 'export $KEY=\"$VALUE\" > /etc/profile.d/exports'
12
+ echo "export $KEY=\"$VALUE\"" > /etc/profile.d/exports
13
+
14
+ chmod +x /etc/profile.d/exports
15
+
16
+ echo "export_vars.sh: provisioning ends"
@@ -0,0 +1,11 @@
1
+ #!/bin/sh
2
+
3
+ echo "git.sh: provisioning starts"
4
+
5
+ [ ! -z $1 ] && cat $1 > /etc/gitconfig
6
+
7
+ sudo apt-get -y install git-core
8
+
9
+ git --version
10
+
11
+ echo "git.sh: provisioning ends"
@@ -0,0 +1,33 @@
1
+ #!/bin/sh
2
+
3
+ echo "hhvm.sh: provisioning starts"
4
+
5
+ # install
6
+ if ! which hhvm > /dev/null 2>&1; then
7
+ sudo apt-get -y install software-properties-common
8
+ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
9
+ sudo add-apt-repository 'deb http://dl.hhvm.com/ubuntu trusty main'
10
+ sudo apt-get update
11
+ sudo apt-get -y install hhvm
12
+ #sudo /usr/share/hhvm/uninstall_fastcgi.sh
13
+ #sudo apt-get install -y hhvm-nightly
14
+
15
+ sudo /usr/share/hhvm/install_fastcgi.sh
16
+ sudo /etc/init.d/hhvm restart
17
+ sudo /etc/init.d/nginx restart
18
+ sudo update-rc.d hhvm defaults
19
+ sudo /usr/bin/update-alternatives --install /usr/bin/php php /usr/bin/hhvm 60
20
+ fi
21
+
22
+ if ! which hhvm > /dev/null 2>&1; then
23
+ echo "hhvm.sh: hhvm failed to install :/" 1>&2
24
+ exit 1
25
+ fi
26
+
27
+ echo "hhvm.sh: -+-+-+- software versions:"
28
+ hhvm --version
29
+
30
+ echo "hhvm.sh: -+-+-+- service status:"
31
+ service hhvm status
32
+
33
+ echo "hhvm.sh: provisioning ends"
@@ -0,0 +1,19 @@
1
+ #!/bin/sh
2
+
3
+ echo "install-nodejs-modules.sh: provisioning starts"
4
+
5
+ source ~/.nvm/nvm.sh
6
+
7
+ nvm --version
8
+ nvm install stable
9
+ nvm use stable
10
+
11
+ modules=$(echo $1 | tr " " "\n")
12
+
13
+ for module in $modules
14
+ do
15
+ echo "npm install -g $module"
16
+ npm install -g $module
17
+ done
18
+
19
+ echo "install-nodejs-modules.sh: provisioning starts"
@@ -0,0 +1,35 @@
1
+ #!/bin/sh
2
+
3
+ echo "mariadb.sh: provisioning starts"
4
+
5
+ # install
6
+ if ! mysql --version | grep Maria > /dev/null 2>&1; then
7
+
8
+ sudo apt-get -y install software-properties-common
9
+ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
10
+ sudo add-apt-repository 'deb http://mirror.jmu.edu/pub/mariadb/repo/10.0/ubuntu trusty main'
11
+ sudo apt-get update
12
+ sudo DEBIAN_FRONTEND=noninteractive apt-get -y -q install mariadb-server mariadb-server-10.0
13
+
14
+ sudo mkdir -p /opt/mysql/data
15
+ sudo mysql_install_db --user=mysql --datadir=/opt/mysql/data
16
+
17
+ #mysql_secure_installation
18
+ mysql -u root -e "DROP USER ''@'localhost';"
19
+ mysql -u root -e "DELETE FROM mysql.db WHERE Db LIKE 'test%';"
20
+ #mysql -u root -e "UPDATE mysql.user set user=\"overlord\" where user=\"root\";"
21
+ fi
22
+
23
+ # check if not installed
24
+ if ! which mysql > /dev/null 2>&1; then
25
+ echo "maraidb.sh: mariadb failed to install :/" 1>&2
26
+ exit 1
27
+ fi
28
+
29
+ echo "maraidb.sh: -+-+-+- software versions:"
30
+ mysql --version
31
+
32
+ echo "maraidb.sh: -+-+-+- service status:"
33
+ service mysql status
34
+
35
+ echo "mariadb.sh: provisioning ends"