Please read the new and updated version.
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 and add the following add on: ClearDB (I chose the free tier).
- Create a GIT repository with
git initand commit all the files withgit add -Aandgit commit -am "first commit". - Create a new folder in the root of the project named
ext. In the same folder, place themysqli.sofile downloadable here. In the root folder, create a new file namedphp.iniwith the following content:
extension_dir = "/app/www/ext/"
extension=mysqli.soThis extension is necessary because Heroku doesn't support MySQLi natively. You can read more about MySQLi on Heroku here, and about custom php extensions on Heroku here.
- Customise the
includes/config.phpand 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 NameAll these settings are necessary to Heroku to automatically hook up the ClearDB add-on. More on the settings here.
- Create a new file named
.buildpacksin the root of the project with the following content:
https://github.com/danielepolencic/heroku-buildpack-php.git
https://github.com/piotras/heroku-buildpack-gettextThese are the scripts that provision and set up the server. The php buildpack uses a slighlty tweaked version than the original php buildpack to support gettext.
- Create a new file named
Procfilein the root of the project with the following content:
web: sh boot.shThis file instruct Heroku on how it should launch the application.
- Add a new remote repository to your local repository:
git remote add heroku [email protected]:nameofyourapp.git- Add a custom buildpack to your Heroku application:
heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git --app nameofyourappThis instructs Heroku to look into the .buildpacks file in the root folder
of the project and install all the buildpacks listed there.
- Commit all the changes and push to Heroku:
git add -A .
git commit -am "Sendy customised for heroku deployment"
git push heroku masterQ: I'm getting 'Application Error' on Heroku
A: From the command line, try to run heroku ps:scale web=1 --app yourappname
Q: I've done what you said and I've got another error:
Scaling web dynos... failed
! No such process type web defined in Procfile.
A: You're missing the Procfile in the root of your directory. Add the file,
push your changes to Heroku and re-run heroku ps:scale web=1 --app yourappname
Do you feel like there are any performance limits on Heroku?