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

Allow installing plugins declaratively #6548

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Infinidoge
Copy link

@Infinidoge Infinidoge commented Aug 16, 2024

Description

Implements the ability for PeerTube to self-install plugins that are declared upfront in a file, checking the file on startup to install/uninstall/update accordingly. The format for the declarative_plugins.json file is as such:

{
  "npm-name-here": {
    "pluginPath": "path/to/plugin/directory",
    // OR
    "version": "yarn.add.compatible-version",
    
    "extraArgs": "--extra --arguments --passed --to --yarn",
    "preInstall": "command run before calling yarn",
    "postInstall": "command run after calling yarn"
  }
}

This design makes it very flexible for different ways of handling installing/uninstaling, with the only thing left out being a way to specify a different command to install a plugin with (such as using npm instead of yarn). Since Yarn is the foundation for plugin management internally, I decided to leave that out in this implementation.

I am not a seasoned TypeScript developer by any stretch of the imagination, so please let me know wherever the code can be improved.

TODO:

  • Add usage to documentation
  • Add unit test

Related issues

Resolves #6428

Has this been tested?

  • 👍 yes, I added tests to the test suite
  • 💭 no, because this PR is a draft and still needs work
  • 🙅 no, because this PR does not update server code
  • 🙋 no, because I need help

@synq
Copy link

synq commented Nov 24, 2024

I have been pushing to get Peertube updated in the NixOS packages repository.

Unfortunately it does not build because the program itself references to a plugin (which is outside of the program itself).
NixOS/nixpkgs#358194

If this PR would be implemented it would fix that problem and we could get Peertube upgraded from 6.0.4 to 6.3.3

@synq synq mentioned this pull request Nov 24, 2024
13 tasks
@Chocobozzz
Copy link
Owner

Hi @synq

I'm not sure to understand "it does not build because the program itself references to a plugin" because we don't install plugins on PeerTube installation

@Chocobozzz
Copy link
Owner

@Infinidoge Hi :) What's the status or this PR?

@Chocobozzz Chocobozzz added the Status: Waiting for answer Waiting issue author answer label Jan 14, 2025
@Infinidoge
Copy link
Author

Having burnt myself out over yarn while working on this, I will fully admit that it's kinda dead in the water. Because of yarnpkg/yarn#7870 (5 YEARS. COME ON YARN.), making this work with how PeerTube manages plugins internally is... extremely difficult. (Or well, more specifically, making it behave the way I want it to for the greater goal of making it work with Nix is extremely difficult.)

To the best of my memory the fundamentals of the PR work. However, due to not hosting a PeerTube instance myself and having many other things higher in priority, I don't have much drive to keep working on it.

@Chocobozzz
Copy link
Owner

Would npm or pnpm solve your problem?

@Infinidoge
Copy link
Author

Yes. (And if i remember correctly, the current NixOS module patches PeerTube to use npm for this reason.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Waiting for answer Waiting issue author answer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Declarative plugin management
3 participants