[PR #468] [CLOSED] Feat/blue green install #525

Closed
opened 2026-02-16 01:16:14 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-plugin-daemon/pull/468
Author: @Woo0ood
Created: 9/29/2025
Status: Closed

Base: mainHead: feat/blue-green-install


📝 Commits (3)

  • 17c8d78 feat: Implement blue-green deployment strategy for plugin management.
  • b19e363 feat: Enhance blue-green deployment support with new API endpoints and runtime management.
  • 7df15e7 Merge branch 'langgenius:main' into feat/blue-green-install

📊 Changes

19 files changed (+913 additions, -96 deletions)

View changed files

📝 internal/core/plugin_daemon/generic.go (+4 -0)
internal/core/plugin_manager/install_options.go (+5 -0)
📝 internal/core/plugin_manager/install_to_local.go (+29 -21)
📝 internal/core/plugin_manager/install_to_serverless.go (+2 -0)
📝 internal/core/plugin_manager/launcher.go (+14 -1)
📝 internal/core/plugin_manager/local_runtime/run.go (+28 -19)
📝 internal/core/plugin_manager/local_runtime/type.go (+7 -3)
📝 internal/core/plugin_manager/manager.go (+18 -0)
internal/core/plugin_manager/runtime_traffic.go (+390 -0)
📝 internal/core/plugin_manager/test_utils/runtime.go (+1 -1)
📝 internal/core/plugin_manager/watcher.go (+11 -1)
📝 internal/core/session_manager/session.go (+63 -1)
📝 internal/server/controllers/plugins.go (+46 -2)
📝 internal/server/http_server.go (+4 -0)
📝 internal/server/middleware.go (+30 -29)
📝 internal/service/endpoint.go (+13 -2)
📝 internal/service/install_plugin.go (+73 -12)
📝 internal/service/manage_plugin.go (+173 -2)
📝 internal/service/session.go (+2 -2)

📄 Description

This pull request introduces support for blue-green deployment during plugin installation, improves plugin runtime lifecycle management, and enhances logging and error handling. The main changes include adding an InstallOptions struct to control blue-green behavior, updating plugin installation and launch flows to support blue-green traffic cutover, and improving the notification mechanism for plugin startup events to avoid missed signals. Additionally, new runtime tracking and cleanup mechanisms are introduced for better session and resource management.

Blue-green deployment support:

  • Added a new InstallOptions struct with a BlueGreen flag to enable blue-green deployment during plugin installation (install_options.go, install_to_local.go, launcher.go). [1] [2] [3]
  • Modified the plugin launch and registration flow to handle blue-green deployment, including tracking and cleanup for old runtimes (launcher.go, manager.go). [1] [2] [3]

Plugin startup and notification improvements:

  • Improved the WaitStarted method and related logic in LocalPluginRuntime to ensure late callers do not miss the plugin started event, using a buffered channel and a started flag (run.go, type.go). [1] [2]
  • Updated the plugin installation process to wait for the plugin to be fully started before signaling completion, ensuring safe traffic cutover (install_to_local.go). [1] [2]

Logging and error handling:

  • Added detailed logging for plugin installation, launch, and error cases to aid in debugging and monitoring (generic.go, install_to_local.go, launcher.go). [1] [2] [3] [4]

Session and runtime management:

  • Introduced new fields in PluginManager for tracking active sessions, plugin IDs, draining states, and cleanup requirements to better manage plugin runtime lifecycles and blue-green transitions (manager.go).

API and internal refactoring:

  • Updated method signatures (e.g., InstallToLocal, launchLocal, InstallToServerlessFromPkg) to accept the new InstallOptions parameter and propagate blue-green deployment options through the stack (install_to_local.go, launcher.go, install_to_serverless.go). [1] [2] [3]

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify-plugin-daemon/pull/468 **Author:** [@Woo0ood](https://github.com/Woo0ood) **Created:** 9/29/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/blue-green-install` --- ### 📝 Commits (3) - [`17c8d78`](https://github.com/langgenius/dify-plugin-daemon/commit/17c8d7803610beb894d798934c0a8d8eb026ecce) feat: Implement blue-green deployment strategy for plugin management. - [`b19e363`](https://github.com/langgenius/dify-plugin-daemon/commit/b19e363eea667109527d47802ae037a7d6834ebe) feat: Enhance blue-green deployment support with new API endpoints and runtime management. - [`7df15e7`](https://github.com/langgenius/dify-plugin-daemon/commit/7df15e7decc7c2866a91f41590502b25842c9b4c) Merge branch 'langgenius:main' into feat/blue-green-install ### 📊 Changes **19 files changed** (+913 additions, -96 deletions) <details> <summary>View changed files</summary> 📝 `internal/core/plugin_daemon/generic.go` (+4 -0) ➕ `internal/core/plugin_manager/install_options.go` (+5 -0) 📝 `internal/core/plugin_manager/install_to_local.go` (+29 -21) 📝 `internal/core/plugin_manager/install_to_serverless.go` (+2 -0) 📝 `internal/core/plugin_manager/launcher.go` (+14 -1) 📝 `internal/core/plugin_manager/local_runtime/run.go` (+28 -19) 📝 `internal/core/plugin_manager/local_runtime/type.go` (+7 -3) 📝 `internal/core/plugin_manager/manager.go` (+18 -0) ➕ `internal/core/plugin_manager/runtime_traffic.go` (+390 -0) 📝 `internal/core/plugin_manager/test_utils/runtime.go` (+1 -1) 📝 `internal/core/plugin_manager/watcher.go` (+11 -1) 📝 `internal/core/session_manager/session.go` (+63 -1) 📝 `internal/server/controllers/plugins.go` (+46 -2) 📝 `internal/server/http_server.go` (+4 -0) 📝 `internal/server/middleware.go` (+30 -29) 📝 `internal/service/endpoint.go` (+13 -2) 📝 `internal/service/install_plugin.go` (+73 -12) 📝 `internal/service/manage_plugin.go` (+173 -2) 📝 `internal/service/session.go` (+2 -2) </details> ### 📄 Description This pull request introduces support for blue-green deployment during plugin installation, improves plugin runtime lifecycle management, and enhances logging and error handling. The main changes include adding an `InstallOptions` struct to control blue-green behavior, updating plugin installation and launch flows to support blue-green traffic cutover, and improving the notification mechanism for plugin startup events to avoid missed signals. Additionally, new runtime tracking and cleanup mechanisms are introduced for better session and resource management. **Blue-green deployment support:** - Added a new `InstallOptions` struct with a `BlueGreen` flag to enable blue-green deployment during plugin installation (`install_options.go`, `install_to_local.go`, `launcher.go`). [[1]](diffhunk://#diff-52fa9156cb55490f103ca1f12ce7a19ae4c7f9bd68cc9b3e95825acd58a98b83R1-R5) [[2]](diffhunk://#diff-881e51398638527ce2db0c8557f21e19ee9fa57c23dddeee88970fab4e3aeb29R19-R23) [[3]](diffhunk://#diff-1d9f2a191b83fc370110a5e1b173fe892b785596b7f582fa665838853f17431eL72-R75) - Modified the plugin launch and registration flow to handle blue-green deployment, including tracking and cleanup for old runtimes (`launcher.go`, `manager.go`). [[1]](diffhunk://#diff-1d9f2a191b83fc370110a5e1b173fe892b785596b7f582fa665838853f17431eR166) [[2]](diffhunk://#diff-6db2b0b9b30c8443c16fa21ba9d100c4424b83adbce882d18ca971c13928faeeR31-R47) [[3]](diffhunk://#diff-1d9f2a191b83fc370110a5e1b173fe892b785596b7f582fa665838853f17431eR183) **Plugin startup and notification improvements:** - Improved the `WaitStarted` method and related logic in `LocalPluginRuntime` to ensure late callers do not miss the plugin started event, using a buffered channel and a `started` flag (`run.go`, `type.go`). [[1]](diffhunk://#diff-eb349a242950c37de053364e31d263050b1a631555d62e6b0c284a8afdbddffaL203-R221) [[2]](diffhunk://#diff-db8c01986514d414bffd8e3a1378bf869d09d583b983b820416809f1321a680aR50-R53) - Updated the plugin installation process to wait for the plugin to be fully started before signaling completion, ensuring safe traffic cutover (`install_to_local.go`). [[1]](diffhunk://#diff-881e51398638527ce2db0c8557f21e19ee9fa57c23dddeee88970fab4e3aeb29R51-R53) [[2]](diffhunk://#diff-881e51398638527ce2db0c8557f21e19ee9fa57c23dddeee88970fab4e3aeb29L89-R97) **Logging and error handling:** - Added detailed logging for plugin installation, launch, and error cases to aid in debugging and monitoring (`generic.go`, `install_to_local.go`, `launcher.go`). [[1]](diffhunk://#diff-0cbfde7cd369d561740d8ad33bac04cf4aa6cc83de34d97b24b4abb65460e161R26-R28) [[2]](diffhunk://#diff-881e51398638527ce2db0c8557f21e19ee9fa57c23dddeee88970fab4e3aeb29R72) [[3]](diffhunk://#diff-881e51398638527ce2db0c8557f21e19ee9fa57c23dddeee88970fab4e3aeb29R19-R23) [[4]](diffhunk://#diff-1d9f2a191b83fc370110a5e1b173fe892b785596b7f582fa665838853f17431eR183) **Session and runtime management:** - Introduced new fields in `PluginManager` for tracking active sessions, plugin IDs, draining states, and cleanup requirements to better manage plugin runtime lifecycles and blue-green transitions (`manager.go`). **API and internal refactoring:** - Updated method signatures (e.g., `InstallToLocal`, `launchLocal`, `InstallToServerlessFromPkg`) to accept the new `InstallOptions` parameter and propagate blue-green deployment options through the stack (`install_to_local.go`, `launcher.go`, `install_to_serverless.go`). [[1]](diffhunk://#diff-881e51398638527ce2db0c8557f21e19ee9fa57c23dddeee88970fab4e3aeb29R19-R23) [[2]](diffhunk://#diff-1d9f2a191b83fc370110a5e1b173fe892b785596b7f582fa665838853f17431eL72-R75) [[3]](diffhunk://#diff-5607e797a73196fb2257741215123f5aa63a19b77c8b836adc0a49a424e26728R20-R24) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 01:16:14 -05:00
yindo closed this issue 2026-02-16 01:16:14 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-daemon#525