Update workflow when I've made changes to the core

As I understand ghost CLI makes it easy to update Ghost server & admin client. The cli sets up the following directory structure with a symlink from the current to the most up-to-date version:

content
current ---------|
versions         |
    2.25.8  <--- |

When I run ghost update I assume the cli will download and add a new version to the versions folder and update the symlink:

content
current ---------|
versions         |
    2.25.8       |
    2.25.9  <----|

This makes an update a breath.

However, what if I’ve made changes to the core? This is where things become complicated.

I see two options:

  1. The first option is to update through CLI and then manually make changes in the newest core.
  2. Second option is to have a clone of the main Ghost core in git and perform merges after the new version is released. In that case I can’t use CLI for update.

What’s the recommended option? Is there an article to read about it? Thanks!

Your understanding of how Ghost updates your instance is spot on. Your assessment that making core changes can be difficult is exactly why it’s not suggested to make core changes, but you’re absolutely correct :slight_smile:

The problem with option 2 is that the git repository is inherently designed to be used for development, not production - for example, the admin client is built in real time, rather than using the bundled version included in the latest release. Your best bet is option 1. You can probably streamline applying your changes by using patches - this article seems to be a good starting point for that:

https://www.thegeekstuff.com/2014/12/patch-command-examples

Got it, thanks! Then we’ll probably go with the option 1 - manual patching. Do you know if there’s any tests suite that we can use to run our Ghost core against after the merge?

The test suite is stripped from the release zip (since it’s normally not necessary), but you can always grab it from github

Got it, thanks for your help! We’ll try to go that route and probably will write an article about our journey :slight_smile:

2 Likes

Interested to know what changes you’re looking to make in core if you’re willing to share :slight_smile:

@Hannah In my case i disable the labs link from the admin, mainly because of the delete all content button. Don’t want an angry or naive admin to delete everything. And sometimes the whole design section, for example when i did the static mega menu then that design section will not work for an admin to add a section to the nav menu, so an admin user will ask why that section its there for him.

@Hannah sure, we’ll probably customize the core a lot, the big feature will be a membership system, I’ve seen it in the roadmap of Ghost. But at this point we’ll start by implementing featured article flag that can only be set by an administrator. This will mark articles featured on the main page. It will be different to featured articles marked by authors in that writers make featured articles shown on their stories page, not the landing.

I’m wondering what’s the best place to ask for questions about internals? This forum, github issues?

@lmuzquiz what’s your workflow for updating the core?

Ghost’s own membership system is in active development in core already :wink:

Definitely ask questions here - GitHub is strictly for bugs :slight_smile:

Cool, any rough ETA?

@maxkoretskyi i´m more into UI/UX and marketing, i’m no expert on web dev, but here’s basically what i do:

  1. Install a previous version of Ghost on my server. Now this version is almost the latest but not the latest. Why? Cause when i upload my modified zipped version of Ghost to the server im gonna use the CLI ghost update command (from a zip file) which will not work (i think) if its not a newer version.

  2. Install Ghost from source on my local machine
    1.1 Run yarn to update dependencies.

  3. Check if it works by running grunt dev
    2.1 Create account & access the admin

  4. Make my changes, in this case to some .hbs files for the admin client.

  5. Check if changes reflect on the admin

  6. After making changes, getting the zip file for the modified version using grunt release will almost always certainly throw errors, stopping the release process. So i always have to use the --force. (no pun intended) like this: grunt release --force

  7. Upload zip file to the versions folder on the server and use this command: ghost update --zip /path/to/zipfile

Before running ghost update you might want to do a ghost doctor

  1. On local machine stash my changes (i don’t do a git branch).

Finished!

Lets say later you want to update the ghost core:

7.1 Run grunt master, Apply stash, fix conflicts.

7.2 getting again the zipped version by running grunt release --force (to avoid being stopped by errors).

7.3 Stash changes again.

I think you have to make sure to use the stable branch when doing all this. Not master.

Again, im no expert, Im sure there’s a better way to do all this.

Thanks for sharing, when we start working on it, I’ll share out workflow