Docker series deploys onlyoffice container for nextcloud
本文最后更新于 361 天前,其中的信息可能已经有所发展或是发生改变,如有失效可到评论区留言。

Deploy redis container

To deploy the onlyoffice container for nextcloud, you first need to deploy the redis container:

docker run --name redis -d --restart=always --net=public-net -p 6379:6379 redis

Creating a bridge

建议大家养成良好的习惯,部署容器的时候,不管有用没有,最好都加上–net参数并使用同一个提前定义好的非默认的bridge,,便于需要的时候可以用容器名调用。因为下面要用到一个名为public-net的bridge,所以需要提前创建:

docker network create public-net

Deploy onlyoffice container

The command is as follows

docker run --name onlyoffice -d --restart=always --net=public-net \ -p 9020:80 \ -p 9023:443 \ -e JWT_SECRET=xxxxxxxxxxxxxxx \ -e REDIS_SERVER_HOST=redis \ -e REDIS_SERVER_PORT=6379 \ -v /docker/onlyoffice/logs:/var/log/onlyoffice \ -v /docker/onlyoffice/data:/var/www/onlyoffice/Data \ -v /docker/onlyoffice/lib:/var/lib/onlyoffice \ -v /docker/onlyoffice/db:/var/lib/postgresql \ -v /docker/onlyoffice/redis:/var/lib/redis \ onlyoffice/documentserver

Parameter explanation:
-p 9020:80 -p 9023:443
Ports 9020 and 9023 correspond to ports 80 and 443 inside the container respectively. You can adjust them according to your actual deployment environment.
-e JWT_SECRET
It specifies a fixed secret. If this environment variable is not specified, the secret will be regenerated every time Docker is restarted, and an error will be reported:

image.png

Then you need to go to the following locations in the onlyoffice container to view:

cat etc/onlyoffice/documentserver/local.json
secret": { "inbox": { "string": "YOURTOKEN" }, "outbox": { "string": "YOURTOKEN" }, "session": { "string": "YOURTOKEN" }

This is very inconvenient, and it is strongly recommended that you specify a fixed value yourself.
-e REDIS_SERVER_HOST=redis
-e REDIS_SERVER_PORT=6379
指定redis服务器的地址和端口,因为redis和onlyoffice同属于一个非default的bridge"public-net",所以可以用容器名直接通信,否则就需要–link参数了。


Note: When you build a container environment, it is recommended that you plan the location of all container mount folders in advance. I put all container mount folders in the /docker folder, and then one folder for each container, such as /docker/onlyoffice/, and then the mount folder corresponding to this container. Developing good habits will make later maintenance more convenient, and when migrating to a new container environment and recreating the corresponding container, you don’t even have to change the mount path, which is very cool.


After the onlyoffice container is deployed, the example is not enabled by default. You need to execute:

docker exec onlyoffice sudo supervisorctl start ds:example

Then you can access:http://xxxx:9020:example
Assume that xxxx is the intranet IP address of your container host. The page is as follows:

image.png

If you want this page to start automatically every time you restart the container, you need to execute:

docker exec onlyoffice sudo sed 's,autostart=false,autostart=true,' -i /etc/supervisor/conf.d/ds-example.conf

Configure nextcloud

The next step is to configure in nextcloud (onlyoffice plug-in needs to be installed in advance):

image.png

The situation here is more complicated, and it is divided into two mainstream situations, depending on whether the client is accessed purely from the intranet or needs to be accessed from the external network, and whether it is divided into http mode or https mode:

1. Both nextcloud and onlyoffice are only in the intranet and the client browser accesses them using HTTP

If you are accessing HTTP in the intranet, then it is easiest to fill in the "ONLYOFFICE Docs address for internal server" option under More settings in the lower right corner of the above picture:http://x.x.x.x:9020 Specify the intranet IP or domain name of onlyoffice in the same way, and then fill in the "Address of the server used for ONLYOFFICE Docs internal requests" option:http://x.x.x.x:9010You can specify the intranet IP or intranet domain name of nextcloud (assuming 9010 is the port mapped by the host of nextcloud).

2. Both nextcloud and onlyoffice are deployed on the public Internet and the client browser accesses them using https

If this is the case, and onlyoffice can open the example page normally through the public domain name, you only need to fill in the onlyoffice corresponding to the first red box "ONLYOFFICE Docs" in the upper right corner of the above picture.https://public domain name , and then fill in the "Key" below with the secret you customized when you created the container earlier.

Note: NextCloud uses HTTPS for access, so OnlyOffice must also be configured with HTTPS, so port 9023 will be mapped when the OnlyOffice container is created. If OnlyOffice is used with reverse proxy, the reverse proxy of the public domain name corresponding to OnlyOffice needs to use HTTPS and point to the HTTPS port when specifying the upstream server target URL. In this example, it points tohttps://x.x.x.x:9023.

When creating the onlyoffice container, we mounted the following directories with -v:
-v /docker/onlyoffice/data:/var/www/onlyoffice/Data

The data directory is used to store the SSL certificate corresponding to the onlyoffice public domain name. Create a certs directory in data, then rename the SSL certificate (crt, key) corresponding to the onlyoffice domain name to onlyoffice.crt and onlyoffice.key, put them in this directory and restart the onlyoffice container.

After saving, if the following content appears on the OnlyOffice page of NextCloud, it is successful:

image.png

This method can complete the deployment of NextCloud and OnlyOffice in the same container environment. There is no need to set up a server with a public IP address to build the OnlyOffice container like some netizens do. In short, just set up OnlyOffice and NextCloud containers in an intranet environment at the same time, and then make corresponding configurations on the export.

In addition, there may be many different deployment scenarios. For example, nextcloud and onlyoffice are respectively in the intranet, public network, and behind the reverse proxy. You can analyze and handle them according to the actual situation.

The content of the blog is original. Please indicate the source when reprinting! For more blog articles, you can go toSitemapUnderstand. The RSS address of the blog is:https://blog.tangwudi.com/feed, welcome to subscribe; if necessary, you can joinTelegram GroupDiscuss the problem together.
No Comments

Send Comment Edit Comment


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠(ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ°Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
Emoticons
Emoji
Little Dinosaur
flower!
Previous
Next
       
error:
en_US
Spring Festival
hapiness