-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
Make ghost run
be responsible for outputting running environment
#463
Comments
Why doesn't it query |
@gcochard that's a valid point - however it's not possible given the way Ghost-CLI works with running environments at the moment. Ghost-CLI is set up so that you can extend it and use a different process manager as long as there's an extension you've installed for it (e.g. pm2 or supervisor). The particular process manager you are going to use is determined during So, Ghost needs to know the running environment in order to determine what process manager to query - and that is ultimately why we can't just query systemd - as nice as that would be to do. |
closes TryGhost#463 [ci skip] - output a .environment file into the content folder using `ghost run`, is cleaned up when ghost is stopped
I don't understand that. The running environment is default production if |
Hmm....that's not a bad point - however if someone started a Ghost blog in production mode ( |
I think this can be covered be ensuring that the ports must be different? Sounds like to me asking the configured extension can work as a possible solution here?
BTW: This sounds a bit too hacky. The content folder should not be used for CLI files. |
I just stumbled over this problem myself. Why is there a need to run the same folder / instance in different config envs? Could you explain why there is a need for it? If nothing too big speaks against only one config I'd like it more as it greatly simplifies everything. |
closes TryGhost#463 - query each process manager if running is not set in cli config
closes TryGhost#463 - query each process manager if running is not set in cli config
closes #463 - query each process manager if running is not set in cli config
There have been several issues raised recently (#461, #449, #431, #430) where the CLI loses track of running blog state when using systemd. The root cause of this is related to how the CLI keeps track of instance running environment.
Currently,
ghost start
starts Ghost using the configured process manager for the particular environment, and after it has been started sticks a value into the.ghost-cli
file at the root of the install that notes what environment Ghost is currently running in. This value is used by the CLI as the source of truth about whether or not a blog is running. If the value does not exist in the .ghost-cli file the blog is assumed to not be running; if it exists, the configured process manager for the running environment is queried to ensure that the blog is actually still running. This approach has issues with systemd in a couple of cases:ghost stop
, then reboot the server. Because the systemd service has been configured to start on boot, the ghost instance is started on boot but no value is output to the.ghost-cli
file because ghost was started automatically, not usingghost start
systemctl start/stop ghost_<servicename>
to start/stop Ghost rather thanghost start
/ghost stop
. This causes the same issue of the running environment not being tracked.To fix this, we need to give responsibility for updating running environment to the
ghost run
command (which both the local process manager and the systemd process manager use under the hood). However, we can't makeghost run
modify the .ghost-cli file asghost start
does right now - because systemd runsghost run
as the ghost system user, it won't have permissions to edit that file. Instead,ghost run
will output a.environment
file into thecontent
directory of the ghost install (which the ghost system user does have write access to) and then the CLI will use that file to determine what environment the CLI is currently running in.The text was updated successfully, but these errors were encountered: