Skip to content

ONLYOFFICE/build_tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2,373 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

ONLYOFFICE Build Tools

Welcome to the build_tools repository! This powerful toolkit simplifies the process of compiling ONLYOFFICE products from source on Linux.

It automatically fetches all the required dependencies and source code to build the latest versions of:

A quick note: For the most stable and reliable builds, we strongly recommend compiling from the master branch of this repository.

How do I use it on Linux? ๐Ÿง

This guide has been tested and verified on Ubuntu 16.04.

Step 1: Install dependencies

First, let's make sure you have Python installed, as it's needed to run the build scripts.

sudo apt-get install -y python

Step 2: Build the source code

Now, you're ready to build the ONLYOFFICE products.

  1. Clone the build_tools repository:

    This command downloads the build tools to your machine using Git:

    git clone https://github.com/ONLYOFFICE/build_tools.git
  2. Navigate to the scripts directory:

    cd build_tools/tools/linux
  3. Run the automation script:

    This is where the magic happens! Running the script without any options will build all three products: Document Server, Document Builder, and Desktop Editors.

    ./automate.py

You can also build ONLYOFFICE products separately. Just run the script with the parameter corresponding to the necessary product. For example, to build Desktop Editors and Document Server

 ./automate.py desktop server

Perfect! Once the script finishes, you will find the compiled products in the ./out directory.

Advanced options & different workflows ๐Ÿš€

How to use Docker

If you prefer using Docker, you can build all products inside a container. This is a great way to keep your local system clean.

  1. Create an output directory:

    mkdir out
  2. Build the Docker image:

    docker build --tag onlyoffice-document-editors-builder .
  3. Run the container to start the build:

    This command mounts your local out directory into the container, so the final build files will appear on your machine.

    docker run -v $PWD/out:/build_tools/out onlyoffice-document-editors-builder

You've done it! The results will be in the ./out directory you created.

How to build and run the products separately โ–ถ๏ธ

Don't need everything? You can save time by building only the products you need. Just add the product name as an argument to the script.

Need just the Document Builderโ“

  • How to build

    ./automate.py builder
  • How to run

    cd ../../out/linux_64/onlyoffice/documentbuilder
    ./docbuilder

Need just the Desktop Editorsโ“

  • How to build
    ./automate.py desktop
  • How to run
    cd ../../out/linux_64/onlyoffice/desktopeditors
    LD_LIBRARY_PATH=./ ./DesktopEditors

Need just the Docs (Document Server)โ“

  • How to build

    ./automate.py server
  • How to run

    Running the Document Server is a multi-step process because it relies on a few background services. Let's break it down step by step.

Step 1. Set up dependencies

The Document Server needs a few things to run correctly:

  • NGINX: Acts as a web server to handle requests.
  • PostgreSQL: Used as the database to store information.
  • RabbitMQ: A message broker that helps different parts of the server communicate.

Here are the commands to install and configure them.

Install and configure NGINX

  1. Install NGINX
sudo apt-get install nginx
  1. Disable the default NGINX site
sudo rm -f /etc/nginx/sites-enabled/default
  1. Set up the new website. To do that create the /etc/nginx/sites-available/onlyoffice-documentserver file with the following contents:
map $http_host $this_host {
  "" $host;
  default $http_host;
}
map $http_x_forwarded_proto $the_scheme {
  default $http_x_forwarded_proto;
  "" $scheme;
}
map $http_x_forwarded_host $the_host {
  default $http_x_forwarded_host;
  "" $this_host;
}
map $http_upgrade $proxy_connection {
  default upgrade;
  "" close;
}
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $the_host;
proxy_set_header X-Forwarded-Proto $the_scheme;
server {
  listen 0.0.0.0:80;
  listen [::]:80 default_server;
  server_tokens off;
  rewrite ^\/OfficeWeb(\/apps\/.*)$ /web-apps$1 redirect;
  location / {
    proxy_pass http://localhost:8000;
    proxy_http_version 1.1;
  }
}
  1. Enable the new site by creating a symbolic link
sudo ln -s /etc/nginx/sites-available/onlyoffice-documentserver /etc/nginx/sites-enabled/onlyoffice-documentserver
  1. Restart NGINX to apply the changes
sudo nginx -s reload

Install and configure PostgreSQL

  1. Install PostgreSQL

    sudo apt-get install postgresql
  2. Create a database and user.

    Note: The user and password must both be 'onlyoffice'.

    sudo -i -u postgres psql -c "CREATE USER onlyoffice WITH PASSWORD 'onlyoffice';"
    sudo -i -u postgres psql -c "CREATE DATABASE onlyoffice OWNER onlyoffice;"
  3. Configure the database:

    psql -hlocalhost -Uonlyoffice -d onlyoffice -f ../../out/linux_64/onlyoffice/documentserver/server/schema/postgresql/createdb.sql

Upon that, you will be asked to provide a password for the onlyoffice PostgreSQL user. Please enter the onlyoffice password.

Install RabbitMQ

sudo apt-get install rabbitmq-server

Now that you have all the dependencies installed, it's time to generate server files.

Step 2. Generate server files

Before running the server, you need to generate font and theme data.

Generate fonts data
cd out/linux_64/onlyoffice/documentserver/
mkdir fonts
LD_LIBRARY_PATH=${PWD}/server/FileConverter/bin server/tools/allfontsgen \
  --input="${PWD}/core-fonts" \
  --allfonts-web="${PWD}/sdkjs/common/AllFonts.js" \
  --allfonts="${PWD}/server/FileConverter/bin/AllFonts.js" \
  --images="${PWD}/sdkjs/common/Images" \
  --selection="${PWD}/server/FileConverter/bin/font_selection.bin" \
  --output-web='fonts' \
  --use-system="true"
Generate presentation themes
cd out/linux_64/onlyoffice/documentserver/
LD_LIBRARY_PATH=${PWD}/server/FileConverter/bin server/tools/allthemesgen \
  --converter-dir="${PWD}/server/FileConverter/bin"\
  --src="${PWD}/sdkjs/slide/themes"\
  --output="${PWD}/sdkjs/common/Images"

Step 3. Run the Document Server services

All Document Server components run as foreground processes. Thus you need separate terminal consoles to run them or specific tools which will allow to run foreground processes in background mode.

  • Start the FileConverter service:

    cd out/linux_64/onlyoffice/documentserver/server/FileConverter
    LD_LIBRARY_PATH=$PWD/bin \
    NODE_ENV=development-linux \
    NODE_CONFIG_DIR=$PWD/../Common/config \
    ./converter
  • Start the DocService service:

    cd out/linux_64/onlyoffice/documentserver/server/DocService
    NODE_ENV=development-linux \
    NODE_CONFIG_DIR=$PWD/../Common/config \
    ./docservice

And it's a wrap! ๐ŸŽ‰

Congratulations! You have successfully used the build_tools to compile your desired ONLYOFFICE products from the latest source code.

Everything is now set up. You can go ahead and run your brand-new, self-compiled ONLYOFFICE applications.

Need help or have an idea? ๐Ÿ’ก

  • ๐Ÿž Found a bug? Please report it by creating an issue.
  • โ“ Have a question? Ask our community and developers on the ONLYOFFICE Forum.
  • ๐Ÿ’ก Want to suggest a feature? Share your ideas on our feedback platform.
  • ๐Ÿง‘โ€๐Ÿ’ป Need help for developers? Check our API documentation.

Made with โค๏ธ by the ONLYOFFICE Team

About

Used to build ONLYOFFICE DocumentServer-related products

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 41