Notes on migrating Ghost and Mailgun to a new domain
I just moved this blog from blog.jasonkratz.me to echoville.blog while at the same time moving to using echoville.blog as the domain for Mailgun. My platform for this blog is:
- Fastmail for my custom domain email.
- Mailgun for sending emails from the blog, both transaction mails and newsletters.
- PikaPods for hosting Ghost itself.
- Porkbun as my domain registrar and DNS hosting.
These instructions are obviously geared toward that tech stack but should be similar to many other setups.
Here’s how I did it.
Set up the domain to use Fastmail for email hosting
This required adding various records to the domain settings in Porkbun - MX records, SPF/DKIM, etc. The values are generated automatically by Fastmail when setting up the new domain in Fastmail’s admin page so it was a simple matter of copy and paste over to Porkbun and waiting for them to propagate through the DNS system (this only took a few minutes).
Set up a subdomain to use Mailgun for email sending
This is very similar to the Fastmail setup. When adding a new domain to Mailgun it generates the required values (MX, TXT, and CNAME records) and creating the DNS records is a simple matter of copy and paste over to Porkbun. Note that this is a subdomain - the default is mg.
Set up a new administrative email address
This is an email used inside of Ghost. It is the email address that appears on anything sent to a user from Ghost (login links, signup links, newsletters, etc). This was set up inside Fastmail.
Configure the Ghost Pod to use the Mailgun SMTP server and authentication information
The Mailgun SMTP server is used to send transactional emails, not newsletters. At the moment PikaPods does not allow editing the Ghost configuration files directly but it does provide environment variables to configure Ghost for Mailgun. Before updating these values SMTP credentials need to be created in Mailgun. This is done in the Mailgun website via Sending->Domain Settings->SMTP Credentials.
- Create a new password by clicking Reset Password and copy into the proper environment variable in PikaPods pod settings for Ghost.
- Copy the login (should be postmaster@
) into the proper environment variable in PikaPods.
- Copy the rest of the settings and make sure to use port 465 and set the secureConnection variable to true.
- Use the administrative email created above as the **mail__from** variable.
Configure Ghost with a Mailgun API key for sending newsletters
Once again go to the Mailgun website and go to Sending->Domain Settings->Sending API Keys. Generate a new key here and copy it to your Ghost settings, specifically Mailgun Settings. You’ll also type in your Mailgun subdomain here (make sure to select the proper region).
Customize Ghost portal settings
You’ll want to use the administrative email as the support email address for your blog. That setting is in Ghost settings under Membership->Portal Settings->Customize->Account page. Once you enter the administrative email you’ll be asked to verify it.
Customize Newsletter sender and reply-to email addresses
Not sure this is strictly needed but I set both of these values in each of my newsletters to the administrative email as well. This also requires verification.
How I handle redirects from the old domain
Porkbun has a URL redirection feature that I set up as I use Porkbun DNS for both my old domain blog.jasonkratz.me as well as this one echoville.blog. Those settings allow me to choose the redirect type (301 - permanent) and also tack on anything in the URL that comes after the domain. This makes redirects very easy. Porkbun also provides free SSL certificates via LetsEncrypt that get renewed automatically as long as the domain is active.
There are quite a few steps involved in setting this up but it wasn’t difficult. The combination of PikaPods-hosted Ghost with the pay-as-you-go tier of Mailgun is a pretty inexpensive way to run a small blog with newsletters.