-
Notifications
You must be signed in to change notification settings - Fork 314
-
Notifications
You must be signed in to change notification settings - Fork 314
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
Service should be set to "uninitialized" after an update occurs #1641
Comments
I would expect it not to run again, because it's already been initialized. If we need behavior that runs after upgrade, we should add another hook. |
@adamhjk this would mean the init hook is truly a run-once even if it's modified by a future version. If an app requires additional initialization after an upgrade we'd need to instead move it to an on-upgrade hook. If that's also behaviour that should happen at initialization time, I think people might be duplicating code in two hooks |
I think there is code that needs to happen the first time a service is run, and never again (it's truly run-once). We probably don't do the right thing here now, because the init hook gets run the first time the service is started, which isn't quite the same. Then there is code that needs to be run every time before a service is started/restarted, which is different. A practical example - some systems need bootstrapping once, but never again. An example would be the generation of self signed certificates for authentication in PostgreSQL. While you could guard against it in a run always init hook, it feels like a different behavior to me. |
I agree that As far as I can tell that is... |
Currently many init hooks in core-plans and also our reference tutorial app either symlink or copy bits from So removing Of course there are other init operations, like creating the system database tables in mysql that make sense to run only once ever. The hooks that I have seen which include such one time logic usually include some guard code to ensure this only happens once. One might argue that after an update, you effectively have a new service that is in need of initialization. Regardless, as we consider when the |
I should also note that without the above change, the |
I understand.
I would have expected those tasks to be handled in Perhaps similar to |
I like the thought model around |
I see a few options conceptually:
And finally: |
I think 4 is basically right. We need a flowchart. :) |
@bodymindarts @adamhjk I'm in agreement with 4 as well |
When a package is updated the service should reset and begin a new lifecycle. This commit stops the service after an update and resets the initialized flag allowing the initialization process to take place via the regular `execute_hooks()` code path on the next `service.tick()` call. Closes #1641
When a package is updated the service should reset and begin a new lifecycle. This commit stops the service after an update and resets the initialized flag allowing the initialization process to take place via the regular `execute_hooks()` code path on the next `service.tick()` call. Closes #1641 Signed-off-by: Justin Carter <justin@starkandwayne.com>
When a package is updated the service should reset and begin a new lifecycle. This commit stops the service after an update and resets the initialized flag allowing the initialization process to take place via the regular `execute_hooks()` code path on the next `service.tick()` call. Closes #1641 Signed-off-by: Justin Carter <justin@starkandwayne.com>
When a package is updated the service should reset and begin a new lifecycle. This commit stops the service after an update and resets the initialized flag allowing the initialization process to take place via the regular `execute_hooks()` code path on the next `service.tick()` call. Closes #1641 Signed-off-by: Justin Carter <justin@starkandwayne.com>
When a package is updated the service should reset and begin a new lifecycle. This commit stops the service after an update and resets the initialized flag allowing the initialization process to take place via the regular `execute_hooks()` code path on the next `service.tick()` call. Closes #1641 Signed-off-by: Justin Carter <justin@starkandwayne.com>
An initialization hook only occurs when a package is started for the first time. After a service upgrade the initialization hook won't be run again and this is probably the behaviour that our users will expect. It's also the behaviour we describe in our documentation.
The simple fix for this is to set the service as uninitialized and not just as needing a restart upon update
The text was updated successfully, but these errors were encountered: