Although I got sendy "working" on heroku, I don't think full functionality is possible due to heroku's 'ephemeral' filesystem. anything in /uploads may be destroyed upon dyno cycling. also, getting /uploads to remain set to 777 has been a non-trivial problem. I am looking into alternative server hosting now.
https://medium.com/@alexjacobs/installing-sendy-as-a-replacement-for-mailchimp-2019-update-the-complete-guide-with-automated-5a59c4bd7249
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 via the desktop, or with
heroku create <YOUR APP NAME>
. - Add the free cleardb addon to your project
heroku addons:add cleardb
- Clone that app to your local development directory with
heroku git:clone -a <YOUR APP NAME>
- Copy your downloaded sendy app into this new directory. Some may choose to just drag the
sendy
folder into this directory, or all of the contents into the root of the directory. I chose to drag all thesendy
folder into the directory to keep it isolated in case I want to use this heroku deployment for any other purposes. IMPORTANT when installed in the/sendy
folder, I was having a problem related to heroku redirecting me to http after logging in at https, even though the 'APP_PATH' variable was set correctly. After reinstalling at the server root, this issue went away. - Customise the COMPULSORY SETTINGS section of the
includes/config.php
file with the following snippet to use the ClearDB addon previously selected on Heroku:
define('APP_PATH', 'https://<HEROKU APP NAME>.herokuapp.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 for Heroku to automatically hook up the ClearDB add-on. More on the settings here.
NOTE: if you change your cleardb password at any point, you will need to update your heroku Config Vars
for CLEARDB_DATABASE_URL
. It is in the format of mysql://USER:PASSWORD@us-cdbr...?reconnect=true
- Add the included
composer.json
file to the root of your cloned directory (if you dragged the entire sendy folder into your project repository, make sure that this composer file is at the root of the entire project, not inside that folder). - run
composer update --ignore-platform-reqs
to generate the requiredcomposer.lock
file - Create or update
.gitignore
withecho "/vendor/" >> .gitignore
- Git will not commit an empty folder. Add a blank file called
.gitkeep
to theuploads/
directory withtouch uploads/.gitkeep
(ortouch sendy/uploads/.gitkeep
if you dragged the entire sendy folder into your project repository). Sendy needs this folder, and without this step it will not be available on your server. - Commit all the changes and push to Heroku:
git add -A .
git commit -m "Sendy customised for heroku deployment"
git push heroku master
- Navigate to your deployed heroku project (+
/sendy
if you deployed the project with that folder inside it) - Follow the remaining Sendy setup steps (http://sendy.co/get-started) starting with Step 5.
Cron (via heroku's scheduler add-on) is required for importing csv lists of mailing list members, triggering auto responders, or sending scheduled campaigns.
- Add the heroku scheduler:
heroku addons:add scheduler:standard
- Open the scheduler:
heroku addons:open scheduler
- Create three jobs, each with a frequency of 10 mins
note, different from cron directions availalbe within sendy: don't include the /app/
preceding the filename when using heroku scheduler
- Job 1:
php autoresponders.php
(includesendy/
prefix if needed) - Job 2:
php scheduled.php
(includesendy/
prefix if needed) - Job 3:
php import-csv.php
(includesendy/
prefix if needed)
You can also include all three of those in a single .sh
file with executable permissions and just have the scheduler execute that file instead of having three scheduled jobs
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 managed to make it work using S3 (I'm using Cloudflare R2), and created both a Dockerfile and a Heroku setup that enables easy deployment.
Check it out here: Sendy on Heroku.