[halo-dev/halo]使用docker-compose初次部署,无法加载默认插件

2024-04-02 443 views
0
是什么版本出现了此问题?

2.7

使用的什么数据库?

MySQL 8.x

使用的哪种方式部署?

Docker Compose

在线站点地址

sopp.top

发生了什么?

您好,我使用官网的docker-compose的mysql示例,构建halo的容器环境,初次运行,就会出现这个错误。错误信息为: 500 Server Error for HTTP POST "/apis/api.console.halo.run/v1alpha1/plugins/install", 这个时候,仍然可以正常运行,比如这个时候,我进行安装主题的操作,也是正确的。 然后完成过后,我将docker容器关闭,使用docker-compose down的命令来关闭并删除,mysql的对应数据也已经保存到mysql数据库表中,但是当我下一次启动的时候,会报错说找不到对应插件。 例如这种错误信息: run.halo.app.core.extension.reconciler.PluginReconciler$DoNotRetryException: Plugin PluginCommentWidget not found in plugin manager

相关日志输出
run.halo.app.core.extension.reconciler.PluginReconciler$DoNotRetryException: Plugin PluginCommentWidget not found in plugin manager.
    at run.halo.app.core.extension.reconciler.PluginReconciler.getPluginWrapper(PluginReconciler.java:370) ~[classes/:2.7.0]
    at run.halo.app.core.extension.reconciler.PluginReconciler.lambda$readinessDetection$3(PluginReconciler.java:149) ~[classes/:2.7.0]
    at java.base/java.util.Optional.map(Unknown Source) ~[na:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.readinessDetection(PluginReconciler.java:138) ~[classes/:2.7.0]
    at run.halo.app.core.extension.reconciler.PluginReconciler.lambda$reconcile$0(PluginReconciler.java:101) ~[classes/:2.7.0]
    at java.base/java.util.Optional.map(Unknown Source) ~[na:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:93) ~[classes/:2.7.0]
    at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:75) ~[classes/:2.7.0]
    at run.halo.app.extension.controller.DefaultController$Worker.run(DefaultController.java:163) ~[api-2.7.0.jar:na]
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[na:na]
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
    at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]

2023-07-16T17:38:02.115+08:00 ERROR 6 --- [nReconciler-t-1] r.h.a.c.e.reconciler.PluginReconciler    : Failed to reconcile plugin: [PluginSitemap]

run.halo.app.core.extension.reconciler.PluginReconciler$DoNotRetryException: Plugin PluginSitemap not found in plugin manager.
    at run.halo.app.core.extension.reconciler.PluginReconciler.getPluginWrapper(PluginReconciler.java:370) ~[classes/:2.7.0]
    at run.halo.app.core.extension.reconciler.PluginReconciler.lambda$readinessDetection$3(PluginReconciler.java:149) ~[classes/:2.7.0]
    at java.base/java.util.Optional.map(Unknown Source) ~[na:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.readinessDetection(PluginReconciler.java:138) ~[classes/:2.7.0]
    at run.halo.app.core.extension.reconciler.PluginReconciler.lambda$reconcile$0(PluginReconciler.java:101) ~[classes/:2.7.0]
    at java.base/java.util.Optional.map(Unknown Source) ~[na:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:93) ~[classes/:2.7.0]
    at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:75) ~[classes/:2.7.0]
    at run.halo.app.extension.controller.DefaultController$Worker.run(DefaultController.java:163) ~[api-2.7.0.jar:na]
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[na:na]
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
    at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]

2023-07-16T17:38:02.280+08:00 ERROR 6 --- [nReconciler-t-1] r.h.a.c.e.reconciler.PluginReconciler    : Failed to reconcile plugin: [PluginSearchWidget]

run.halo.app.core.extension.reconciler.PluginReconciler$DoNotRetryException: Plugin PluginSearchWidget not found in plugin manager.
    at run.halo.app.core.extension.reconciler.PluginReconciler.getPluginWrapper(PluginReconciler.java:370) ~[classes/:2.7.0]
    at run.halo.app.core.extension.reconciler.PluginReconciler.lambda$readinessDetection$3(PluginReconciler.java:149) ~[classes/:2.7.0]
    at java.base/java.util.Optional.map(Unknown Source) ~[na:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.readinessDetection(PluginReconciler.java:138) ~[classes/:2.7.0]
    at run.halo.app.core.extension.reconciler.PluginReconciler.lambda$reconcile$0(PluginReconciler.java:101) ~[classes/:2.7.0]
    at java.base/java.util.Optional.map(Unknown Source) ~[na:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:93) ~[classes/:2.7.0]
    at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:75) ~[classes/:2.7.0]
    at run.halo.app.extension.controller.DefaultController$Worker.run(DefaultController.java:163) ~[api-2.7.0.jar:na]
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[na:na]
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
    at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]

2023-07-16T17:38:02.378+08:00 ERROR 6 --- [nReconciler-t-1] r.h.a.c.e.reconciler.PluginReconciler    : Failed to reconcile plugin: [PluginFeed]

run.halo.app.core.extension.reconciler.PluginReconciler$DoNotRetryException: Plugin PluginFeed not found in plugin manager.
    at run.halo.app.core.extension.reconciler.PluginReconciler.getPluginWrapper(PluginReconciler.java:370) ~[classes/:2.7.0]
    at run.halo.app.core.extension.reconciler.PluginReconciler.lookupPluginSetting(PluginReconciler.java:177) ~[classes/:2.7.0]
    at run.halo.app.core.extension.reconciler.PluginReconciler.waitForSettingCreation(PluginReconciler.java:216) ~[classes/:2.7.0]
    at run.halo.app.core.extension.reconciler.PluginReconciler.lambda$readinessDetection$3(PluginReconciler.java:139) ~[classes/:2.7.0]
    at java.base/java.util.Optional.map(Unknown Source) ~[na:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.readinessDetection(PluginReconciler.java:138) ~[classes/:2.7.0]
    at run.halo.app.core.extension.reconciler.PluginReconciler.lambda$reconcile$0(PluginReconciler.java:101) ~[classes/:2.7.0]
    at java.base/java.util.Optional.map(Unknown Source) ~[na:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:93) ~[classes/:2.7.0]
    at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:75) ~[classes/:2.7.0]
    at run.halo.app.extension.controller.DefaultController$Worker.run(DefaultController.java:163) ~[api-2.7.0.jar:na]
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[na:na]
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
    at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]

回答

7

查阅issue的时候发现,和 #3893 很像,同时查看了修复日志,也发现,据说在2.5版本已经修复了,但是2.7又出现了,上报附加的报错信息,是第一说明中的第二个错,第一个错是容器第一次运行的时候出现的,那个信息没有截图了。

8

补充说明: 系统版本: Centos7.9 docker版本为:23.0.5 docker-compose版本为:v2.10.2,谢谢。

3

我试了一下并没有复现,你可以提供一个可以复现的配置吗,我使用的配置如下:

version: "3"

