2.22.2 > 2.37.2 Upgrade - Permissions Issues

Hi Everyone,

I am trying to upgrade my Ghost instance from 2.22.2 to 2.37.2 but I have permissions problems (I want to go to v3 so I am presuming this is a necessary interim upgrade?)

:heavy_check_mark: Checking system Node.js version
:heavy_check_mark: Ensuring user is not logged in as ghost user
:heavy_multiplication_x: Checking if logged in user is directory owner
:heavy_multiplication_x: Checking current folder permissions
:heavy_check_mark: Checking folder permissions
:heavy_check_mark: Checking file permissions
:heavy_check_mark: Checking content folder ownership
:heavy_check_mark: Checking memory availability
One or more errors occurred.

1) Checking if logged in user is directory owner

Message: Your user does not own the directory /var/www/ghost and is also not a member of the owning group.
You must either log in with the user that owns the directory or add your user to the owning group.
Help: https://ghost.org/docs/install/ubuntu/#create-a-new-user-

2) Checking current folder permissions

Message: The directory /var/www/ghost is not writable by your user. You must grant write access and try again.
Help: https://ghost.org/docs/install/ubuntu/#create-a-directory

Debug Information:

  • OS: Ubuntu, v18.04.3 LTS*
  • Node Version: v10.18.0*
  • Ghost Version: 2.22.2*
  • Ghost-CLI Version: 1.13.1*
  • Environment: production*
  • Command: ‘ghost update’*

If I try to run as myself, I get permissions errors. If I try to run as root, it won’t let me. I su’d to Ghost but I can’t use that account either.

The permissions are set as follows:

-rw-r–r-- 1 ghost-mgr ghost-mgr 606 May 23 2019 config.production.json
drwxr-xr-x 8 ghost ghost 4096 May 23 2019 content
lrwxrwxrwx 1 ghost-mgr ghost-mgr 30 May 23 2019 current -> /var/www/ghost/versions/2.22.2
drwxr-xr-x 4 ghost-mgr ghost-mgr 4096 May 23 2019 system
drwxr-xr-x 3 ghost-mgr ghost-mgr 4096 May 23 2019 versions

I’m reluctant to start changing ownership of folders as I suspect this is the wrong approach

This is a droplet on Digital Ocean using their image. I’m not super savvy with Ghost behind the scenes and I am obviously doing something wrong, but the docs that are linked to don’t really explain permissions.

How can I safely upgrade? I think in the past I did it the old way of downloading source files & copying as opposed to using ghost-cli

Any tips appreciated

Many Thanks

PS - If I wanted to build a new Ghost box, what is the easiest way to migrate content? Is it the json export and /content folder from current instance, and copy/import to new host?

Hey @hooj999 :wave:

You should be running the commands as the ghost-mgr user (sudo su ghost-mgr should let you do that). That user is created in the one-click droplet for managing the ghost instance :slight_smile:

Yep, that’s about it! The content folder has backups, settings, images, etc. and the json file is most of your database

Thankyou @vikaspotluri123!

So, essentially the one user I did not try. Knew it would be something simple!

Worked right away and went straight up to 3.2.0

Thanks very much for the help :slight_smile:

As an aside to this, a lot of the posts I found when looking were 3+ years old and suggested the need to stop services before backing up, whereas now the Ghost docs just say to back up the items already discussed. Is there generally any reason to do this any more?

Also, where in the file system is the equivalent fle what is exported as JSON from the Ghost admin panel? I’d prefer to keep Ghost right up to date with production releases, which would seem reasonably easy to do with a bash scriot and a cron job. I see some older ones but nothing terribly recent, so wondering if there is perhaps a better way to perform automatic updates

Thanks

1 Like

If I understood correctly, you’re asking if there’s any reason to stop services before backing up. I wasn’t to involved with ghost prior to the release of the CLI, so I can’t really say based on previous reasoning. However, the current upgrade guide just says what you originally suggested is enough, so I’d follow that :slight_smile:

It will be in the content directory. Automatic updates are not officially supported with Ghost, but many users have successfully done so! Just be careful with major versions since it might leave your site down for longer :wink:

Thanks again, really helpful :slight_smile:

1 Like