SoftInstigate / restheart

Open Source Low-code API development framework Featuring ready-to-go Security and MongoDB API
http://softinstigate.github.io/restheart/
GNU Affero General Public License v3.0
792 stars 170 forks source link

Enhanced Plugin Directory Management in RESTHeart #495

Closed ujibang closed 5 months ago

ujibang commented 6 months ago

Objective: To enable RESTHeart to load plugins recursively from subdirectories of the plugins-directory.

Current Limitation: At present, RESTHeart is configured to search for plugins in the directory specified by the plugins-directory configuration option. By default, this is set to ./plugins. It just searches jar files in the directory and won't look into subdirectories. This limitation poses challenges, especially when deploying custom plugins in a Docker environment.

Proposed Solution: RESTHeart will search for plugins in the plugins-directory and recursively in its subdirectories (up to two levels deep).

Use Case Scenario: In a Docker deployment scenario, users often need to deploy custom plugins. The current system requires the use of Docker volume mappings for each custom plugin or its dependencies, like this:

$ docker run -rm -p 8080:8080 -v custom-plugins.jar:/opt/restheart/plugins/custom-plugins.jar softinstigate/restheart

However, remapping the /opt/restheart/plugins directory to include custom plugins risks overwriting the standard plugin JARs (e.g., restheart-graphql.jar) that come with RESTHeart. The challenge is amplified when a plugin has several dependencies, necessitating multiple Docker volume mappings.

Benefits of the Proposed Change:

  1. Flexibility: Allows separation of custom and standard plugins into different directories.
  2. Simplified Deployment: Reduces the complexity in Docker environments by minimizing the need for multiple volume mappings.
  3. Maintainability: Eases the process of updating and managing custom and standard plugins independently.

Implementation Considerations:

Detailed Documentation: To be developed, detailing the technical implementation, configuration changes, and examples of usage in different deployment scenarios.

ujibang commented 5 months ago

done, available in v7.7.0