1

OnlyOffice is not opening previously saved documents after doing docker-compose down. I needed to increase the memory of nextcloud instance (docker container) so I proceeded to stop all the containers, modify the docker-compose and set everything up again.

There are no issues with new documents so far but editing previously saved ones OnlyOffice opens a blank document besides the files sizes are intact (no errors in console), still showing KB in NextCloud.

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:
zoid
  • 27
  • 5

2 Answers2

1

Please also note that you must ALWAYS disconnect you users before stop/restart your container. See https://github.com/ONLYOFFICE/Docker-DocumentServer#document-server-usage-issues

sudo docker exec onlyoffice documentserver-prepare4shutdown.sh
CrazyRabbit
  • 251
  • 3
  • 10
0

It seems that every time the containers are mounted in a NextCloud + OnlyOffice setup it generates tokens to authorize the access to the documents thru headers.

I solved it by adding a third docker volume to preserve the documentserver files. Fortunately I had a backup of my files, I removed the containers and added them again and everything it's working now.

- 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
zoid
  • 27
  • 5