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

Changed: Enhance DataLayer Plugin Registration System for Improved Third-Party Integration #17711

Merged

Conversation

MichaelTaylor3D
Copy link
Contributor

Purpose:

The current implementation of the DataLayer plugin system relies on direct modifications to the config.yaml file for plugin registration. This approach presents challenges for third-party applications developed atop DataLayer, particularly in terms of creating installers that need to register plugins. Currently, installers either alter config.yaml directly during installation or require users to manually register plugins. The former approach risks compromising the stability of Chia due to potential installer bugs, while the latter is notably user-unfriendly and sometimes unfeasible.

To address these issues, this Pull Request introduces a new mechanism for plugin management within the DataLayer framework. I propose the creation of dedicated plugin directories within the CHIA_ROOT/data_layer path. This structure enables third-party applications to install or uninstall DataLayer plugin files smoothly, without needing to interact directly with the config.yaml file.

Key Changes:

Plugin Directories: Establish designated directories within CHIA_ROOT/data_layer for DataLayer plugins, streamlining the installation and uninstallation process.
Reduced Direct Configuration Manipulation: Minimize the need for third-party installers to modify config.yaml directly, enhancing system stability and reliability.
Improved User Experience: Simplify the plugin installation process for end-users, removing the need for manual plugin registration.
This enhancement fosters a more robust and user-friendly ecosystem for DataLayer and its third-party integrations, ensuring a smoother experience for both developers and users.

Current Behavior:

Datalayer activates plugins only from config.yaml

New Behavior:

Datalayer will still activate plugins from config.yaml, but it will also look in the CHIA_ROOT/data_layer/plugins folder and activate plugins from .conf files that are located in that directory.

Testing Notes:

PR includes coverage for loading the conf files from the plugins folder

image
image
image
image
image

@MichaelTaylor3D MichaelTaylor3D requested a review from a team as a code owner March 15, 2024 14:19
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot added the merge_conflict Branch has conflicts that prevent merge to main label Mar 15, 2024
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions github-actions bot removed the merge_conflict Branch has conflicts that prevent merge to main label Mar 15, 2024
@altendky altendky added the Changed Required label for PR that categorizes merge commit message as "Changed" for changelog label Mar 15, 2024
@MichaelTaylor3D MichaelTaylor3D changed the title Added: Enhance DataLayer Plugin Registration System for Improved Third-Party Integration Changed: Enhance DataLayer Plugin Registration System for Improved Third-Party Integration Mar 15, 2024
@emlowe emlowe requested a review from altendky March 15, 2024 16:22
@emlowe
Copy link
Contributor

emlowe commented Mar 15, 2024

Michael, you have an extraneous update to the mozilla-ca sub repo you should undo here

@MichaelTaylor3D
Copy link
Contributor Author

Michael, you have an extraneous update to the mozilla-ca sub repo you should undo here

@emlowe
Not sure how that happened but im struggling to revert it since its a submodule update and not a regular versioned file. Any pointers you can throw my way?

Copy link
Contributor

@altendky altendky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the plugin files allow for the full PluginRemote schema (albeit two items) so that these new plugins can provide custom headers such as for authentication?

chia/util/misc.py Outdated Show resolved Hide resolved
chia/server/start_data_layer.py Outdated Show resolved Hide resolved
chia/server/start_data_layer.py Outdated Show resolved Hide resolved
chia/server/start_data_layer.py Outdated Show resolved Hide resolved
chia/util/misc.py Outdated Show resolved Hide resolved
chia/util/misc.py Outdated Show resolved Hide resolved
chia/util/misc.py Outdated Show resolved Hide resolved
chia/util/misc.py Outdated Show resolved Hide resolved
chia/util/misc.py Outdated Show resolved Hide resolved
@altendky altendky self-requested a review March 19, 2024 13:10
@MichaelTaylor3D
Copy link
Contributor Author

Shouldn't the plugin files allow for the full PluginRemote schema (albeit two items) so that these new plugins can provide custom headers such as for authentication?

Added support for PluginRemote schema

@altendky altendky requested review from altendky and removed request for altendky March 21, 2024 15:24
@emlowe
Copy link
Contributor

emlowe commented Mar 22, 2024

I think the only real question I have is using JSON for this additional plugin config, while the rest of the chia config is yaml. This was discussed earlier, I'm not sure about it tbh

@emlowe
Copy link
Contributor

emlowe commented Mar 26, 2024

I've decided it's ok to allow JSON here for these files plugin files
@MichaelTaylor3D I think you might owe a comment or two for Kyle
@altendky I think you might be able to resolve some comments

@MichaelTaylor3D
Copy link
Contributor Author

@emlowe went on vacation and then got busy when came back, revisiting this now

chia/data_layer/util/plugin.py Outdated Show resolved Hide resolved
chia/data_layer/util/plugin.py Show resolved Hide resolved
Co-authored-by: Kyle Altendorf <sda@fstab.net>
@emlowe
Copy link
Contributor

emlowe commented Apr 16, 2024

Kyle reminds me that all json files are also yaml files - so if you parse this file with the yaml parser instead of the json parser, you can use either style for the plugin and it shouldn't involve any other code changes.

@MichaelTaylor3D
Copy link
Contributor Author

Kyle reminds me that all json files are also yaml files - so if you parse this file with the yaml parser instead of the json parser, you can use either style for the plugin and it shouldn't involve any other code changes.

I swapped it over to using yaml loader instead of json loader

chia/data_layer/util/plugin.py Outdated Show resolved Hide resolved
Co-authored-by: Kyle Altendorf <sda@fstab.net>
@emlowe emlowe requested a review from altendky June 4, 2024 15:32
@emlowe
Copy link
Contributor

emlowe commented Jul 16, 2024

close and reopen for CI

@emlowe emlowe closed this Jul 16, 2024
@emlowe emlowe reopened this Jul 16, 2024
@Starttoaster Starttoaster merged commit a4da91a into Chia-Network:main Jul 16, 2024
709 of 711 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changed Required label for PR that categorizes merge commit message as "Changed" for changelog community-pr DataLayer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants