Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
ationframework/Vagrantfile
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
141 lines (109 sloc)
4.55 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrant plugin requirements | |
required_plugins = %w(vagrant-triggers vagrant-vbguest vagrant-hostsupdater) | |
plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin } | |
if not plugins_to_install.empty? | |
puts "Installing plugins: #{plugins_to_install.join(' ')}" | |
system "vagrant plugin install #{plugins_to_install.join(' ')}" | |
exec "vagrant #{ARGV.join(' ')}" | |
end | |
Vagrant.configure(2) do |config| | |
########################## | |
# Wordpress Variables | |
########################## | |
# DB Config | |
db_name = 'wordpress' | |
db_user = 'wordpress' | |
db_password = 'localpw' | |
# Admin user configuration | |
admin_name = 'admin' | |
admin_pw = 'admin' | |
admin_email = 'ationdigitalmedia@gmail.com' | |
# Theme to auto-activate | |
theme_slug_to_activate = 'twentysixteen' | |
# Plugins to start install activated/deactivated | |
#plugin_slug_list_activate = ['disable-comments', 'force-regenerate-thumbnails', 'advanced-custom-fields'] | |
#plugin_slug_list_deactivate = ['cas-maestro'] | |
# Ruby array to shell array | |
#plugins_activate = plugin_slug_list_activate.join(' ') | |
#plugins_deactivate = plugin_slug_list_deactivate.join(' ') | |
# Wordpress Paths | |
local_shared_folder = './www' | |
guest_shared_folder = '/var/www/html' | |
local_wordpress_install = './www' | |
guest_wordpress_install = '/var/www/html' | |
# Other config | |
private_ip = '192.168.33.60' | |
wp_site_title = 'ATION Digital Media' | |
########################## | |
# Vagrant Options | |
########################## | |
# CentOS starter box | |
config.vm.box = "ubuntu/trusty64" | |
# Network | |
config.vm.hostname = "ation.local" | |
config.vm.network "forwarded_port", guest: 80, host: 9800 | |
config.vm.network "private_network", ip: "#{private_ip}" | |
# Shared folders | |
config.vm.synced_folder "#{local_shared_folder}", "#{guest_shared_folder}", :type => "nfs" | |
# Provider specific | |
config.vm.provider "virtualbox" do |vb| | |
# Customize the amount of memory on the VM: | |
vb.memory = "1024" | |
end | |
# we will try to autodetect this path. | |
# However, if we cannot or you have a special one you may pass it like: | |
# config.vbguest.iso_path = "#{ENV['HOME']}/Downloads/VBoxGuestAdditions.iso" | |
# or | |
# config.vbguest.iso_path = "http://company.server/VirtualBox/%{version}/VBoxGuestAdditions.iso" | |
# set auto_update to false, if you do NOT want to check the correct | |
# additions version when booting this machine | |
config.vbguest.auto_update = true | |
# do NOT download the iso file from a webserver | |
# config.vbguest.no_remote = false | |
config.vm.provision "shell", inline: <<-SHELL | |
echo -e "Updating" | |
sudo apt-get update | |
echo -e "Installing Apache" | |
sudo apt-get -y install apache2 | |
sudo rm -rf #{guest_wordpress_install}/index.html | |
echo -e "Installing MySQL" | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password vagrant' | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password vagrant' | |
sudo apt-get -y install mysql-server-5.6 | |
echo -e "Installing PHP" | |
sudo add-apt-repository -y ppa:ondrej/php5-5.6 | |
sudo apt-get -y install php5 | |
sudo apt-get -y install php5-mysql php5-curl php5-mcrypt | |
sudo service apache2 restart | |
echo -e "PHP installed. Setting up MySQL database." | |
sudo service apache2 restart | |
sudo mysql -u root --password="vagrant" -e 'CREATE DATABASE IF NOT EXISTS #{db_name}' | |
sudo mysql -u root --password="vagrant" -e 'GRANT ALL PRIVILEGES ON `#{db_name}`.* TO #{db_user}@localhost IDENTIFIED BY "#{db_password}"' | |
sudo mysql -u root --password="vagrant" -e 'FLUSH PRIVILEGES' | |
echo -e "Databases setup." | |
echo -e "Installing WP-CLI." | |
curl -O -s https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
sudo chmod +x wp-cli.phar | |
sudo mv wp-cli.phar /usr/local/bin/wp | |
sudo a2enmod rewrite | |
sudo bash -c 'cat #{guest_shared_folder}/apacheconfig > /etc/apache2/sites-available/000-default.conf' | |
sudo service apache2 restart | |
sudo service mysql restart | |
echo Ready to develop! Visit #{private_ip}! | |
SHELL | |
# Vagrant Triggers | |
# config.trigger.after :up do | |
# run_remote "sudo service httpd restart > /dev/null" | |
# run_remote "sudo service mysqld restart > /dev/null" | |
# end | |
# config.trigger.after :reload do | |
# run_remote "sudo service httpd restart > /dev/null" | |
# run_remote "sudo service mysqld restart > /dev/null" | |
# end | |
# config.trigger.after :resume do | |
# run_remote "sudo service httpd restart > /dev/null" | |
# run_remote "sudo service mysqld restart > /dev/null" | |
# end | |
end |