Last active
August 29, 2015 14:02
-
-
Save jrub/cfa8c881033743d80b5d to your computer and use it in GitHub Desktop.
Simple Vagrantfile with inline shell provision script for Symfony2 projects
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 : | |
VAGRANTFILE_API_VERSION = "2" | |
$script = <<SCRIPT | |
# reconfigura los locales para evitar mensajes molestos | |
locale-gen UTF-8 | |
sudo dpkg-reconfigure locales | |
# instalar git y dependencias php (+ mysql) | |
apt-get update | |
apt-get install -y git php5 php5-gd php5-intl php5-mysql php5-curl | |
# instalar composer | |
curl -s https://getcomposer.org/installer | php | |
sudo mv composer.phar /usr/local/bin/composer | |
sudo chmod a+x /usr/local/bin/composer | |
## Ejemplo creacion de proyecto | |
sudo composer create-project symfony/framework-standard-edition "symfony_zgz03" 2.4.* | |
# permisos | |
cd symfony_zgz03 | |
sudo chmod 777 app/cache/ app/logs | |
# apendar el timezone al php | |
echo "date.timezone = Europe/Madrid" | sudo tee -a /etc/php5/cli/php.ini | |
echo "date.timezone = Europe/Madrid" | sudo tee -a /etc/php5/apache2/php.ini | |
# comprueba todo ok | |
php app/check.php | |
SCRIPT | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
# Image | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" | |
# Network | |
config.vm.network :forwarded_port, guest: 8000, host: 8000 | |
# Setup | |
config.vm.provision "shell", inline: $script | |
# hacer q la carpeta local sea /var/www/html además de /vagrant | |
# config.vm.synced_folder ".", "/var/www/html", owner: "www-data", group: "www-data" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment