Create daemons on initial site provisioning #129
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows creating daemons on forge when provisioning a new site.
You can create a single or multiple daemons the same way as queue workers. The user and directory is set to the same ones used on the site, a reasonable default I think.
or
If the command you need to run has arguments of its own, you can single or double-quote the entire command.
Handling of teardown process.
When in user isolation mode, daemon removal happens by deleting all daemons that are running as the user used for the site.
In all cases, daemons are deleted if their directory falls within the site currently being teardown-ed.
After all that, any remaining daemons are deleted based on the env variable set by the user. So it is recommended to add the same env value for
FORGE_DAEMONS
for teardown workflow as well. Would ask you to review the code for teardown carefully. Thanks.And finally some concerns
The inertia pipeline steps seem redundant for the most part and can simply be replaced with
php artisan inertia:start-ssr
in theFORGE_DAEMONS
. Additionally, it addsinertia:stop-ssr
to the deployment script, which seems out of scope to do automatically. The user still needs to write their deployment script anyway, and they should add the daemon-killing command to their script, as suggested by the documentation for those libraries.That being said, I have not made any changes to inertia as that would be a breaking change.
I will be submitting another PR to fix the handling of user isolation in the scheduler job and inertia daemon creation. Since at the moment it's hard coded to
forge
.Apologies for the wall of text 😞