Skip to main content

Mounting the Font Package for LibreOffice

I. Create a Font Package Directory

  1. On the server, create a font package directory and upload the font package.

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

II. Configuration Steps

Configuration Based on a HAP Standalone Environment

  1. Use vim /data/mingdao/script/docker-compose.yaml to add the mount - ./volume/ldoc/font-packages/:/usr/share/fonts/font-packages/

     services:
    app:
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-community:6.5.2
    environment:
    ENV_DOCPREVIRE_EXT_ENDPOINTS: "ldoc:8000"

    ldoc:
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-ldoc:2.0.2
    volumes: # Added
    - ./volume/ldoc/font-packages/:/usr/share/fonts/font-packages/ # Added
  2. Then restart the hap service to apply changes

    Execute the restart command in the manager directory

     bash ./service.sh restartall

Deploying ldoc Service Independently via Docker

  1. Use vim ldoc.yaml to add the mount - /data/mingdao/script/volume/ldoc/font-packages/:/usr/share/fonts/font-packages/

    version: '3'

    services:
    ldoc:
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-ldoc:2.0.2
    ports:
    - 8881:8000
    volumes: # Added
    - /data/mingdao/script/volume/ldoc/font-packages/:/usr/share/fonts/font-packages/ # Added
  2. Then restart the LibreOffice service to apply changes

    Execute the restart command in the directory containing ldoc.yaml

     # 1. Stop ldoc
    docker stack rm ldoc

    # 2. Check ldoc
    docker ps -a | grep ldoc

    # 3. Once no ldoc container is found in step 2, start ldoc
    docker stack deploy -c ldoc.yaml ldoc

Deploying ldoc Service with Kubernetes

Note: The step of Creating Font Package Directory must be performed on each node of the microservice and the font package uploaded.

  1. Modify the mount configuration of the deployment for ldoc, using the hostpath method to mount.

    apiVersion: apps/v1
    kind: Deployment
    metadata:
    name: ldoc
    namespace: default
    spec:
    replicas: 1
    selector:
    matchLabels:
    app: ldoc
    template:
    metadata:
    labels:
    app: ldoc
    spec:
    containers:
    - name: ldoc
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-ldoc:2.0.2
    resources:
    limits:
    cpu: "4"
    memory: 4096Mi
    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/ldoc/font-packages/ # Added

    ---

    apiVersion: v1
    kind: Service
    metadata:
    name: ldoc
    namespace: default
    spec:
    selector:
    app: ldoc
    ports:
    - name: internal
    port: 8001
    targetPort: 8000
  2. Then restart the LibreOffice service to apply changes

    Execute the restart command in the directory containing service.yaml

     kubectl apply -f service.yaml

    # Check once the pod is started
    kubectl get pods | grep ldoc

    # If ldoc does not restart, you can manually perform a rolling restart
    kubectl rollout restart deploy ldoc