Created
July 16, 2014 20:19
-
-
Save eaton/6baa0d779b5f64279d3d to your computer and use it in GitHub Desktop.
CMS test run vagrantfiles
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 : | |
# Setting up Craft CMS: | |
# 0. vagrant-up | |
# 1. Download the latest from http://buildwithcraft.com | |
# 2. Uncompress the Craft zip. | |
# 3. Copy its 'public' and 'craft' directories into the 'www' folder. | |
# 4. Rename www/public/htaccess to www/public/.htaccess | |
# 5. Update www/craft/config/db.php with password 'root' and dbname 'craft' | |
# 6. Hit http://craft.local/admin to begin the installation. | |
# 7. Optionally upgrade craft to Pro level -- this requires no purchase when running | |
# on a .dev or .local domain. | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
$script = <<SCRIPT | |
sudo apt-get update | |
# Utils and fun bits | |
sudo apt-get install -y curl git | |
sudo apt-get install -y avahi-daemon | |
sudo apt-get install -y openssh-client openssh-server mcrypt | |
# MySQL and friends | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root' | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root' | |
sudo apt-get install -y mysql-server | |
# PHP with all the fixins | |
sudo apt-get install -y php5 php5-apcu php5-cli php5-curl php5-gd php5-imagick php5-json php5-mcrypt php5-mysql php5-oauth php5-readline php5-sqlite php5-xdebug php5-xhprof php5-xmlrpc | |
sudo php5enmod mcrypt | |
# Install apache and screw mightily with permissions | |
sudo apt-get install -y apache2 libapache2-mod-php5 | |
sudo echo "ServerName localhost" >> /etc/apache2/conf-available/fqdn.conf | |
sudo a2enconf fqdn | |
sudo echo "<VirtualHost *:80>" >> /etc/apache2/sites-available/craft.conf | |
sudo echo " ServerName craft.local" >> /etc/apache2/sites-available/craft.conf | |
sudo echo " ServerAdmin webmaster@localhost" >> /etc/apache2/sites-available/craft.conf | |
sudo echo " DocumentRoot /var/www/public" >> /etc/apache2/sites-available/craft.conf | |
sudo echo " ErrorLog ${APACHE_LOG_DIR}/error.log" >> /etc/apache2/sites-available/craft.conf | |
sudo echo " CustomLog ${APACHE_LOG_DIR}/access.log combined" >> /etc/apache2/sites-available/craft.conf | |
sudo echo " <Directory /var/www>" >> /etc/apache2/sites-available/craft.conf | |
sudo echo " AllowOverride All" >> /etc/apache2/sites-available/craft.conf | |
sudo echo " </Directory>" >> /etc/apache2/sites-available/craft.conf | |
sudo echo "</VirtualHost>" >> /etc/apache2/sites-available/craft.conf | |
sudo a2dissite 000-default | |
sudo a2ensite craft | |
sudo a2enmod rewrite | |
sudo service apache2 restart | |
mysql --user="root" --password="root" -e "create database craft;" | |
SCRIPT | |
config.vm.box = "ubuntu/trusty32" | |
config.vm.network "private_network", type: "dhcp" | |
config.vm.hostname = "craft" | |
config.vm.synced_folder "www/", "/var/www", owner: "www-data", group: "www-data", create: true | |
config.vm.synced_folder "logs/", "/var/log/apache2", create: true | |
config.vm.provision "shell", inline: $script | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment