seafile+onlyoffice集成部署

准备docker-compose

version: "3"
services:
  db:
    image: mariadb:10.11
    container_name: seafile-mysql
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=sea123456  # 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.

  memcached:
    image: memcached:1.6
    container_name: seafile-memcached
    restart: always
    entrypoint: memcached -m 256

  seafile:
    image: seafileltd/seafile-mc:11.0.3
    container_name: seafile
    restart: always
    ports:
      - "2401:80"
#      - "443:443"  # If https is enabled, cancel the comment.
    volumes:
      - ./data/seafile-data:/shared   # Requested, specifies the path to Seafile data persistent store.
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=sea123456  # 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.
      - [email protected] # Specifies Seafile admin user, default is '[email protected]'.
      - 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.example.com # Specifies your host name.
    depends_on:
      - db
      - memcached

  sea-onlyoffice:
    image: onlyoffice/documentserver:7.5.1
    container_name: sea-onlyoffice
    restart: always
    environment:
      - JWT_ENABLED=false
        #- USE_UNAUTHORIZED_STORAGE=true
        #- ONLYOFFICE_HTTPS_HSTS_ENABLED=false

    ports:
      - "24011:80"
        # - "8443:443"

    volumes:
      - ./data/seafile-onlyoffice/log:/var/log/onlyoffice
      - ./data/seafile-onlyoffice/data:/var/www/onlyoffice/Data
      - ./data/seafile-onlyoffice/lib:/var/lib/onlyoffice
      - ./data/seafile-onlyoffice/postgresql:/var/lib/postgresql
      # - ./default.json:/etc/onlyoffice/documentserver/default.json

networks:
  default:
    external:
      name: test

修改default.json

docker cp sea-onlyoffice:/etc/onlyoffice/documentserver/default.json ./

修改以下值为:

...
"request-filtering-agent" : {
				"allowPrivateIPAddress": true,
				"allowMetaIPAddress": true
			},
...

在docker-compose中添加挂载:

- ./default.json:/etc/onlyoffice/documentserver/default.json

编辑seahub_settings.py

编辑./data/seafile-data/seafile/conf/seahub_settings.py,替换IP:PORT,添加:

# Enable Only Office
ENABLE_ONLYOFFICE = True
VERIFY_ONLYOFFICE_CERTIFICATE = False
# ONLYOFFICE_APIJS_URL = 'http{s}://{your OnlyOffice server's domain or IP}/web-apps/apps/api/documents/api.js'
ONLYOFFICE_APIJS_URL = 'http://IP:PORT/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')