MGFeng commited on
Commit
0272b43
·
verified ·
1 Parent(s): c0c85fc

Upload 81 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +2 -0
  2. .github/CODE_OF_CONDUCT.md +43 -0
  3. .github/DISCUSSION_TEMPLATE/general.yml +24 -0
  4. .github/DISCUSSION_TEMPLATE/help.yml +30 -0
  5. .github/DISCUSSION_TEMPLATE/suggestion.yml +37 -0
  6. .github/ISSUE_TEMPLATE/bug_report.yml +61 -0
  7. .github/ISSUE_TEMPLATE/config.yml +5 -0
  8. .github/ISSUE_TEMPLATE/document_issue.yml +24 -0
  9. .github/ISSUE_TEMPLATE/feature_request.yml +40 -0
  10. .github/ISSUE_TEMPLATE/translation_issue.yml +55 -0
  11. .github/linters/.hadolint.yaml +1 -0
  12. .github/linters/.isort.cfg +2 -0
  13. .github/linters/.yaml-lint.yml +11 -0
  14. .github/pull_request_template.md +34 -0
  15. .github/workflows/api-tests.yml +79 -0
  16. .github/workflows/build-push.yml +141 -0
  17. .github/workflows/db-migration-test.yml +62 -0
  18. .github/workflows/deploy-dev.yml +24 -0
  19. .github/workflows/expose_service_ports.sh +13 -0
  20. .github/workflows/stale.yml +30 -0
  21. .github/workflows/style.yml +125 -0
  22. .github/workflows/tool-test-sdks.yaml +41 -0
  23. .github/workflows/translate-i18n-base-on-english.yml +54 -0
  24. .github/workflows/vdb-tests.yml +75 -0
  25. .github/workflows/web-tests.yml +46 -0
  26. dev/pytest/pytest_all_tests.sh +14 -0
  27. dev/pytest/pytest_artifacts.sh +4 -0
  28. dev/pytest/pytest_model_runtime.sh +13 -0
  29. dev/pytest/pytest_tools.sh +4 -0
  30. dev/pytest/pytest_unit_tests.sh +5 -0
  31. dev/pytest/pytest_vdb.sh +16 -0
  32. dev/pytest/pytest_workflow.sh +4 -0
  33. dev/reformat +18 -0
  34. dev/sync-poetry +18 -0
  35. dev/update-poetry +13 -0
  36. docker-legacy/docker-compose.chroma.yaml +13 -0
  37. docker-legacy/docker-compose.middleware.yaml +109 -0
  38. docker-legacy/docker-compose.milvus.yaml +64 -0
  39. docker-legacy/docker-compose.opensearch.yml +40 -0
  40. docker-legacy/docker-compose.oracle.yaml +17 -0
  41. docker-legacy/docker-compose.pgvecto-rs.yaml +23 -0
  42. docker-legacy/docker-compose.pgvector.yaml +23 -0
  43. docker-legacy/docker-compose.png +0 -0
  44. docker-legacy/docker-compose.qdrant.yaml +12 -0
  45. docker-legacy/docker-compose.yaml +596 -0
  46. docker-legacy/nginx/conf.d/default.conf +38 -0
  47. docker-legacy/nginx/nginx.conf +32 -0
  48. docker-legacy/nginx/proxy.conf +8 -0
  49. docker-legacy/nginx/ssl/.gitkeep +1 -0
  50. docker-legacy/startupscripts/create_user.sql +5 -0
.gitattributes CHANGED
@@ -6,3 +6,5 @@
6
 
7
  *.sh text eol=lf
8
  web/app/signin/assets/background.png filter=lfs diff=lfs merge=lfs -text
 
 
 
6
 
7
  *.sh text eol=lf
8
  web/app/signin/assets/background.png filter=lfs diff=lfs merge=lfs -text
9
+ images/demo.png filter=lfs diff=lfs merge=lfs -text
10
+ images/wechat.png filter=lfs diff=lfs merge=lfs -text
.github/CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dify Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Language Policy
40
+
41
+ To facilitate clear and effective communication, all discussions, comments, documentation, and pull requests in this project should be conducted in English. This ensures that all contributors can participate and collaborate effectively.
42
+
43
+
.github/DISCUSSION_TEMPLATE/general.yml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ title: "General Discussion"
2
+ body:
3
+ - type: checkboxes
4
+ attributes:
5
+ label: Self Checks
6
+ description: "To make sure we get to you in time, please check the following :)"
7
+ options:
8
+ - label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
9
+ required: true
10
+ - label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
11
+ required: true
12
+ - label: "[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
13
+ required: true
14
+ - label: "Please do not modify this template :) and fill in all the required fields."
15
+ required: true
16
+ - type: textarea
17
+ attributes:
18
+ label: Content
19
+ placeholder: Please describe the content you would like to discuss.
20
+ validations:
21
+ required: true
22
+ - type: markdown
23
+ attributes:
24
+ value: Please limit one request per issue.
.github/DISCUSSION_TEMPLATE/help.yml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ title: "Help"
2
+ body:
3
+ - type: checkboxes
4
+ attributes:
5
+ label: Self Checks
6
+ description: "To make sure we get to you in time, please check the following :)"
7
+ options:
8
+ - label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
9
+ required: true
10
+ - label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
11
+ required: true
12
+ - label: "[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
13
+ required: true
14
+ - label: "Please do not modify this template :) and fill in all the required fields."
15
+ required: true
16
+ - type: textarea
17
+ attributes:
18
+ label: 1. Is this request related to a challenge you're experiencing? Tell me about your story.
19
+ placeholder: Please describe the specific scenario or problem you're facing as clearly as possible. For instance "I was trying to use [feature] for [specific task], and [what happened]... It was frustrating because...."
20
+ validations:
21
+ required: true
22
+ - type: textarea
23
+ attributes:
24
+ label: 2. Additional context or comments
25
+ placeholder: (Any other information, comments, documentations, links, or screenshots that would provide more clarity. This is the place to add anything else not covered above.)
26
+ validations:
27
+ required: false
28
+ - type: markdown
29
+ attributes:
30
+ value: Please limit one request per issue.
.github/DISCUSSION_TEMPLATE/suggestion.yml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ title: Suggestions for New Features
2
+ body:
3
+ - type: checkboxes
4
+ attributes:
5
+ label: Self Checks
6
+ description: "To make sure we get to you in time, please check the following :)"
7
+ options:
8
+ - label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
9
+ required: true
10
+ - label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
11
+ required: true
12
+ - label: "[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
13
+ required: true
14
+ - label: "Please do not modify this template :) and fill in all the required fields."
15
+ required: true
16
+ - type: textarea
17
+ attributes:
18
+ label: 1. Is this request related to a challenge you're experiencing? Tell me about your story.
19
+ placeholder: Please describe the specific scenario or problem you're facing as clearly as possible. For instance "I was trying to use [feature] for [specific task], and [what happened]... It was frustrating because...."
20
+ validations:
21
+ required: true
22
+ - type: textarea
23
+ attributes:
24
+ label: 2. Additional context or comments
25
+ placeholder: (Any other information, comments, documentations, links, or screenshots that would provide more clarity. This is the place to add anything else not covered above.)
26
+ validations:
27
+ required: false
28
+ - type: checkboxes
29
+ attributes:
30
+ label: 3. Can you help us with this feature?
31
+ description: Let us know! This is not a commitment, but a starting point for collaboration.
32
+ options:
33
+ - label: I am interested in contributing to this feature.
34
+ required: false
35
+ - type: markdown
36
+ attributes:
37
+ value: Please limit one request per issue.
.github/ISSUE_TEMPLATE/bug_report.yml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "🕷️ Bug report"
2
+ description: Report errors or unexpected behavior
3
+ labels:
4
+ - bug
5
+ body:
6
+ - type: checkboxes
7
+ attributes:
8
+ label: Self Checks
9
+ description: "To make sure we get to you in time, please check the following :)"
10
+ options:
11
+ - label: This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general).
12
+ required: true
13
+ - label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
14
+ required: true
15
+ - label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
16
+ required: true
17
+ - label: "[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
18
+ required: true
19
+ - label: "Please do not modify this template :) and fill in all the required fields."
20
+ required: true
21
+
22
+ - type: input
23
+ attributes:
24
+ label: Dify version
25
+ description: See about section in Dify console
26
+ validations:
27
+ required: true
28
+
29
+ - type: dropdown
30
+ attributes:
31
+ label: Cloud or Self Hosted
32
+ description: How / Where was Dify installed from?
33
+ multiple: true
34
+ options:
35
+ - Cloud
36
+ - Self Hosted (Docker)
37
+ - Self Hosted (Source)
38
+ validations:
39
+ required: true
40
+
41
+ - type: textarea
42
+ attributes:
43
+ label: Steps to reproduce
44
+ description: We highly suggest including screenshots and a bug report log. Please use the right markdown syntax for code blocks.
45
+ placeholder: Having detailed steps helps us reproduce the bug.
46
+ validations:
47
+ required: true
48
+
49
+ - type: textarea
50
+ attributes:
51
+ label: ✔️ Expected Behavior
52
+ placeholder: What were you expecting?
53
+ validations:
54
+ required: false
55
+
56
+ - type: textarea
57
+ attributes:
58
+ label: ❌ Actual Behavior
59
+ placeholder: What happened instead?
60
+ validations:
61
+ required: false
.github/ISSUE_TEMPLATE/config.yml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: "\U0001F4E7 Discussions"
4
+ url: https://github.com/langgenius/dify/discussions/categories/general
5
+ about: General discussions and request help from the community
.github/ISSUE_TEMPLATE/document_issue.yml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "📚 Documentation Issue"
2
+ description: Report issues in our documentation
3
+ labels:
4
+ - documentation
5
+ body:
6
+ - type: checkboxes
7
+ attributes:
8
+ label: Self Checks
9
+ description: "To make sure we get to you in time, please check the following :)"
10
+ options:
11
+ - label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
12
+ required: true
13
+ - label: I confirm that I am using English to submit report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
14
+ required: true
15
+ - label: "[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
16
+ required: true
17
+ - label: "Please do not modify this template :) and fill in all the required fields."
18
+ required: true
19
+ - type: textarea
20
+ attributes:
21
+ label: Provide a description of requested docs changes
22
+ placeholder: Briefly describe which document needs to be corrected and why.
23
+ validations:
24
+ required: true
.github/ISSUE_TEMPLATE/feature_request.yml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "⭐ Feature or enhancement request"
2
+ description: Propose something new.
3
+ labels:
4
+ - enhancement
5
+ body:
6
+ - type: checkboxes
7
+ attributes:
8
+ label: Self Checks
9
+ description: "To make sure we get to you in time, please check the following :)"
10
+ options:
11
+ - label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
12
+ required: true
13
+ - label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
14
+ required: true
15
+ - label: "[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
16
+ required: true
17
+ - label: "Please do not modify this template :) and fill in all the required fields."
18
+ required: true
19
+ - type: textarea
20
+ attributes:
21
+ label: 1. Is this request related to a challenge you're experiencing? Tell me about your story.
22
+ placeholder: Please describe the specific scenario or problem you're facing as clearly as possible. For instance "I was trying to use [feature] for [specific task], and [what happened]... It was frustrating because...."
23
+ validations:
24
+ required: true
25
+ - type: textarea
26
+ attributes:
27
+ label: 2. Additional context or comments
28
+ placeholder: (Any other information, comments, documentations, links, or screenshots that would provide more clarity. This is the place to add anything else not covered above.)
29
+ validations:
30
+ required: false
31
+ - type: checkboxes
32
+ attributes:
33
+ label: 3. Can you help us with this feature?
34
+ description: Let us know! This is not a commitment, but a starting point for collaboration.
35
+ options:
36
+ - label: I am interested in contributing to this feature.
37
+ required: false
38
+ - type: markdown
39
+ attributes:
40
+ value: Please limit one request per issue.
.github/ISSUE_TEMPLATE/translation_issue.yml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "🌐 Localization/Translation issue"
2
+ description: Report incorrect translations. [please use English :)]
3
+ labels:
4
+ - translation
5
+ body:
6
+ - type: checkboxes
7
+ attributes:
8
+ label: Self Checks
9
+ description: "To make sure we get to you in time, please check the following :)"
10
+ options:
11
+ - label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
12
+ required: true
13
+ - label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
14
+ required: true
15
+ - label: "[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
16
+ required: true
17
+ - label: "Please do not modify this template :) and fill in all the required fields."
18
+ required: true
19
+ - type: input
20
+ attributes:
21
+ label: Dify version
22
+ description: Hover over system tray icon or look at Settings
23
+ validations:
24
+ required: true
25
+ - type: input
26
+ attributes:
27
+ label: Utility with translation issue
28
+ placeholder: Some area
29
+ description: Please input here the utility with the translation issue
30
+ validations:
31
+ required: true
32
+ - type: input
33
+ attributes:
34
+ label: 🌐 Language affected
35
+ placeholder: "German"
36
+ validations:
37
+ required: true
38
+ - type: textarea
39
+ attributes:
40
+ label: ❌ Actual phrase(s)
41
+ placeholder: What is there? Please include a screenshot as that is extremely helpful.
42
+ validations:
43
+ required: true
44
+ - type: textarea
45
+ attributes:
46
+ label: ✔️ Expected phrase(s)
47
+ placeholder: What was expected?
48
+ validations:
49
+ required: true
50
+ - type: textarea
51
+ attributes:
52
+ label: ℹ Why is the current translation wrong
53
+ placeholder: Why do you feel this is incorrect?
54
+ validations:
55
+ required: true
.github/linters/.hadolint.yaml ADDED
@@ -0,0 +1 @@
 
 
1
+ failure-threshold: "error"
.github/linters/.isort.cfg ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [settings]
2
+ line_length=120
.github/linters/.yaml-lint.yml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+
3
+ extends: default
4
+
5
+ rules:
6
+ brackets:
7
+ max-spaces-inside: 1
8
+ comments-indentation: disable
9
+ document-start: disable
10
+ line-length: disable
11
+ truthy: disable
.github/pull_request_template.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Checklist:
2
+
3
+ > [!IMPORTANT]
4
+ > Please review the checklist below before submitting your pull request.
5
+
6
+ - [ ] Please open an issue before creating a PR or link to an existing issue
7
+ - [ ] I have performed a self-review of my own code
8
+ - [ ] I have commented my code, particularly in hard-to-understand areas
9
+ - [ ] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
10
+
11
+ # Description
12
+
13
+ Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue. Close issue syntax: `Fixes #<issue number>`, see [documentation](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) for more details.
14
+
15
+ Fixes
16
+
17
+ ## Type of Change
18
+
19
+ - [ ] Bug fix (non-breaking change which fixes an issue)
20
+ - [ ] New feature (non-breaking change which adds functionality)
21
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
22
+ - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs)
23
+ - [ ] Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
24
+ - [ ] Dependency upgrade
25
+
26
+ # Testing Instructions
27
+
28
+ Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
29
+
30
+ - [ ] Test A
31
+ - [ ] Test B
32
+
33
+
34
+
.github/workflows/api-tests.yml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Run Pytest
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - api/**
9
+ - docker/**
10
+ - .github/workflows/api-tests.yml
11
+
12
+ concurrency:
13
+ group: api-tests-${{ github.head_ref || github.run_id }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ test:
18
+ name: API Tests
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ python-version:
23
+ - "3.10"
24
+ - "3.11"
25
+ - "3.12"
26
+
27
+ steps:
28
+ - name: Checkout code
29
+ uses: actions/checkout@v4
30
+
31
+ - name: Install Poetry
32
+ uses: abatilo/actions-poetry@v3
33
+
34
+ - name: Set up Python ${{ matrix.python-version }}
35
+ uses: actions/setup-python@v5
36
+ with:
37
+ python-version: ${{ matrix.python-version }}
38
+ cache: poetry
39
+ cache-dependency-path: api/poetry.lock
40
+
41
+ - name: Check Poetry lockfile
42
+ run: |
43
+ poetry check -C api --lock
44
+ poetry show -C api
45
+
46
+ - name: Install dependencies
47
+ run: poetry install -C api --with dev
48
+
49
+ - name: Check dependencies in pyproject.toml
50
+ run: poetry run -C api bash dev/pytest/pytest_artifacts.sh
51
+
52
+ - name: Run Unit tests
53
+ run: poetry run -C api bash dev/pytest/pytest_unit_tests.sh
54
+
55
+ - name: Run ModelRuntime
56
+ run: poetry run -C api bash dev/pytest/pytest_model_runtime.sh
57
+
58
+ - name: Run Tool
59
+ run: poetry run -C api bash dev/pytest/pytest_tools.sh
60
+
61
+ - name: Set up dotenvs
62
+ run: |
63
+ cp docker/.env.example docker/.env
64
+ cp docker/middleware.env.example docker/middleware.env
65
+
66
+ - name: Expose Service Ports
67
+ run: sh .github/workflows/expose_service_ports.sh
68
+
69
+ - name: Set up Sandbox
70
+ uses: hoverkraft-tech/compose-action@v2.0.2
71
+ with:
72
+ compose-file: |
73
+ docker/docker-compose.middleware.yaml
74
+ services: |
75
+ sandbox
76
+ ssrf_proxy
77
+
78
+ - name: Run Workflow
79
+ run: poetry run -C api bash dev/pytest/pytest_workflow.sh
.github/workflows/build-push.yml ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build and Push API & Web
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - "main"
7
+ - "deploy/dev"
8
+ release:
9
+ types: [published]
10
+
11
+ concurrency:
12
+ group: build-push-${{ github.head_ref || github.run_id }}
13
+ cancel-in-progress: true
14
+
15
+ env:
16
+ DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
17
+ DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
18
+ DIFY_WEB_IMAGE_NAME: ${{ vars.DIFY_WEB_IMAGE_NAME || 'langgenius/dify-web' }}
19
+ DIFY_API_IMAGE_NAME: ${{ vars.DIFY_API_IMAGE_NAME || 'langgenius/dify-api' }}
20
+
21
+ jobs:
22
+ build:
23
+ runs-on: ${{ matrix.platform == 'linux/arm64' && 'arm64_runner' || 'ubuntu-latest' }}
24
+ if: github.repository == 'langgenius/dify'
25
+ strategy:
26
+ matrix:
27
+ include:
28
+ - service_name: "build-api-amd64"
29
+ image_name_env: "DIFY_API_IMAGE_NAME"
30
+ context: "api"
31
+ platform: linux/amd64
32
+ - service_name: "build-api-arm64"
33
+ image_name_env: "DIFY_API_IMAGE_NAME"
34
+ context: "api"
35
+ platform: linux/arm64
36
+ - service_name: "build-web-amd64"
37
+ image_name_env: "DIFY_WEB_IMAGE_NAME"
38
+ context: "web"
39
+ platform: linux/amd64
40
+ - service_name: "build-web-arm64"
41
+ image_name_env: "DIFY_WEB_IMAGE_NAME"
42
+ context: "web"
43
+ platform: linux/arm64
44
+
45
+ steps:
46
+ - name: Prepare
47
+ run: |
48
+ platform=${{ matrix.platform }}
49
+ echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
50
+
51
+ - name: Login to Docker Hub
52
+ uses: docker/login-action@v3
53
+ with:
54
+ username: ${{ env.DOCKERHUB_USER }}
55
+ password: ${{ env.DOCKERHUB_TOKEN }}
56
+
57
+ - name: Set up QEMU
58
+ uses: docker/setup-qemu-action@v3
59
+
60
+ - name: Set up Docker Buildx
61
+ uses: docker/setup-buildx-action@v3
62
+
63
+ - name: Extract metadata for Docker
64
+ id: meta
65
+ uses: docker/metadata-action@v5
66
+ with:
67
+ images: ${{ env[matrix.image_name_env] }}
68
+
69
+ - name: Build Docker image
70
+ id: build
71
+ uses: docker/build-push-action@v6
72
+ with:
73
+ context: "{{defaultContext}}:${{ matrix.context }}"
74
+ platforms: ${{ matrix.platform }}
75
+ build-args: COMMIT_SHA=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
76
+ labels: ${{ steps.meta.outputs.labels }}
77
+ outputs: type=image,name=${{ env[matrix.image_name_env] }},push-by-digest=true,name-canonical=true,push=true
78
+ cache-from: type=gha,scope=${{ matrix.service_name }}
79
+ cache-to: type=gha,mode=max,scope=${{ matrix.service_name }}
80
+
81
+ - name: Export digest
82
+ run: |
83
+ mkdir -p /tmp/digests
84
+ digest="${{ steps.build.outputs.digest }}"
85
+ touch "/tmp/digests/${digest#sha256:}"
86
+
87
+ - name: Upload digest
88
+ uses: actions/upload-artifact@v4
89
+ with:
90
+ name: digests-${{ matrix.context }}-${{ env.PLATFORM_PAIR }}
91
+ path: /tmp/digests/*
92
+ if-no-files-found: error
93
+ retention-days: 1
94
+
95
+ create-manifest:
96
+ needs: build
97
+ runs-on: ubuntu-latest
98
+ if: github.repository == 'langgenius/dify'
99
+ strategy:
100
+ matrix:
101
+ include:
102
+ - service_name: "merge-api-images"
103
+ image_name_env: "DIFY_API_IMAGE_NAME"
104
+ context: "api"
105
+ - service_name: "merge-web-images"
106
+ image_name_env: "DIFY_WEB_IMAGE_NAME"
107
+ context: "web"
108
+ steps:
109
+ - name: Download digests
110
+ uses: actions/download-artifact@v4
111
+ with:
112
+ path: /tmp/digests
113
+ pattern: digests-${{ matrix.context }}-*
114
+ merge-multiple: true
115
+
116
+ - name: Login to Docker Hub
117
+ uses: docker/login-action@v3
118
+ with:
119
+ username: ${{ env.DOCKERHUB_USER }}
120
+ password: ${{ env.DOCKERHUB_TOKEN }}
121
+
122
+ - name: Extract metadata for Docker
123
+ id: meta
124
+ uses: docker/metadata-action@v5
125
+ with:
126
+ images: ${{ env[matrix.image_name_env] }}
127
+ tags: |
128
+ type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-') }}
129
+ type=ref,event=branch
130
+ type=sha,enable=true,priority=100,prefix=,suffix=,format=long
131
+ type=raw,value=${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') }}
132
+
133
+ - name: Create manifest list and push
134
+ working-directory: /tmp/digests
135
+ run: |
136
+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
137
+ $(printf '${{ env[matrix.image_name_env] }}@sha256:%s ' *)
138
+
139
+ - name: Inspect image
140
+ run: |
141
+ docker buildx imagetools inspect ${{ env[matrix.image_name_env] }}:${{ steps.meta.outputs.version }}
.github/workflows/db-migration-test.yml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: DB Migration Test
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - api/migrations/**
9
+
10
+ concurrency:
11
+ group: db-migration-test-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ jobs:
15
+ db-migration-test:
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ matrix:
19
+ python-version:
20
+ - "3.10"
21
+
22
+ steps:
23
+ - name: Checkout code
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Set up Python ${{ matrix.python-version }}
27
+ uses: actions/setup-python@v5
28
+ with:
29
+ python-version: ${{ matrix.python-version }}
30
+ cache-dependency-path: |
31
+ api/pyproject.toml
32
+ api/poetry.lock
33
+
34
+ - name: Install Poetry
35
+ uses: abatilo/actions-poetry@v3
36
+
37
+ - name: Install dependencies
38
+ run: poetry install -C api
39
+
40
+ - name: Prepare middleware env
41
+ run: |
42
+ cd docker
43
+ cp middleware.env.example middleware.env
44
+
45
+ - name: Set up Middlewares
46
+ uses: hoverkraft-tech/compose-action@v2.0.2
47
+ with:
48
+ compose-file: |
49
+ docker/docker-compose.middleware.yaml
50
+ services: |
51
+ db
52
+ redis
53
+
54
+ - name: Prepare configs
55
+ run: |
56
+ cd api
57
+ cp .env.example .env
58
+
59
+ - name: Run DB Migration
60
+ run: |
61
+ cd api
62
+ poetry run python -m flask upgrade-db
.github/workflows/deploy-dev.yml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Deploy Dev
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: ["Build and Push API & Web"]
6
+ branches:
7
+ - "deploy/dev"
8
+ types:
9
+ - completed
10
+
11
+ jobs:
12
+ deploy:
13
+ runs-on: ubuntu-latest
14
+ if: |
15
+ github.event.workflow_run.conclusion == 'success'
16
+ steps:
17
+ - name: Deploy to server
18
+ uses: appleboy/ssh-action@v0.1.8
19
+ with:
20
+ host: ${{ secrets.SSH_HOST }}
21
+ username: ${{ secrets.SSH_USER }}
22
+ key: ${{ secrets.SSH_PRIVATE_KEY }}
23
+ script: |
24
+ ${{ vars.SSH_SCRIPT || secrets.SSH_SCRIPT }}
.github/workflows/expose_service_ports.sh ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ yq eval '.services.weaviate.ports += ["8080:8080"]' -i docker/docker-compose.yaml
4
+ yq eval '.services.qdrant.ports += ["6333:6333"]' -i docker/docker-compose.yaml
5
+ yq eval '.services.chroma.ports += ["8000:8000"]' -i docker/docker-compose.yaml
6
+ yq eval '.services["milvus-standalone"].ports += ["19530:19530"]' -i docker/docker-compose.yaml
7
+ yq eval '.services.pgvector.ports += ["5433:5432"]' -i docker/docker-compose.yaml
8
+ yq eval '.services["pgvecto-rs"].ports += ["5431:5432"]' -i docker/docker-compose.yaml
9
+ yq eval '.services["elasticsearch"].ports += ["9200:9200"]' -i docker/docker-compose.yaml
10
+ yq eval '.services.couchbase-server.ports += ["8091-8096:8091-8096"]' -i docker/docker-compose.yaml
11
+ yq eval '.services.couchbase-server.ports += ["11210:11210"]' -i docker/docker-compose.yaml
12
+
13
+ echo "Ports exposed for sandbox, weaviate, qdrant, chroma, milvus, pgvector, pgvecto-rs, elasticsearch, couchbase"
.github/workflows/stale.yml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
2
+ #
3
+ # You can adjust the behavior by modifying this file.
4
+ # For more information, see:
5
+ # https://github.com/actions/stale
6
+ name: Mark stale issues and pull requests
7
+
8
+ on:
9
+ schedule:
10
+ - cron: '0 3 * * *'
11
+
12
+ jobs:
13
+ stale:
14
+
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ issues: write
18
+ pull-requests: write
19
+
20
+ steps:
21
+ - uses: actions/stale@v5
22
+ with:
23
+ days-before-issue-stale: 15
24
+ days-before-issue-close: 3
25
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
26
+ stale-issue-message: "Close due to it's no longer active, if you have any questions, you can reopen it."
27
+ stale-pr-message: "Close due to it's no longer active, if you have any questions, you can reopen it."
28
+ stale-issue-label: 'no-issue-activity'
29
+ stale-pr-label: 'no-pr-activity'
30
+ any-of-labels: 'duplicate,question,invalid,wontfix,no-issue-activity,no-pr-activity,enhancement,cant-reproduce,help-wanted'
.github/workflows/style.yml ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Style check
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ concurrency:
9
+ group: style-${{ github.head_ref || github.run_id }}
10
+ cancel-in-progress: true
11
+
12
+ jobs:
13
+ python-style:
14
+ name: Python Style
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Check changed files
22
+ id: changed-files
23
+ uses: tj-actions/changed-files@v45
24
+ with:
25
+ files: api/**
26
+
27
+ - name: Install Poetry
28
+ if: steps.changed-files.outputs.any_changed == 'true'
29
+ uses: abatilo/actions-poetry@v3
30
+
31
+ - name: Set up Python
32
+ uses: actions/setup-python@v5
33
+ if: steps.changed-files.outputs.any_changed == 'true'
34
+ with:
35
+ python-version: '3.10'
36
+
37
+ - name: Python dependencies
38
+ if: steps.changed-files.outputs.any_changed == 'true'
39
+ run: poetry install -C api --only lint
40
+
41
+ - name: Ruff check
42
+ if: steps.changed-files.outputs.any_changed == 'true'
43
+ run: poetry run -C api ruff check ./api
44
+
45
+ - name: Dotenv check
46
+ if: steps.changed-files.outputs.any_changed == 'true'
47
+ run: poetry run -C api dotenv-linter ./api/.env.example ./web/.env.example
48
+
49
+ - name: Ruff formatter check
50
+ if: steps.changed-files.outputs.any_changed == 'true'
51
+ run: poetry run -C api ruff format --check ./api
52
+
53
+ - name: Lint hints
54
+ if: failure()
55
+ run: echo "Please run 'dev/reformat' to fix the fixable linting errors."
56
+
57
+ web-style:
58
+ name: Web Style
59
+ runs-on: ubuntu-latest
60
+ defaults:
61
+ run:
62
+ working-directory: ./web
63
+
64
+ steps:
65
+ - name: Checkout code
66
+ uses: actions/checkout@v4
67
+
68
+ - name: Check changed files
69
+ id: changed-files
70
+ uses: tj-actions/changed-files@v45
71
+ with:
72
+ files: web/**
73
+
74
+ - name: Setup NodeJS
75
+ uses: actions/setup-node@v4
76
+ if: steps.changed-files.outputs.any_changed == 'true'
77
+ with:
78
+ node-version: 20
79
+ cache: yarn
80
+ cache-dependency-path: ./web/package.json
81
+
82
+ - name: Web dependencies
83
+ if: steps.changed-files.outputs.any_changed == 'true'
84
+ run: yarn install --frozen-lockfile
85
+
86
+ - name: Web style check
87
+ if: steps.changed-files.outputs.any_changed == 'true'
88
+ run: yarn run lint
89
+
90
+
91
+ superlinter:
92
+ name: SuperLinter
93
+ runs-on: ubuntu-latest
94
+
95
+ steps:
96
+ - name: Checkout code
97
+ uses: actions/checkout@v4
98
+
99
+ - name: Check changed files
100
+ id: changed-files
101
+ uses: tj-actions/changed-files@v45
102
+ with:
103
+ files: |
104
+ **.sh
105
+ **.yaml
106
+ **.yml
107
+ **Dockerfile
108
+ dev/**
109
+
110
+ - name: Super-linter
111
+ uses: super-linter/super-linter/slim@v7
112
+ if: steps.changed-files.outputs.any_changed == 'true'
113
+ env:
114
+ BASH_SEVERITY: warning
115
+ DEFAULT_BRANCH: main
116
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117
+ IGNORE_GENERATED_FILES: true
118
+ IGNORE_GITIGNORED_FILES: true
119
+ VALIDATE_BASH: true
120
+ VALIDATE_BASH_EXEC: true
121
+ # FIXME: temporarily disabled until api-docker.yaml's run script is fixed for shellcheck
122
+ # VALIDATE_GITHUB_ACTIONS: true
123
+ VALIDATE_DOCKERFILE_HADOLINT: true
124
+ VALIDATE_XML: true
125
+ VALIDATE_YAML: true
.github/workflows/tool-test-sdks.yaml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Run Unit Test For SDKs
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - sdks/**
9
+
10
+ concurrency:
11
+ group: sdk-tests-${{ github.head_ref || github.run_id }}
12
+ cancel-in-progress: true
13
+
14
+ jobs:
15
+ build:
16
+ name: unit test for Node.js SDK
17
+ runs-on: ubuntu-latest
18
+
19
+ strategy:
20
+ matrix:
21
+ node-version: [16, 18, 20]
22
+
23
+ defaults:
24
+ run:
25
+ working-directory: sdks/nodejs-client
26
+
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+
30
+ - name: Use Node.js ${{ matrix.node-version }}
31
+ uses: actions/setup-node@v4
32
+ with:
33
+ node-version: ${{ matrix.node-version }}
34
+ cache: ''
35
+ cache-dependency-path: 'yarn.lock'
36
+
37
+ - name: Install Dependencies
38
+ run: yarn install
39
+
40
+ - name: Test
41
+ run: yarn test
.github/workflows/translate-i18n-base-on-english.yml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Check i18n Files and Create PR
2
+
3
+ on:
4
+ pull_request:
5
+ types: [closed]
6
+ branches: [main]
7
+
8
+ jobs:
9
+ check-and-update:
10
+ if: github.event.pull_request.merged == true
11
+ runs-on: ubuntu-latest
12
+ defaults:
13
+ run:
14
+ working-directory: web
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ with:
18
+ fetch-depth: 2 # last 2 commits
19
+
20
+ - name: Check for file changes in i18n/en-US
21
+ id: check_files
22
+ run: |
23
+ recent_commit_sha=$(git rev-parse HEAD)
24
+ second_recent_commit_sha=$(git rev-parse HEAD~1)
25
+ changed_files=$(git diff --name-only $recent_commit_sha $second_recent_commit_sha -- 'i18n/en-US/*.ts')
26
+ echo "Changed files: $changed_files"
27
+ if [ -n "$changed_files" ]; then
28
+ echo "FILES_CHANGED=true" >> $GITHUB_ENV
29
+ else
30
+ echo "FILES_CHANGED=false" >> $GITHUB_ENV
31
+ fi
32
+
33
+ - name: Set up Node.js
34
+ if: env.FILES_CHANGED == 'true'
35
+ uses: actions/setup-node@v2
36
+ with:
37
+ node-version: 'lts/*'
38
+
39
+ - name: Install dependencies
40
+ if: env.FILES_CHANGED == 'true'
41
+ run: yarn install --frozen-lockfile
42
+
43
+ - name: Run npm script
44
+ if: env.FILES_CHANGED == 'true'
45
+ run: npm run auto-gen-i18n
46
+
47
+ - name: Create Pull Request
48
+ if: env.FILES_CHANGED == 'true'
49
+ uses: peter-evans/create-pull-request@v6
50
+ with:
51
+ commit-message: Update i18n files based on en-US changes
52
+ title: 'chore: translate i18n files'
53
+ body: This PR was automatically created to update i18n files based on changes in en-US locale.
54
+ branch: chore/automated-i18n-updates
.github/workflows/vdb-tests.yml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Run VDB Tests
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - api/core/rag/datasource/**
9
+ - docker/**
10
+ - .github/workflows/vdb-tests.yml
11
+
12
+ concurrency:
13
+ group: vdb-tests-${{ github.head_ref || github.run_id }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ test:
18
+ name: VDB Tests
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ python-version:
23
+ - "3.10"
24
+ - "3.11"
25
+ - "3.12"
26
+
27
+ steps:
28
+ - name: Checkout code
29
+ uses: actions/checkout@v4
30
+
31
+ - name: Install Poetry
32
+ uses: abatilo/actions-poetry@v3
33
+
34
+ - name: Set up Python ${{ matrix.python-version }}
35
+ uses: actions/setup-python@v5
36
+ with:
37
+ python-version: ${{ matrix.python-version }}
38
+ cache: poetry
39
+ cache-dependency-path: api/poetry.lock
40
+
41
+ - name: Check Poetry lockfile
42
+ run: |
43
+ poetry check -C api --lock
44
+ poetry show -C api
45
+
46
+ - name: Install dependencies
47
+ run: poetry install -C api --with dev
48
+
49
+ - name: Set up dotenvs
50
+ run: |
51
+ cp docker/.env.example docker/.env
52
+ cp docker/middleware.env.example docker/middleware.env
53
+
54
+ - name: Expose Service Ports
55
+ run: sh .github/workflows/expose_service_ports.sh
56
+
57
+ - name: Set up Vector Stores (Weaviate, Qdrant, PGVector, Milvus, PgVecto-RS, Chroma, MyScale, ElasticSearch, Couchbase)
58
+ uses: hoverkraft-tech/compose-action@v2.0.2
59
+ with:
60
+ compose-file: |
61
+ docker/docker-compose.yaml
62
+ services: |
63
+ weaviate
64
+ qdrant
65
+ couchbase-server
66
+ etcd
67
+ minio
68
+ milvus-standalone
69
+ pgvecto-rs
70
+ pgvector
71
+ chroma
72
+ elasticsearch
73
+
74
+ - name: Test Vector Stores
75
+ run: poetry run -C api bash dev/pytest/pytest_vdb.sh
.github/workflows/web-tests.yml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Web Tests
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - web/**
9
+
10
+ concurrency:
11
+ group: web-tests-${{ github.head_ref || github.run_id }}
12
+ cancel-in-progress: true
13
+
14
+ jobs:
15
+ test:
16
+ name: Web Tests
17
+ runs-on: ubuntu-latest
18
+ defaults:
19
+ run:
20
+ working-directory: ./web
21
+
22
+ steps:
23
+ - name: Checkout code
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Check changed files
27
+ id: changed-files
28
+ uses: tj-actions/changed-files@v45
29
+ with:
30
+ files: web/**
31
+
32
+ - name: Setup Node.js
33
+ uses: actions/setup-node@v4
34
+ if: steps.changed-files.outputs.any_changed == 'true'
35
+ with:
36
+ node-version: 20
37
+ cache: yarn
38
+ cache-dependency-path: ./web/package.json
39
+
40
+ - name: Install dependencies
41
+ if: steps.changed-files.outputs.any_changed == 'true'
42
+ run: yarn install --frozen-lockfile
43
+
44
+ - name: Run tests
45
+ if: steps.changed-files.outputs.any_changed == 'true'
46
+ run: yarn test
dev/pytest/pytest_all_tests.sh ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -x
3
+
4
+ # ModelRuntime
5
+ dev/pytest/pytest_model_runtime.sh
6
+
7
+ # Tools
8
+ dev/pytest/pytest_tools.sh
9
+
10
+ # Workflow
11
+ dev/pytest/pytest_workflow.sh
12
+
13
+ # Unit tests
14
+ dev/pytest/pytest_unit_tests.sh
dev/pytest/pytest_artifacts.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -x
3
+
4
+ pytest api/tests/artifact_tests/
dev/pytest/pytest_model_runtime.sh ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -x
3
+
4
+ pytest api/tests/integration_tests/model_runtime/anthropic \
5
+ api/tests/integration_tests/model_runtime/azure_openai \
6
+ api/tests/integration_tests/model_runtime/openai api/tests/integration_tests/model_runtime/chatglm \
7
+ api/tests/integration_tests/model_runtime/google api/tests/integration_tests/model_runtime/xinference \
8
+ api/tests/integration_tests/model_runtime/huggingface_hub/test_llm.py \
9
+ api/tests/integration_tests/model_runtime/upstage \
10
+ api/tests/integration_tests/model_runtime/fireworks \
11
+ api/tests/integration_tests/model_runtime/nomic \
12
+ api/tests/integration_tests/model_runtime/mixedbread \
13
+ api/tests/integration_tests/model_runtime/voyage
dev/pytest/pytest_tools.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -x
3
+
4
+ pytest api/tests/integration_tests/tools/test_all_provider.py
dev/pytest/pytest_unit_tests.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -x
3
+
4
+ # libs
5
+ pytest api/tests/unit_tests
dev/pytest/pytest_vdb.sh ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -x
3
+
4
+ pytest api/tests/integration_tests/vdb/chroma \
5
+ api/tests/integration_tests/vdb/milvus \
6
+ api/tests/integration_tests/vdb/pgvecto_rs \
7
+ api/tests/integration_tests/vdb/pgvector \
8
+ api/tests/integration_tests/vdb/qdrant \
9
+ api/tests/integration_tests/vdb/weaviate \
10
+ api/tests/integration_tests/vdb/elasticsearch \
11
+ api/tests/integration_tests/vdb/vikingdb \
12
+ api/tests/integration_tests/vdb/baidu \
13
+ api/tests/integration_tests/vdb/tcvectordb \
14
+ api/tests/integration_tests/vdb/upstash \
15
+ api/tests/integration_tests/vdb/couchbase \
16
+ api/tests/integration_tests/vdb/oceanbase \
dev/pytest/pytest_workflow.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -x
3
+
4
+ pytest api/tests/integration_tests/workflow
dev/reformat ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ set -x
4
+
5
+ # style checks rely on commands in path
6
+ if ! command -v ruff &> /dev/null || ! command -v dotenv-linter &> /dev/null; then
7
+ echo "Installing linting tools (Ruff, dotenv-linter ...) ..."
8
+ poetry install -C api --only lint
9
+ fi
10
+
11
+ # run ruff linter
12
+ poetry run -C api ruff check --fix ./api
13
+
14
+ # run ruff formatter
15
+ poetry run -C api ruff format ./api
16
+
17
+ # run dotenv-linter linter
18
+ poetry run -C api dotenv-linter ./api/.env.example ./web/.env.example
dev/sync-poetry ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # rely on `poetry` in path
4
+ if ! command -v poetry &> /dev/null; then
5
+ echo "Installing Poetry ..."
6
+ pip install poetry
7
+ fi
8
+
9
+ # check poetry.lock in sync with pyproject.toml
10
+ poetry check -C api --lock
11
+ if [ $? -ne 0 ]; then
12
+ # update poetry.lock
13
+ # refreshing lockfile only without updating locked versions
14
+ echo "poetry.lock is outdated, refreshing without updating locked versions ..."
15
+ poetry lock -C api --no-update
16
+ else
17
+ echo "poetry.lock is ready."
18
+ fi
dev/update-poetry ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # rely on `poetry` in path
4
+ if ! command -v poetry &> /dev/null; then
5
+ echo "Installing Poetry ..."
6
+ pip install poetry
7
+ fi
8
+
9
+ # refreshing lockfile, updating locked versions
10
+ poetry update -C api
11
+
12
+ # check poetry.lock in sync with pyproject.toml
13
+ poetry check -C api --lock
docker-legacy/docker-compose.chroma.yaml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ # Chroma vector store.
3
+ chroma:
4
+ image: ghcr.io/chroma-core/chroma:0.5.1
5
+ restart: always
6
+ volumes:
7
+ - ./volumes/chroma:/chroma/chroma
8
+ environment:
9
+ CHROMA_SERVER_AUTHN_CREDENTIALS: difyai123456
10
+ CHROMA_SERVER_AUTHN_PROVIDER: chromadb.auth.token_authn.TokenAuthenticationServerProvider
11
+ IS_PERSISTENT: TRUE
12
+ ports:
13
+ - "8000:8000"
docker-legacy/docker-compose.middleware.yaml ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3'
2
+ services:
3
+ # The postgres database.
4
+ db:
5
+ image: postgres:15-alpine
6
+ restart: always
7
+ environment:
8
+ # The password for the default postgres user.
9
+ POSTGRES_PASSWORD: difyai123456
10
+ # The name of the default postgres database.
11
+ POSTGRES_DB: dify
12
+ # postgres data directory
13
+ PGDATA: /var/lib/postgresql/data/pgdata
14
+ volumes:
15
+ - ./volumes/db/data:/var/lib/postgresql/data
16
+ ports:
17
+ - "5432:5432"
18
+
19
+ # The redis cache.
20
+ redis:
21
+ image: redis:6-alpine
22
+ restart: always
23
+ volumes:
24
+ # Mount the redis data directory to the container.
25
+ - ./volumes/redis/data:/data
26
+ # Set the redis password when startup redis server.
27
+ command: redis-server --requirepass difyai123456
28
+ ports:
29
+ - "6379:6379"
30
+
31
+ # The Weaviate vector store.
32
+ weaviate:
33
+ image: semitechnologies/weaviate:1.19.0
34
+ restart: always
35
+ volumes:
36
+ # Mount the Weaviate data directory to the container.
37
+ - ./volumes/weaviate:/var/lib/weaviate
38
+ environment:
39
+ # The Weaviate configurations
40
+ # You can refer to the [Weaviate](https://weaviate.io/developers/weaviate/config-refs/env-vars) documentation for more information.
41
+ QUERY_DEFAULTS_LIMIT: 25
42
+ AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'false'
43
+ PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
44
+ DEFAULT_VECTORIZER_MODULE: 'none'
45
+ CLUSTER_HOSTNAME: 'node1'
46
+ AUTHENTICATION_APIKEY_ENABLED: 'true'
47
+ AUTHENTICATION_APIKEY_ALLOWED_KEYS: 'WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih'
48
+ AUTHENTICATION_APIKEY_USERS: 'hello@dify.ai'
49
+ AUTHORIZATION_ADMINLIST_ENABLED: 'true'
50
+ AUTHORIZATION_ADMINLIST_USERS: 'hello@dify.ai'
51
+ ports:
52
+ - "8080:8080"
53
+
54
+ # The DifySandbox
55
+ sandbox:
56
+ image: langgenius/dify-sandbox:0.2.1
57
+ restart: always
58
+ environment:
59
+ # The DifySandbox configurations
60
+ # Make sure you are changing this key for your deployment with a strong key.
61
+ # You can generate a strong key using `openssl rand -base64 42`.
62
+ API_KEY: dify-sandbox
63
+ GIN_MODE: 'release'
64
+ WORKER_TIMEOUT: 15
65
+ ENABLE_NETWORK: 'true'
66
+ HTTP_PROXY: 'http://ssrf_proxy:3128'
67
+ HTTPS_PROXY: 'http://ssrf_proxy:3128'
68
+ SANDBOX_PORT: 8194
69
+ volumes:
70
+ - ./volumes/sandbox/dependencies:/dependencies
71
+ networks:
72
+ - ssrf_proxy_network
73
+
74
+ # ssrf_proxy server
75
+ # for more information, please refer to
76
+ # https://docs.dify.ai/learn-more/faq/install-faq#id-18.-why-is-ssrf_proxy-needed
77
+ ssrf_proxy:
78
+ image: ubuntu/squid:latest
79
+ restart: always
80
+ ports:
81
+ - "3128:3128"
82
+ - "8194:8194"
83
+ volumes:
84
+ # pls clearly modify the squid.conf file to fit your network environment.
85
+ - ./volumes/ssrf_proxy/squid.conf:/etc/squid/squid.conf
86
+ networks:
87
+ - ssrf_proxy_network
88
+ - default
89
+ # Qdrant vector store.
90
+ # uncomment to use qdrant as vector store.
91
+ # (if uncommented, you need to comment out the weaviate service above,
92
+ # and set VECTOR_STORE to qdrant in the api & worker service.)
93
+ # qdrant:
94
+ # image: qdrant/qdrant:1.7.3
95
+ # restart: always
96
+ # volumes:
97
+ # - ./volumes/qdrant:/qdrant/storage
98
+ # environment:
99
+ # QDRANT_API_KEY: 'difyai123456'
100
+ # ports:
101
+ # - "6333:6333"
102
+ # - "6334:6334"
103
+
104
+
105
+ networks:
106
+ # create a network between sandbox, api and ssrf_proxy, and can not access outside.
107
+ ssrf_proxy_network:
108
+ driver: bridge
109
+ internal: true
docker-legacy/docker-compose.milvus.yaml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3.5'
2
+
3
+ services:
4
+ etcd:
5
+ container_name: milvus-etcd
6
+ image: quay.io/coreos/etcd:v3.5.5
7
+ environment:
8
+ - ETCD_AUTO_COMPACTION_MODE=revision
9
+ - ETCD_AUTO_COMPACTION_RETENTION=1000
10
+ - ETCD_QUOTA_BACKEND_BYTES=4294967296
11
+ - ETCD_SNAPSHOT_COUNT=50000
12
+ volumes:
13
+ - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/etcd:/etcd
14
+ command: etcd -advertise-client-urls=http://127.0.0.1:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd
15
+ healthcheck:
16
+ test: ["CMD", "etcdctl", "endpoint", "health"]
17
+ interval: 30s
18
+ timeout: 20s
19
+ retries: 3
20
+
21
+ minio:
22
+ container_name: milvus-minio
23
+ image: minio/minio:RELEASE.2023-03-20T20-16-18Z
24
+ environment:
25
+ MINIO_ACCESS_KEY: minioadmin
26
+ MINIO_SECRET_KEY: minioadmin
27
+ ports:
28
+ - "9001:9001"
29
+ - "9000:9000"
30
+ volumes:
31
+ - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/minio:/minio_data
32
+ command: minio server /minio_data --console-address ":9001"
33
+ healthcheck:
34
+ test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
35
+ interval: 30s
36
+ timeout: 20s
37
+ retries: 3
38
+
39
+ milvus-standalone:
40
+ container_name: milvus-standalone
41
+ image: milvusdb/milvus:v2.4.6
42
+ command: ["milvus", "run", "standalone"]
43
+ environment:
44
+ ETCD_ENDPOINTS: etcd:2379
45
+ MINIO_ADDRESS: minio:9000
46
+ common.security.authorizationEnabled: true
47
+ volumes:
48
+ - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/milvus:/var/lib/milvus
49
+ healthcheck:
50
+ test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"]
51
+ interval: 30s
52
+ start_period: 90s
53
+ timeout: 20s
54
+ retries: 3
55
+ ports:
56
+ - "19530:19530"
57
+ - "9091:9091"
58
+ depends_on:
59
+ - "etcd"
60
+ - "minio"
61
+
62
+ networks:
63
+ default:
64
+ name: milvus
docker-legacy/docker-compose.opensearch.yml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ opensearch: # This is also the hostname of the container within the Docker network (i.e. https://opensearch/)
3
+ image: opensearchproject/opensearch:latest # Specifying the latest available image - modify if you want a specific version
4
+ container_name: opensearch
5
+ environment:
6
+ - discovery.type=single-node
7
+ - bootstrap.memory_lock=true # Disable JVM heap memory swapping
8
+ - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx1024m" # Set min and max JVM heap sizes to at least 50% of system RAM
9
+ - OPENSEARCH_INITIAL_ADMIN_PASSWORD=Qazwsxedc!@#123 # Sets the demo admin user password when using demo configuration, required for OpenSearch 2.12 and later
10
+ ulimits:
11
+ memlock:
12
+ soft: -1 # Set memlock to unlimited (no soft or hard limit)
13
+ hard: -1
14
+ nofile:
15
+ soft: 65536 # Maximum number of open files for the opensearch user - set to at least 65536
16
+ hard: 65536
17
+ volumes:
18
+ - ./volumes/opensearch/data:/usr/share/opensearch/data # Creates volume called opensearch-data1 and mounts it to the container
19
+ ports:
20
+ - 9200:9200 # REST API
21
+ - 9600:9600 # Performance Analyzer
22
+ networks:
23
+ - opensearch-net # All of the containers will join the same Docker bridge network
24
+ opensearch-dashboards:
25
+ image: opensearchproject/opensearch-dashboards:latest # Make sure the version of opensearch-dashboards matches the version of opensearch installed on other nodes
26
+ container_name: opensearch-dashboards
27
+ ports:
28
+ - 5601:5601 # Map host port 5601 to container port 5601
29
+ expose:
30
+ - "5601" # Expose port 5601 for web access to OpenSearch Dashboards
31
+ environment:
32
+ OPENSEARCH_HOSTS: '["https://opensearch:9200"]' # Define the OpenSearch nodes that OpenSearch Dashboards will query
33
+ volumes:
34
+ - ./volumes/opensearch/opensearch_dashboards.yml:/usr/share/opensearch-dashboards/config/opensearch_dashboards.yml
35
+ networks:
36
+ - opensearch-net
37
+
38
+ networks:
39
+ opensearch-net:
40
+ driver: bridge
docker-legacy/docker-compose.oracle.yaml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ # oracle 23 ai vector store.
3
+ oracle:
4
+ image: container-registry.oracle.com/database/free:latest
5
+ restart: always
6
+ ports:
7
+ - 1521:1521
8
+ volumes:
9
+ - type: volume
10
+ source: oradata_vector
11
+ target: /opt/oracle/oradata
12
+ - ./startupscripts:/opt/oracle/scripts/startup
13
+ environment:
14
+ - ORACLE_PWD=Dify123456
15
+ - ORACLE_CHARACTERSET=AL32UTF8
16
+ volumes:
17
+ oradata_vector:
docker-legacy/docker-compose.pgvecto-rs.yaml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ # The pgvecto—rs database.
3
+ pgvecto-rs:
4
+ image: tensorchord/pgvecto-rs:pg16-v0.2.0
5
+ restart: always
6
+ environment:
7
+ PGUSER: postgres
8
+ # The password for the default postgres user.
9
+ POSTGRES_PASSWORD: difyai123456
10
+ # The name of the default postgres database.
11
+ POSTGRES_DB: dify
12
+ # postgres data directory
13
+ PGDATA: /var/lib/postgresql/data/pgdata
14
+ volumes:
15
+ - ./volumes/pgvectors/data:/var/lib/postgresql/data
16
+ # uncomment to expose db(postgresql) port to host
17
+ ports:
18
+ - "5431:5432"
19
+ healthcheck:
20
+ test: [ "CMD", "pg_isready" ]
21
+ interval: 1s
22
+ timeout: 3s
23
+ retries: 30
docker-legacy/docker-compose.pgvector.yaml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ # Qdrant vector store.
3
+ pgvector:
4
+ image: pgvector/pgvector:pg16
5
+ restart: always
6
+ environment:
7
+ PGUSER: postgres
8
+ # The password for the default postgres user.
9
+ POSTGRES_PASSWORD: difyai123456
10
+ # The name of the default postgres database.
11
+ POSTGRES_DB: dify
12
+ # postgres data directory
13
+ PGDATA: /var/lib/postgresql/data/pgdata
14
+ volumes:
15
+ - ./volumes/pgvector/data:/var/lib/postgresql/data
16
+ # uncomment to expose db(postgresql) port to host
17
+ ports:
18
+ - "5433:5432"
19
+ healthcheck:
20
+ test: [ "CMD", "pg_isready" ]
21
+ interval: 1s
22
+ timeout: 3s
23
+ retries: 30
docker-legacy/docker-compose.png ADDED
docker-legacy/docker-compose.qdrant.yaml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ # Qdrant vector store.
3
+ qdrant:
4
+ image: langgenius/qdrant:v1.7.3
5
+ restart: always
6
+ volumes:
7
+ - ./volumes/qdrant:/qdrant/storage
8
+ environment:
9
+ QDRANT_API_KEY: 'difyai123456'
10
+ ports:
11
+ - "6333:6333"
12
+ - "6334:6334"
docker-legacy/docker-compose.yaml ADDED
@@ -0,0 +1,596 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3'
2
+ services:
3
+ # API service
4
+ api:
5
+ image: langgenius/dify-api:0.11.0
6
+ restart: always
7
+ environment:
8
+ # Startup mode, 'api' starts the API server.
9
+ MODE: api
10
+ # The log level for the application. Supported values are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
11
+ LOG_LEVEL: INFO
12
+ # enable DEBUG mode to output more logs
13
+ # DEBUG : true
14
+ # A secret key that is used for securely signing the session cookie and encrypting sensitive information on the database. You can generate a strong key using `openssl rand -base64 42`.
15
+ SECRET_KEY: sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
16
+ # The base URL of console application web frontend, refers to the Console base URL of WEB service if console domain is
17
+ # different from api or web app domain.
18
+ # example: http://cloud.dify.ai
19
+ CONSOLE_WEB_URL: ''
20
+ # Password for admin user initialization.
21
+ # If left unset, admin user will not be prompted for a password when creating the initial admin account.
22
+ INIT_PASSWORD: ''
23
+ # The base URL of console application api server, refers to the Console base URL of WEB service if console domain is
24
+ # different from api or web app domain.
25
+ # example: http://cloud.dify.ai
26
+ CONSOLE_API_URL: ''
27
+ # The URL prefix for Service API endpoints, refers to the base URL of the current API service if api domain is
28
+ # different from console domain.
29
+ # example: http://api.dify.ai
30
+ SERVICE_API_URL: ''
31
+ # The URL prefix for Web APP frontend, refers to the Web App base URL of WEB service if web app domain is different from
32
+ # console or api domain.
33
+ # example: http://udify.app
34
+ APP_WEB_URL: ''
35
+ # File preview or download Url prefix.
36
+ # used to display File preview or download Url to the front-end or as Multi-model inputs;
37
+ # Url is signed and has expiration time.
38
+ FILES_URL: ''
39
+ # File Access Time specifies a time interval in seconds for the file to be accessed.
40
+ # The default value is 300 seconds.
41
+ FILES_ACCESS_TIMEOUT: 300
42
+ # The maximum number of active requests for the application, where 0 means unlimited, should be a non-negative integer.
43
+ APP_MAX_ACTIVE_REQUESTS: 0
44
+ # When enabled, migrations will be executed prior to application startup and the application will start after the migrations have completed.
45
+ MIGRATION_ENABLED: 'true'
46
+ # The configurations of postgres database connection.
47
+ # It is consistent with the configuration in the 'db' service below.
48
+ DB_USERNAME: postgres
49
+ DB_PASSWORD: difyai123456
50
+ DB_HOST: db
51
+ DB_PORT: 5432
52
+ DB_DATABASE: dify
53
+ # The configurations of redis connection.
54
+ # It is consistent with the configuration in the 'redis' service below.
55
+ REDIS_HOST: redis
56
+ REDIS_PORT: 6379
57
+ REDIS_USERNAME: ''
58
+ REDIS_PASSWORD: difyai123456
59
+ REDIS_USE_SSL: 'false'
60
+ # use redis db 0 for redis cache
61
+ REDIS_DB: 0
62
+ # The configurations of celery broker.
63
+ # Use redis as the broker, and redis db 1 for celery broker.
64
+ CELERY_BROKER_URL: redis://:difyai123456@redis:6379/1
65
+ # Specifies the allowed origins for cross-origin requests to the Web API, e.g. https://dify.app or * for all origins.
66
+ WEB_API_CORS_ALLOW_ORIGINS: '*'
67
+ # Specifies the allowed origins for cross-origin requests to the console API, e.g. https://cloud.dify.ai or * for all origins.
68
+ CONSOLE_CORS_ALLOW_ORIGINS: '*'
69
+ # CSRF Cookie settings
70
+ # Controls whether a cookie is sent with cross-site requests,
71
+ # providing some protection against cross-site request forgery attacks
72
+ #
73
+ # Default: `SameSite=Lax, Secure=false, HttpOnly=true`
74
+ # This default configuration supports same-origin requests using either HTTP or HTTPS,
75
+ # but does not support cross-origin requests. It is suitable for local debugging purposes.
76
+ #
77
+ # If you want to enable cross-origin support,
78
+ # you must use the HTTPS protocol and set the configuration to `SameSite=None, Secure=true, HttpOnly=true`.
79
+ #
80
+ # The type of storage to use for storing user files. Supported values are `local` and `s3` and `azure-blob` and `google-storage`, Default: `local`
81
+ STORAGE_TYPE: local
82
+ # The path to the local storage directory, the directory relative the root path of API service codes or absolute path. Default: `storage` or `/home/john/storage`.
83
+ # only available when STORAGE_TYPE is `local`.
84
+ STORAGE_LOCAL_PATH: storage
85
+ # The S3 storage configurations, only available when STORAGE_TYPE is `s3`.
86
+ S3_USE_AWS_MANAGED_IAM: 'false'
87
+ S3_ENDPOINT: 'https://xxx.r2.cloudflarestorage.com'
88
+ S3_BUCKET_NAME: 'difyai'
89
+ S3_ACCESS_KEY: 'ak-difyai'
90
+ S3_SECRET_KEY: 'sk-difyai'
91
+ S3_REGION: 'us-east-1'
92
+ # The Azure Blob storage configurations, only available when STORAGE_TYPE is `azure-blob`.
93
+ AZURE_BLOB_ACCOUNT_NAME: 'difyai'
94
+ AZURE_BLOB_ACCOUNT_KEY: 'difyai'
95
+ AZURE_BLOB_CONTAINER_NAME: 'difyai-container'
96
+ AZURE_BLOB_ACCOUNT_URL: 'https://<your_account_name>.blob.core.windows.net'
97
+ # The Google storage configurations, only available when STORAGE_TYPE is `google-storage`.
98
+ GOOGLE_STORAGE_BUCKET_NAME: 'yout-bucket-name'
99
+ # if you want to use Application Default Credentials, you can leave GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64 empty.
100
+ GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64: 'your-google-service-account-json-base64-string'
101
+ # The Alibaba Cloud OSS configurations, only available when STORAGE_TYPE is `aliyun-oss`
102
+ ALIYUN_OSS_BUCKET_NAME: 'your-bucket-name'
103
+ ALIYUN_OSS_ACCESS_KEY: 'your-access-key'
104
+ ALIYUN_OSS_SECRET_KEY: 'your-secret-key'
105
+ ALIYUN_OSS_ENDPOINT: 'https://oss-ap-southeast-1-internal.aliyuncs.com'
106
+ ALIYUN_OSS_REGION: 'ap-southeast-1'
107
+ ALIYUN_OSS_AUTH_VERSION: 'v4'
108
+ # The Tencent COS storage configurations, only available when STORAGE_TYPE is `tencent-cos`.
109
+ TENCENT_COS_BUCKET_NAME: 'your-bucket-name'
110
+ TENCENT_COS_SECRET_KEY: 'your-secret-key'
111
+ TENCENT_COS_SECRET_ID: 'your-secret-id'
112
+ TENCENT_COS_REGION: 'your-region'
113
+ TENCENT_COS_SCHEME: 'your-scheme'
114
+ # The type of vector store to use. Supported values are `weaviate`, `qdrant`, `milvus`, `relyt`,`pgvector`, `chroma`, 'opensearch', 'tidb_vector'.
115
+ VECTOR_STORE: weaviate
116
+ # The Weaviate endpoint URL. Only available when VECTOR_STORE is `weaviate`.
117
+ WEAVIATE_ENDPOINT: http://weaviate:8080
118
+ # The Weaviate API key.
119
+ WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
120
+ # The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
121
+ QDRANT_URL: http://qdrant:6333
122
+ # The Qdrant API key.
123
+ QDRANT_API_KEY: difyai123456
124
+ # The Qdrant client timeout setting.
125
+ QDRANT_CLIENT_TIMEOUT: 20
126
+ # The Qdrant client enable gRPC mode.
127
+ QDRANT_GRPC_ENABLED: 'false'
128
+ # The Qdrant server gRPC mode PORT.
129
+ QDRANT_GRPC_PORT: 6334
130
+ # Milvus configuration Only available when VECTOR_STORE is `milvus`.
131
+ # The milvus uri.
132
+ MILVUS_URI: http://127.0.0.1:19530
133
+ # The milvus token.
134
+ MILVUS_TOKEN: ''
135
+ # The milvus username.
136
+ MILVUS_USER: root
137
+ # The milvus password.
138
+ MILVUS_PASSWORD: Milvus
139
+ # relyt configurations
140
+ RELYT_HOST: db
141
+ RELYT_PORT: 5432
142
+ RELYT_USER: postgres
143
+ RELYT_PASSWORD: difyai123456
144
+ RELYT_DATABASE: postgres
145
+ # pgvector configurations
146
+ PGVECTOR_HOST: pgvector
147
+ PGVECTOR_PORT: 5432
148
+ PGVECTOR_USER: postgres
149
+ PGVECTOR_PASSWORD: difyai123456
150
+ PGVECTOR_DATABASE: dify
151
+ # tidb vector configurations
152
+ TIDB_VECTOR_HOST: tidb
153
+ TIDB_VECTOR_PORT: 4000
154
+ TIDB_VECTOR_USER: xxx.root
155
+ TIDB_VECTOR_PASSWORD: xxxxxx
156
+ TIDB_VECTOR_DATABASE: dify
157
+ # oracle configurations
158
+ ORACLE_HOST: oracle
159
+ ORACLE_PORT: 1521
160
+ ORACLE_USER: dify
161
+ ORACLE_PASSWORD: dify
162
+ ORACLE_DATABASE: FREEPDB1
163
+ # Chroma configuration
164
+ CHROMA_HOST: 127.0.0.1
165
+ CHROMA_PORT: 8000
166
+ CHROMA_TENANT: default_tenant
167
+ CHROMA_DATABASE: default_database
168
+ CHROMA_AUTH_PROVIDER: chromadb.auth.token_authn.TokenAuthClientProvider
169
+ CHROMA_AUTH_CREDENTIALS: xxxxxx
170
+ # ElasticSearch Config
171
+ ELASTICSEARCH_HOST: 127.0.0.1
172
+ ELASTICSEARCH_PORT: 9200
173
+ ELASTICSEARCH_USERNAME: elastic
174
+ ELASTICSEARCH_PASSWORD: elastic
175
+ # Mail configuration, support: resend, smtp
176
+ MAIL_TYPE: ''
177
+ # default send from email address, if not specified
178
+ MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg: no-reply <no-reply@dify.ai>)'
179
+ SMTP_SERVER: ''
180
+ SMTP_PORT: 465
181
+ SMTP_USERNAME: ''
182
+ SMTP_PASSWORD: ''
183
+ SMTP_USE_TLS: 'true'
184
+ SMTP_OPPORTUNISTIC_TLS: 'false'
185
+ # the api-key for resend (https://resend.com)
186
+ RESEND_API_KEY: ''
187
+ RESEND_API_URL: https://api.resend.com
188
+ # The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
189
+ SENTRY_DSN: ''
190
+ # The sample rate for Sentry events. Default: `1.0`
191
+ SENTRY_TRACES_SAMPLE_RATE: 1.0
192
+ # The sample rate for Sentry profiles. Default: `1.0`
193
+ SENTRY_PROFILES_SAMPLE_RATE: 1.0
194
+ # Notion import configuration, support public and internal
195
+ NOTION_INTEGRATION_TYPE: public
196
+ NOTION_CLIENT_SECRET: you-client-secret
197
+ NOTION_CLIENT_ID: you-client-id
198
+ NOTION_INTERNAL_SECRET: you-internal-secret
199
+ # The sandbox service endpoint.
200
+ CODE_EXECUTION_ENDPOINT: "http://sandbox:8194"
201
+ CODE_EXECUTION_API_KEY: dify-sandbox
202
+ CODE_MAX_NUMBER: 9223372036854775807
203
+ CODE_MIN_NUMBER: -9223372036854775808
204
+ CODE_MAX_STRING_LENGTH: 80000
205
+ TEMPLATE_TRANSFORM_MAX_LENGTH: 80000
206
+ CODE_MAX_STRING_ARRAY_LENGTH: 30
207
+ CODE_MAX_OBJECT_ARRAY_LENGTH: 30
208
+ CODE_MAX_NUMBER_ARRAY_LENGTH: 1000
209
+ # SSRF Proxy server
210
+ SSRF_PROXY_HTTP_URL: 'http://ssrf_proxy:3128'
211
+ SSRF_PROXY_HTTPS_URL: 'http://ssrf_proxy:3128'
212
+ # Indexing configuration
213
+ INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH: 1000
214
+ depends_on:
215
+ - db
216
+ - redis
217
+ volumes:
218
+ # Mount the storage directory to the container, for storing user files.
219
+ - ./volumes/app/storage:/app/api/storage
220
+ # uncomment to expose dify-api port to host
221
+ # ports:
222
+ # - "5001:5001"
223
+ networks:
224
+ - ssrf_proxy_network
225
+ - default
226
+
227
+ # worker service
228
+ # The Celery worker for processing the queue.
229
+ worker:
230
+ image: langgenius/dify-api:0.11.0
231
+ restart: always
232
+ environment:
233
+ CONSOLE_WEB_URL: ''
234
+ # Startup mode, 'worker' starts the Celery worker for processing the queue.
235
+ MODE: worker
236
+
237
+ # --- All the configurations below are the same as those in the 'api' service. ---
238
+
239
+ # The log level for the application. Supported values are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
240
+ LOG_LEVEL: INFO
241
+ # A secret key that is used for securely signing the session cookie and encrypting sensitive information on the database. You can generate a strong key using `openssl rand -base64 42`.
242
+ # same as the API service
243
+ SECRET_KEY: sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
244
+ # The configurations of postgres database connection.
245
+ # It is consistent with the configuration in the 'db' service below.
246
+ DB_USERNAME: postgres
247
+ DB_PASSWORD: difyai123456
248
+ DB_HOST: db
249
+ DB_PORT: 5432
250
+ DB_DATABASE: dify
251
+ # The configurations of redis cache connection.
252
+ REDIS_HOST: redis
253
+ REDIS_PORT: 6379
254
+ REDIS_USERNAME: ''
255
+ REDIS_PASSWORD: difyai123456
256
+ REDIS_DB: 0
257
+ REDIS_USE_SSL: 'false'
258
+ # The configurations of celery broker.
259
+ CELERY_BROKER_URL: redis://:difyai123456@redis:6379/1
260
+ # The type of storage to use for storing user files. Supported values are `local` and `s3` and `azure-blob` and `google-storage`, Default: `local`
261
+ STORAGE_TYPE: local
262
+ STORAGE_LOCAL_PATH: storage
263
+ # The S3 storage configurations, only available when STORAGE_TYPE is `s3`.
264
+ S3_USE_AWS_MANAGED_IAM: 'false'
265
+ S3_ENDPOINT: 'https://xxx.r2.cloudflarestorage.com'
266
+ S3_BUCKET_NAME: 'difyai'
267
+ S3_ACCESS_KEY: 'ak-difyai'
268
+ S3_SECRET_KEY: 'sk-difyai'
269
+ S3_REGION: 'us-east-1'
270
+ # The Azure Blob storage configurations, only available when STORAGE_TYPE is `azure-blob`.
271
+ AZURE_BLOB_ACCOUNT_NAME: 'difyai'
272
+ AZURE_BLOB_ACCOUNT_KEY: 'difyai'
273
+ AZURE_BLOB_CONTAINER_NAME: 'difyai-container'
274
+ AZURE_BLOB_ACCOUNT_URL: 'https://<your_account_name>.blob.core.windows.net'
275
+ # The Google storage configurations, only available when STORAGE_TYPE is `google-storage`.
276
+ GOOGLE_STORAGE_BUCKET_NAME: 'yout-bucket-name'
277
+ # if you want to use Application Default Credentials, you can leave GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64 empty.
278
+ GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64: 'your-google-service-account-json-base64-string'
279
+ # The Alibaba Cloud OSS configurations, only available when STORAGE_TYPE is `aliyun-oss`
280
+ ALIYUN_OSS_BUCKET_NAME: 'your-bucket-name'
281
+ ALIYUN_OSS_ACCESS_KEY: 'your-access-key'
282
+ ALIYUN_OSS_SECRET_KEY: 'your-secret-key'
283
+ ALIYUN_OSS_ENDPOINT: 'https://oss-ap-southeast-1-internal.aliyuncs.com'
284
+ ALIYUN_OSS_REGION: 'ap-southeast-1'
285
+ ALIYUN_OSS_AUTH_VERSION: 'v4'
286
+ # The Tencent COS storage configurations, only available when STORAGE_TYPE is `tencent-cos`.
287
+ TENCENT_COS_BUCKET_NAME: 'your-bucket-name'
288
+ TENCENT_COS_SECRET_KEY: 'your-secret-key'
289
+ TENCENT_COS_SECRET_ID: 'your-secret-id'
290
+ TENCENT_COS_REGION: 'your-region'
291
+ TENCENT_COS_SCHEME: 'your-scheme'
292
+ # The type of vector store to use. Supported values are `weaviate`, `qdrant`, `milvus`, `relyt`, `pgvector`, `chroma`, 'opensearch', 'tidb_vector'.
293
+ VECTOR_STORE: weaviate
294
+ # The Weaviate endpoint URL. Only available when VECTOR_STORE is `weaviate`.
295
+ WEAVIATE_ENDPOINT: http://weaviate:8080
296
+ # The Weaviate API key.
297
+ WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
298
+ # The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
299
+ QDRANT_URL: http://qdrant:6333
300
+ # The Qdrant API key.
301
+ QDRANT_API_KEY: difyai123456
302
+ # The Qdrant client timeout setting.
303
+ QDRANT_CLIENT_TIMEOUT: 20
304
+ # The Qdrant client enable gRPC mode.
305
+ QDRANT_GRPC_ENABLED: 'false'
306
+ # The Qdrant server gRPC mode PORT.
307
+ QDRANT_GRPC_PORT: 6334
308
+ # Milvus configuration Only available when VECTOR_STORE is `milvus`.
309
+ # The milvus uri.
310
+ MILVUS_URI: http://127.0.0.1:19530
311
+ # The milvus token.
312
+ MILVUS_PORT: ''
313
+ # The milvus username.
314
+ MILVUS_USER: root
315
+ # The milvus password.
316
+ MILVUS_PASSWORD: Milvus
317
+ # Mail configuration, support: resend
318
+ MAIL_TYPE: ''
319
+ # default send from email address, if not specified
320
+ MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg: no-reply <no-reply@dify.ai>)'
321
+ SMTP_SERVER: ''
322
+ SMTP_PORT: 465
323
+ SMTP_USERNAME: ''
324
+ SMTP_PASSWORD: ''
325
+ SMTP_USE_TLS: 'true'
326
+ SMTP_OPPORTUNISTIC_TLS: 'false'
327
+ # the api-key for resend (https://resend.com)
328
+ RESEND_API_KEY: ''
329
+ RESEND_API_URL: https://api.resend.com
330
+ # relyt configurations
331
+ RELYT_HOST: db
332
+ RELYT_PORT: 5432
333
+ RELYT_USER: postgres
334
+ RELYT_PASSWORD: difyai123456
335
+ RELYT_DATABASE: postgres
336
+ # tencent configurations
337
+ TENCENT_VECTOR_DB_URL: http://127.0.0.1
338
+ TENCENT_VECTOR_DB_API_KEY: dify
339
+ TENCENT_VECTOR_DB_TIMEOUT: 30
340
+ TENCENT_VECTOR_DB_USERNAME: dify
341
+ TENCENT_VECTOR_DB_DATABASE: dify
342
+ TENCENT_VECTOR_DB_SHARD: 1
343
+ TENCENT_VECTOR_DB_REPLICAS: 2
344
+ # OpenSearch configuration
345
+ OPENSEARCH_HOST: 127.0.0.1
346
+ OPENSEARCH_PORT: 9200
347
+ OPENSEARCH_USER: admin
348
+ OPENSEARCH_PASSWORD: admin
349
+ OPENSEARCH_SECURE: 'true'
350
+ # pgvector configurations
351
+ PGVECTOR_HOST: pgvector
352
+ PGVECTOR_PORT: 5432
353
+ PGVECTOR_USER: postgres
354
+ PGVECTOR_PASSWORD: difyai123456
355
+ PGVECTOR_DATABASE: dify
356
+ # tidb vector configurations
357
+ TIDB_VECTOR_HOST: tidb
358
+ TIDB_VECTOR_PORT: 4000
359
+ TIDB_VECTOR_USER: xxx.root
360
+ TIDB_VECTOR_PASSWORD: xxxxxx
361
+ TIDB_VECTOR_DATABASE: dify
362
+ # oracle configurations
363
+ ORACLE_HOST: oracle
364
+ ORACLE_PORT: 1521
365
+ ORACLE_USER: dify
366
+ ORACLE_PASSWORD: dify
367
+ ORACLE_DATABASE: FREEPDB1
368
+ # Chroma configuration
369
+ CHROMA_HOST: 127.0.0.1
370
+ CHROMA_PORT: 8000
371
+ CHROMA_TENANT: default_tenant
372
+ CHROMA_DATABASE: default_database
373
+ CHROMA_AUTH_PROVIDER: chromadb.auth.token_authn.TokenAuthClientProvider
374
+ CHROMA_AUTH_CREDENTIALS: xxxxxx
375
+ # ElasticSearch Config
376
+ ELASTICSEARCH_HOST: 127.0.0.1
377
+ ELASTICSEARCH_PORT: 9200
378
+ ELASTICSEARCH_USERNAME: elastic
379
+ ELASTICSEARCH_PASSWORD: elastic
380
+ # Notion import configuration, support public and internal
381
+ NOTION_INTEGRATION_TYPE: public
382
+ NOTION_CLIENT_SECRET: you-client-secret
383
+ NOTION_CLIENT_ID: you-client-id
384
+ NOTION_INTERNAL_SECRET: you-internal-secret
385
+ # Indexing configuration
386
+ INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH: 1000
387
+ depends_on:
388
+ - db
389
+ - redis
390
+ volumes:
391
+ # Mount the storage directory to the container, for storing user files.
392
+ - ./volumes/app/storage:/app/api/storage
393
+ networks:
394
+ - ssrf_proxy_network
395
+ - default
396
+
397
+ # Frontend web application.
398
+ web:
399
+ image: langgenius/dify-web:0.11.0
400
+ restart: always
401
+ environment:
402
+ # The base URL of console application api server, refers to the Console base URL of WEB service if console domain is
403
+ # different from api or web app domain.
404
+ # example: http://cloud.dify.ai
405
+ CONSOLE_API_URL: ''
406
+ # The URL for Web APP api server, refers to the Web App base URL of WEB service if web app domain is different from
407
+ # console or api domain.
408
+ # example: http://udify.app
409
+ APP_API_URL: ''
410
+ # The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
411
+ SENTRY_DSN: ''
412
+ # uncomment to expose dify-web port to host
413
+ # ports:
414
+ # - "3000:3000"
415
+
416
+ # The postgres database.
417
+ db:
418
+ image: postgres:15-alpine
419
+ restart: always
420
+ environment:
421
+ PGUSER: postgres
422
+ # The password for the default postgres user.
423
+ POSTGRES_PASSWORD: difyai123456
424
+ # The name of the default postgres database.
425
+ POSTGRES_DB: dify
426
+ # postgres data directory
427
+ PGDATA: /var/lib/postgresql/data/pgdata
428
+ volumes:
429
+ - ./volumes/db/data:/var/lib/postgresql/data
430
+ # notice!: if you use windows-wsl2, postgres may not work properly due to the ntfs issue.you can use volumes to mount the data directory to the host.
431
+ # if you use the following config, you need to uncomment the volumes configuration below at the end of the file.
432
+ # - postgres:/var/lib/postgresql/data
433
+ # uncomment to expose db(postgresql) port to host
434
+ # ports:
435
+ # - "5432:5432"
436
+ healthcheck:
437
+ test: [ "CMD", "pg_isready" ]
438
+ interval: 1s
439
+ timeout: 3s
440
+ retries: 30
441
+
442
+ # The redis cache.
443
+ redis:
444
+ image: redis:6-alpine
445
+ restart: always
446
+ volumes:
447
+ # Mount the redis data directory to the container.
448
+ - ./volumes/redis/data:/data
449
+ # Set the redis password when startup redis server.
450
+ command: redis-server --requirepass difyai123456
451
+ healthcheck:
452
+ test: [ "CMD", "redis-cli", "ping" ]
453
+ # uncomment to expose redis port to host
454
+ # ports:
455
+ # - "6379:6379"
456
+
457
+ # The Weaviate vector store.
458
+ weaviate:
459
+ image: semitechnologies/weaviate:1.19.0
460
+ restart: always
461
+ volumes:
462
+ # Mount the Weaviate data directory to the container.
463
+ - ./volumes/weaviate:/var/lib/weaviate
464
+ environment:
465
+ # The Weaviate configurations
466
+ # You can refer to the [Weaviate](https://weaviate.io/developers/weaviate/config-refs/env-vars) documentation for more information.
467
+ QUERY_DEFAULTS_LIMIT: 25
468
+ AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'false'
469
+ PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
470
+ DEFAULT_VECTORIZER_MODULE: 'none'
471
+ CLUSTER_HOSTNAME: 'node1'
472
+ AUTHENTICATION_APIKEY_ENABLED: 'true'
473
+ AUTHENTICATION_APIKEY_ALLOWED_KEYS: 'WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih'
474
+ AUTHENTICATION_APIKEY_USERS: 'hello@dify.ai'
475
+ AUTHORIZATION_ADMINLIST_ENABLED: 'true'
476
+ AUTHORIZATION_ADMINLIST_USERS: 'hello@dify.ai'
477
+ # uncomment to expose weaviate port to host
478
+ # ports:
479
+ # - "8080:8080"
480
+
481
+ # The DifySandbox
482
+ sandbox:
483
+ image: langgenius/dify-sandbox:0.2.1
484
+ restart: always
485
+ environment:
486
+ # The DifySandbox configurations
487
+ # Make sure you are changing this key for your deployment with a strong key.
488
+ # You can generate a strong key using `openssl rand -base64 42`.
489
+ API_KEY: dify-sandbox
490
+ GIN_MODE: 'release'
491
+ WORKER_TIMEOUT: 15
492
+ ENABLE_NETWORK: 'true'
493
+ HTTP_PROXY: 'http://ssrf_proxy:3128'
494
+ HTTPS_PROXY: 'http://ssrf_proxy:3128'
495
+ SANDBOX_PORT: 8194
496
+ volumes:
497
+ - ./volumes/sandbox/dependencies:/dependencies
498
+ networks:
499
+ - ssrf_proxy_network
500
+
501
+ # ssrf_proxy server
502
+ # for more information, please refer to
503
+ # https://docs.dify.ai/learn-more/faq/install-faq#id-18.-why-is-ssrf_proxy-needed
504
+ ssrf_proxy:
505
+ image: ubuntu/squid:latest
506
+ restart: always
507
+ volumes:
508
+ # pls clearly modify the squid.conf file to fit your network environment.
509
+ - ./volumes/ssrf_proxy/squid.conf:/etc/squid/squid.conf
510
+ networks:
511
+ - ssrf_proxy_network
512
+ - default
513
+ # Qdrant vector store.
514
+ # uncomment to use qdrant as vector store.
515
+ # (if uncommented, you need to comment out the weaviate service above,
516
+ # and set VECTOR_STORE to qdrant in the api & worker service.)
517
+ # qdrant:
518
+ # image: langgenius/qdrant:v1.7.3
519
+ # restart: always
520
+ # volumes:
521
+ # - ./volumes/qdrant:/qdrant/storage
522
+ # environment:
523
+ # QDRANT_API_KEY: 'difyai123456'
524
+ # # uncomment to expose qdrant port to host
525
+ # # ports:
526
+ # # - "6333:6333"
527
+ # # - "6334:6334"
528
+
529
+ # The pgvector vector database.
530
+ # Uncomment to use qdrant as vector store.
531
+ # pgvector:
532
+ # image: pgvector/pgvector:pg16
533
+ # restart: always
534
+ # environment:
535
+ # PGUSER: postgres
536
+ # # The password for the default postgres user.
537
+ # POSTGRES_PASSWORD: difyai123456
538
+ # # The name of the default postgres database.
539
+ # POSTGRES_DB: dify
540
+ # # postgres data directory
541
+ # PGDATA: /var/lib/postgresql/data/pgdata
542
+ # volumes:
543
+ # - ./volumes/pgvector/data:/var/lib/postgresql/data
544
+ # # uncomment to expose db(postgresql) port to host
545
+ # # ports:
546
+ # # - "5433:5432"
547
+ # healthcheck:
548
+ # test: [ "CMD", "pg_isready" ]
549
+ # interval: 1s
550
+ # timeout: 3s
551
+ # retries: 30
552
+
553
+ # The oracle vector database.
554
+ # Uncomment to use oracle23ai as vector store. Also need to Uncomment volumes block
555
+ # oracle:
556
+ # image: container-registry.oracle.com/database/free:latest
557
+ # restart: always
558
+ # ports:
559
+ # - 1521:1521
560
+ # volumes:
561
+ # - type: volume
562
+ # source: oradata
563
+ # target: /opt/oracle/oradata
564
+ # - ./startupscripts:/opt/oracle/scripts/startup
565
+ # environment:
566
+ # - ORACLE_PWD=Dify123456
567
+ # - ORACLE_CHARACTERSET=AL32UTF8
568
+
569
+
570
+ # The nginx reverse proxy.
571
+ # used for reverse proxying the API service and Web service.
572
+ nginx:
573
+ image: nginx:latest
574
+ restart: always
575
+ volumes:
576
+ - ./nginx/nginx.conf:/etc/nginx/nginx.conf
577
+ - ./nginx/proxy.conf:/etc/nginx/proxy.conf
578
+ - ./nginx/conf.d:/etc/nginx/conf.d
579
+ #- ./nginx/ssl:/etc/ssl
580
+ depends_on:
581
+ - api
582
+ - web
583
+ ports:
584
+ - "80:80"
585
+ #- "443:443"
586
+ # notice: if you use windows-wsl2, postgres may not work properly due to the ntfs issue.you can use volumes to mount the data directory to the host.
587
+ # volumes:
588
+ #   postgres:
589
+ networks:
590
+ # create a network between sandbox, api and ssrf_proxy, and can not access outside.
591
+ ssrf_proxy_network:
592
+ driver: bridge
593
+ internal: true
594
+
595
+ #volumes:
596
+ # oradata:
docker-legacy/nginx/conf.d/default.conf ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ server {
2
+ listen 80;
3
+ server_name _;
4
+
5
+ location /console/api {
6
+ proxy_pass http://api:5001;
7
+ include proxy.conf;
8
+ }
9
+
10
+ location /api {
11
+ proxy_pass http://api:5001;
12
+ include proxy.conf;
13
+ }
14
+
15
+ location /v1 {
16
+ proxy_pass http://api:5001;
17
+ include proxy.conf;
18
+ }
19
+
20
+ location /files {
21
+ proxy_pass http://api:5001;
22
+ include proxy.conf;
23
+ }
24
+
25
+ location / {
26
+ proxy_pass http://web:3000;
27
+ include proxy.conf;
28
+ }
29
+
30
+ # If you want to support HTTPS, please uncomment the code snippet below
31
+ #listen 443 ssl;
32
+ #ssl_certificate ./../ssl/your_cert_file.cer;
33
+ #ssl_certificate_key ./../ssl/your_cert_key.key;
34
+ #ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
35
+ #ssl_prefer_server_ciphers on;
36
+ #ssl_session_cache shared:SSL:10m;
37
+ #ssl_session_timeout 10m;
38
+ }
docker-legacy/nginx/nginx.conf ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ user nginx;
2
+ worker_processes auto;
3
+
4
+ error_log /var/log/nginx/error.log notice;
5
+ pid /var/run/nginx.pid;
6
+
7
+
8
+ events {
9
+ worker_connections 1024;
10
+ }
11
+
12
+
13
+ http {
14
+ include /etc/nginx/mime.types;
15
+ default_type application/octet-stream;
16
+
17
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
18
+ '$status $body_bytes_sent "$http_referer" '
19
+ '"$http_user_agent" "$http_x_forwarded_for"';
20
+
21
+ access_log /var/log/nginx/access.log main;
22
+
23
+ sendfile on;
24
+ #tcp_nopush on;
25
+
26
+ keepalive_timeout 65;
27
+
28
+ #gzip on;
29
+ client_max_body_size 15M;
30
+
31
+ include /etc/nginx/conf.d/*.conf;
32
+ }
docker-legacy/nginx/proxy.conf ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ proxy_set_header Host $host;
2
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
3
+ proxy_set_header X-Forwarded-Proto $scheme;
4
+ proxy_http_version 1.1;
5
+ proxy_set_header Connection "";
6
+ proxy_buffering off;
7
+ proxy_read_timeout 3600s;
8
+ proxy_send_timeout 3600s;
docker-legacy/nginx/ssl/.gitkeep ADDED
@@ -0,0 +1 @@
 
 
1
+
docker-legacy/startupscripts/create_user.sql ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ show pdbs;
2
+ ALTER SYSTEM SET PROCESSES=500 SCOPE=SPFILE;
3
+ alter session set container= freepdb1;
4
+ create user dify identified by dify DEFAULT TABLESPACE users quota unlimited on users;
5
+ grant DB_DEVELOPER_ROLE to dify;