Giter VIP home page Giter VIP logo

wangwangbot's Issues

如果服务器上的Docker没有启动会报错

File "/usr/local/Caskroom/miniconda/base/envs/aio/lib/python3.9/site-packages/aiogram/dispatcher/dispatcher.py", line 417, in _process_polling_updates
for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
│ │ │ │ │ │ └ True
│ │ │ │ │ └ [<aiogram.types.update.Update object at 0x7f82a949adf0>]
│ │ │ │ └ <function Dispatcher.process_updates at 0x7f82a839a5e0>
│ │ │ └ <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7f82a87ddee0>
│ │ └ <method 'from_iterable' of 'itertools.chain' objects>
│ └ <class 'itertools.chain'>
└ <module 'itertools' (built-in)>
File "/usr/local/Caskroom/miniconda/base/envs/aio/lib/python3.9/site-packages/aiogram/dispatcher/dispatcher.py", line 238, in process_updates
return await asyncio.gather(*tasks)
│ │ └ [<coroutine object Handler.notify at 0x7f82a963c640>]
│ └ <function gather at 0x7f82a6a11700>
└ <module 'asyncio' from '/usr/local/Caskroom/miniconda/base/envs/aio/lib/python3.9/asyncio/init.py'>
File "/usr/local/Caskroom/miniconda/base/envs/aio/lib/python3.9/site-packages/aiogram/dispatcher/handler.py", line 116, in notify
response = await handler_obj.handler(*args, **partial_data)
│ │ │ └ {}
│ │ └ (<aiogram.types.update.Update object at 0x7f82a949adf0>,)
│ └ <bound method Dispatcher.process_update of <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7f82a87ddee0>>
└ Handler.HandlerObj(handler=<bound method Dispatcher.process_update of <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7...
File "/usr/local/Caskroom/miniconda/base/envs/aio/lib/python3.9/site-packages/aiogram/dispatcher/dispatcher.py", line 259, in process_update
return await self.message_handlers.notify(update.message)
│ │ │ │ └ <aiogram.types.fields.Field object at 0x7f82a82bf340>
│ │ │ └ <aiogram.types.update.Update object at 0x7f82a949adf0>
│ │ └ <function Handler.notify at 0x7f82a836e160>
│ └ <aiogram.dispatcher.handler.Handler object at 0x7f82a88094f0>
└ <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7f82a87ddee0>
File "/usr/local/Caskroom/miniconda/base/envs/aio/lib/python3.9/site-packages/aiogram/dispatcher/handler.py", line 116, in notify
response = await handler_obj.handler(*args, **partial_data)
│ │ │ └ {}
│ │ └ (<aiogram.types.message.Message object at 0x7f82a96588e0>,)
│ └ <function admin_command at 0x7f82a96411f0>
└ Handler.HandlerObj(handler=<function admin_command at 0x7f82a96411f0>, spec=FullArgSpec(args=['message'], varargs=None, varkw...

File "/Users/hd/work/WangWangBot/WangWangBot/handlers/users/admin.py", line 25, in admin_command
msg, reply_markup = get_top_services_msg()
└ <function get_top_services_msg at 0x7f82a8b75550>

File "/Users/hd/work/WangWangBot/WangWangBot/handlers/users/admin.py", line 14, in get_top_services_msg
services = docker.check_dir_service_list(Config.DOCKER_COMPOSE_DIR)
│ │ │ └ '/Users/hd/work/WangWangBot/'
│ │ └ <class 'WangWangBot.config.Config'>
│ └ <function check_dir_service_list at 0x7f82a963aa60>
└ <module 'WangWangBot.utils.docker' from '/Users/hd/work/WangWangBot/WangWangBot/utils/docker.py'>

File "/Users/hd/work/WangWangBot/WangWangBot/utils/docker.py", line 101, in check_dir_service_list
project = get_project(
└ <function get_project at 0x7f82a963a1f0>

File "/usr/local/Caskroom/miniconda/base/envs/aio/lib/python3.9/site-packages/compose/cli/command.py", line 152, in get_project
client = get_client(
└ <function get_client at 0x7f82a9634ca0>
File "/usr/local/Caskroom/miniconda/base/envs/aio/lib/python3.9/site-packages/compose/cli/docker_client.py", line 41, in get_client
client = docker_client(
└ <function docker_client at 0x7f82a9634e50>
File "/usr/local/Caskroom/miniconda/base/envs/aio/lib/python3.9/site-packages/compose/cli/docker_client.py", line 170, in docker_client
client = APIClient(use_ssh_client=not use_paramiko_ssh, **kwargs)
│ │ └ {'base_url': 'unix:///var/run/docker.sock', 'timeout': 60, 'user_agent': 'docker-compose/1.29.2 docker-py/5.0.0 Darwin/20.6.0'}
│ └ 0
└ <class 'docker.api.client.APIClient'>
File "/usr/local/Caskroom/miniconda/base/envs/aio/lib/python3.9/site-packages/docker/api/client.py", line 197, in init
self._version = self._retrieve_server_version()
│ │ └ <function APIClient._retrieve_server_version at 0x7f82a9298940>
│ └ <docker.api.client.APIClient object at 0x7f82a9658b80>
└ <docker.api.client.APIClient object at 0x7f82a9658b80>
File "/usr/local/Caskroom/miniconda/base/envs/aio/lib/python3.9/site-packages/docker/api/client.py", line 221, in _retrieve_server_version
raise DockerException(
└ <class 'docker.errors.DockerException'>

docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

使用docker运行bot出错

使用的docker命令:
docker run -d --name=wangwangbot --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /root/wangwangbot/data:/data --env-file local.env hdcola/wangwangbot

/root/wangwangbot/local.env文件内容如下:
BOT_TOKEN=我的bot token
ADMINS=我的id

对bot发送/admin发现没有反应,但是发送/start和/help有回应

使用tail /root/wangwangbot/logs/wangwangbot.log 查到以下内容

日志错误信息如下:
compose.config.errors.ComposeFileNotFound:
Can't find a suitable configuration file in this directory or any
parent. Are you in the right directory?

    Supported filenames: docker-compose.yml, docker-compose.yaml, compose.yml, compose.yaml

2021-08-22 01:10:56.357 | ERROR | aiogram.utils.executor:start_polling:323 - Task exception was never retrieved
future: <Task finished name='Task-24' coro=<Dispatcher._process_polling_updates() done, defined at /usr/local/lib/python3.9/site-packages/aiogram/dispatcher/dispatcher.py:409> exception=ComposeFileNotFound(['docker-compose.yml', 'docker-compose.yaml', 'compose.yml', 'compose.yaml'])>
Traceback (most recent call last):

File "/usr/local/lib/python3.9/site-packages/aiogram/dispatcher/dispatcher.py", line 417, in _process_polling_updates
for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
│ │ │ │ │ │ └ True
│ │ │ │ │ └ [<aiogram.types.update.Update object at 0x7f6922d849a0>]
│ │ │ │ └ <function Dispatcher.process_updates at 0x7f692165d160>
│ │ │ └ <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7f6920e70c70>
│ │ └ <method 'from_iterable' of 'itertools.chain' objects>
│ └ <class 'itertools.chain'>
└ <module 'itertools' (built-in)>
File "/usr/local/lib/python3.9/site-packages/aiogram/dispatcher/dispatcher.py", line 238, in process_updates
return await asyncio.gather(*tasks)
│ │ └ [<coroutine object Handler.notify at 0x7f691f8b5d40>]
│ └ <function gather at 0x7f69232258b0>
└ <module 'asyncio' from '/usr/local/lib/python3.9/asyncio/init.py'>
File "/usr/local/lib/python3.9/site-packages/aiogram/dispatcher/handler.py", line 116, in notify
response = await handler_obj.handler(*args, **partial_data)
│ │ │ └ {}
│ │ └ (<aiogram.types.update.Update object at 0x7f6922d849a0>,)
│ └ <bound method Dispatcher.process_update of <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7f6920e70c70>>
└ Handler.HandlerObj(handler=<bound method Dispatcher.process_update of <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7...
File "/usr/local/lib/python3.9/site-packages/aiogram/dispatcher/dispatcher.py", line 259, in process_update
return await self.message_handlers.notify(update.message)
│ │ │ │ └ <aiogram.types.fields.Field object at 0x7f692177aac0>
│ │ │ └ <aiogram.types.update.Update object at 0x7f6922d849a0>
│ │ └ <function Handler.notify at 0x7f692169ea60>
│ └ <aiogram.dispatcher.handler.Handler object at 0x7f6920e705e0>
└ <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7f6920e70c70>
File "/usr/local/lib/python3.9/site-packages/aiogram/dispatcher/handler.py", line 116, in notify
response = await handler_obj.handler(*args, **partial_data)
│ │ │ └ {}
│ │ └ (<aiogram.types.message.Message object at 0x7f6922d84190>,)
│ └ <function admin_command at 0x7f691f8cab80>
└ Handler.HandlerObj(handler=<function admin_command at 0x7f691f8cab80>, spec=FullArgSpec(args=['message'], varargs=None, varkw...

File "/WangWangBot/WangWangBot/handlers/users/admin.py", line 23, in admin_command
msg, reply_markup = get_top_services_msg()
└ <function get_top_services_msg at 0x7f6922de93a0>

File "/WangWangBot/WangWangBot/handlers/users/admin.py", line 13, in get_top_services_msg
services = docker.check_dir_service_list(Config.DOCKER_COMPOSE_DIR)
│ │ │ └ '/data/'
│ │ └ <class 'WangWangBot.config.Config'>
│ └ <function check_dir_service_list at 0x7f691f8ca550>
└ <module 'WangWangBot.utils.docker' from '/WangWangBot/WangWangBot/utils/docker.py'>

File "/WangWangBot/WangWangBot/utils/docker.py", line 101, in check_dir_service_list
project = get_project(
└ <function get_project at 0x7f691f8c6ca0>

File "/usr/local/lib/python3.9/site-packages/compose/cli/command.py", line 144, in get_project
config_details = config.find(project_dir, config_path, environment, override_dir)
│ │ │ │ │ └ None
│ │ │ │ └ {'PATH': '/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'HOSTNAME': 'f7410364dcb6', 'BOT_TOKE...
│ │ │ └ None
│ │ └ '/data'
│ └ <function find at 0x7f691ff6a4c0>
└ <module 'compose.config' from '/usr/local/lib/python3.9/site-packages/compose/config/init.py'>
File "/usr/local/lib/python3.9/site-packages/compose/config/config.py", line 320, in find
raise ComposeFileNotFound(SUPPORTED_FILENAMES)
│ └ ['docker-compose.yml', 'docker-compose.yaml', 'compose.yml', 'compose.yaml']
└ <class 'compose.config.errors.ComposeFileNotFound'>

compose.config.errors.ComposeFileNotFound:
Can't find a suitable configuration file in this directory or any
parent. Are you in the right directory?

    Supported filenames: docker-compose.yml, docker-compose.yaml, compose.yml, compose.yaml

Snipaste_2021-08-22_09-37-37

支持docker images指令

运行一段时间后,会产生tag为的image,所以加入docker images来查看

docker image ls

还需要支持

docker image prune 来清除没有需要的image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.