Skip to content

Instantly share code, notes, and snippets.

@lexjacobs lexjacobs/composer.json forked from dovy/Sendy.md
Last active Jan 17, 2019

Embed
What would you like to do?
Installing Sendy on Heroku
{
"require": {
"php": ">=5.5.0",
"ext-gettext": "*"
}
}

deprecated

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.

replacement: I moved to DigitalOcean

full blog post write-up here:

https://medium.com/@alexjacobs/installing-sendy-as-a-replacement-for-mailchimp-2019-update-the-complete-guide-with-automated-5a59c4bd7249

below is archive of original gist:


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. On Heroku, create a new app via the desktop, or with heroku create <YOUR APP NAME>.
  2. Add the free cleardb addon to your project heroku addons:add cleardb
  3. Clone that app to your local development directory with heroku git:clone -a <YOUR APP NAME>
  4. 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 the sendy 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.
  5. 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

  1. 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).
  2. run composer update --ignore-platform-reqs to generate the required composer.lock file
  3. Create or update .gitignore with echo "/vendor/" >> .gitignore
  4. Git will not commit an empty folder. Add a blank file called .gitkeep to the uploads/ directory with touch uploads/.gitkeep (or touch 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.
  5. Commit all the changes and push to Heroku:
   git add -A .
   git commit -m "Sendy customised for heroku deployment"
   git push heroku master
  1. Navigate to your deployed heroku project (+/sendy if you deployed the project with that folder inside it)
  2. Follow the remaining Sendy setup steps (http://sendy.co/get-started) starting with Step 5.

Seting up Cron

Cron (via heroku's scheduler add-on) is required for importing csv lists of mailing list members, triggering auto responders, or sending scheduled campaigns.

  1. Add the heroku scheduler: heroku addons:add scheduler:standard
  2. Open the scheduler: heroku addons:open scheduler
  3. 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 (include sendy/ prefix if needed)
  • Job 2: php scheduled.php (include sendy/ prefix if needed)
  • Job 3: php import-csv.php (include sendy/ 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

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.

@lexjacobs

This comment has been minimized.

Copy link
Owner Author

commented Jan 2, 2019

Forked and modified. Verified instructions as written on 1 Jan 2019

@lexjacobs

This comment has been minimized.

Copy link
Owner Author

commented Jan 6, 2019

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.

@lexjacobs

This comment has been minimized.

Copy link
Owner Author

commented Jan 15, 2019

deprecated

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.

replacement: I moved to DigitalOcean

full blog post write-up here:

https://medium.com/@alexjacobs/installing-sendy-as-a-replacement-for-mailchimp-2019-update-the-complete-guide-with-automated-5a59c4bd7249

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.