记录日常工作关于系统运维,虚拟化云计算,数据库,网络安全等各方面问题。

seafile云盘+onlyoffice文档服务器


一,安装说明。

  1. 演示安装环境,Centos7+docker+mysql+memcached

  2. 安装依赖与系统配置。

     

    sudo setenforce 0
    sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
    
    yum -y install wget gcc make openssl-devel openssl net-snmp net-snmp-devel popt popt-devel
    yum install -y yum-utils device-mapper-persistent-data lvm2
    

     

  3. 安装docker,docker-compose。

    yum install -y docker-ce-20.10.7 docker-ce-cli-20.10.7 containerd.io
    sudo tee /etc/docker/daemon.json <<-'EOF'
    {
    "registry-mirrors": ["https://82m9ar63.mirror.aliyuncs.com"],
    "exec-opts": ["native.cgroupdriver=systemd"],
     "log-driver": "json-file",
    "log-opts": {
    "max-size": "100m"
     },
     "storage-driver": "overlay2"
    }
    EOF
    
    
    wget https://github.com//docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64
    mv docker-compose-linux-x86_64 /usr/bin/docker-compose
    chmod +x /usr/bin/docker-compose
    
    sudo systemctl daemon-reload
    sudo systemctl restart docker
    

     

  4. 查看docker-compose命令运行情况。

    [root@node2 ]# docker-compose version
     Docker Compose version v2.2.3
    

     

  5. 下载或是创建seafile文件网盘需要使用的的YAML文件.

    根据情况修改相关变量与挂载目录,以下是原版文件内容。

    touch /opt/seafile.yaml
    

     

    version: '2.0'
    services:
      db:
        image: mariadb:10.5
        container_name: seafile-mysql
        environment:
          - MYSQL_ROOT_PASSWORD=db_dev  # Requested, set the root's password of MySQL service.
          - MYSQL_LOG_CONSOLE=true
        volumes:
          - /opt/seafile-mysql/db:/var/lib/mysql  # Requested, specifies the path to MySQL data persistent store.
        networks:
          - seafile-net
    
      memcached:
        image: memcached:1.5.6
        container_name: seafile-memcached
        entrypoint: memcached -m 256
        networks:
    
       - seafile-net
    
      seafile:
        image: seafileltd/seafile-mc:latest
        container_name: seafile
        ports:
    
       - "80:80"
    
    #      - "443:443"  # If https is enabled, cancel the comment.
    
        volumes:
          - /opt/seafile-data:/shared   # Requested, specifies the path to Seafile data persistent store.
        environment:
          - DB_HOST=db
          - DB_ROOT_PASSWD=db_dev  # 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@example.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.example.com # Specifies your host name.
        depends_on:
          - db
          - memcached
        networks:
          - seafile-net
    
    networks:
      seafile-net:
    

     

  6. 创建相关容器。

     

    docker-compose -f /opt/seafile.yaml -p seafile up -d
    

    运行以上命令,会生成三个容器。


     

  7. 根据YAML文件中的配置,web打开seafile的IP地址进行访问测试。

     

二,集成onlyoffice Documentserver功能。

  1. 安装onlyoffice Documentserver。

    mkdir -p /opt/onlyoffice/DocumentServer
    
    docker run --name onlyoffice-community-server -i -t -d  -p 8088:80 \
    -v /opt/onlyoffice/DocumentServer/logs:/var/log/onlyoffice \
    -v /opt/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data \
    -v /opt/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice \
    -v /opt/onlyoffice/DocumentServer/rabbitmq:/var/lib/rabbitmq \
    -v /opt/onlyoffice/DocumentServer/redis:/var/lib/redis \
    -v /opt/onlyoffice/DocumentServer/db:/var/lib/postgresql   onlyoffice/documentserver
    
    
  2. 打开web地址测试。


  3. seafile容器的nginx配置文件增加内容,配置文件地址 /opt/seafile-data/nginx/conf/seafile.nginx.conf

    以下内容增加到server字段之前:

     

    map $http_x_forwarded_proto $the_scheme {
            default $http_x_forwarded_proto;
            "" $scheme;
        }


    map $http_x_forwarded_host $the_host {
            default $http_x_forwarded_host;
            "" $host;
        }


    map $http_upgrade $proxy_connection {
            default upgrade;
            "" close;
    }

     

    以下内容增加到server字段之中:




 

  1. 以下内容增加到 /opt/seafile-data/seafile/conf/seahub_settings.py文件中。

    # Enable Only Office
    
    ENABLE_ONLYOFFICE = True
    VERIFY_ONLYOFFICE_CERTIFICATE = False
    ONLYOFFICE_APIJS_URL = 'http://192.168.137.32:8088/web-apps/apps/api/documents/api.js'
    ONLYOFFICE_FILE_EXTENSION = ('pdf','doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods')
    ONLYOFFICE_EDIT_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx')
    

    #禁止用户注销账号
    ENABLE_DELETE_ACCOUNT = True 

  2. 重启seafile相关容器。

    docker-compose -p seafile -f /opt/seafile.yaml restart
    

     

  3. 登陆seafile,测试文档编辑功能是否正常。


  4. .seafile配置文件相关信息。

      /opt/seafile/seafile-server-latest/seahub/seahub/settings.py  此配置文件的内容与seahub_settings.py是相通的。
     不管配置到哪个文件,都会生效,seahub_settings.py优先级高些。但是 settings.py里面有很多配置开关选项。

     settings.py配置文件内容


转载请标明出处【seafile云盘+onlyoffice文档服务器】。

《www.92cto.com》 虚拟化云计算,系统运维,安全技术服务.

网站已经关闭评论