Skip to content

Instantly share code, notes, and snippets.

@joshteng
Forked from dovy/Sendy.md
Last active February 1, 2016 17:33
Show Gist options
  • Save joshteng/d4e9f4a1ab91688c8bdc to your computer and use it in GitHub Desktop.
Save joshteng/d4e9f4a1ab91688c8bdc to your computer and use it in GitHub Desktop.
{
"require": {
"php": "^5.6.0",
"ext-gettext": "*"
}
}

Sendy

Sendy is a self hosted email newsletter application that lets you send trackable emails via Amazon Simple Email Service (SES).

Heroku

You can deploy Sendy on Heroku using the following instructions (I assume you've already installed the heroku toolbelt).

  1. Download Sendy
  2. Navigate into the folder where Sendy is and initialize it as a Git repo git init
  3. Run git add -A
  4. Run git commit -m "initial commit
  5. Add composer.json in the root of Sendy folder
  6. Run composer update (this assumes you have PHP and composer installed) (Otherwise install them! https://getcomposer.org/download/ and for PHP on a mac: https://github.com/Homebrew/homebrew-php)
  7. Run git add -A
  8. Run git commit -m "add composer"
  9. Deploy to Heroku heroku create (this assumes you have heroku cli installed)
  10. Add the free cleardb addon to your project heroku addons:add cleardb
  11. Customise the includes/config.php and include the following snippet to use the ClearDB addon previously selected on Heroku:
   <?php
   define('APP_PATH', 'http://yourdomain.com');

   $url_cleardb = parse_url(getenv("CLEARDB_DATABASE_URL"));

   /*  MySQL database connection credentials  */
   $dbHost = $url_cleardb['host']; //MySQL Hostname
   $dbUser = $url_cleardb['user']; //MySQL Username
   $dbPass = $url_cleardb['pass']; //MySQL Password
   $dbName = substr($url_cleardb["path"],1); //MySQL Database Name

All these settings are necessary to Heroku to automatically hook up the ClearDB add-on. More on the settings here.

  1. Commit all the changes and push to Heroku:
   git add -A .
   git commit -am "Sendy customised for heroku deployment"
   git push heroku master
  1. Follow the remaining Sendy setup steps (http://sendy.co/get-started) starting with Step 5.

Seting up Cron

Cron will make your experience much nicer, and not lock up your site.

  1. Add the heroku scheduler: heroku addons:add scheduler:standard
  2. Open the scheduler: heroku addons:open scheduler
  3. Create two jobs, each with a frequency of 10 mins, and 1x dyno
  • Task 1: php autoresponders.php > /dev/null 2>&1
  • Task 2: php scheduled.php > /dev/null 2>&1

FAQs

You can add your own domain/subdomain easily: heroku domains:add YOUR.DOMAIN.COM Then go to your Domain Registrant and add a CNAME with the value of your app:

Record Name Target
CNAME YOUR YOUR-APP.herokuapp.com.

Replacing of course the name to match the subdomain of your choosing, and appending to your domain record.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment