侧边栏壁纸
博主头像
进一步,海阔天空 博主等级

进一步,海阔天空

  • 累计撰写 140 篇文章
  • 累计创建 19 个标签
  • 累计收到 7 条评论

目 录CONTENT

文章目录

Docker Compose部署seafile服务器并安装onlyoffice插件

海阔天空
2022-05-28 / 0 评论 / 0 点赞 / 882 阅读 / 0 字
  • 首先安装docker和docker-compose,这是就不必说了。
  • 在官网下载seafile的docker-compose.yaml文件,但是官网的docker-compose文件有两个地方要优化一下,一是没有对数据库的启动状态做检查,这样当数据库服务虽然启动了,但是还没有达到健康状态时,seafile访问就会出现502错误。二是没有集成word在线编辑插件。我们这里把这两个都补上了,大家可以拿着去用,不谢。
version: '3.0'
services:
  db:
    restart: always
    image: mariadb:10.6
    container_name: seafile-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=xxx  # Requested, set the root's password of MySQL service.
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - /disk_data0/seafile/seafile-mysql/db:/var/lib/mysql  # Requested, specifies the path to MySQL data persistent store.
    networks:
      - seafile-net
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      timeout: 20s
      retries: 10
  memcached:
    restart: always
    image: memcached:1.6.18
    container_name: seafile-memcached
    entrypoint: memcached -m 256
    depends_on:
      db:
        condition: service_healthy
    networks:
      - seafile-net

  seafile:
    restart: always
    image: seafileltd/seafile-mc:latest
    container_name: seafile
    ports:
      - "80:80"
      - "443:443"  # If https is enabled, cancel the comment.
    volumes:
      - /disk_data0/seafile/seafile-data:/shared   # Requested, specifies the path to Seafile data persistent store.
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=xxxx  # Requested, the value shuold be root's password of MySQL service.
      - TIME_ZONE=Asia/Shanghai # Optional, default is UTC. Should be uncomment and set to your local time zone.
      - SEAFILE_ADMIN_EMAIL=me@qq.com # Specifies Seafile admin user, default is 'me@example.com'.
      - SEAFILE_ADMIN_PASSWORD=asecret     # Specifies Seafile admin password, default is 'asecret'.
      - SEAFILE_SERVER_LETSENCRYPT=false   # Whether use letsencrypt to generate cert.
      - SEAFILE_SERVER_HOSTNAME=seafile.xxx.com # Specifies your host name.

    depends_on:
      db:
        condition: service_healthy #状态检查
    networks:
      - seafile-net
  onlyoffice:
    #7.2以上版本会出现错误,请参考https://bbs.seafile.com/t/topic/16165
    image: onlyoffice/documentserver
    container_name: onlyoffice
    restart: unless-stopped
    ports:
      - '81:80'
    volumes:
      - '/srv/onlyoffice/DocumentServer/logs:/var/log/onlyoffice'
      - '/srv/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data'
      - '/srv/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice'
      - '/srv/onlyoffice/DocumentServer/db:/var/lib/postgresql'
    environment:
      - JWT_ENABLED=flase #避免出现"文档安全令牌未正确形成"的错误
    networks:
      - seafile-net
networks:
  seafile-net:
  • 启动服务
docker-compose up
  • 修改seafile配置

修改/opt/seafile-data/seafile/conf/seahub_settings.py 加入以下配置

# Enable Only Office
ENABLE_ONLYOFFICE = True
VERIFY_ONLYOFFICE_CERTIFICATE = False
ONLYOFFICE_APIJS_URL = 'http://seafile.yoursite.com:7001/web-apps/apps/api/documents/api.js' #上文配置的onlyoffice访问地址
ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods')
ONLYOFFICE_EDIT_FILE_EXTENSION = ('docx', 'pptx', 'xlsx')
  • 重启seafile服务
docker-compose restart

这样一个属于自己的网盘服务就好了。

0

评论区