lss233 / chatgpt-mirai-qq-bot

🚀 一键部署!真正的 AI 聊天机器人!支持ChatGPT、文心一言、讯飞星火、Bing、Bard、ChatGLM、POE,多账号,人设调教,虚拟女仆、图片渲染、语音发送 | 支持 QQ、Telegram、Discord、微信 等平台
GNU Affero General Public License v3.0
13.43k stars 1.57k forks source link

docker-compose启动mcl时报错 #16

Closed Pil0tXia closed 1 year ago

Pil0tXia commented 1 year ago

通过 Docker Compose 部署的 使用的是apt安装的docker-compose 首先,运行sudo docker-compose run mirai时(看到你刚刚在中间加了个横杠lol)有一个这样的错误,我自行解决了:

Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/home/azure_root/chatgpt-mirai-qq-bot/mirai/config.json" to rootfs at "/mirai/config.json": mount /home/azure_root/chatgpt-mirai-qq-bot/mirai/config.json:/mirai/config.json (via /proc/self/fd/7), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

原因是部署时~/chatgpt-mirai-qq-bot/mirai/config.json错误的创建为了文件夹,而非mcl-installer的config.json。替换后解决。 但是再次run时出现以下错误:

2022-12-10 09:09:32 I/main: Backend: version 2.13.2, built on 2022-12-04 17:50:53.
2022-12-10 09:09:32 I/main: Frontend Terminal: version 2.13.2, provided by Mamoe Technologies
2022-12-10 09:09:32 I/main: Welcome to visit https://mirai.mamoe.net/
2022-12-10 09:09:33 W/stderr: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
2022-12-10 09:09:33 W/stderr: SLF4J: Defaulting to no-operation (NOP) logger implementation
2022-12-10 09:09:33 W/stderr: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2022-12-10 09:09:34 I/plugin: Successfully loaded plugin net.mamoe.mirai-api-http v2.6.2
2022-12-10 09:09:34 I/plugin: Successfully loaded plugin Chat Command v0.5.0
2022-12-10 09:09:34 I/plugin: Successfully loaded plugin net.mamoe.mirai-api-http v2.6.2
2022-12-10 09:09:34 I/plugin: Successfully loaded plugin MCL Addon v2.1.1
2022-12-10 09:09:35 I/main: Prepared built-in commands: autoLogin, help, login, logout, permission, status, stop
2022-12-10 09:09:35 I/Mirai HTTP API: ********************************************************
2022-12-10 09:09:35 W/stderr: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
2022-12-10 09:09:35 W/stderr: SLF4J: Defaulting to no-operation (NOP) logger implementation
2022-12-10 09:09:35 W/stderr: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2022-12-10 09:09:36 E/net.mamoe.mirai-api-http: kotlinx.coroutines.JobCancellationException: LazyStandaloneCoroutine is cancelling; job=LazyStandaloneCoroutine{Cancelling}@28f154cc
kotlinx.coroutines.JobCancellationException: LazyStandaloneCoroutine is cancelling; job=LazyStandaloneCoroutine{Cancelling}@28f154cc
Caused by: java.net.SocketException: Unresolved address
        at java.base/sun.nio.ch.Net.translateToSocketException(Unknown Source)
        at java.base/sun.nio.ch.Net.translateException(Unknown Source)
        at java.base/sun.nio.ch.Net.translateException(Unknown Source)
        at java.base/sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
        at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.ConnectUtilsJvmKt.bind(ConnectUtilsJvm.kt:32)
        at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.TcpSocketBuilder.bind(TcpSocketBuilder.kt:46)
        at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.TcpSocketBuilder.bind(TcpSocketBuilder.kt:30)
        at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.TcpSocketBuilder.bind$default(TcpSocketBuilder.kt:26)
        at mirai-api-http-v2.6.2.jar[shared]//io.ktor.server.cio.backend.HttpServerKt$httpServer$acceptJob$1.invokeSuspend(HttpServer.kt:46)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Caused by: java.nio.channels.UnresolvedAddressException
        at java.base/sun.nio.ch.Net.checkAddress(Unknown Source)
        at java.base/sun.nio.ch.Net.checkAddress(Unknown Source)
        at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(Unknown Source)
        at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
        ... 12 more

