Mounting the Font Package for LibreOffice
I. Create a Font Package Directory
-
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-packagesdirectory.
- Store the font package in the
II. Configuration Steps
Configuration Based on a HAP Standalone Environment
-
Use
vim /data/mingdao/script/docker-compose.yamlto add the mount- ./volume/ldoc/font-packages/:/usr/share/fonts/font-packages/services:app:image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-hap:7.3.4environment:ENV_DOCPREVIRE_EXT_ENDPOINTS: "ldoc:8000"ldoc:image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-ldoc:2.0.2command: ["/bin/sh", "-c", "mkfontscale && mkfontdir && fc-cache -fv && java -jar /app.jar"] # Addedvolumes: # Added- ./volume/ldoc/font-packages/:/usr/share/fonts/font-packages/ # Added -
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
-
Use
vim ldoc.yamlto 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.2ports:- 8881:8000command: ["/bin/sh", "-c", "mkfontscale && mkfontdir && fc-cache -fv && java -jar /app.jar"] # Addedvolumes: # Added- /data/mingdao/script/volume/ldoc/font-packages/:/usr/share/fonts/font-packages/ # Added -
Then restart the
LibreOfficeservice to apply changesExecute the restart command in the directory containing
ldoc.yaml# 1. Stop ldocdocker stack rm ldoc# 2. Check ldocdocker ps -a | grep ldoc# 3. Once no ldoc container is found in step 2, start ldocdocker stack deploy -c ldoc.yaml ldoc
Deploying ldoc Service with Kubernetes
Note: The step of Create a Font Package Directory must be performed on each node of the microservice and the font package uploaded.
-
Modify the mount configuration of the
deploymentforldoc, using thehostpathmethod to mount.apiVersion: apps/v1kind: Deploymentmetadata:name: ldocnamespace: defaultspec:replicas: 1selector:matchLabels:app: ldoctemplate:metadata:labels:app: ldocspec:containers:- name: ldocimage: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-ldoc:2.0.2command: ["/bin/sh", "-c"] # Addedargs: ["mkfontscale && mkfontdir && fc-cache -fv && java -jar /app.jar"] # Addedresources:limits:cpu: "4"memory: 4096Mirequests:cpu: "0.01"memory: 64MireadinessProbe:tcpSocket:port: 8000initialDelaySeconds: 10periodSeconds: 10livenessProbe:tcpSocket:port: 8000initialDelaySeconds: 180periodSeconds: 10volumeMounts: # Added- name: font-packages # AddedmountPath: /usr/share/fonts/font-packages/ # Addedvolumes: # Added- name: font-packages # AddedhostPath: # Addedpath: /data/mingdao/script/volume/ldoc/font-packages/ # Added---apiVersion: v1kind: Servicemetadata:name: ldocnamespace: defaultspec:selector:app: ldocports:- name: internalport: 8001targetPort: 8000 -
Then restart the
LibreOfficeservice to apply changesExecute the restart command in the directory containing
service.yamlkubectl apply -f service.yaml# Check once the pod is startedkubectl get pods | grep ldoc# If ldoc does not restart, you can manually perform a rolling restartkubectl rollout restart deploy ldoc