Docker version of OnlyOffice image production

Docker version of OnlyOffice image production

1. Environmental preparation

1. Computer requirements

1. The host machine has more than 16G of memory and more than 4 cores and 8 threads of CPU. It is recommended to give up on old machines .

2. The virtual machine system uses ubuntu18.04, the processor core is guaranteed to be 2✖2 or above, the running memory is allocated to more than 6G, and the hard disk capacity is allocated to more than 60G

3. Ubuntu on the virtual machine must enable the proxy software

4. The network speed must be guaranteed to be above 1M/s

5. Ubuntu's swap memory can be set larger. You can set it up on Baidu .

PS: You need to download the replacement file I provided, which will be used for Docker replacement later (extraction code: SxoA)

Official version download of files that need to be replaced for docker deployment丨Latest version download丨Green version download丨APP download-123 Cloud Disk

2. Compile onlyoffice

1. Enable root remote login

1.Set root password

sudo passwd root  #Set the root account password after verifying the current account password.

2. Install ssh service

  a pt -get update     #Update apt source

apt-get install openssh-server       #安装openssh-server

3. Modify ssh configuration file

vi /etc/ssh/sshd_config

Port 22 #Uncomment this line

LoginGraceTime 2m #Uncomment this line

PermitRootLogin yes #Uncomment this line and change prohibit-password to yes

StrictModes yes #Uncomment this line

MaxAuthTries 6 #Cancel the comment on this line MaxSessions 10 #Cancel the comment on this line

4. Start or restart the service

systemctl restart ssh

systemctl enable ssh

2. Upgrade gcc compilation tool

1. Install and upgrade gcc7

  1. add-apt-repository ppa:ubuntu-toolchain-r/test
  2. apt-get install gcc-7
  3. apt-get install g++-7

2. Set gcc7 and g++7 as default options

1. update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 100

2. update-alternatives --config gcc

3. update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 100

4. update-alternatives --config g++

3. Configure the network environment

1. Set global agent and compiled version definition

(1) vim /etc/profile, add the following content :

  1. export HTTP_PROXY=http://127.0.0.1:2340
  2. export HTTPS_PROXY=http://127.0.0.1:2340
 
 

(2) source /etc/profile              #Make the configuration effective

2. Install git, python, node

a pt - get install -y python git    #Install git and python

a pt-get install               node #Install node


3. Upgrade npm and set up git agent

npm cache clean -f                 #Clear npm cache and execute the command

npm in stall -g [email protected]        #Upgrade npm version

npm config set registry https://registry.npm.taobao.org  #npm镜像

git config --global http.proxy http://127.0.0.1:2340    #git代理

git config --global https.proxy http://127.0.0.1:2340  #git代理

git config http.postBuffer 5242880000               #git http length

4. Start compiling onlyoffice

1. Create an onlyoffice working directory in the root directory:

mkdir ooSource

2. Download the onlyoffice compilation and build tool:

cd ooSource

git clone GitHub - ONLYOFFICE/build_tools: Used to build ONLYOFFICE DocumentServer-related products

3.Linux version is automatically compiled:

cd /ooSource/build_tools/tools/linux/      #Enter the script directory

./automate.py server         #Start compilation (no version parameters are required), it will take a few hours

4. After compilation is completed, the out directory will be generated in the build_tools directory.

      5. Crack 20 people’s connections (modify source code)

1.   Enter the corresponding directory through the ubuntu desktop and find constant.js

/ooSource/server/Common/sources/       #The directory where the js for the number of people limit is located

2.  Modify the constants.js number limit through ubuntu desktop and save it.

export s.LICENSE_CONNECTIONS = 20 ;         #Modify the number of connections you want here

3. Recompile _

(1) Modify /ooSource/build_tools/tools/linux/automate.py :

build_tools_params = ["--branch", branch,

                      "--module", modules,

                      "--update", "0", #Change here to 0 , 1 will pull the latest code                       "--qt-dir", os.getcwd() + "/qt_build/Qt-5.9.9"]

( 2 ) Recompile and the out directory will be regenerated under /ooSource/bui ld_tools/ :

     cd /ooSource/bui ld_tools/tools/linux   #Enter the directory

PRODUCT_VERSION='7.3.3' BUILD_NUMBER='54' NODE_ENV='production'

 ./automate.py server                 #Recompile (please bring version parameters)

6. Crack others (modify out directory)

1.Support wps editing:

Modify /var/www/onlyoffice/documentserver/web-apps/apps/api/documents/api.js:

Find var type , add the corresponding three wps formats wps/et/dps, and save it

2. Change the font to windows font:

Delete everything under /ooSource/core-fonts/, and then add our own fonts package

three. Package onlyoffice

1. Prepare packaging tools

1. Switch to the ooSource directory and install the packaging tool:

  cd /ooSource      #Enter the ooSource directory

  apt install build-essential m4 npm   #Install m4

  npm install -g     pkg #Install pkg
2. Download the onlyoffice packaging tool in the ooSource directory 

  git clone https://github.com/ONLYOFFICE/document-server-package.git 

2. Package onlyoffice

1. Install dependencies

cd /ooSource/document-server-package   #Enter the package directory

cat << EOF >> Makefile

deb_dependencies: \$(DEB_DEPS)         #Compile files to append dependencies

EOF

PRODUCT_VERSION='7.3.3' BUILD_NUMBER='54' make deb_dependencies 

2. Package onlyoffice

cd /ooSource/document-server-package/deb/build

apt build-dep ./

cd /ooSource/document-server-package

PRODUCT_VERSION='7.3.3' BUILD_NUMBER='54' make deb

The deb will eventually be generated in the /ooSource/document-server-package/deb/ directory

3. Notes:

Next time you package, leave only one template folder for /ooSource/document-server-package/deb. The rest of the folders and files need to be deleted, and then run the command in 2.

4. Generate Docker image

1. Prepare image creation tools

1. Download the image creation tool:

git clone GitHub - ONLYOFFICE/Docker-DocumentServer: ONLYOFFICE Document Server is an online office suite comprising viewers and editors for texts, spreadsheets and presentations, fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.

2. Transform into local packaging :

   For Docker-DocumentServer, do the following:

    1. Replace the DockerFile and run-document-server.sh I provided, and add the deb package generated in the third step;
    2. Change the name of the deb' package to onlyoffice.deb

3.Install Docker

apt-get remove docker docker-engine docker.io    #Uninstall the old version

apt-get install docker-ce docker-ce-cli containerd.io

Run vim /etc/docker/daemon.json and add:

{

      "registry-mirrors": ["https://mirrors.aliyun.com/"]       #Configure Ali mirror

}

systemctl daemon-reload         #Enable Ali image to take effect

systemctl restart       docker #Restart docker

  

  1. Build onlyoffice image

   cd /ooSource/Docker-DocumentServer 

   docker build -t image name: tag .      #Start building the onlyoffice image

   docker images    #View the built onlyoffice image

   docker login

   docker push image name: tag    #Push to remote warehouse

PS: Common error handling methods

1. apt-get update (apt source error)

2. Increase swap memory (solve Error: open CFI at the end of file; missing .cfi_endproc directive,)

3. git config http.postBuffer 5242880000 (solve the problem of A TLS packet with unexpected length was received) (premature EOF terminator )

4. Same as method 2 (solve c++: internal compiler error: killed (program cc1plus)

5npm cache clear --force (解决Cannot read properties of null (reading 'pickAlgorithm')

6.  Reset the git proxy (to solve the problem of git being unable to connect)

Guess you like

Origin blog.csdn.net/weixin_56760813/article/details/130299249