2022-12-10 09:09:36 E/MahKtorAdapter[http,ws]: java.net.SocketException: Unresolved address
java.net.SocketException: Unresolved address
        at java.base/sun.nio.ch.Net.translateToSocketException(Unknown Source)
        at java.base/sun.nio.ch.Net.translateException(Unknown Source)
        at java.base/sun.nio.ch.Net.translateException(Unknown Source)
        at java.base/sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
        at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.ConnectUtilsJvmKt.bind(ConnectUtilsJvm.kt:32)
        at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.TcpSocketBuilder.bind(TcpSocketBuilder.kt:46)
        at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.TcpSocketBuilder.bind(TcpSocketBuilder.kt:30)
        at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.TcpSocketBuilder.bind$default(TcpSocketBuilder.kt:26)
        at mirai-api-http-v2.6.2.jar[shared]//io.ktor.server.cio.backend.HttpServerKt$httpServer$acceptJob$1.invokeSuspend(HttpServer.kt:46)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Caused by: java.nio.channels.UnresolvedAddressException
        at java.base/sun.nio.ch.Net.checkAddress(Unknown Source)
        at java.base/sun.nio.ch.Net.checkAddress(Unknown Source)
        at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(Unknown Source)
        at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
        ... 12 more

2022-12-10 09:09:36 E/main: Failed to init MiraiConsole.
net.mamoe.mirai.console.plugin.loader.PluginLoadException: Exception while enabling net.mamoe.mirai-api-http
        at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.enable(BuiltInJvmPluginLoaderImpl.kt:311)
        at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.enable(BuiltInJvmPluginLoaderImpl.kt:35)
        at net.mamoe.mirai.console.plugin.jvm.JvmPluginLoader$BuiltIn.enable(JvmPluginLoader.kt)
        at net.mamoe.mirai.console.plugin.jvm.JvmPluginLoader$BuiltIn.enable(JvmPluginLoader.kt:50)
        at net.mamoe.mirai.console.plugin.PluginManager.enablePlugin(PluginManager.kt:173)
        at net.mamoe.mirai.console.internal.plugin.PluginManagerImpl.enableAllLoadedPlugins$mirai_console(PluginManagerImpl.kt:175)
        at net.mamoe.mirai.console.internal.MiraiConsoleImplementationBridge.doStart$mirai_console(MiraiConsoleImplementationBridge.kt:336)
        at net.mamoe.mirai.console.MiraiConsoleImplementation$Companion.start(MiraiConsoleImplementation.kt:508)
        at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.startAsDaemon(MiraiConsoleTerminalLoader.kt:177)
        at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.startAsDaemon$default(MiraiConsoleTerminalLoader.kt:176)
        at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.main(MiraiConsoleTerminalLoader.kt:54)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.itxtech.mcl.Utility.bootJars(Utility.java:86)
        at org.itxtech.mcl.Utility.bootJars(Utility.java:76)
        at org.itxtech.mcl.Utility.bootMirai(Utility.java:98)
        at org.itxtech.mcl.module.builtin.Boot.boot(Boot.java:113)
        at org.itxtech.mcl.module.ModuleManager.phaseBoot(ModuleManager.java:123)
        at org.itxtech.mcl.Loader.lambda$start$4(Loader.java:196)
        at org.itxtech.mcl.Loader.tryCatching(Loader.java:151)
        at org.itxtech.mcl.Loader.start(Loader.java:196)
        at org.itxtech.mcl.Loader.main(Loader.java:84)
Caused by: net.mamoe.mirai.console.permission.PermissionRegistryConflictException: Conflicting Permission registry. new: PermissionImpl(id=net.mamoe.mirai-api-http:*, description='The base permission', parent=PermissionImpl(id=*:*, description='The root permission', parent=<self>)), existing: PermissionImpl(id=net.mamoe.mirai-api-http:*, description='The base permission', parent=PermissionImpl(id=*:*, description='The root permission', parent=<self>))
        at net.mamoe.mirai.console.internal.permission.AbstractConcurrentPermissionService.register(AbstractConcurrentPermissionService.kt:29)
        at net.mamoe.mirai.console.permission.PermissionService.register$default(PermissionService.kt:101)
        at net.mamoe.mirai.console.internal.plugin.JvmPluginInternal$parentPermission$2.invoke(JvmPluginInternal.kt:52)
        at net.mamoe.mirai.console.internal.plugin.JvmPluginInternal$parentPermission$2.invoke(JvmPluginInternal.kt:51)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at net.mamoe.mirai.console.internal.plugin.JvmPluginInternal.getParentPermission(JvmPluginInternal.kt:51)
        at net.mamoe.mirai.console.internal.plugin.JvmPluginInternal.internalOnEnable$mirai_console(JvmPluginInternal.kt:126)
        at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.enable(BuiltInJvmPluginLoaderImpl.kt:305)
        ... 23 more

请问该如何解决?

lss233 commented 1 year ago

如果你在教程的第4步,

第一个报错 Unresolved address 不用管。

第二个报错是因为加载了两个 mirai-http-api 插件。 检查下 mirai/plugins 目录下面是不是有两个,或者是不是你在你 mirai/config.json 里面放了 mirai-http-api 插件。

Pil0tXia commented 1 year ago

我在使用docker compose之前,按照 https://github.com/project-mirai/mirai-api-http 部署过mirai-api-http和mcl,没有放在同一个目录

Pil0tXia commented 1 year ago

mirai/config.json:

{
  "module_packages": [
    "mcl:org.itxtech.mcl.module.builtin"
  ],
  "mirai_repo": "https://repo.mirai.mamoe.net/keep/mcl",
  "maven_repo": [
    "https://maven.aliyun.com/repository/public"
  ],
  "packages": {
    "net.mamoe:mirai-console": {
      "channel": "maven-stable",
      "version": "2.13.2",
      "type": "libs",
      "versionLocked": false
    },
    "net.mamoe:mirai-console-terminal": {
      "channel": "maven-stable",
      "version": "2.13.2",
      "type": "libs",
      "versionLocked": false
    },
    "net.mamoe:mirai-core-all": {
      "channel": "maven-stable",
      "version": "2.13.2",
      "type": "libs",
      "versionLocked": false
    },
    "org.itxtech:mcl-addon": {
      "channel": "maven-stable",
      "version": "2.1.1",
      "type": "plugins",
      "versionLocked": false
    },
    "net.mamoe:mirai-api-http": {
      "channel": "stable-v2",
      "version": "2.6.2",
      "type": "plugins",
      "versionLocked": false
    }
  },
  "archiveSuffix": [
    ".zip",
    ".mirai2.jar",
    ".mirai.jar",
    "-all.jar",
    ".jar"
  ],
  "disabled_modules": [],
  "proxy": "",
  "log_level": 1,
  "modules_props": {}
}

并没有两个mirai-api-http 此外我并没有找到mirai/plugins,只有mirai/plugin-libraries,里面似乎是一些第三方库

lss233 commented 1 year ago

如果你自己部署过 mirai 和 mirai-http-api, 那就不需要 使用 Docker-Compose 来启动了,因为 这个方案里面也会带一个 含有 mirai-http-api 的 mirai。 你可以直接用 Docker 启动

Pil0tXia commented 1 year ago

我一开始就是在自己部署的Mirai的基础上,直接用 Docker 启动的。但是遇到了问题,https://github.com/lss233/chatgpt-mirai-qq-bot/issues/17

Pil0tXia commented 1 year ago

目前 mirai-api-http + mirai-chatgpt-bot 运行良好。之前部署的mirai-api-http在另一个文件夹,没有运行时应该是不会干扰docker-compose中的mirai的吧。我没有继续尝试docker-compose了。