iero
February 2, 2021, 9:27pm
1
Hello
Is it possible to get a message in the administration side to know when a release is available ?
A menu in the left bar with a small blue dot when a new release is out. When we click on it, we see what’s new. And… if we could apply the update process from here…
I know it’s not exctly what you’re asking, but if you go to the About page, there is a notification of a new update:
One click updates are something that’s been discussed in the past, but not implemented:
opened 06:50PM - 15 Feb 17 UTC
closed 09:55PM - 23 Jan 19 UTC
server / core
feature
later
It has been a feature long-requested by many users, and thanks to the new [Ghost… -CLI](https://github.com/TryGhost/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.
# Brief Overview
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:
1. The update process erred, in which case Ghost-Admin would retrieve the error and display it (with perhaps a link to documentation).
2. The update process succeeded, and the user needs to refresh the page to get the latest version of Ghost-Admin.
## Additional Notes
- The update process will only be available if Ghost is being run with Ghost-CLI.
- The first iteration will only feature one-click updates through the admin client. Future versions will work on automatic updates that require no user interaction.
# Tasks
## Ghost-CLI
- [ ] `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.
## Ghost
- [ ] Update API endpoint (PR in progress - #7977)
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:
1. New version if one is available
2. Status flag signifying whether or not the blog is currently undergoing an update process.
3. Any errors that occurred during update
The POST endpoint will:
- Trigger the update process by sending an IPC message to Ghost-CLI
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).
## Ghost-Admin
- [ ] Make custom update notification that links to the About page.
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.
- [ ] Build polling service that will poll the server in the background at either fixed or increasing intervals to determine update status
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
1 Like