Data persistence and backup
The default run commands store database and document files inside the container. Deleting an Office container also deletes documents and settings stored only inside it. Store data you need to retain in folders on the server, and prepare separate backups for failures.
Keep data outside the container
You can mount folders on the server at the container's data paths. The databases continue to run inside the container, while their data files are stored in the server folders. When creating a new container, reconnect the existing data folders to resume using Office with your previous documents and settings.
To retain admin settings and editing data as well as original documents, you must preserve the following folders together.
| Data to retain | Folder inside the container |
|---|---|
| Original documents and saved files in the default Host Storage | /home/thinkfree/docs |
| Admin settings, adapter information, documents being edited, and GridFS resources such as images | /home/thinkfree/mongodb/data |
| Persisted session and cache data | /home/thinkfree/redis/data |
| Runtime logs for troubleshooting | /home/thinkfree/weboffice/logs |
Run with document, data, and log folders mounted
The following Linux example uses an image with a Trial license included for non-commercial evaluation. Run it on a server where port 8080 is available.
First create document, database, cache, and log folders under your current working directory. Set their ownership so the container's runtime user (UID and GID 1000) can write to them.
mkdir -p office-data/documents office-data/mongodb office-data/redis office-data/logs
sudo chown -R 1000:1000 office-data
docker run --name thinkfree-office-persistent --stop-timeout 60 \
-p 8080:8070 \
-v "$PWD/office-data/documents:/home/thinkfree/docs" \
-v "$PWD/office-data/mongodb:/home/thinkfree/mongodb/data" \
-v "$PWD/office-data/redis:/home/thinkfree/redis/data" \
-v "$PWD/office-data/logs:/home/thinkfree/weboffice/logs" \
thinkfree/office-single-node-trial:latest
$PWD is the current working directory. Place documents to use in Office in office-data/documents.
The image includes sample documents in /home/thinkfree/docs by default. When you mount a host folder at this path, you can open and edit the documents stored in that folder instead of the samples.
Admin settings and editing data are stored in office-data/mongodb, persisted session and cache data in office-data/redis, and runtime logs in office-data/logs. Document filter logs are available in office-data/logs/hncLog.
Open Office Admin on the server to check its status and settings. From another computer, replace localhost with the server address. When using the Free Commercial image, also include the license file mount option.
If you use S3, WebDAV, or HTTP Storage, you must establish and manage a separate backup policy for the external storage that holds your original documents.
When replacing the container, shut down the existing container gracefully, then reconnect the same server folders.
Back up data and verify recovery
Mounting folders retains data across container replacement, but does not automatically create backups against file deletion or server failure. You must store backups separately and establish and operate a backup policy for your environment.
- Stop new document work, save documents being edited, and shut down Office gracefully.
- Back up document storage, databases, and cache at a consistent point in time. For external storage, also stop changes to that storage or obtain a snapshot from the same point in time.
- Restore the backup in a separate environment and check admin settings and adapter connections.
- Open a restored document, edit it, save it, and reopen it to verify recovery.