services:
  halo:
    image: halohub/halo:2.7
    container_name: halo
    restart: on-failure:3
    depends_on:
      halodb:
        condition: service_healthy
    networks:
      halo_network:
    volumes:
      - ./:/root/.halo2
    ports:
      - "8090:8090"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8090/actuator/health/readiness"]
      interval: 30s
      timeout: 5s
      retries: 5
      start_period: 30s
    command:
      - --spring.r2dbc.url=r2dbc:pool:mysql://halodb:3306/halo
      - --spring.r2dbc.username=root
      # MySQL 的密码,请保证与下方 MYSQL_ROOT_PASSWORD 的变量值一致。
      - --spring.r2dbc.password=o#DwN&JSa56
      - --spring.sql.init.platform=mysql
      # 外部访问地址,请根据实际需要修改
      - --halo.external-url=http://localhost:8090/
      # 初始化的超级管理员用户名
      - --halo.security.initializer.superadminusername=admin
      # 初始化的超级管理员密码
      - --halo.security.initializer.superadminpassword=P@88w0rd

  halodb:
    image: mysql:8.0.31
    container_name: halodb
    restart: on-failure:3
    networks:
      halo_network:
    command: 
      - --default-authentication-plugin=mysql_native_password
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_general_ci
      - --explicit_defaults_for_timestamp=true
    volumes:
      - ./mysql:/var/lib/mysql
      - ./mysqlBackup:/data/mysqlBackup
    ports:
      - "3306:3306"
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
      interval: 3s
      retries: 5
      start_period: 30s
    environment:
      # 请修改此密码,并对应修改上方 Halo 服务的 SPRING_R2DBC_PASSWORD 变量值
      - MYSQL_ROOT_PASSWORD=o#DwN&JSa56
      - MYSQL_DATABASE=halo

networks:
  halo_network:

docker compose up -d 启动后 halo 的账户密码为:

admin
P@88w0rd
9

您好,是这个内容,您试试呢?我刚才重新构建了一次,这次按照我的描述内容是可以启动了,只是会显示插件的状态为错误的,就显示红色的状态。 其他暂时未发现异常~

version: '3.9'
services:
  halo:
    image: halohub/halo:2.7
    container_name: halo
    restart: on-failure:3
    privileged: true
    depends_on:
      halodb:
        condition: service_healthy
    volumes:
      - ./halo:/root/.halo
    ports:
      - "8090:8090"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8090/actuator/health/readiness"]
      interval: 30s
      timeout: 5s
      retries: 5
      start_period: 30s
    command:
      - --spring.r2dbc.url=r2dbc:pool:mysql://halodb:3306/halo
      - --spring.r2dbc.username=root
      # MySQL 的密码,请保证与下方 MYSQL_ROOT_PASSWORD 的变量值一致。
      - --spring.r2dbc.password=wwe!WE&2W52
      - --spring.sql.init.platform=mysql
      # 外部访问地址,请根据实际需要修改
      - --halo.external-url=https://sopp.top/
      # 初始化的超级管理员用户名
      - --halo.security.initializer.superadminusername=admin
      # 初始化的超级管理员密码
      - --halo.security.initializer.superadminpassword=wwe!WE&2W52
  halodb:
    image: mysql:8.0.31
    container_name: halodb
    privileged: true
    restart: on-failure:3
    command: 
      - --default-authentication-plugin=mysql_native_password
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_general_ci
      - --explicit_defaults_for_timestamp=true
    volumes:
      - ./mysql:/var/lib/mysql
      - ./mysqlBackup:/data/mysqlBackup
    ports:
      - "3306:3306"
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
      interval: 3s
      retries: 5
      start_period: 30s
    environment:
      # 请修改此密码,并对应修改上方 Halo 服务的 SPRING_R2DBC_PASSWORD 变量值
      - MYSQL_ROOT_PASSWORD=wwe!WE&2W52
      - MYSQL_DATABASE=halo
  nginx:
    restart: always
    image: nginx:stable-alpine
    container_name: nginx
    privileged: true
    environment:
      - TZ=Asia/Shanghai 
    ports:
      - "80:80"
      - "443:443"
    links:
      - halo
    depends_on:
      - halo
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./nginx/config:/etc/nginx/conf.d
      - ./nginx/log:/var/log/nginx
      - ./nginx/cert/:/halo/nginx/cert
8

我不知道是不是linux存在缓存问题导致的?我之前这么构建,本身的docker-compose文件夹下有一个mysql文件夹,我每次都是删除了里面所有内容重新构建的,但是好几次出现第二次启动直接就无法访问了。

6

谢谢,我重新验证了一下,确实是这个路径的问题,辛苦~