Skip to content

Instantly share code, notes, and snippets.

@matthewpoer
Created September 26, 2018 03:56
Show Gist options
  • Save matthewpoer/6162d189ff3c9178f808da8cf01efe54 to your computer and use it in GitHub Desktop.
Save matthewpoer/6162d189ff3c9178f808da8cf01efe54 to your computer and use it in GitHub Desktop.
LAMP with PHP 5.6 (via devbox project) and MailHog
$mailhog_setup = <<-SCRIPT
rm ~/.profile
apt-get update
apt-get install -y golang-go
echo "export GOPATH=$HOME/gocode" >> ~/.profile
source ~/.profile
go get github.com/mailhog/MailHog
go get github.com/mailhog/mhsendmail
cp ~/gocode/bin/MailHog /usr/local/bin/mailhog
cp ~/gocode/bin/mhsendmail /usr/local/bin/mhsendmail
echo "sendmail_path = /usr/local/bin/mhsendmail" >> /etc/php/5.6/cli/php.ini
echo "Starting mailhog..."
/usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 &
echo "Mailhog should be running on port 8025"
SCRIPT
Vagrant.configure("2") do |config|
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
config.vm.box = "damianlewis/ubuntu-16.04-lamp"
config.vm.network "forwarded_port", guest: 8025, host: 8025
config.vm.provision "shell",
inline: 'update-alternatives --set php "/usr/bin/php5.6" > /dev/null'
config.vm.provision "shell", inline: $mailhog_setup
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment