Skip to content

Instantly share code, notes, and snippets.

@lerox
Last active August 29, 2015 14:14
Show Gist options
  • Save lerox/5502c726bb26bbcb5144 to your computer and use it in GitHub Desktop.
Save lerox/5502c726bb26bbcb5144 to your computer and use it in GitHub Desktop.
Provision of a web environment
#!/usr/bin/env bash
#
# Provision of a web enviroment
#
# vagrant box add utopic https://cloud-images.ubuntu.com/vagrant/utopic/current/utopic-server-cloudimg-amd64-vagrant-disk1.box
#
# 2015-01-27
# Leandro de Santana Diniz
# github.com/lerox
sudo su
if [ ! -d /var/log/vagrant/flags ]; then
mkdir -p /var/log/vagrant/flags
chmod 777 /var/log/vagrant/flags -R
fi
if [ ! -f /var/log/vagrant/flags/percona ]; then
apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A
echo "" >> /etc/apt/sources.list
echo "deb http://repo.percona.com/apt utopic main" >> /etc/apt/sources.list
echo "deb-src http://repo.percona.com/apt utopic main" >> /etc/apt/sources.list
export DEBIAN_FRONTEND=noninteractive
touch /var/log/vagrant/flags/percona
fi
apt-get update && apt-get upgrade -y
if [ ! -f /var/log/vagrant/flags/aptgetinstall ]; then
apt-get install -y python-software-properties php5 memcached php5-memcached php5-curl php5-intl php5-xdebug php-pear git vim percona-server-server-5.6 percona-server-client-5.6
curl update-channels
touch /var/log/vagrant/flags/aptgetinstall
fi
if [ ! -f /var/log/vagrant/flags/apache ]; then
rm -rf /var/www/html
ln -s /vagrant /var/www/html
a2enmod rewrite
touch /var/log/vagrant/flags/apache
fi
if [ ! -f /var/log/vagrant/flags/composer ]; then
curl -s https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
touch /var/log/vagrant/flags/composer
fi
if [ ! -f /var/log/vagrant/flags/capifony ]; then
gem install capifony
touch /var/log/vagrant/flags/capifony
fi
if [ ! -f /var/log/vagrant/flags/initfolder ]; then
echo "" >> /home/vagrant/.profile
echo "cd /vagrant" >> /home/vagrant/.profile
touch /var/log/vagrant/flags/initfolder
fi
/etc/init.d/mysql restart
/etc/init.d/apache2 stop
su vagrant
memcached &
# Example:
# $ vagrant ssh
# $ cd /vagrant
# $ sudo php -S 0.0.0.0:8000 -t ./project/web/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment