The Cloud 66 documentation to install SMTP on a server is excellent and easy to follow, but glosses over how to write a deploy hook to automate the process.
This is my take on a deploy hook to install SMPT through Postfix.
deploy_hooks.yml
---
production:
first_thing:
- source: /.cloud66/postfix_setup.sh
destination: ~/postfix_setup.sh
target: any
apply_during: build_only
execute: true
sudo: true
postfix_setup.sh
#!/bin/bash
set -e
# Install Postfix to send emails
yet | sudo apt-get install postfix
# Configure Postfix
sudo echo "myhostname = yourdomain.com" >> /etc/postfix/main.cf
# Apply configurations
sudo /etc/init.d/postfix reload
This is the first deploy hook that I've ever written for Cloud 66, so if you think there's a better way to achieve the result please get in touch through Twitter @mokagio, or leave a comment below.
Leave the codebase better than you found it.