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

Attempt to start new version of Ghost during ghost update #153

Closed
acburdine opened this issue Feb 14, 2017 · 3 comments
Closed

Attempt to start new version of Ghost during ghost update #153

acburdine opened this issue Feb 14, 2017 · 3 comments

Comments

@acburdine
Copy link
Member

acburdine commented Feb 14, 2017

The current update process works as follows:

  • Download new Ghost version & install dependencies
  • Stop current Ghost
  • Update symlinks
  • Start new Ghost

However, if an issue occurred during the installation of the new Ghost version, that issue won't be discovered until the blog is restarted, leaving your blog in an offline state. This is especially critical for automatic/one-click updates, as the user won't be running the update through the traditional means.

So the idea is to start the new version of Ghost on a different port temporarily before stopping & starting Ghost. This should be fairly simple, and there is already a library (portfinder) in Ghost-CLI that can be used to find an open port.

However, this will involve some other thinking - namely how to start the new version of Ghost with the same content, without messing with the current live database. With SQLite this should be pretty easy - just create a copy of the DB file, however if the user is using a MySQL database it might be a little trickier. Definitely needs some thought - as we don't want to just implicitly require that a sqlite database exist.

Kate Note: This is only related to one click updates!

@acburdine acburdine changed the title Attempt to start Ghost during ghost update Attempt to start new version of Ghost during ghost update Feb 14, 2017
@kirrg001
Copy link
Contributor

kirrg001 commented Feb 16, 2017

Some thoughts on this.

First of all, we have to turn the current ghost blog into maintenance mode to avoid any updates to the database. We already have a maintenance flag in Ghost.

One problem with mysql could be that mysqldump is not available, because the executable is not correctly linked, but we could ignore that for the first version and tell the user why auto update wasn't working. Also, there are npm modules out there to dump and insert mysql database via javascript, e.g. https://github.com/webcaetano/mysqldump (deleted the second link)

Furthermore we have to override the database name/filename via env parameter if we start knex-migrator or if we start the new blog.

If a migration happens and it fails, ghost-cli will know, because knex-migrator will fail.
If blog can't start, ghost-cli will know.

@acburdine
Copy link
Member Author

That makes sense. I was thinking "trickier" along the lines of creating a new database might not work if the db user doesn't have the proper permissions. But what we could do in mysql is just dump the db and then try migrating-if that doesn't work then restore the old database from either the dump (if mysql) or the actual db file (if sqlite).

@kirrg001 kirrg001 added this to the 1.0.0-rc.1 milestone Jun 22, 2017
@kirrg001 kirrg001 removed this from the 1.0.0-rc.1 milestone Jun 22, 2017
@acburdine acburdine added this to the 1.1.0 milestone Jul 23, 2017
@kirrg001 kirrg001 added the later label Jan 12, 2018
@kirrg001 kirrg001 removed this from the 1.1.0 milestone Jan 12, 2018
@kirrg001 kirrg001 removed the later label Dec 14, 2018
@github-actions
Copy link

github-actions bot commented May 5, 2021

Our bot has automatically marked this issue as stale because there has not been any activity here in some time. The issue will be closed soon if there are no further updates, however we ask that you do not post comments to keep the issue open if you are not actively working on a PR. We keep the issue list minimal so we can keep focus on the most pressing issues. Closed issues can always be reopened if a new contributor is found. Thank you for understanding 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants