1

OnlyOffice 在执行 docker-compose down 后不会打开以前保存的文档。我需要增加 nextcloud 实例(docker 容器)的内存,所以我继续停止所有容器,修改 docker-compose 并重新设置所有内容。

到目前为止,新文档没有问题,但编辑以前保存的文档 OnlyOffice 会打开一个空白文档,除了文件大小完好无损(控制台中没有错误),NextCloud 中仍显示 KB。

version: "2.3"
services:
  nextcloud:
    container_name: nextcloud
    image: nextcloud:latest
    hostname: MYDOMAIN
    stdin_open: true
    tty: true
    restart: always
    expose:
      - "80"
    networks:
      - cloud_network
    volumes:
      - /mnt/apps/nextcloud/data:/var/www/html
    environment:
      - MYSQL_HOST=mariadb
      - PHP_MEMORY_LIMIT=-1
    env_file:
      - db.env
    mem_limit: 8g
    depends_on:
      - mariadb

  mariadb:
    container_name: mariadb
    image: mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-file-per-table=1 --skip-innodb-read-only-compressed
    restart: always
    networks:
      - cloud_network
    volumes:
      - mariadb_volume:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=SOMEPASSWORD
    env_file:
      - db.env

  onlyoffice:
    container_name: onlyoffice
    image: onlyoffice/documentserver:latest
    stdin_open: true
    tty: true
    restart: always
    networks:
      - cloud_network
    expose:
      - "80"
    volumes:
      #- /mnt/apps/onlyoffice/data:/var/www/onlyoffice/Data
      - office_data_volume:/var/www/onlyoffice/Data
      #- onlyoffice_log_volume:/var/log/onlyoffice
      - office_db_volume:/var/lib/postgresql

  caddy:
    container_name: caddy
    image: abiosoft/caddy:no-stats
    stdin_open: true
    tty: true
    restart: always
    ports:
      - 80:80
      - 443:443
    networks:
      - cloud_network
    environment:
      - CADDYPATH=/certs
      - ACME_AGREE=true
      # CHANGE THESE OR THE CONTAINER WILL FAIL TO RUN
      - CADDY_LETSENCRYPT_EMAIL=MYEMAIL
      - CADDY_EXTERNAL_DOMAIN=MYDOMAIN
    volumes:
      - /mnt/apps/caddy/certs:/certs:rw
      - /mnt/apps/caddy/Caddyfile:/etc/Caddyfile:ro

networks:
  cloud_network:
    driver: "bridge"

volumes:
  office_data_volume:
  office_db_volume:
  mariadb_volume:
4

2 回答 2

1

另请注意,在停止/重新启动容器之前,您必须始终断开用户连接。请参阅https://github.com/ONLYOFFICE/Docker-DocumentServer#document-server-usage-issues

sudo docker exec onlyoffice documentserver-prepare4shutdown.sh
于 2021-11-30T10:55:12.577 回答
0

似乎每次将容器安装在 NextCloud + OnlyOffice 设置中时,它都会生成令牌以授权通过标题访问文档。

我通过添加第三个 docker 卷来保存文档服务器文件来解决它。幸运的是,我备份了我的文件,我删除了容器并再次添加它们,现在一切正常。

- office_config_volume:/etc/onlyoffice/documentserver

onlyoffice:
    container_name: onlyoffice
    image: onlyoffice/documentserver:latest
    stdin_open: true
    tty: true
    restart: unless-stopped
    networks:
        - cloud_network
    expose:
        - "80"
    volumes:
        - office_data_volume:/var/www/onlyoffice/Data
        - office_db_volume:/var/lib/postgresql
        - office_config_volume:/etc/onlyoffice/documentserver
于 2021-11-04T03:51:55.070 回答