Skip to main content

Mounting Font Packages for OnlyOffice

I. Create the Font Package Directory​

  1. Create the font package directory on the server and upload the font package.

    mkdir -p /data/mingdao/script/volume/doc/font-packages
    • Store the font package in the /data/mingdao/script/volume/doc/font-packages directory.

II. Configuration Steps​

HAP Standalone Environment​

  1. Run vim /data/mingdao/script/docker-compose.yaml and add the mount - ./volume/doc/font-packages/:/usr/share/fonts/font-packages/.

    services:
    doc:
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-doc:2.0.0
    command: ["/bin/sh", "-c", "mkfontscale && mkfontdir && fc-cache -fv && exec /app/ds/run-document-server.sh"] # Added
    volumes: # Added
    - ./volume/doc/font-packages/:/usr/share/fonts/font-packages/ # Added
  2. Restart the OnlyOffice service to apply the changes.

    Run the restart command from the manager directory.

    bash ./service.sh restartall

Deploying OnlyOffice as a Standalone Docker Service​

  1. Run vim doc.yaml and add the mount - /data/mingdao/script/volume/doc/font-packages/:/usr/share/fonts/font-packages/.

    version: '3'

    services:
    doc:
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-doc:2.0.0
    command: ["/bin/sh", "-c", "mkfontscale && mkfontdir && fc-cache -fv && exec /app/ds/run-document-server.sh"] # Added
    volumes: # Added
    - /data/mingdao/script/volume/doc/font-packages/:/usr/share/fonts/font-packages/ # Added
  2. Restart the OnlyOffice service to apply the changes.

    Run the restart command from the directory containing doc.yaml.

    docker stack deploy -c doc.yaml doc

Deploying OnlyOffice on Kubernetes​

Note: The font package directory creation step must be performed on every microservice node, and the font package must be uploaded on each node.

  1. Update the mount configuration in the doc Deployment, using hostPath.

    apiVersion: apps/v1
    kind: Deployment
    metadata:
    name: doc
    namespace: default
    spec:
    replicas: 1
    selector:
    matchLabels:
    app: doc
    version: default
    template:
    metadata:
    labels:
    app: doc
    version: default
    annotations:
    md-update: "20230703103126"
    spec:
    containers:
    - name: doc
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-doc:2.0.0
    command: ["/bin/bash", "-c"] # Added
    args: ["mkfontscale && mkfontdir && fc-cache -fv && exec /app/ds/run-document-server.sh"] # Added
    env:
    - name: ENV_FILE_INNER_URI
    value: "www:8880"
    resources:
    limits:
    cpu: "4"
    memory: 2048Mi
    requests:
    cpu: "0.01"
    memory: 64Mi
    readinessProbe:
    tcpSocket:
    port: 8000
    initialDelaySeconds: 10
    periodSeconds: 10
    livenessProbe:
    tcpSocket:
    port: 8000
    initialDelaySeconds: 180
    periodSeconds: 10
    volumeMounts: # Added
    - name: font-packages # Added
    mountPath: /usr/share/fonts/font-packages/ # Added
    volumes: # Added
    - name: font-packages # Added
    hostPath: # Added
    path: /data/mingdao/script/volume/doc/font-packages/ # Added
  2. Restart the OnlyOffice service to apply the changes.

    Run the restart command from the directory containing service.yaml.

    kubectl apply -f service.yaml

    # Check that the pod has started
    kubectl get pods |grep doc

    # If ldoc has not restarted, manually trigger a rolling restart
    kubectl rollout restart deploy doc