New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ghost won't start (via systemd) if installed in different location to /var/www/{install_folder} #780

Closed
raspberrycoulis opened this Issue Aug 10, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@raspberrycoulis
Copy link
Contributor

raspberrycoulis commented Aug 10, 2018

Summary

For redundancy (on a Raspberry Pi), I have created a RAID0 via two 16GB USB drives as follows:

/mnt/raid0

In there, I have moved the contents of /var/www/ as documented in this guide on Digital Ocean, and then configured nginx accordingly.

Before installing Ghost, I checked nginx is configured correctly and I can see the standard nginx HTML page if I visit the Raspberry Pi's IP address in my browser.

I then create a new folder in my mounted RAID0 folder as follows:

/mnt/raid0/www/ghost

And then apply the appropriate permissions for the user (in this case, the default pi user).

Installing Ghost works just fine, and it works without issue - I can access the blog in my browser and everything works as per the norm.

However, upon reboot the Ghost blog does not start and when I check the status with ghost ls, it shows that the blog is in the stopped state but the Process Manager is n/a.

Attempting to start the blog again (via ghost start in the /mnt/raid0/www/ghost folder) results in the following:

A ProcessError occurred.

Message: Command failed: /bin/sh -c sudo -S -p '#node-sudo-passwd#'  systemctl start ghost_ghostpi-pro
Failed to start ghost_ghostpi-pro.service: Unit ghost_ghostpi-pro.service not found.

Exit code: 5

I am able to fix by deleting the ghost_ghostpi-pro.service file from /mnt/raid0/www/ghost/system/files and then running ghost setup systemd from the command line again. This starts Ghost again, but fails again when I reboot.

I then tested an install in the default location - i.e. /var/www/ghost/ and everything works just fine, so I can only assume it is an issue with the mounted folder?

Appreciate this is not the supported stack, but I have been running Ghost on my Raspberry Pi for a while without any major issue, but this seems to be linked to how the systemd service is created and called.

Steps to Reproduce

  1. Move /var/www/ to a RAID0 device located at /mnt/raid0/
  2. Configure nginx to point to the correct location as documented here
  3. Create a new directory for the Ghost install in /mnt/raid0/www/ghost/
  4. Give appropriate folder permissions - sudo chown pi:pi /mnt/raid0/www/ghost
  5. Install Ghost
  6. Ghost starts
  7. Reboot
  8. Ghost fails to start
  9. Delete the ghost_ghostpi-pro.service file in /mnt/raid0/www/ghost/system/files/
  10. Run ghost setup systemd
  11. Run ghost start
  12. Ghost runs again, but fails on reboot again.

Log file

Debug Information:
    OS: Raspbian, v9.4
    Node Version: v8.11.3
    Ghost-CLI Version: 1.8.1
    Environment: production
    Command: 'ghost start'
Message: Command failed: /bin/sh -c sudo -S -p '#node-sudo-passwd#'  systemctl start ghost_ghostpi-pro
Failed to start ghost_ghostpi-pro.service: Unit ghost_ghostpi-pro.service not found.

Exit code: 5

--------------- stderr ---------------
Failed to start ghost_ghostpi-pro.service: Unit ghost_ghostpi-pro.service not found.

Technical details

This is automatically output by Ghost-CLI if an error occurs, please copy & paste:

  • OS: Raspbian v9.4
  • Node Version: v8.11.3
  • Ghost-CLI Version: 1.8.1
  • Environment: production
  • Command: 'ghost start'
@acburdine

This comment has been minimized.

Copy link
Member

acburdine commented Aug 10, 2018

I believe this is a duplicate of #390 - it has to do with the fact that we're symlinking the systemd unit file from the ghost install location into the systemd service folder. Running it on external storage (esp. if it's software RAID) means that the file won't be present initially on system boot, leading to the issue you're experiencing.

There's plans for the future to rework the behavior so the files are no longer symlinked and a hard copy of the file exists in the right place.

@raspberrycoulis

This comment has been minimized.

Copy link
Contributor

raspberrycoulis commented Aug 10, 2018

Ok, thanks @acburdine that's good to hear. Apologies, I did search for the issue before posting, but couldn't find #390.

Would creating the ghost_ghostpi-pro.service file manually in /lib/systemd/system/ instead be a temporary work-around, or will this cause an issue with the Ghost-CLI?

@acburdine

This comment has been minimized.

Copy link
Member

acburdine commented Aug 10, 2018

@raspberrycoulis just copying the file from <ghost folder>/system/files and putting it in /lib/systemd/system should fix the issue in the short term.

@acburdine

This comment has been minimized.

Copy link
Member

acburdine commented Aug 13, 2018

Gonna go ahead and close this as a duplicate of #390

@acburdine acburdine closed this Aug 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment