Second site on Raspberry Pi - ECONNREFUSED


#1

I’m trying to get a second instance of Ghost up and running on my Pi. Mostly, I think its there, but when I try to start the service (ghost start) I get:

Debug Information:
OS: Raspbian, v9.4
Node Version: v6.14.2
Ghost-CLI Version: 1.7.3
Environment: production
Command: ‘ghost start’
Message: Ghost did not start.
Suggestion: journalctl -u ghost_storypositive-com -n 50
Stack: Error: Ghost did not start.
at connectToGhostSocket.then.catch (/usr/lib/node_modules/ghost-cli/lib/utils/port-polling.js:94:32)
at process._tickCallback (internal/process/next_tick.js:109:7)

Original Error Message:
Message: connect ECONNREFUSED 127.0.0.1:2368
Stack: Error: connect ECONNREFUSED 127.0.0.1:2368
at Object.exports._errnoException (util.js:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1099:14)

My other site loads fine and can be reached via this URL: www.corballis.co.uk

I’m pretty sure things are as they should be:

  • each site is in a separate directory
  • Symlinks appear to be okay
  • nginx config seems ticketyboo

I’m using the same credentials for maria for both, though different database names

ghost doctor reveals no errors.

ghost run says:

Running sudo command: node current/index.js
[2018-05-12 09:27:22] ERROR

NAME: DatabaseIsNotOkError
CODE: DB_NOT_INITIALISED
MESSAGE: Please run knex-migrator init

level:normal

If knex-migrator is not installed, please run “npm install -g knex-migrator”
Read more here: https://github.com/TryGhost/knex-migrator
DatabaseIsNotOkError: Please run knex-migrator init
at DatabaseIsNotOkError.KnexMigrateError (/var/www/storypositive.com/versions/1.22.7/node_modules/knex-migrator/lib/errors.js:7:26)
at new DatabaseIsNotOkError (/var/www/storypositive.com/versions/1.22.7/node_modules/knex-migrator/lib/errors.js:19:26)
at /var/www/storypositive.com/versions/1.22.7/node_modules/knex-migrator/lib/index.js:1082:23
at tryCatcher (/var/www/storypositive.com/versions/1.22.7/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/var/www/storypositive.com/versions/1.22.7/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/var/www/storypositive.com/versions/1.22.7/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/var/www/storypositive.com/versions/1.22.7/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/var/www/storypositive.com/versions/1.22.7/node_modules/bluebird/js/release/promise.js:689:18)
at Async._drainQueue (/var/www/storypositive.com/versions/1.22.7/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/var/www/storypositive.com/versions/1.22.7/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/var/www/storypositive.com/versions/1.22.7/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)

Note, ghost run doesn’t make the same complaint about the working site.

I’m all out of ideas so anything anyone can point me at would be welcome.


#2

Please read the given error message you’ve been kind enough to paste here:

MESSAGE: Please run knex-migrator init

level:normal

If knex-migrator is not installed, please run “npm install -g knex-migrator”
Read more here: https://github.com/TryGhost/knex-migrator
DatabaseIsNotOkError: Please run knex-migrator init


#3

Thanks for the response.

I did that, but it still kept failing. Why, I don’t know.

I have now got past this problem. Here’s what I did in case anyone else gets a similar issue:

  1. I went into the Maria command line and manually created the database for the second site: CREATE DATABASE database_name;
  2. Exited Maria: exit
  3. Exported the first site’s database, by running this command: mysqldump yourFirstDatabase -u user -ppassword > yourDatabase.sql
  4. Imported the dumped file: sudo mysql yourSecondDatabase -u user -ppassword < yourDatabase.sql
  5. Enabled the service: systemctl enable ghost_second-site.service
  6. Start the service: ghost start [from the second_site directory]
  7. Checked to see if everything was working: ghost ls

That did mean that second_site looked exactly like first, so I went into the Admin console and edited/deleted stuff there.

Note, notwithstanding that I had to set up the database manually, the correct permissions had been assigned in the user catalogue by the set up process so I didn’t need to do anything there.

I have no idea why the database setup failed, I tried to run it from cli and also tried running the Knew Migration tool, but neither worked for some reason. I suspect I did something stupid earlier on. :frowning:


#4

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.