Skip to content

Docker cannot be deployed #4

Closed

Description

@fenglingR

First of all, I am very grateful to the author for developing this bot.

Next I will describe my problem.

I consulted the tutorial and referenced the deployment case

我的部署命令如下:

docker run --rm -it --name allocator-bot \
  -e HOST_URL=http://localhost:4322 \
  -e APP_API_KEY=my_api_key \
  -e OPENROUTER_API_KEY=my_api_key\
  -e data_folder_path=/data \
  -e S3_ENABLED=false \
  -p 4299:4299 \
  ghcr.io/piiq/allocator-bot:latest

The activation error code is as follows:

Traceback (most recent call last):
  File "/app/.venv/bin/openbb-api", line 4, in <module>
    from openbb_platform_api.main import main
  File "/app/.venv/lib/python3.12/site-packages/openbb_platform_api/main.py", line 48, in <module>
    kwargs = parse_args()
             ^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/openbb_platform_api/utils/api.py", line 408, in parse_args
    _kwargs["app"] = import_app(_app_path, _name, _factory)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/openbb_platform_api/utils/api.py", line 341, in import_app
    app = app_or_factory()
          ^^^^^^^^^^^^^^^^
  File "/app/allocator_bot/__main__.py", line 19, in get_app
    from .api import app
  File "/app/allocator_bot/api.py", line 13, in <module>
    from .agent import execution_loop
  File "/app/allocator_bot/agent.py", line 30, in <module>
    from .portfolio import prepare_allocation
  File "/app/allocator_bot/portfolio.py", line 8, in <module>
    from .config import config
  File "/app/allocator_bot/config.py", line 9, in <module>
    config = AppConfig(
             ^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/pydantic/main.py", line 253, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 2 validation errors for AppConfig
agent_host_url
  Value error, agent_host_url environment variable is required. [type=value_error, input_value='', input_type=str]
    For further information visit https://errors.pydantic.dev/2.11/v/value_error
data_folder_path
  Value error, Data folder path must be set when S3 is not enabled. [type=value_error, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.11/v/value_error

The deployment environment is as follows:
OS: debian 12
Docker version 28.3.3, build 980b856

Activity

  1. piiq commented on Aug 21, 2025

    @piiq
    Owner

    Thanks for the issue. Need to check the readme - there might be an env variable missing in the documentation.

  2. added a commit that references this issue on Aug 22, 2025
    6a2a49d
  3. piiq commented on Aug 22, 2025

    @piiq
    Owner

    @fenglingR can you try using the instructions in the updated readme?

    In your case

    1. AGENT_HOST_URL instead of HOST_URL
    2. DATA_FOLDER_PATH should be in caps

    I would also suggest you mount a folder to /data so that your info is persisted between container rebuilds

    so your command would look like:

    docker run --rm -it --name allocator-bot \
      -e AGENT_HOST_URL=http://localhost:4322 \
      -e APP_API_KEY=my_api_key \
      -e OPENROUTER_API_KEY=my_api_key \
      -e DATA_FOLDER_PATH=/data \
      -e S3_ENABLED=false \
      -p 4299:4299 \
      -v $(pwd):/data \
      ghcr.io/piiq/allocator-bot:latest
    

    This command will mount the folder you're launching it from into /data and the allocations will be saved there

  4. fenglingR commented on Aug 24, 2025

    @fenglingR
    Author

    Thank you, I have successfully deployed it now.
    But I now have a new problem.

    Image

    As you can see, I can't use copilot.
    I checked the docker logs and found that no requests were generated.

    Image

    I have a question about the configuration side. Can APP_API_KEY set as a self-service password? Or use OpenAI's api_key? I can't troubleshoot the specific problem, please explain if you need to see my configuration.

    Please help me, thank you

  5. piiq commented on Aug 24, 2025

    @piiq
    Owner

    The APP_API_KEY is any string that you use as an auth token to access the bot (so that it can be deployed beyond your local machine)
    So when you're adding the bot, after you paste the URL you should click the "Add Authentication" button and specify the Authorization header so that you see something like this (this assumes that your APP_API_KEY variable is my_api_key):

    Image

    Did this section of the readme help? https://github.com/piiq/allocator-bot?tab=readme-ov-file#adding-to-openbb-workspace

    Note: the OPENROUTER_API_KEY is not the OpenAI API key. The bot in it's current state uses a DeepSeek-V3 model, not any of the OpenAI models. You can get an OpenRouter API key on https://openrouter.ai/

  6. piiq commented on Aug 26, 2025

    @piiq
    Owner

    @fenglingR

    Did the suggestion above help?

  7. fenglingR commented on Sep 12, 2025

    @fenglingR
    Author

    Hey, thank you for your concern.
    I've been busy with work recently, so I've put this project aside.
    Unfortunately, the problem has not been resolved.
    I checked the format for adding components and found that there was an error in the key part, which made it impossible to access the data. After the correction, openbb was able to access the widget data.

    Image

    But I still can't use this bot properly.
    I added a layer of proxy on the host system of Docker, but found no commands to request the API.
    I checked the backend API data of OPENROUTER and found that no requests were received. I believe it should be a network issue.
    But the network environment I am in requires the use of a VPN to access the internet normally.
    I need your further assistance, thank you.

  8. piiq commented on Sep 13, 2025

    @piiq
    Owner

    Hi @fenglingR

    You actually pointed out a bug that resulted from OpenRouter model providers not advertising certain features their API supports. I've been able to reproduce it an I have fixed the bug in this PR #6

    The new image has been built and published. I've just installed the new version to my deployment and I see it working correctly.

    Please do

    docker pull ghcr.io/piiq/allocator-bot:latest
    

    followed by

    docker run --rm -it --name allocator-bot \
      -e AGENT_HOST_URL=http://localhost:4322 \
      -e APP_API_KEY=my_api_key \
      -e OPENROUTER_API_KEY=replace_with_your_openrouter_api_key \
      -e DATA_FOLDER_PATH=/data \
      -e S3_ENABLED=false \
      -p 4299:4299 \
      -v $(pwd):/data \
      ghcr.io/piiq/allocator-bot:latest
    

    And tell me how it goes.

  9. fenglingR commented on Sep 14, 2025

    @fenglingR
    Author

    Thank you for your reminder, I have received the update and redeployed the service.
    Unfortunately, this update doesn't seem to have solved the problem.
    First of all, the bot is still unable to call the LLM model and cannot respond.
    OpenBB encountered a 500 error code when requesting historical data.
    In addition, when I tried to view the /doc/ documentation of the deployment link, it returned: {"detail":"Not Found"}
    I will put the error logs from the Docker run below. Thank you to the author for taking the time and effort to maintain this project amidst a busy schedule.

      File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 714, in __call__
        await self.middleware_stack(scope, receive, send)
      File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 734, in app
        await route.handle(scope, receive, send)
      File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle
        await self.app(scope, receive, send)
      File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 76, in app
        await wrap_app_handling_exceptions(app, request)(scope, receive, send)
      File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
        raise exc
      File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
        await app(scope, receive, sender)
      File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 73, in app
        response = await f(request)
                   ^^^^^^^^^^^^^^^^
      File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 301, in app
        raw_response = await run_endpoint_function(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
        return await dependant.call(**values)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/app/allocator_bot/api.py", line 367, in get_task_data
        tasks = await load_tasks()
                ^^^^^^^^^^^^^^^^^^
      File "/app/allocator_bot/storage.py", line 134, in load_tasks
        storage: LocalFileStorage | CloudObjectStorage = await get_storage()
                                                         ^^^^^^^^^^^^^^^^^^^
      File "/app/allocator_bot/storage.py", line 105, in get_storage
        return LocalFileStorage()
               ^^^^^^^^^^^^^^^^^^
      File "/app/allocator_bot/storage.py", line 18, in __init__
        os.makedirs(self.data_folder_path)
      File "<frozen os>", line 225, in makedirs
    PermissionError: [Errno 13] Permission denied: '/data'
    ERROR:    [Errno 13] Permission denied: '/data'
    INFO:     172.17.0.1:40850 - "GET /task_data HTTP/1.0" 500 Internal Server Error
    ERROR:    Exception in ASGI application
    Traceback (most recent call last):
      File "/app/.venv/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
        result = await app(  # type: ignore[func-returns-value]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/app/.venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
        return await self.app(scope, receive, send)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/app/.venv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
        await super().__call__(scope, receive, send)
      File "/app/.venv/lib/python3.12/site-packages/starlette/applications.py", line 112, in __call__
        await self.middleware_stack(scope, receive, send)
      File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 187, in __call__
        raise exc
      File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 165, in __call__
        await self.app(scope, receive, _send)
      File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 93, in __call__
        await self.simple_response(scope, receive, send, request_headers=headers)
      File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 144, in simple_response
        await self.app(scope, receive, send)
      File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 93, in __call__
        await self.simple_response(scope, receive, send, request_headers=headers)
      File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 144, in simple_response
        await self.app(scope, receive, send)
      File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
        await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
      File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
        raise exc
      File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
        await app(scope, receive, sender)
      File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 714, in __call__
        await self.middleware_stack(scope, receive, send)
      File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 734, in app
        await route.handle(scope, receive, send)
      File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle
        await self.app(scope, receive, send)
      File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 76, in app
        await wrap_app_handling_exceptions(app, request)(scope, receive, send)
      File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
        raise exc
      File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
        await app(scope, receive, sender)
      File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 73, in app
        response = await f(request)
                   ^^^^^^^^^^^^^^^^
      File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 301, in app
        raw_response = await run_endpoint_function(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
        return await dependant.call(**values)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/app/allocator_bot/api.py", line 367, in get_task_data
        tasks = await load_tasks()
                ^^^^^^^^^^^^^^^^^^
      File "/app/allocator_bot/storage.py", line 134, in load_tasks
        storage: LocalFileStorage | CloudObjectStorage = await get_storage()
                                                         ^^^^^^^^^^^^^^^^^^^
      File "/app/allocator_bot/storage.py", line 105, in get_storage
        return LocalFileStorage()
               ^^^^^^^^^^^^^^^^^^
      File "/app/allocator_bot/storage.py", line 18, in __init__
        os.makedirs(self.data_folder_path)
      File "<frozen os>", line 225, in makedirs
    PermissionError: [Errno 13] Permission denied: '/data'
    
  10. piiq commented on Sep 14, 2025

    @piiq
    Owner

    @fenglingR

    This

     File "<frozen os>", line 225, in makedirs
    PermissionError: [Errno 13] Permission denied: '/data'
    

    Means that the bot doesn't have the permission to read the folder that you have mounted.

    Can you post the launch command you used?

  11. piiq commented on Sep 14, 2025

    @piiq
    Owner

    Also, was there any error in the logs when you tried calling the llm?

  12. fenglingR commented on Sep 15, 2025

    @fenglingR
    Author

    @fenglingR

    这

     File "<frozen os>", line 225, in makedirs
    PermissionError: [Errno 13] Permission denied: '/data'
    

    意味着该机器人没有权限读取您已挂载的文件夹。

    您可以发布您使用的启动命令吗?

    I checked my deployment command, and it was a problem with the command for the file path of the persistent storage that caused a lack of permissions. But when calling the LLM, no command was sent and there was no error reported. It only reported the following error on the front end:

    An error has occurred.
    
    I couldn't process your request at the moment. Would you like to try another question?
    
  13. piiq commented on Sep 16, 2025

    @piiq
    Owner

    Hey @fenglingR

    I've added configuration validation on application startup in this PR #7

    The new docker image has been published. When you use the new version at startup the app will check if the API keys that you have provided are valid. Once you run - can you paste the startup logs? This might give us an understanding of what's wrong with the LLM connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions