Skip to content

Instantly share code, notes, and snippets.

@jeremyworboys
Last active August 29, 2015 13:57
Show Gist options
  • Save jeremyworboys/9458650 to your computer and use it in GitHub Desktop.
Save jeremyworboys/9458650 to your computer and use it in GitHub Desktop.
Personal Vagrant Provisions
export ZSH=$HOME/.oh-my-zsh
ZSH_THEME="pure"
DISABLE_AUTO_TITLE="true"
ENABLE_CORRECTION="true"
COMPLETION_WAITING_DOTS="true"
plugins=(bower composer cp git laravel4 npm common-aliases pip python virtualenv)
source $ZSH/oh-my-zsh.sh
# User configuration
export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
export PATH="/usr/local/bin:$PATH"
export PATH="$HOME/.composer/vendor/bin:vendor/bin:$PATH"
source ~/.zalias
cd /vagrant

Add the following to the bottom of the project Vagrantfile:

config.vm.provision "shell", path: "https://gist.githubusercontent.com/jeremyworboys/9458650/raw/server.sh", args: ["vagrant.dev", "/vagrant/public"]
config.vm.provision "shell", path: "https://gist.githubusercontent.com/jeremyworboys/9458650/raw/zsh.sh"
config.vm.provision "shell", path: "https://gist.githubusercontent.com/jeremyworboys/9458650/raw/provision.sh"
config.vm.provision "shell", path: "https://gist.githubusercontent.com/jeremyworboys/9458650/raw/mailcatcher.sh"
#!/usr/bin/env bash
#
# This script is from advice by duellsy
# https://laracasts.com/forum/?p=conversation/post/8418
#
# Install dependencies
sudo apt-get install ruby1.9.1-dev -y
sudo apt-get install libsqlite3-dev
# Install mailcatcher
sudo gem install mailcatcher
set -e
if [ ! -n "$ZSH" ]; then
ZSH=~/.oh-my-zsh
fi
if [ -d "$ZSH" ]; then
echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove $ZSH if you want to install"
exit
fi
echo "\033[0;34mCloning Oh My Zsh...\033[0m"
hash git >/dev/null 2>&1 && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
echo "git not installed"
exit
}
echo "\033[0;34mLooking for an existing zsh config...\033[0m"
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32mBacking up to ~/.zshrc.pre-oh-my-zsh\033[0m";
mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
fi
echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m"
cp $ZSH/templates/zshrc.zsh-template ~/.zshrc
sed -i -e "/^ZSH=/ c\\
ZSH=$ZSH
" ~/.zshrc
echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
sed -i -e "/export PATH=/ c\\
export PATH=\"$PATH\"
" ~/.zshrc
echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
sudo chsh -s `which zsh` vagrant
echo "\033[0;32m"' __ __ '"\033[0m"
echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m"
echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m"
echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m"
echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m"
echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m"
echo "\n\n \033[0;32mp.s. Follow us at http://twitter.com/ohmyzsh.\033[0m"
/usr/bin/env zsh
. ~/.zshrc
# Generate locale
sudo locale-gen en_AU.UTF-8
# Setup shell
curl https://gist.githubusercontent.com/jeremyworboys/9201342/raw/.zalias -k > ~/.zalias
curl https://gist.githubusercontent.com/jeremyworboys/9458650/raw/.zshrc -k > ~/.zshrc
#!/usr/bin/env bash
#
# This script is adapted from Homestead by Taylor Otwell
# https://github.com/laravel/homestead
#
block="server {
listen 80;
server_name $1 *.192.168.22.10.xip.io;
root $2;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files \$uri \$uri/ /index.php?\$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/$1-error.log error;
error_page 404 /index.php;
sendfile off;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
"
echo "$block" >> "/etc/nginx/sites-available/$1"
ln -s "/etc/nginx/sites-available/$1" "/etc/nginx/sites-enabled/$1"
service nginx restart
service php5-fpm restart
#!/usr/bin/env bash
#
# This script is adapted from Vaprobash by Chris Fidao
# https://github.com/fideloper/Vaprobash
#
# Install zsh
sudo apt-get install -y zsh
# Install oh-my-zsh
sudo su - vagrant -c 'wget https://gist.githubusercontent.com/jeremyworboys/9458650/raw/omz-installer.sh -O - | zsh'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment