502 Bad Gateway After Update

I solved this by manually removing the 3.38.1 directory I created and granting ownership to the /versions folder. Not sure how I missed this.

URL: https://yqspod.com
Installed on DigitalOcean as 3.37, error occurred after trying to update.

I think maybe something got moved or some permission is to blame here, but I’m honestly brand new to working with SSH & Ghost so I don’t even know where to start. Any help would be kindly appreciated!

Errors encountered:
EACCES: permission denied, open '/var/www/ghost/.ghost-cli
– To solve I did

chown <user>:<user> /var/www/ghost/.ghost-cli

Also had an issue with config.production.json so I ran

chown <user>:<user> /var/www/ghost/config.production.json

EACCESS: permission denied, mkdir β€˜(can’t remember the error here, was about making a directory such as 3.38)’.
– To solve I made the dir manually.

When trying ghost update --force I get the error Message: β€˜EACCES: permission denied, rmdir β€˜/var/www/ghost/versions/3.38.1’’
Even though I did chown : /var/www/ghost/versions/3.38.1

Message: 'EACCES: permission denied, rmdir '/var/www/ghost/versions/3.38.1''

Stack: Error: EACCES: permission denied, rmdir '/var/www/ghost/versions/3.38.1'
    at Object.rmdirSync (fs.js:843:3)
    at rmdirSync (/usr/lib/node_modules/ghost-cli/node_modules/fs-extra/lib/remove/rimraf.js:264:13)
    at Object.rimrafSync [as removeSync] (/usr/lib/node_modules/ghost-cli/node_modules/fs-extra/lib/remove/rimraf.js:24$    at Task.downloadAndUpdate [as task] (/usr/lib/node_modules/ghost-cli/lib/commands/update.js:138:16)
    at /usr/lib/node_modules/ghost-cli/node_modules/listr/lib/task.js:167:30
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
Code: EACCES
Path: /var/www/ghost/versions/3.38.1

I also did several chown and permission changes I found online.

When I run ghost start:
+ sudo systemctl is-active ghost_yqspod-com
βœ” Ensuring user is not logged in as ghost user
βœ” Checking if logged in user is directory owner
βœ” Checking current folder permissions
+ sudo systemctl is-active ghost_yqspod-com
βœ” Validating config
βœ” Checking folder permissions
βœ” Checking file permissions
βœ” Checking content folder ownership
βœ” Checking memory availability
βœ” Checking binary dependencies
+ sudo systemctl start ghost_yqspod-com
+ sudo systemctl stop ghost_yqspod-com
βœ– Starting Ghost: yqspod-com
A GhostError occurred.```

When I run 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
βœ” Checking system compatibility
βœ” Checking for a MySQL installation
+ sudo systemctl is-active ghost_yqspod-com
βœ” Validating config
βœ” Checking folder permissions
βœ” Checking file permissions
βœ” Checking content folder ownership
βœ” Checking memory availability
βœ” Checking binary dependencies
βœ” Checking free space

When checking /home/paul/.ghost/logs/ghost-cli-debug-2020-11-18T14_53_05_221Z.log
Debug Information:
	OS: Ubuntu, v18.04.4 LTS
	Node Version: v12.18.0
	Ghost Version: 3.38.1
	Ghost-CLI Version: 1.15.2
	Environment: production
	Command: 'ghost start'
Message: Could not communicate with Ghost
Suggestion: journalctl -u ghost_yqspod-com -n 50
Stack Error: Could not communicate with Ghost
	at Server.<anonymous> (/usr/lib/node_modules/ghost-cli/lib/util/port-polling.js:56:20)
	at Object.onceWrapper (events.js:421:28)
	at Server.emit (events.js:315:20)
	at emitCloseNT (net.js:1655:8)
	at processTicksAndRejections (internal/process/task_queues.js:83:21)

After switching to root and checking journalctl -u ghost_yqspod-com -n 50
This message repeats over and over:
- Inspecting operating system
internal/modules/cjs/loader.js:969
    throw err;
    ^
Error: Cannot find module '/var/www/ghost/current/index.js'
	at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
	at Function.Module._load (internal/modules/cjs/loader.js:842:27)
	at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
	at internal/main/run_main?module.js:17:47 {
      code: 'MODULE_NOT_FOUND',
     requireStack: []
}
ghost_yqspod-com.service: Service hold-off time over, scheduling restart.
ghost_yqspod-com.service: Scheduled restart job, restart counter is at 3.
Stopped Ghost systemd service for blog: yqspod-com.
Starting Ghost systemd service for blog: yqspod-com.
1 Like