Sendy deployment with Docker
If you look for a simple, inexpensive and solid newsletter service, I can recommend Sendy - it’s a self-hosted (PHP and MySQL) system using Amazon SES to deliver emails.
It costs $59 for a license + a few dollars monthly for SES deliveries, in my case it’s 20x cheaper that MailChimp or GetResponse.
I didn’t find any clear end-to-end instructions how to install Sendy, so I’ve prepared my own Docker-Sendy configuration which will get you a running Sendy instance in few easy steps.
Prerequisites
-
Sendy files and license number
-
Server - create a t2.micro instance on AWS (free for 12 months since signup) or prepare other small machine (512MB of RAM is enough) with Ubuntu Server 16.04
-
Domain address - set a DNS record pointing to your server’s IP address
-
SSL - prepare certificate files for your domain
Install Docker and Docker-Compose
- Install Docker and grant an user Docker access for your user (steps 1 & 2):
- Install Docker-Compose (step 1):
Install Sendy as a Docker container
-
Clone my Docker-Compose configuration in the home directory:
git clone https://github.com/marcinbiegun/docker-sendy.git
-
Upload your SSL ceriticate files as
~/docker-sendy/docker/sendy.key
and~/docker-sendy/docker/sendy.pem
-
Open
~/docker-sendy/docker/docker-compose.yml
and set MySQL passwords at the end of the file -
In
~/docker-sendy/docker/server.conf
change value ofserver_name
to your domain name -
Copy Sendy files inside
~/docker-sendy/public_html
- Edit
~/docker-sendy/public_html/include/config.php
:- set
APP_PATH
to your site URL - set
$dbHost
domysql
- set
$dbUser
tosendy
- set
$dbName
tosendy
- set
$dbPass
to the password you’ve set indocker-compose.yml
- set
-
Run
chmod 777 ~/docker-sendy/public_html/uploads
-
Inside
~/docker-sendy/docker
directory, rundocker-compose build
to build the containers, then start the app withdocker-compose start
- Setup cron. Find the PHP container’s name by running
docker-compose ps
, it will be named likedocker_php_1
. Runcrontab -e
and add this line:
* * * * * docker exec docker_php_1 php /code/public_html/scheduled.php
Configure Sendy
At this point, Sendy should be up and running under your domain address. Open it, finish the setup inside Sendy installer (connect Amazon SAS account, etc.).
Done! You can send your first newsletter.