It has been a feature long-requested by many users, and thanks to the new Ghost-CLI project, Automatic Updates are finally within reach!
Before this feature will work fully, however, there are several changes that need to be made across Ghost, Ghost-Admin, and Ghost-CLI, to provide the smoothest, most fault-tolerant update process. This issue exists to document and track those specific changes as they occur in the separate repositories.
Currently, whenever there is a new Ghost version, a notification appears in Ghost-Admin prompting the user to update, and providing a link to the relevant support page with documentation as to how to manually update Ghost. This current notification would be extended and instead of linking to a support page, it would link to the /ghost/about page, where a button would appear that a user could click to update their blog.
Upon clicking the button, a server request would be made, and the Ghost server would communicate with the managing CLI process (ghost run), which would then trigger the ghost update command. As Ghost itself would still be running, the user could then continue using Ghost normally, and Ghost-Admin would poll the Ghost server in the background until 1 of 2 things happens:
ghost update command should make sure blog can start before switching to new version (TryGhost/Ghost-CLI#153)Basically, Ghost-CLI needs to be able to verify that the new version of Ghost has been installed correctly, and that there won't be any issues switching versions. With the current update process, the blog could be left in a broken state if the old version is stopped and the new one fails to start, so we want to make sure the new version will start correctly.
ghost update should communicate with the Ghost process (issue/PR # TBD)Currently, Ghost-CLI starts ghost using a ghost run command, which allows the CLI to provide some light management of the core Ghost server process. Communication between the two process currently happens over IPC channels - and this should be extended to allow ghost update to tell ghost run that it has finished installing the new Ghost version, before it stops the old version, giving Ghost time to notify the client that the blog is restarting.
This endpoint handles communication with the Ghost-CLI process to start the update process, as well as inform Ghost-Admin of the update status.
There will be both a GET endpoint and a POST endpoint.
The GET endpoint will return a couple of things:
The POST endpoint will:
At the moment, only the blog owner will be able to update the blog, but it could be extended in the future to allow administrators as well, pending discussion.
As part of this endpoint, there will be a config variable added that controls whether or not the blog is able to be updated (for example, if you enable a particular privacy flag or if you're not running with Ghost-CLI).
Because the update button will be located on the About page, the update notification should link to the About page instead of a support page. This should also take into account the configuration of the server, so if the user is not running via Ghost-CLI, or has disabled CLI updates for any particular reason, then the notification will not link to the about page and instead show a different message.
The service should also check whenever Ghost-Admin is first loaded to see if Ghost is currently being updated, and trigger the polling process if it is. (Use case: user refreshes the page after starting an update process).
There should probably be a way to ask the service if Ghost is updating, and certain blog actions may need to be disabled during update (for example: theme uploads, import/export, etc.) - this may be added in future improvements
@acburdine what's the status of this so far as Ghost-CLI is concerned?
Ghost-CLI currently is missing a couple of things needed to get this working, my thought was we'd be putting this off until after 1.0, as it's a fairly sizable feature that will require stuff in all three major Ghost components.
Ok, it was added to an internal sprint list so just wanted to check in on the current status so I can prioritise properly 馃槃
We had a conversation about this earlier today. Not sure what the status is, but the simple version that we were talking about was:
Running ghost autoupdate causes Ghost to setup a cron job that runs daily.
The cron job should do the following:
ghost updateNot sure the best way to send an email, maybe an endpoint in Ghost?
The other thing to consider here, is that I _think_ we lost maintenance mode between LTS and 1.0.0? Original issue: https://github.com/TryGhost/Ghost/issues/6976
We should make sure that this is available, because ghost update could make use of it.
This might be a simple approach to getting this working?
That was actually something I had thought about as well. The email part might be a little tricky, but it's definitely a viable approach 馃憤
For what it's worth, I think https://github.com/TryGhost/Ghost-CLI/issues/153 is still a needed feature before even the simple approach can be considered - otherwise we would potentially run into the issue where ghost update would kill your blog because of some issue.
Any updates here?
Closing as feature, later until we decide to prioritise this
Most helpful comment
Ghost-CLI currently is missing a couple of things needed to get this working, my thought was we'd be putting this off until after 1.0, as it's a fairly sizable feature that will require stuff in all three major Ghost components.