I’m currently running Ghost v4.16 in Docker. I set up a Mailgun account last night and was able to successfully send a test post e-mail (with the contents of a post).
However, I’ve now discovered that when someone tries to subscribe to my blog via the “Subscribe” button, an error is thrown:
Failed to load resource /blog/members/api/send-magic-link/ {"errors":[{"message":"Resource not found","context":null,"type":"NotFoundError","details":null,"property":null,"help":null,"code":null,"id":"af8j2de0-2155-16ec-9y1c-25f30e45586e"}]}
I have the same problem. Running Ghost v4.16 on DO Droplet, config.production.json is configured
right, but it does not work. Console gives same error.
Why do you think you can use Mailgun without SMTP? As far as I know, the SMTP and API interfaces are used, with some types of emails sent by one and some sent by the other. The API interface is configured in Settings → Email newsletter → Email newsletter settings, so maybe that’s why your test email worked.
Ghost has the ability to deliver posts as email newsletters natively. A bulk-mail provider is required to use this feature and SMTP cannot be used — read more about mail config.
I assumed configuring Mailgan and providing Ghost w/ the API was utilizing something other than SMTP given the heavy messaging against it.
Right. SMTP is not used for bulk-mail like newsletters. But you’re talking about the subscription magic link email. That’s a single email - a so called “Transactional” email. You still need some way to send those. SMTP is fine (and generally more reliable than the default “Direct” method) for that.
I’ve confirmed my Mailgun SMTP credentials through the control panel as well as all other related info. My bulk e-mail functionality still works, but I’m receiving the same error with the above configuration now added to the config.production.json file.
To find the config file, I navigated to /appdata/ghost/config.production.json. My ‘appdata’ folder is mapped to /var/lib/ghost/content.
Config file looks good. I don’t recognise the paths though (but, to be fair, I’m not familiar with the Docker setup!). An easy way to check it’s the right config file might be to corrupt it (just add some arbitrary text in the middle that isn’t JSON formatted) and restart Ghost - it should say “A SystemError occurred.” and refuse to start.
The only thing that makes me suspicious is that the config file should be in the directory abovecontent. For example:
$ ls -l
config.production.json
content
current -> /var/www/empirical-ghost/versions/4.16.0
system
versions
I seem to recall seeing that Docker doesn’t use a config file - everything is configured using environment variables instead.
As EmpiricalEE noted, Docker doesn’t use a config file for Ghost, it uses environment variables (that you can define in a .env file).
Ghost explains how to use environment variables for your config here. TL;DR, instead of nesting items in JSON, you separate them with double underscores.
Dave Jansen has a great blog post on how to properly deploy Ghost. I made some minor modifications but by-and-large used his setup. It works great.
(I have removed the Matomo portion of that config, but I can share with you over DM if you would like).
Getting Ghost set up with Docker is a bit of a hassle the first time (only because you have to learn Docker), but if you make sure you use volumes, it is a breeze to maintain!! Upgrading Ghost isn’t done through the command line, but is done instead through a simple: docker-compose restart or a docker-compose down && docker-compose up -d.
All - thanks again for the responses. I was able to successfully configure transaction email in my Ghost instance using the appropriate environment variables.