Seafile网盘安装记录

发布时间 2024-01-13 09:19:39作者: IsYuh

系统:Ubuntu22.04.1

注:为安装后的回忆记录,非安装时纪录,可能会有差错

1 安装docker

sudo apt-get update | sudo apt-get install docker-compose -y

2 设置docker-compose.yml

 

services:
  db:
    image: mariadb:10.11
    container_name: seafile-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=  # Requested, set the root's password of MySQL service.
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - /data/seafile-mysql/db:/var/lib/mysql  # Requested, specifies the path to MySQL data persistent store.
    networks:
      - seafile-net

  memcached:
    image: memcached:1.6
    container_name: seafile-memcached
    entrypoint: memcached -m 256
    networks:
      - seafile-net
          
  seafile:
    image: seafileltd/seafile-mc:latest
    container_name: seafile
    ports:
      - "8843:80"  # 主机81端口映射至容器80端口http
      - "4433:443"  # 主机4433端口映射至容器443端口https
      - "8088:8080"  # 主机8088端口映射至容器8080端口webdav
    volumes:
      - /data/seafile-data:/shared   # Requested, specifies the path to Seafile data persistent store.
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=  # 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= # Specifies Seafile admin user, default is 'me@example.com'.
      - SEAFILE_ADMIN_PASSWORD=     # Specifies Seafile admin password, default is 'asecret'.
#      - SEAFILE_SERVER_LETSENCRYPT=true   # Whether use letsencrypt to generate cert.
      - SEAFILE_SERVER_HOSTNAME=127.0.0.1:8843 # Specifies your host name.
    depends_on:
      - db
      - memcached
    networks:
      - seafile-net

  oods:
    image: onlyoffice/documentserver:latest
    container_name: seafile-oods
    restart: on-failure
    volumes:
      - /data/onlyoffice
    networks:
      - seafile-net
    networks:
      - seafile-net
    environment:
      - JWT_ENABLED=true
      - JWT_SECRET=     #自定义,用于onlyoffice

networks:
  seafile-net:

3 安装 

sudo docker-compose up -d

4 配置Onlyoffice

4.1 安装 Onlyoffice

sudo docker run -i -t -d -p 80XX:80 -e JWT_ENABLED={与docker-compose.yml中一致} onlyoffice/documentserver

4.2 配置Seafile服务

添加以下配置信息到seahub_settings.py

# Enable Only Office
ENABLE_ONLYOFFICE = True
VERIFY_ONLYOFFICE_CERTIFICATE = False
ONLYOFFICE_APIJS_URL = 'http{s}://{ OnlyOffice 的域名或者IP}/web-apps/apps/api/documents/api.js'
ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods')
ONLYOFFICE_EDIT_FILE_EXTENSION = ('docx', 'pptx', 'xlsx')

 重启seafile即可

docker restart seafile