Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bringing One-Click/Automatic Updates to Ghost #8005

Closed
5 tasks
acburdine opened this issue Feb 15, 2017 · 8 comments
Closed
5 tasks

Bringing One-Click/Automatic Updates to Ghost #8005

acburdine opened this issue Feb 15, 2017 · 8 comments
Labels
feature [triage] New features we're planning or working on later [triage] Things we intend to work but are not immediate priority server / core Issues relating to the server or core of Ghost

Comments

@acburdine
Copy link
Member

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.

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

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

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

@acburdine acburdine added affects:admin Anything relating to Ghost Admin epic feature [triage] New features we're planning or working on server / core Issues relating to the server or core of Ghost labels Feb 15, 2017
@kirrg001 kirrg001 modified the milestones: 1.0.0 Launch, 1.0.0 Backlog May 10, 2017
@kevinansfield
Copy link
Member

@acburdine what's the status of this so far as Ghost-CLI is concerned?

@acburdine
Copy link
Member Author

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.

@kevinansfield
Copy link
Member

Ok, it was added to an internal sprint list so just wanted to check in on the current status so I can prioritise properly 😄

@kirrg001 kirrg001 added the later [triage] Things we intend to work but are not immediate priority label May 24, 2017
@ErisDS
Copy link
Member

ErisDS commented Jul 31, 2017

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:

  • if there is a patch or minor update available, run ghost update
  • if there is a major update available, send an email

Not 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: #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?

@acburdine
Copy link
Member Author

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 👍

@acburdine
Copy link
Member Author

For what it's worth, I think TryGhost/Ghost-CLI#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.

@m1guelpf
Copy link
Contributor

Any updates here?

@ErisDS ErisDS added later [triage] Things we intend to work but are not immediate priority and removed cli-issue affects:admin Anything relating to Ghost Admin later [triage] Things we intend to work but are not immediate priority labels Jan 23, 2019
@ErisDS
Copy link
Member

ErisDS commented Jan 23, 2019

Closing as feature, later until we decide to prioritise this

@ErisDS ErisDS closed this as completed Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature [triage] New features we're planning or working on later [triage] Things we intend to work but are not immediate priority server / core Issues relating to the server or core of Ghost
Projects
None yet
Development

No branches or pull requests

5 participants