TryGhost / Ghost-CLI

CLI Tool for installing & updating Ghost
https://ghost.org
MIT License
450 stars 224 forks source link

Ghost-Update wanted to migrate a mysql-server, instead of sqlite #573

Closed oschade closed 6 years ago

oschade commented 6 years ago

Hello, I wanted to update my local ghost installation. I got a migration error. It seems, that the update-process wants to connect to a mysql server, but my installation just using sqlite. How can I fix that?

Here's the output of my console:

`√ Checking for available migrations √ Checking for latest Ghost version i Downloading and updating Ghost [skipped] i Stopping Ghost [skipped] √ Linking latest Ghost and recording versions × Running database migrations An error occurred. Message: 'Command failed: knex-migrator-migrate --init --mgpath C:\wamp\www\gh - Kopie\current [2017-12-22 09:43:07] ERROR

NAME: RollbackError CODE: ECONNREFUSED MESSAGE: connect ECONNREFUSED 127.0.0.1:3306

level:normal

OuterError: The server has encountered an error. RollbackError: connect ECONNREFUSED 127.0.0.1:3306 at RollbackError.KnexMigrateError (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\knex-migrator\lib\errors.js:9:26) at new RollbackError (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\knex-migrator\lib\errors.js:34:26) at C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\knex-migrator\lib\index.js:207:23 at tryCatcher (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\bluebird\js\release\promise.js:512:31) at Promise._settlePromise (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\bluebird\js\release\promise.js:569:18) at Promise._settlePromise0 (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\bluebird\js\release\promise.js:614:10) at Promise._settlePromises (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\bluebird\js\release\promise.js:689:18) at Async._drainQueue (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\bluebird\js\release\async.js:133:16) at Async._drainQueues (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\bluebird\js\release\async.js:143:10) at Immediate.Async.drainQueues (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\bluebird\js\release\async.js:17:14) at runCallback (timers.js:672:20) at tryOnImmediate (timers.js:645:5) at processImmediate [as _immediateCallback] (timers.js:617:5)

Error: connect ECONNREFUSED 127.0.0.1:3306 at Object.exports._errnoException (util.js:1018:11) at exports._exceptionWithHostPort (util.js:1041:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)

at Protocol._enqueue (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\mysql\lib\protocol\Protocol.js:145:48)
at Protocol.handshake (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\mysql\lib\protocol\Protocol.js:52:23)
at Connection.connect (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\mysql\lib\Connection.js:130:18)
at C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\knex\lib\dialects\mysql\index.js:106:18
at Promise._execute (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\bluebird\js\release\debuggability.js:303:9)
at Promise._resolveFromExecutor (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\bluebird\js\release\promise.js:483:18)
at new Promise (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\bluebird\js\release\promise.js:79:10)
at Client_MySQL.acquireRawConnection (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\knex\lib\dialects\mysql\index.js:104:12)
at Object.create (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\knex\lib\client.js:239:16)
at Pool._createResource (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\generic-pool\lib\generic-pool.js:354:17)
at Pool.dispense [as _dispense] (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\generic-pool\lib\generic-pool.js:314:10)
at Pool.acquire (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\generic-pool\lib\generic-pool.js:436:8)
at C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\knex\lib\client.js:289:19
at Promise._execute (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\bluebird\js\release\debuggability.js:303:9)
at Promise._resolveFromExecutor (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\bluebird\js\release\promise.js:483:18)
at new Promise (C:\wamp\www\gh - Kopie\versions\1.19.0\node_modules\bluebird\js\release\promise.js:79:10)

'

Debug Information: Node Version: v6.11.0 Ghost-CLI Version: 1.4.1 Environment: development Command: 'ghost update'`

vikaspotluri123 commented 6 years ago

Hey @oschade 👋 you probably need to specify you want to use the development config - ghost update -D

oschade commented 6 years ago

Thank you for your hint, @vikaspotluri123 but the same error occurred.

vikaspotluri123 commented 6 years ago

Can you reach out on slack for faster / easier debugging 😄

ericrange commented 6 years ago

same problem here. you CAN NOT update ghost based on sqlite. at least since 1.19. sqlite is totally ignored. the ghost cli wants sql!

ericrange commented 6 years ago

for reproduce: install 1.17.0 with sqlite database and then try to update (with the latest ghost cli)

ericrange commented 6 years ago

here is my config:

{
  "url": "https://...",
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "sqlite3",
    "connection": {
      "filename": "./content/data/ghost-blog.db"
    }
  },
  "mail": {
    "from": "...",
    "transport": "SMTP",
    "options": {
      "host": "...",
      "port": 25,
      "auth": {
        "user": "...",
        "pass": "..."
      }
    }
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/www/.../content"
  }
}
ericrange commented 6 years ago

just for info: ghost update worked for the period of 1.0.0 => 1.17.0. since the announced new database migrations, the update process fails.

ericrange commented 6 years ago

maybe for ghost 2.0 a mongodb as databse? :D

acburdine commented 6 years ago

maybe for ghost 2.0 a mongodb as databse? :D

@ericrange probably not lol 😁 however thanks for the reproduction case - I'll look into this.

acburdine commented 6 years ago

quick question @ericrange -> is yours failing on windows or are you running on a *nix environment (macOS or Linux). I wasn't able to reproduce the issue locally on macOS, but it looks like @oschade's running on Windows - and if you are as well I can debug it from the Windows side of things to see if that's what's causing the issue.

oschade commented 6 years ago

@acburdine I'm running windows.

ericrange commented 6 years ago

ubuntu 16

aileen commented 6 years ago

for reproduce: install 1.17.0 with sqlite database and then try to update (with the latest ghost cli)

I was not able to reproduce this. Installed Ghost 1.17.0 on Ubuntu 16 with the recommended stack and following the installation guide. The update to 1.20.0 worked fine for me.

Ghost-CLI version: 1.4.2

ericrange commented 6 years ago

can u try to upgrade vom 1.0.0?

aileen commented 6 years ago

@ericrange updating from 1.0.0 to 1.20.0 with sqlite worked fine for me as well:

image

Note: When installing Ghost@1.0.0 you'll first need to downgrade the CLI to <1.3.0 and once Ghost is installed, update it before you run ghost update.

Did you follow the recommended server setup as described here?

kirrg001 commented 6 years ago

@ericrange Is this your production config (config.production.json)?

ericrange commented 6 years ago

yes. so it shouldn't be? :D

kirrg001 commented 6 years ago

No should be fine. Could you please swing by our slack community and leave a note in the #help channel? It's easier to investigate your problem in slack and then we can leave the result here.

ericrange commented 6 years ago

ok after i installed the latest ghost-cli again and the knex-migrator to the "current" directory locally, it works for me (even with sqlite). the update process fail because there was something wrong with the "knex-migrator"... but i dont know what.

acburdine commented 6 years ago

Going to close this for now as it seems to have been fixed on the recommended stack - in a bit we can come back to this and, if it's still an issue, fix it for Windows.