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

Unify plugin endpoint configuration for api and worker: migrate from PLUGIN_DAEMON_URL and PLUGIN_DAEMON_KEY to PLUGIN_API_URL/PLUGIN_API_KEY #13214

Closed

Conversation

BorisPolonsky
Copy link
Contributor

@BorisPolonsky BorisPolonsky commented Feb 5, 2025

Unify plugin endpoint configuration for api and worker: Substitute PLUGIN_API_URL and PLUGIN_API_KEY for PLUGIN_DAEMON_URL and PLUGIN_DAEMON_KEY
This is an alternative solution to #13239, which does things the other way around.

Fixes #13113

Summary

PR #13055 introduces PLUGIN_API_URL and PLUGIN_API_KEY in docker-compose.yaml, which coexists with the original PLUGIN_DAEMON_URL and PLUGIN_DAEMON_KEY (the ones that actually take effect) and caused confusions that ends up in InternalServerError (#12664). This PR unify the environment variables by migrating from PLUGIN_DAEMON_URL and PLUGIN_DAEMON_KEY to PLUGIN_API_URL and PLUGIN_API_KEY in order to unify the configuration and fix the issues caused by this confusion, namely

Tip

Close issue syntax: Fixes #<issue number> or Resolves #<issue number>, see documentation for more details.

Screenshots

Before After
... ...

Checklist

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

…e `PLUGIN_API_URL` and `PLUGIN_API_KEY` for `PLUGIN_DAEMON_URL` and `PLUGIN_DAEMON_KEY`
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. 📚 documentation Improvements or additions to documentation labels Feb 5, 2025
@BorisPolonsky BorisPolonsky changed the title Unify plugin endpoint configuration for api and worker: PLUGIN_DAEMON_URL and PLUGIN_DAEMON_KEY -> PLUGIN_API_URL/PLUGIN_API_KEY Unify plugin endpoint configuration for api and worker: migrate from PLUGIN_DAEMON_URL and PLUGIN_DAEMON_KEY to PLUGIN_API_URL/PLUGIN_API_KEY Feb 5, 2025
@crazywoola
Copy link
Member

Please fix the lint errors. :)

@BorisPolonsky
Copy link
Contributor Author

BorisPolonsky commented Feb 5, 2025

Given that there's ongoing PR that works on ruff lint (#13193) and all of the python code remain untouched in this PR while ruff prompts

Would reformat: models/dataset.py
1 file would be reformatted, 1207 files already formatted`

It's unlikely to be caused by this PR. Shall we resolved this with a separate PR and proceed with this PR for now (or at least come to a conclusion whether it's a good idea to migrate environment variables first). @crazywoola

@crazywoola
Copy link
Member

Let me see.

@BorisPolonsky
Copy link
Contributor Author

BorisPolonsky commented Feb 5, 2025

Let me see.

We've located the source and issued a separate PR to resolve this. @crazywoola
#13221

@Yeuoly
Copy link
Collaborator

Yeuoly commented Feb 5, 2025

PLUGIN_API_URL is a little confusing, on daemon side, PLUGIN_API_URL can been considered as the endpoint of api service, but on api side, PLUGIN_API_URL looks like the endpoint of daemon service, and all the environments are placed at a single .env file , that's why we refactor it to PLUGIN_DAEMON_URL, I recommend just change them to PLUGIN_DAEMON_URL and PLUGIN_DAEMON_KEY

@BorisPolonsky
Copy link
Contributor Author

BorisPolonsky commented Feb 5, 2025

PLUGIN_API_URL is a little confused, on daemon side, PLUGIN_API_URL can been considered as the endpoint of api service, but on api side, PLUGIN_API_URL looks like the endpoint of daemon service, and all the environments are placed at a single .env file , that's why we refactor it to PLUGIN_DAEMON_URL, I recommend just change them to PLUGIN_DAEMON_URL and PLUGIN_DAEMON_KEY.

I'm with the idea that PLUGIN_API_URL is confusing. This PR is issued just to speed up the process of decision as we are currently working on dify-helm for 1.0.0 compatibility and wanted to avoid possible breaking change in the future. We could come up with a different PR that simply reverts PLUGIN_API_URL and PLUGIN_API_KEY that we introduced in #13055 as they don't take effects actually.

@Yeuoly
Copy link
Collaborator

Yeuoly commented Feb 5, 2025

PLUGIN_API_URL is a little confused, on daemon side, PLUGIN_API_URL can been considered as the endpoint of api service, but on api side, PLUGIN_API_URL looks like the endpoint of daemon service, and all the environments are placed at a single .env file , that's why we refactor it to PLUGIN_DAEMON_URL, I recommend just change them to PLUGIN_DAEMON_URL and PLUGIN_DAEMON_KEY.

I'm with the idea that PLUGIN_API_URL is confusing. This PR is issued just to speed up the process of decision as we are currently working on dify-helm for 1.0.0 compatibility and wanted to avoid possible breaking change in the future. We could come up with a different PR that simply reverts those to variables introduced in #13055 as they don't take effects actually.

PLUGIN_API_KEY could be reverted I think, we should unify them also in docker compose, and of course we should not bring breaking changes to helm

@Yeuoly
Copy link
Collaborator

Yeuoly commented Feb 5, 2025

You can rebase to plugins/beta to resolve the CI errors

@BorisPolonsky
Copy link
Contributor Author

BorisPolonsky commented Feb 5, 2025

You can rebase to plugins/beta to resolve the CI errors

Resolved linting error stated above. I've also issued another PR that unify environment variables as PLUGIN_DAEMON_URL and PLUGIN_DAEMON_KEY in #13239.

Yeuoly pushed a commit that referenced this pull request Feb 6, 2025
@Yeuoly
Copy link
Collaborator

Yeuoly commented Feb 6, 2025

Resolved #13239

@Yeuoly Yeuoly closed this Feb 6, 2025
@crazywoola crazywoola added this to the 1.0 milestone Feb 6, 2025
@BorisPolonsky BorisPolonsky deleted the feat-plugin-api-env branch February 6, 2025 04:02
@bowenliang123
Copy link
Contributor

Thumbs up for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 documentation Improvements or additions to documentation size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants