dify icon indicating copy to clipboard operation
dify copied to clipboard

Failed DB migration

Open damadorPL opened this issue 10 months ago • 2 comments

Self Checks

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

Dify version

1.0.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

git pull and docker compose up-d

✔️ Expected Behavior

No response

❌ Actual Behavior

Running migrations 2025-02-28 09:10:48.893 INFO [MainThread] [utils.py:162] - NumExpr defaulting to 6 threads. 2025-02-28 09:10:51.758 INFO [MainThread] [_client.py:1038] - HTTP Request: GET https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json "HTTP/1.1 200 OK" Preparing database migration... Starting database migration. ERROR [root] Failed to execute database migration Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 146, in init self._dbapi_connection = engine.raw_connection() ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3302, in raw_connection return self.pool.connect() ^^^^^^^^^^^^^^^^^^^

seems that it cant connect to DB -

as iam running another postgress container i had to set in .env

DB_PORT=5632 PGVECTOR_PORT=5632 EXPOSE_DB_PORT=5632

damadorPL avatar Feb 28 '25 09:02 damadorPL

I found a similar closed issue that might help resolve your problem. The issue was related to port conflicts when running multiple PostgreSQL containers. The solution involved ensuring that the docker-compose.yaml file correctly maps the host port to the container's port. Here's what you can do:

  1. Update the docker-compose.yaml file: Make sure it maps the correct port. For example, if you set DB_PORT=5632 in your .env file, ensure the docker-compose.yaml file has:

    ports:
      - '5632:5432'
    
  2. Set Environment Variables: Ensure both DB_PORT=5632 and EXPOSE_DB_PORT=5632 are set in your .env file.

  3. Restart Docker Containers: After making these changes, restart your Docker containers to apply the new configuration. You can do this by running:

    docker compose down
    docker compose up -d
    

These steps should help resolve the connection issue by ensuring the correct port mapping and environment variable settings [1].

To continue talking to Dosu, mention @dosu.


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

dosubot[bot] avatar Feb 28 '25 09:02 dosubot[bot]

port from containers are exposed correctly - unfortunatelly API cant connect and still get these errors

damadorPL avatar Feb 28 '25 10:02 damadorPL