hdcodepractice / wangwangbot Goto Github PK
View Code? Open in Web Editor NEW汪汪Bot是一个Telegram Bot,用于帮助你管理一台服务器上的Docker
License: MIT License
汪汪Bot是一个Telegram Bot,用于帮助你管理一台服务器上的Docker
License: MIT License
docker-compose pull
ERROR: Couldn't find env file: /home/xxx/xxxbot/local.env
这是 #13 里提出的,先把README.md中相关文档加上说明
能操作单独的service
使用的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
省得自己手输入一条一条的指令了
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'))
运行一段时间后,会产生tag为的image,所以加入docker images来查看
docker image ls
还需要支持
docker image prune 来清除没有需要的image
不知道是不是docker-compose内部的API没有调对呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.