Skip to content
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

Declarative plugin management #6428

Open
OPNA2608 opened this issue Jun 2, 2024 · 1 comment · May be fixed by #6548
Open

Declarative plugin management #6428

OPNA2608 opened this issue Jun 2, 2024 · 1 comment · May be fixed by #6548
Labels
Component: PeerTube Plugin 📦 Features that can be developed in a plugin, but require PeerTube plugin API development Type: Discussion 💭

Comments

@OPNA2608
Copy link

OPNA2608 commented Jun 2, 2024

Describe the problem to be solved

For the NGI-funded Summer of Nix project, we (@Infinidoge and I) are looking into how peertube plugins can be managed declaratively within a NixOS module.

From our understanding, plugins can only be installed imperatively: Start the CLI & tell it to install a plugin, and peertube will trigger a state change in the database to register the plugin and look for it in its plugin directory on startup. This extra requirement on a certain database state is a major pain point for our endeavour.

A previous effort around this found a workaround by

  1. Collecting a list of every plugin that we want to have available
  2. Getting a hash of peertube's storage.plugins package.json
  3. Launching peertube
  4. Running the plugin install script for every desired plugin
  5. Comparing the list of previously-desired plugins against now-desired plugins, and running the uninstall script for every plugin that isn't desired anymore
  6. Saving the list from step 1 under storage.plugins
  7. Comparing the hash from step 2 against the current hash of that file, triggering a restart of peertube if they differ

But we think this extra plugin management around your own plugin management is very unsatisfying & hacky solution.

Describe the solution you would like

We would like to find solution that doesn't rely on us doing plugin management around your plugin management.

Maybe there could be a way to tell peertube to read a list of additional plugins from somewhere, or have it automagically find additional plugins if they're in a certain directory.

Ideal for us (I think) would be a way to completely lock down the imperative plugin management and have it be fully managed by the external mechanism, so we can ensure that only the plugins the user desires are available to peertube.

@Chocobozzz Chocobozzz added Type: Discussion 💭 Component: PeerTube Plugin 📦 Features that can be developed in a plugin, but require PeerTube plugin API development labels Jun 3, 2024
@Infinidoge
Copy link

Infinidoge commented Jun 5, 2024

As part of this, I have been working on a prototype implementation of this as a feature, found here: https://github.com/Infinidoge/PeerTube/tree/develop-nginix

How it works currently is you create a json file in the plugins directory, and it runs the internal installation/removal from there, handling the database where needed.

declarative_plugins.json format:

{
  "npm-package-name": {
    "pluginPath": "/path/to/plugin/directory"
  },
  "other-npm-package-name": {
    "version": "version.to.install"
  }
}

I also intend on adding an offlineCache option, to instruct yarn internally to use the given offline cache, allowing for pre-fetching plugins.

Something that would be worth doing is instead moving this into the PeerTube configuration, removing the need for the positional file and letting multiple config files declare plugins.

@Infinidoge Infinidoge linked a pull request Aug 16, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: PeerTube Plugin 📦 Features that can be developed in a plugin, but require PeerTube plugin API development Type: Discussion 💭
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants