Skip to content

Instantly share code, notes, and snippets.

@linhmtran168
Last active March 23, 2016 14:36
Show Gist options
  • Save linhmtran168/a3768339eaf9e1b4df2b to your computer and use it in GitHub Desktop.
Save linhmtran168/a3768339eaf9e1b4df2b to your computer and use it in GitHub Desktop.
Laravel Homestead setup script
#!/bin/sh
# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
# Uupdate
sudo apt-get update
# Install some base packages
sudo apt-get install -qq tmux git build-essential python-software-properties zsh autojump supervisor ruby1.9.1-dev libpq-dev
home_dir=/home/vagrant
zprezto_dir=$home_dir/.zprezto
if [ ! -d $zprezto_dir ]; then
# Install zpresto
git clone --recursive https://github.com/sorin-ionescu/prezto.git $zprezto_dir
# Change default shell to zsh for vagrant user
sudo chsh -s /bin/zsh vagrant
fi
# Update permission for .zprezto folder
sudo chmod 777 -R $zprezto_dir
# Install dotfiles for linux
dotfiles_dir=/home/vagrant/dotfiles
if [ ! -d $dotfiles_dir ]; then
git clone https://github.com/linhmtran168/linux_dotfiles.git $dotfiles_dir
# Link setting file
ln -sf $dotfiles_dir/.zpreztorc $home_dir
ln -sf $dotfiles_dir/.zprofile $home_dir
ln -sf $dotfiles_dir/.zshrc $home_dir
ln -sf $dotfiles_dir/.tmux.conf $home_dir
# Link zprezto theme
ln -sf $dotfiles_dir/prompt_superlinh_setup $zprezto_dir/modules/prompt/functions/
fi
# Install mailcatcher
if [ $(gem list mailcatcher -i) = "false" ]; then
sudo gem install mailcatcher
fi
# Install pgcli
sudo pip install pgcli
# Add the mailcatcher service to supervisord
if [ ! -f /etc/supervisor/conf.d/mailcatcher.conf ]; then
mailcatcher_block="[program:mailcatcher]
command=mailcatcher -f --http-ip=0.0.0.0
autostart=true
autorestart=true
stderr_logfile=/var/log/mailcatcher.err.log
stdout_logfile=/var/log/mailcatcher.out.log"
echo "$mailcatcher_block" > "/etc/supervisor/conf.d/mailcatcher.conf"
supervisorctl reread
supervisorctl update
fi
# Install and add the phantomjs service to supervisord
sudo apt-get install phantomjs
if [ ! -f /etc/supervisor/conf.d/phantomjs.conf ]; then
phantomjs_block="[program:phantomjs]
command=phantomjs --webdriver=4444
autostart=true
autorestart=true
stderr_logfile=/var/log/phantomjs.err.log
stdout_logfile=/var/log/phantomjs.out.log"
echo "$phantomjs_block" > "/etc/supervisor/conf.d/phantomjs.conf"
supervisorctl reread
supervisorctl update
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment