Sendy is a self hosted email newsletter application that lets you send trackable emails via Amazon Simple Email Service (SES).
You can deploy Sendy on Heroku using the following instructions (I assume you've already installed the heroku toolbelt).
- On Heroku, create a new app.
- Clone that app to your desktop
git clone [email protected]:YOURAPP.git -o heroku
- Add the free cleardb addon to your project
heroku addons:add cleardb
- Add the included
composer.json
file to the root of your cloned directory. - 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.
- Commit all the changes and push to Heroku:
git add -A .
git commit -am "Sendy customised for heroku deployment"
git push heroku master
- Follow the remaining Sendy setup steps (http://sendy.co/get-started) starting with Step 5.
Cron will make your experience much nicer, and not lock up your site.
- Add the heroku scheduler:
heroku addons:add scheduler:standard
- Open the scheduler:
heroku addons:open scheduler
- 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
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.
I just successfully installed sendy on heroku! Thx for this!
There was an error after pushing up to heroku with this guide as of 2nd February 2016.
If you see an error like this:
Tweak
composer.json
file in this gist should be modified to use PHP 5 instead of any versions of PHP above5.5
which may end up using PHP 7 on Heroku.composer.json
should be:I chose to use PHP 5.5. I suppose 5.6 or 5.7 should work as well. Should probably use the latest to avoid security vulnerabilities.
@Tam-Vo
For guys getting this error:
Make sure to run
composer update
!For those not familiar with composer, you need to first install it. https://getcomposer.org/download/
I don't code in PHP so I had to install PHP on my mac with
brew install php56
https://github.com/Homebrew/homebrew-php