Ghost ignores remote mysql in production config
See original GitHub issueGhost 1.16.2 Ghost-CLI 1.2.0 Node Version: 6.11.5
Installed via ghost cli, run via pm2.
config.production.json located in /var/www/ghost/current
{
"url": "http://www.langton.cloud",
"server": {
"port": 80,
"host": "127.0.0.1"
},
"database": {
"client": "mysql",
"connection": {
"host": "ghost-rds.langton.cloud",
"user": "user_for_ghost",
"password": "incorrect",
"database": "db_for_ghost"
}
},
"mail": {
"transport": "Direct"
},
"logging": {
"transports": [
"file",
"stdout"
]
},
"process": "systemd"
}
Error:
[2017-11-05 04:05:40] ERROR
NAME: InternalServerError
CODE: ECONNREFUSED
MESSAGE: The server has encountered an error.
level:normal
InternalServerError: The server has encountered an error.
at new GhostError (/var/www/ghost/versions/1.16.2/core/server/errors.js:9:26)
at /var/www/ghost/versions/1.16.2/index.js:38:15
at tryCatcher (/var/www/ghost/versions/1.16.2/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/var/www/ghost/versions/1.16.2/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/var/www/ghost/versions/1.16.2/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/var/www/ghost/versions/1.16.2/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/var/www/ghost/versions/1.16.2/node_modules/bluebird/js/release/promise.js:689:18)
at Async._drainQueue (/var/www/ghost/versions/1.16.2/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/var/www/ghost/versions/1.16.2/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/var/www/ghost/versions/1.16.2/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:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
--------------------
at Protocol._enqueue (/var/www/ghost/versions/1.16.2/node_modules/mysql/lib/protocol/Protocol.js:145:48)
at Protocol.handshake (/var/www/ghost/versions/1.16.2/node_modules/mysql/lib/protocol/Protocol.js:52:23)
at Connection.connect (/var/www/ghost/versions/1.16.2/node_modules/mysql/lib/Connection.js:130:18)
at /var/www/ghost/versions/1.16.2/node_modules/knex/lib/dialects/mysql/index.js:106:18
at Promise._execute (/var/www/ghost/versions/1.16.2/node_modules/bluebird/js/release/debuggability.js:300:9)
at Promise._resolveFromExecutor (/var/www/ghost/versions/1.16.2/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/var/www/ghost/versions/1.16.2/node_modules/bluebird/js/release/promise.js:79:10)
at Client_MySQL.acquireRawConnection (/var/www/ghost/versions/1.16.2/node_modules/knex/lib/dialects/mysql/index.js:104:12)
at Object.create (/var/www/ghost/versions/1.16.2/node_modules/knex/lib/client.js:239:16)
at Pool._createResource (/var/www/ghost/versions/1.16.2/node_modules/generic-pool/lib/generic-pool.js:354:17)
at Pool.dispense [as _dispense] (/var/www/ghost/versions/1.16.2/node_modules/generic-pool/lib/generic-pool.js:314:10)
at Pool.acquire (/var/www/ghost/versions/1.16.2/node_modules/generic-pool/lib/generic-pool.js:436:8)
at /var/www/ghost/versions/1.16.2/node_modules/knex/lib/client.js:289:19
at Promise._execute (/var/www/ghost/versions/1.16.2/node_modules/bluebird/js/release/debuggability.js:300:9)
at Promise._resolveFromExecutor (/var/www/ghost/versions/1.16.2/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/var/www/ghost/versions/1.16.2/node_modules/bluebird/js/release/promise.js:79:10)
As you can see it tries to use 127.0.0.1
ignoring the config, any chance there is a bug here or the docs are out of date? Maybe i’m missing something…
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Cannot Connect to fresh Remote DB on Startup #92 - GitHub
At startup, when Ghost attempts to create the Admin user, it fails to connect to the database. The script executed to configure the...
Read more >Need help to diagnose MYSQL database issue in updating to ...
Errors when I run ghost doctor : Local MySQL install was not found or is stopped. You can ignore this if you are...
Read more >How to install Ghost alongside CyberPanel on Ubuntu 20.04 ...
Use remote database server with MySQL 8. Pro: Meets requirements. Con: Need to set up remote database. Configure SQLite if you don't want...
Read more >The ghost cleanup task for SQL Server Databases
I have seen DBAs have an idea about Checkpoint, Lazy Writer process, but they ignore the importance of the Ghost Cleanup background process....
Read more >4.22 Troubleshooting Problems Connecting to MySQL
... to ignore network connections or (if you are attempting to connect remotely) ... Under Linux or Unix, check your IP tables (or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So that’s not exactly the issue. The
config.<env>.json
file is read from the current working directory of the process that runs Ghost. Because your pm2 process doesn’t specify a CWD, that’s likely where the problem is occurring.You might try running this command (from inside your ghost install directory /var/www/ghost):
NODE_ENV=production pm2 start ./current/index.js --name "Ghost"
- that should fix the issue.i see - i guess the default CWD is
pwd
right? not intuitive to first timers but I see the ease of that choice. Might want to make a call out in the docs or something on how to define or “handle” the CWD.I’ll update my init.d script to change the working dir. thanks.