System requirements

Minimal system requirements for running server with BGERP + MySQL:

  • OS Linux, preferably RPM based: CentOS or RHEL, because the samples below;

  • CPU core equal Intel x86 500 MHz, recommended - 1 GHz;

  • 512 MB RAM, recommended - 1 GB.

Docker image

Installation from Docker image.

The Docker image is approximately 1 GB and contains the latest published build will all the required components: MySQL, Java. The actual Demo is also applied during first run.

This variant perfectly fits for following purposes:

  • having first look and playing with program;

  • running on Windows machines;

  • running in different environment, e.g. already installed MySQL with not appropriate version.

For removing container, also before update.

docker rm -f bgerp

The running container is available via Web-interface. Use NGINX for restricting access from outside network.

Data volumes inside (Win and *NIX)

In this case all the data volumes are hidden inside Docker.

All the related data is removed together with container.
docker pull bgerp/bgerp && docker run -d --name bgerp --restart unless-stopped -p 9088:9088 bgerp/bgerp && docker logs --follow bgerp

Data volumes outside (*NIX only)

docker pull bgerp/bgerp && docker run -d --name bgerp --restart unless-stopped \
    -v /srv/bgerp/data/mysql:/var/lib/mysql \
    -v /srv/bgerp/data/filestorage:/opt/bgerp/filestorage \
    -v /srv/bgerp/data/backup:/opt/bgerp/backup \
    -v /srv/bgerp/conf:/opt/bgerp/conf \
    -v /srv/bgerp/log:/opt/bgerp/log \
    -p 9088:9088 \
    bgerp/bgerp && docker logs --follow bgerp
Completely remove all the related data.
rm -rf /srv/bgerp

Deployment Script

A Bash script that runs on Debian/CentOS and performs:

  • deployment a Docker container with running BGERP;

  • configuration of NGINX with SSL access.


  • You need to be installed next packages: docker-ce, nginx, certbot, curl.

  • Run script with sudo or root

Switch to a working directory, e.g:

cd /tmp

Download the script using curl:

curl --output


sudo bash <NAME> <PORT>


  • <NAME> - DNS server name used for the instance;

  • <PORT> - HTTP port exposed on localhost.


sudo bash 9001

Linux server

Installation on Linux server.


The Original MySQL DB Server version 8.0 or newer has to be used.

Different forks of MySQL (Maria, Percona) do not fit because of missing fulltext index support. Here is the test query to verify it:

// PzdcDoc snippet of: 'src/ru/bgcrm/plugin/fulltext/db.sql', lines: 1 - 9

        object_type VARCHAR(100) NOT NULL,
        object_id INT NOT NULL,
        scheduled_dt DATETIME,
        data TEXT NOT NULL,
        FULLTEXT (data) WITH PARSER ngram,
        KEY scheduled_dt (scheduled_dt),
        UNIQUE KEY type_id (object_type, object_id)

You can use the instruction for converting existing MySQL-like DB to the right version.


Check the required options below in [mysqld] section in file my.cnf:

sql-mode must be set exactly to empty string, as shown in the example. If sql-mode is not defined - add it, if missing - make value DB creation script contains correctness of it any case.

Add missing sql-mode command:

sed -i '/\[mysqld\]/a sql-mode= ' /etc/mysql/my.cnf

You will also need a root access to the MySQL Server one time.


Required version OpenJDK 21, may be installed differently for distributions, for example so:

sudo yum update
sudo yum install -y java-21-openjdk-devel
Check, what both commands java and javac must be available after installation.


All the operations require root user.

Check and install if needed script dependencies:

sudo yum update
sudo yum install -y epel-release
sudo yum install -y zip pwgen wget mysql-community-client unzip

Download archive and unpack it:

wget -O /tmp/ &&
unzip /tmp/ -d /opt &&
chmod 744 /opt/bgerp/*.sh

Generate DB password ant put it in files:

ERP_DB_PWD=`pwgen -y -c 20` && export EPR_DB_PWD &&
echo "Setting DB password: '$ERP_DB_PWD'" &&
sed -i "s/GENERATED_PASSWORD/$ERP_DB_PWD/" /opt/bgerp/ &&
sed -i "s/GENERATED_PASSWORD/'$ERP_DB_PWD'/" /opt/bgerp/db_create.sql

Run DB user and structure creation:

mysql --default-character-set=utf8 -h127.0.0.1 -uroot -p < /opt/bgerp/db_create.sql
mysql --default-character-set=utf8 -h127.0.0.1 -ubgerp -p$ERP_DB_PWD < /opt/bgerp/db_init.sql

Apply data from the Demo:

wget -O /opt/bgerp/bgerp.sql
mysql --default-character-set=utf8 -h127.0.0.1 -uroot -p bgerp < /opt/bgerp/bgerp.sql

Change if needed in DB server host, HTTP and management ports, in JAVA_HOME:

if [ -z "$JAVA_HOME" ]; then
  echo "The JAVA_HOME environment variable is not defined"
  echo "This environment variable is needed to run this program"
  exit 1

java and javac are looked in $JAVA_HOME/bin/

For starting/stopping use - shows current status of the application. After starting check log/bgerp.log and log/bgerp.out on errors.

The running application is available via Web-interface.


Скрипт сервиса Systemd расположен в scripts/bgerp.service, переместите его в каталог /etc/systemd/system/. Затем выполните команды:

systemctl daemon-reload
systemctl enable bgerp

Для автозапуска приложения при загрузке системы.

Demo System

The Demo System is running on with the latest published builds of software and resets to initial state any 3rd hour CET time. Both, software and data for the demo system are provided from master branch. DB content of the system is identical to Docker Container that should be preferred in case of you going to do changes.


Изучите лог обновлений, там могут содержаться важные сведения либо инструкции.


В оснастке Администрирование / Приложение / Статус приложения доступен просмотр текущей версии приложения, списка с логами обновлений. Для всех операций неявно используется консольная утилита, описанная далее.


Раздел Update - обновление на текущую версию системы и набора библиотек. Выполняемая команда:

./ && ./ update(f) && ./

Раздел Update on change - загрузка пакетов обновления изменения по коду процесса. Выполняемая команда:

./ && ./ install && ./
Повторное Обновление после Обновления на изменение позволит сбросить сервер в состояние последнего релиза.

Консольные утилиты

Перед установкой обновления всегда делайте резервную копию программы при помощи скрипта

  • При указании параметра db скрипт создаст резервную копию БД, данные для подключения к серверу MySQL берутся из файла

  • Резервные копии сохраняются в папке backup в файлах с форматом имени год-месяц-дата-время(.db).zip, наличие подстроки db означает, что в архиве есть дамп БД

Для обновления вызовите команду:

./ update

Для обновления системы на иную версию (не 3.0) вызовите команду:

./ update <version>


./ update 3.0

Running without arguments prints the help.

Commands for installer:
         update            - update to the actual builds if they differ from currents.
         updatef           - update to the actual builds without comparison.
         update <version>  - switch to another version (not build) of the program.
         killhash          - clear executed queries history.
         install <zip>     - install a module from the zip file.
         installc <change> - download update files from <change> and install them.

Recommended command for updating (argument 'db' can be excluded for speeding up and used only periodically):

./ db && ./ update && ./

Update files are taken from version-containing URL, for example for version 3.0:

Хранимые процедуры обновления

Для изменений структуры БД в скриптах внутри пакетов обновлении используются хранимые процедуры. Например:

CALL add_column_if_not_exists('task', 'config', 'TEXT NOT NULL');

При восстановлении БД из резервной копии они могут пропасть. Процедура обновления происходит с ошибками. В этом случае необходимо выполнить следующие команды:

./ killhash
./ updatef

Первая удаляет из БД информацию о уже применённых обновлениях структуры, вторая - производит повторное выполнение всех скриптов.


Typically the application is running in Intranet, access to restricted interfaces from outside as well as SSL may be organized using NGINX.


The application is runnun on internal host Outside on host is available only open interface The configuration may be typically placed in file /etc/nginx/conf.d/

server {
    server_name   ;
    access_log              /var/log/nginx/;

    # optionally close access without interface
    #location = / {
    #    return 404;

    # for opening user interface - add admin||user
    # for opening user mobile interface - add usermob
    location / {
        client_max_body_size    100m;
        proxy_pass    ;
        proxy_redirect          http:// https://;
        proxy_set_header        Host $host;
        proxy_set_header        Connection close;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_read_timeout      300;
        gzip_proxied            any;

    # this part has to be generated first by CertBot:
    # certbot --nginx -d -d -d -d -d -d
    listen 443 ssl; # managed by Certbot
    listen [::]:443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

# redirect HTTP to HTTPS
server {
    listen        80;
    listen        [::]:80;
    return 301    https://$host$request_uri;