-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Plugin installation step #6875
Comments
This unlocks:
|
Assuming I'm not missing anything, our data flow looks like:
I'll have to figure out how that results in updates on the frontend, but design / concept wise - I don't see any problems (yet). |
Hey, this is mostly spot on! Some things to add though :).
Ultimately the answer is to store installs in a different model, which would also allow us to keep much more metadata like
For storing capabilities, let's not do
|
Excellent points, thanks! It makes sense about the plugin-server -> postgres bit. Had a deeper look last night, and sure enough, there's lots of parts doing this already, so my assumption about Django being the only model manager is false.
Oh, I think the installation can only happen after the configuration has happened, since the setup task can depend on the config?
Hmm, I don't think this is feasible, if we want to show if an installation failed for whatever reason? (bad config, typos, etc.)?
Another reason I want the (Yeah, maybe About installing DB model & upgrades: (related to point 1 and 6): I actually don't want to add an extra layer on top of enabled/disabled for checking installation status. Rather, "installing" is a subset of the disabled state. So, how I imagine it works with updating: You click update, the plugin goes into an installing state (and gets disabled while installing), as the source archives are changing, we go through the setup loop, and if things work fine, installing state is set back to false, and plugin is enabled. (If things didn't work out, we'll go to the broken tab and keep it disabled, since it literally can't work anymore) So, I actually do think this works for upgrades as well? I wouldn't go the another model route unless we really want the installed_at / installed_by audit logs? Another possibility with updating is to keep the plugin enabled while in installing status - this way, old plugin keeps running until installation finishes, at which point we either: (1) disable it if installation failed. or (2) reload workers if it succeeded (somehow?) |
Oh, plugin installation should happen before configuration. The point is still currently to capture capabilities on install, and verify that all the plugin JS works. We don't need user data for that. All that's needed is to comment out the part that runs And we really absolutely totally can not disable plugins when updating. Imagine your fortune 500 company is relying on the "bigquery export" plugin... that just skips exporting a few thousand events for the 10 seconds the plugin was down for upgrades. That's a no go. |
Hmm, that's the thing, I don't think we can verify JS works until we have the config in place? Since those are all parameters used by the JS code? Interesting, I was actually thinking installation would mean running the setup and see everything is OK. Fair point about disabling while updating, we can keep the old version running while updating. |
We definitely can... and if you look at I mean, we can't verify that Regarding keeping the old version running, I don't see how you can do that without a separate table. If you override any source/archive fields in the plugin, you can't predict what happens next. Some old plugins might be running, but what happens in a new server instance that boots up? We need to store the code to try to run somewhere, and a "plugin_installations" or "plugin_installed_versions" or whatever table makes most sense IMO. Regarding this "Installing tab", that's thinking like a developer. While we are marketing towards developers, even developers like tools designed for regular people :). That means, the simpler, less cluttered, least making you think the interface is, the better. |
I understand, that was the missing bit: I assumed installation would test that things work before actually enabling things. That clears some things out, thanks! .. And if there's no extra information to relay back, we don't need an extra tab/section. Your initial points make a lot more sense now. Thanks! |
This issue hasn't seen activity in two years! If you want to keep it open, post a comment or remove the |
This issue has 2037 words at 10 comments. Issues this long are hard to read or contribute to, and tend to take very long to reach a conclusion. Instead, why not:
Is this issue intended to be sprawling? Consider adding label |
This issue was closed due to lack of activity. Feel free to reopen if it's still relevant. |
Currently plugins are installed from Django. The main posthog app in
plugin.py
. The code there either 1) gets a github repo URL, parses it, fetches a.zip
file with the plugin code, does basic validation (version check) and stores the archive in postgres, or 2) Opens a source editor and stores its contents in postgres.In both cases, we won't know if the plugin actually works before we try it out for real.
Instead, I'd like there to be a separate "install plugin" step and "installing..."/"updating..." states. This might mean pushing some of the logic away from Python into NodeJS (e.g. downloading the archives?) and just dispatching tasks from the plugin server, and awaiting their responses.
Eventually we the plugin server would spin up a VM for the "to install" plugin, capture its capabilities, and if all loaded well, mark the plugin as installed and ready to use. I'd argue the VM should be spin up in a separate worker pool (with just one thread) for isolation. Either via piscina or some other system. This could be the basis for plugin testing as well https://github.com/PostHog/plugin-server/issues/165
The text was updated successfully, but these errors were encountered: