This topic has been covered in the community forums before. But the last thread I found was a few years ago. I think that this is an extremely important question for users so I hope you’ll indulge me in revisiting the topic.
I love Ghost CMS but for using it for a professional context, I can’t afford to take risks in “moving fast and breaking things.” A staging environment would be essential, especially when modifying themes.
I have installed Ghost with ease on VPSes but have little experience in manually provisioning something like a staging workflow / CI:CD pipeline.
A few questions:
Are there any Ghost-friendly hosts that can automatically provision the staging environment? This exists quite widely in the Wordpress ecosystem.
If not, for those trying to achieve this manually, can anyone recommend what tools they have had success with? I’m guessing that Git is an essential component but perhaps it doesn’t need to be more complicated than pushing the Ghost folder, when desired, between two VPSes.
If it’s just about theme modifications, I could imagine a workflow like this:
You set up two Ghost sites. One for production, one for staging. Potentially consider some sample content that tests all styles etc. for the staging one. These can also run on the same machine – at least, I don’t see a benefit of running them on two separate ones.
For the theme you’re testing, I’d set up a Github repository, if you haven’t and use the Github Action to deploy themes.
Now, the example in there will automatically run. So, set up the set of secrets for the staging environment.
Then set up a second Github action, but like this:
So, when you’re satisfied with your changes on your staging environment, go to the Github actions in your repository and click the “Run workflow” button there (or use the API to trigger it). A few moments later, the new theme should be on your production environment.
Haven’t tested this with themes, but that’s is the principle (with different custom Github actions) of how I deploy new Ghost versions on Magic Pages.
Because we have staff users, paying Ghost for another site with everyone’s accounts is prohibitively expensive for staging, but it is doable. If you just have one or two staff users it might be ok.
I set up a staging ghost on Linode (linode.com, Nanode 1GB size, ~$5 / month), mostly following these docs: How to install & setup Ghost on Ubuntu 20.04 or 22.04 and then was able to use the Github Action to deploy to there any time I push to the dev branch of our theme repository. It works just like the “real” site except can’t send mail, etc. Works great.
(If you are looking for some help I do contract work and could set that up for you- mail address is: mg at neptune dot digital.)