Ghost update fails if config.production.json is a link


#1

To facilitate source control of a multi-tenanted ghost VPS, I have all my config.production.json in /etc/ghost and have linked config.production.json from each blog back to the relevant file in etc.

Even though all the ownership and permissions of the relevant files - including the link-files themselves - are correct (i.e. non-root and non-ghost), the ghost update command fails with this error:

✔ Stopping Ghost
✔ Linking latest Ghost and recording versions
✖ Running database migrations
An error occurred.
Message: 'EACCES: permission denied, open '/var/www/normus.totahi.com/config.production.json''


Debug Information:
    OS: Debian, v9.4
    Node Version: v6.14.1
    Ghost-CLI Version: 1.7.1
    Environment: production
    Command: 'ghost update'

Additional log info available in: /home/normus/.ghost/logs/ghost-cli-debug-2018-04-18T16_28_42_550Z.log

Try running ghost doctor to check your system for known issues.

When I run ghost doctor it thinks everything is ok… which kind of confirms that this is not really a permission problem…

ghost doctor
✔ Checking system Node.js version
✔ Checking logged in user
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
System checks failed with message: 'Linux version is not Ubuntu 16'
Some features of Ghost-CLI may not work without additional configuration.
For local installs we recommend using `ghost install local` instead.
? Continue anyway? Yes
ℹ Checking operating system compatibility [skipped]
✔ Checking for a MySQL installation
Running sudo command: systemctl is-active ghost_normus-totahi-com
ℹ Validating config [skipped]
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability

I have to ghost start to get the blog back up - it looks ok, but I worry because the fail happens for the database migration stage.


#2

oh - and the blog runs ok - using the config link - so this issue appears to be specific to how the database-migration step opens the config file to pick up the database credentials.


#3

Oh - and the stack trace is:

Debug Information:
    OS: Debian, v9.4
    Node Version: v6.14.1
    Ghost-CLI Version: 1.7.1
    Environment: production
    Command: 'ghost update'
An error occurred.
Message: 'EACCES: permission denied, open '/var/www/normus.totahi.com/config.production.json''

Stack: Error: EACCES: permission denied, open '/var/www/normus.totahi.com/config.production.json'
    at Error (native)
    at Object.fs.openSync (fs.js:642:18)
    at Object.fs.writeFileSync (fs.js:1356:33)
    at Object.writeFileSync (/usr/lib/node_modules/ghost-cli/node_modules/jsonfile/index.js:117:13)
    at Config.save (/usr/lib/node_modules/ghost-cli/lib/utils/config.js:91:12)
    at Task.runMigrations [as task] (/usr/lib/node_modules/ghost-cli/lib/tasks/migrate.js:16:48)
    at Promise.resolve.then.then.skipped (/usr/lib/node_modules/ghost-cli/node_modules/listr/lib/task.js:168:30)
Code: EACCES
Path: /var/www/normus.totahi.com/config.production.json

#4

@jeff This does indeed look like a bug in Ghost-CLI - thanks for catching it! Would you mind opening up a github issue at https://github.com/TryGhost/Ghost-CLI/issues/new ? That way we can track it and hopefully get it fixed :slight_smile:


#5

I have raised it here:


#6

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