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

When upgrading the Docker container, it failed to connect to the database, resulting in a migration failure. #3234

Closed
4 tasks done
mwnu opened this issue Apr 9, 2024 · 3 comments
Assignees
Labels
🐞 bug Something isn't working

Comments

@mwnu
Copy link

mwnu commented Apr 9, 2024

Self Checks

  • This is only for bug report, if you would like to ask a quesion, 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).
  • Pleas do not modify this template :) and fill in all the required fields.

Dify version

0.6.0-fix1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I used the new docker-compose in version 0.6.0-fix1 and modified it, then executed:

docker-compose down
docker-compose pull
docker-compose -d

Due to incorrect internal network configuration in my docker, the api and worker applications failed to connect to the database services (postgresql, redis, and qdrant). Consequently, the database did not migrate automatically (strangely, everything on the frontend application worked normally, and there were no error messages in the logs).
Then I manually updated the tables in the database:

ALTER TABLE dataset_keyword_tables ADD COLUMN data_source_type VARCHAR(255) NOT NULL DEFAULT 'database';
ALTER TABLE embeddings ADD COLUMN provider_name VARCHAR(40) NOT NULL DEFAULT '';
ALTER TABLE embeddings DROP CONSTRAINT embedding_hash_idx;
ALTER TABLE embeddings ADD CONSTRAINT embedding_hash_idx UNIQUE (model_name, hash, provider_name);

Then executed "docker-compose -f exec api flask convert-to-agent-apps"
The result was:

Start convert to agent apps.
Congratulations! Converted 0 agent apps.

The discovery applications found on the homepage were all in English (although I had set the frontend to Chinese).
On another server, I successfully migrated automatically and executed "docker-compose -f exec api flask convert-to-agent-apps" to successfully convert agent apps, and the applications on the homepage were displayed in Chinese.

✔️ Expected Behavior

I don't know what other errors there might be, how can I fix this situation?

❌ Actual Behavior

There are no logs and no errors. Currently, it seems that only the homepage application is not displaying Chinese correctly, other errors are unknown.
image

Some log in the worker:
image
image

Copy link

dosubot bot commented Apr 9, 2024

Hey @mwnu! Great to see you back here. Seems like you've run into quite the puzzle this time around.

Based on the information you've provided, it seems like you've encountered a complex issue. Let's try to address each part of the problem.

Firstly, regarding the Docker container failing to connect to the database during the upgrade, it's possible that the network configuration in your docker-compose.yml file might need adjustments. Ensure that the services are on the same network and the hostnames match the service names. Also, check if the database services are ready to accept connections before the API and worker applications try to connect. You can use a wait-for script or a similar approach to manage this.

As for the manual database updates, the commands you've executed seem correct based on the schema changes in Dify v0.6.0-fix1. However, it's important to note that manual database updates should be a last resort, as they can lead to inconsistencies or missed updates compared to the automatic migration process.

The message "Congratulations! Converted 0 agent apps" suggests that there were no new agent apps to convert. If you expected some apps to be converted, it might be worth checking the conditions for conversion and whether your apps meet these conditions.

Regarding the language issue, the Dify frontend uses the language setting from the browser by default. If the browser's language is set to English, the frontend will display in English even if the server is set to Chinese. You can change the language setting in the browser to Chinese, or you can set the DEFAULT_LANGUAGE environment variable in the docker-compose.yml file to zh-Hans to force the frontend to use Chinese.

If the issue persists, it would be helpful to have more information. Could you please provide the logs from the Docker container, the docker-compose.yml file, and any error messages you see in the browser console? This will help in diagnosing the issue further.

For more information, you can refer to the Dockerfile and config.py in the Dify repository.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot dosubot bot added the 🐞 bug Something isn't working label Apr 9, 2024
@crazywoola
Copy link
Member

You can try to switch the language to English and switch it back to see the templates are correct.

@mwnu
Copy link
Author

mwnu commented Apr 9, 2024

You can try to switch the language to English and switch it back to see the templates are correct.

After switching the language, the app can now display Chinese. Thank you.

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

No branches or pull requests

3 participants