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

Flask : upgrade-db #11920

Open
5 tasks done
DarkNeedle opened this issue Dec 20, 2024 · 4 comments
Open
5 tasks done

Flask : upgrade-db #11920

DarkNeedle opened this issue Dec 20, 2024 · 4 comments
Labels
🐞 bug Something isn't working

Comments

@DarkNeedle
Copy link

DarkNeedle commented Dec 20, 2024

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

Current : Main

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

make build-all

docker-compose up

✔️ Expected Behavior

Expected the app to launch. This is some issue injected in the current GitHub source

❌ Actual Behavior

worker-1 | Usage: flask [OPTIONS] COMMAND [ARGS]...
worker-1 | Try 'flask --help' for help.
worker-1 |
worker-1 | Error: No such command 'upgrade-db'.
api-1 | Usage: flask [OPTIONS] COMMAND [ARGS]...
api-1 | Try 'flask --help' for help.
api-1 |
api-1 | Error: No such command 'upgrade-db'.

The actual fix is:

in api/docker/entrypoit.sh
Line 7: change to "flask db upgrade" (flask upgrade-db does not exist)

in .github/workflows/db-migration-test.yml
Line 55: change to "poetry run python -m flask db upgrade"

This seems to have been corrected in the README.md but did not make it in to the code

@dosubot dosubot bot added the 🐞 bug Something isn't working label Dec 20, 2024
Copy link

dosubot bot commented Dec 20, 2024

Hello, @DarkNeedle! I'm here to help you with any bugs, questions, or contributions while we wait for a human maintainer. Let's tackle this issue together!

The error message indicates that the upgrade-db command is not recognized by Flask in your current setup. This could be due to several reasons, such as the command being removed or not properly registered in the current version of the Dify codebase.

The upgrade-db command is intended to perform database migrations and is implemented in the Dify codebase using Flask-Migrate. It uses a Redis lock to ensure that migrations are not run concurrently [1].

Here are a few steps you can take to troubleshoot and resolve this issue:

  1. Check for Recent Changes: Verify if there have been any recent changes or commits in the Dify codebase that might have affected the availability of the upgrade-db command. This could include changes in the api/commands.py file where the command is defined.

  2. Ensure Proper Registration: Make sure that the command is properly registered in your Flask application. This typically involves ensuring that the module containing the command is imported and registered with the Flask app instance.

  3. Environment Configuration: Double-check your environment configuration to ensure that all necessary dependencies, such as Flask-Migrate and Redis, are correctly installed and configured.

  4. Review Documentation: Look for any documentation or comments in the codebase that might explain the removal or deprecation of the upgrade-db command.

If these steps do not resolve the issue, you may need to investigate further into the specific version of the Dify codebase you are using to identify any discrepancies or missing components related to the upgrade-db command.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@DarkNeedle
Copy link
Author

Refer to my original post, the code is wrong in the repo and needs to be updated per what I mentioned above

@crazywoola
Copy link
Member

Please feel free to open a pull request. I think the Makefile is contributed by the community. And we use Actions to build the image.

@kenwoodjw
Copy link
Contributor

Strange, I can't reproduce it anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants