If the title hasn't scared you away, then welcome!
Over the weekend I was struggling to get a mapped URL for a Ghost container on Reclaim Cloud resolving consistently to the main URL. While the home page worked, several subpages were defaulting to
localhost:2386, which is hardcoded in the
config.production.json file.* This is where that URL is normally defined, but Docker environmental variables are not actually read through this file, which is a bit of abstraction you have to wrap your head around when working with Docker. That file will work consistently if it's hosted on a stack, but in a Docker container you need an environmental variable file (or .env file). Another detail discovered on my journey towards understanding Docker. Thankfully I have Taylor Jadin to think this stuff through with now given he's a bit further ahead in his grasp of containers and has played with Reclaim Cloud a fair bit.
So, the proper way to deal with this issue in Reclaim Cloud is to add the url variable to the container environment. In the Ghost application container go to Additional Settings --> Variables:
From there click on the green Add button:
After that you need to add the url variable as illustrated below (keep in mind url needs to be lowercase):
This will ensure your environment loads cleanly over a mapped domain, and all references to the domain url are updated throughout the container. Be sure to restart the application container (not the load balancer) and give it a minute or so and the site will come back up.
This solution helped me stop using the hack of cloning the site with an edited url field in the
config.production.json file to fix the issue, while also solving my adjacent issue with setting the Newsletter/Support emails. I'll write more on that in my next post about Setting Up Email for a Ghost Newsletter.
Another variable I added for Ghost was
mail__from -you can see an example of this above for the address ghost_at_bavatuesdays.com.
*This file is found in the var/lib/ghost/ directory of the official Ghost Docker image.
Cover image Rainy Dark Tree thanks to PxHere.