chiachan
chiachan
Published on 2025-03-12 / 11 Visits
0

使用docker-compose部署halo及liveapi看板娘

使用docker-compose部署halo及liveapi看板娘

  1. 数据存储方式有哪几种?

这里我选用了mysql作为数据存储,可以参考官方文档,替换成其他方式

  1. 为什么要自建live2d-api

近期发现live-api介入了jsdelivr cdn,但是使用中出现了跨域问题,等了好几个月没见更新,所以决定本地部署

目录说明

  • halo
    • docker-compose.yaml
    • halo2
    • live2d
      • live2d # 即https://github.com/fghrsh/live2d_api
    • mysql
    • mysqlBackup
    • wordmark.svg # 替换icon(可选)

live2d插件

  • 将 https://github.com/fghrsh/live2d_api 拉到live2d 并改名成live2d

    cd live2d
    git clone [email protected]:fghrsh/live2d_api.git
    mv live2d_api live2d
    # 由于权限问题,需要授权用户
    sudo chown -R nobody:101 live2d/
    
  • 然后到插件/live2d 看板娘/接口设置 修改Live2d 模型地址 为 https://www.xxx.com/live2d/

docker-compose.yaml

version: "3"

services:
  halo:
    image: halohub/halo:2.20.16
    restart: always
    depends_on:
      halodb:
        condition: service_healthy
    networks:
      halo_network:
    volumes:
      - ./halo2:/root/.halo2
      - ./wordmark.svg:/application/BOOT-INF/classes/static/images/wordmark.svg
    ports:
      - "8090:8090"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8090/actuator/health/readiness"]
      interval: 30s
      timeout: 5s
      retries: 5
      start_period: 30s
    environment:
      - JVM_OPTS=-Xmx256m -Xms256m
    command:
      - --spring.r2dbc.url=r2dbc:pool:mysql://halodb:3306/halo
      - --spring.r2dbc.username=root
      - --spring.r2dbc.password=123456
      - --spring.sql.init.platform=mysql
      - --halo.external-url=https://www.3yfist.com/

  halodb:
    image: mysql:8.1.0
    restart: always
    networks:
      halo_network:
    command:
      - --default-authentication-plugin=caching_sha2_password
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_general_ci
      - --explicit_defaults_for_timestamp=true
    volumes:
      - ./mysql:/var/lib/mysql
      - ./mysqlBackup:/data/mysqlBackup
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
      interval: 3s
      retries: 5
      start_period: 30s
    environment:
      - MYSQL_ROOT_PASSWORD=123456
      - MYSQL_DATABASE=halo

  live2d:
    image: trafex/php-nginx:3.8.0
    container_name: live2d
    networks:
        halo_network:
    volumes:
        - ./live2d/:/var/www/html/
networks:
  halo_network:

参考文献