一、Document Server介绍
ONLYOFFICE Document Server 是一个在线办公套件,包括文本、电子表格和演示文稿的查看器和编辑器,完全兼容 Office Open XML 格式:.docx、.xlsx、.pptx,并支持实时协作编辑。
二、检查系统版本
[root@node lighthttpd]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
三、检查docker状态
[root@node lighthttpd]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2022-11-04 09:12:32 CST; 9h ago
Docs: https://docs.docker.com
Main PID: 10162 (dockerd)
Tasks: 49
Memory: 910.2M
CGroup: /system.slice/docker.service
├─10162 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
├─21803 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 27217 -container-ip 172.17.0.2 -container-port 27017
├─21808 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 27217 -container-ip 172.17.0.2 -container-port 27017
├─33495 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 3548 -container-ip 172.17.0.3 -container-port 3306
├─33501 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 3548 -container-ip 172.17.0.3 -container-port 3306
├─43634 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8080 -container-ip 172.17.0.4 -container-port 80
└─43640 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8080 -container-ip 172.17.0.4 -container-port 80
Nov 04 10:00:54 node dockerd[10162]: time="2022-11-04T10:00:54.645415843+08:00" level=info msg="Attempting next endpoint for pull after ...unknown"
Nov 04 11:46:29 node dockerd[10162]: time="2022-11-04T11:46:29.261326827+08:00" level=info msg="Attempting next endpoint for pull after ...unknown"
Nov 04 11:47:04 node dockerd[10162]: time="2022-11-04T11:47:04.769147449+08:00" level=info msg="Download failed, retrying (1/5): net/htt...timeout"
Nov 04 11:51:16 node dockerd[10162]: time="2022-11-04T11:51:16.548891252+08:00" level=error msg="Not continuing with pull after error: c...anceled"
Nov 04 11:55:42 node dockerd[10162]: time="2022-11-04T11:55:42.370401579+08:00" level=info msg="ignoring event" container=ac860c2aa163e2...kDelete"
Nov 04 14:31:26 node dockerd[10162]: time="2022-11-04T14:31:26.826919720+08:00" level=warning msg="reference for unknown type: applicati...:latest"
Nov 04 14:31:27 node dockerd[10162]: time="2022-11-04T14:31:27.105606415+08:00" level=warning msg="Error persisting manifest" digest="sha256:f2e...
Nov 04 14:31:27 node dockerd[10162]: time="2022-11-04T14:31:27.105748609+08:00" level=warning msg="Image docker.io/romainlecomte/lighthttpd-dock...
Nov 04 14:45:39 node dockerd[10162]: time="2022-11-04T14:45:39.628278832+08:00" level=error msg="Not continuing with pull after error: m...unknown"
Nov 04 14:45:39 node dockerd[10162]: time="2022-11-04T14:45:39.628408475+08:00" level=error msg="Handler for POST /v1.41/images/create r...unknown"
Hint: Some lines were ellipsized, use -l to show in full.
四、下载ONLYOFFICE Document Server镜像
[root@node ~]# docker pull onlyoffice/documentserver
Using default tag: latest
latest: Pulling from onlyoffice/documentserver
f3ef4ff62e0d: Pull complete
d07cf79b5f7d: Pull complete
e5395a39b9a5: Pull complete
e6010a09edba: Pull complete
30fedd4b1d62: Pull complete
Digest: sha256:7e4a36f99966640fa7d0298ec3334309331229f61bdce7280667575ba9c8f7f6
Status: Downloaded newer image for onlyoffice/documentserver:latest
docker.io/onlyoffice/documentserver:latest
五、部署ONLYOFFICE Document Server
1.创建数据目录
[root@node ~]# mkdir -p /data/onlyoffice/DocumentServer/logs
[root@node ~]# mkdir -p /data/onlyoffice/DocumentServer/data
[root@node ~]# chmod -R 777 /data/onlyoffice/DocumentServer/
2.创建ONLYOFFICE Document Server容器
docker run -d --name mydoc -p 8098:80 \
-v /data/onlyoffice/DocumentServer/logs:/var/log/onlyoffice \
-v /data/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data onlyoffice/documentserver
3.查看ONLYOFFICE Document Server容器状态
[root@node DocumentServer]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e7fc82c2c5ee onlyoffice/documentserver "/app/ds/run-documen…" 23 seconds ago Up 22 seconds 443/tcp, 0.0.0.0:8098->80/tcp, :::8098->80/tcp mydoc
4.查看ONLYOFFICE Document Server容器日志
[root@node DocumentServer]# docker logs mydoc
* Starting PostgreSQL 12 database server
...done.
* Starting RabbitMQ Messaging Server rabbitmq-server
六、开启测试用例
![image.png image.png](https://bbs-img.huaweicloud.com/blogs/img/20221104/1667551380100770839.png?x-oss-process=image/resize,w_1400/format,webp)
sudo docker exec e7fc82c2c5ee sudo supervisorctl start ds:example
sudo docker exec e7fc82c2c5ee sudo sed 's,autostart=false,autostart=true,' -i /etc/supervisor/conf.d/ds-example.conf
七、测试使用ONLYOFFICE Document Server
![image.png image.png](https://bbs-img.huaweicloud.com/blogs/img/20221104/1667551554641136172.png?x-oss-process=image/resize,w_1400/format,webp)
![image.png image.png](https://bbs-img.huaweicloud.com/blogs/img/20221104/1667551564891940524.png?x-oss-process=image/resize,w_1400/format,webp)