Skip to content

Instantly share code, notes, and snippets.

vagrant box add precise32 http://files.vagrantup.com/precise32.box
git clone [email protected]:jgrossiord/vagrant-silex-hello-world.git
cd vagrant-silex-hello-world
vagrant up
@jgrossiord
jgrossiord / gist:5750069
Last active December 18, 2015 07:58
Vagrantfile sample for vagrant-silex-hello-world
Vagrant.configure("2") do |config|
# tells that the VM is a "Ubuntu 32 bits Precise VM"
config.vm.box = "precise32"
# gives the URL of the VM if you did not issue the vagrant add command before
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
# asks Vagrant to run a script at the startup of the VM
# (this is the important part, we will talk further on this point)
config.vm.provision :shell, :path => "script/vagrant-bootstrap.sh"
#!/bin/bash -e
sudo apt-get update -y
sudo apt-get install -y curl apache2 php5 php5-cli php-pear php5-curl phpunit php5-intl php5-memcache php5-dev php5-gd php5-mcrypt php5-dev git-core git
sudo cp /vagrant/script/template/silex-app.conf /etc/apache2/sites-available/silex-app
rm -f /vagrant/logs/web/*.log
rm -f /vagrant/logs/web/urls.txt
sudo a2enmod rewrite
sudo a2dissite 000-default
sudo a2ensite silex-app
sudo service apache2 restart
cd /vagrant
curl -s http://getcomposer.org/installer | php5
php5 composer.phar install
php5 composer.phar update
ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | grep -v '10.0.2' | grep -v '10.11.12.1' | cut -d: -f2 | awk '{ print "http://"$1"/"}' > /vagrant/logs/web/urls.txt
echo "You can access your application on "
cat /vagrant/logs/web/urls.txt
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /vagrant/web
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /vagrant/web/>
AllowOverride All
Order allow,deny
@jgrossiord
jgrossiord / vagrant.sh
Last active December 18, 2015 07:59
Somes vagrant commands
# Startup the VM
vagrant up
# suspend the VM (saved on disk)
vagrant suspend
# shutdown the VM
vagrant halt
# delete the VM
INSERT INTO Table2 (SELECT * FROM Table3 WHERE a=X)