Skip to content

Multi-Container Deployment

Docker k8s deployment requires packaging each component into separate images. The following are the packaging methods for each component.

Database

Note: It is recommended to install the database on the host machine. If you need to install it in a container, be sure to mount the data disk, otherwise data loss may occur. If the Docker version is lower than 20.10.6, you need to add the --privileged=true option to start in privileged mode.

shell
$ docker pull postgres:13.11
$ mkdir -p /data/pgsql-13/data
$ docker run --name postgres-13.11 -p 5432:5432 -e POSTGRES_PASSWORD={password} -d -v /data/pgsql-13/data:/var/lib/postgresql/data postgres:13.11

After installing the database, you need to initialize the database:

Download Installation Package

shell
$ wget https://repo.informat.cn/downloads/packages/informat_next_2.26.zip
$ unzip informat_next_2.26.zip

Download Script to Initialize Database

The execution script needs to be placed in the same directory as the db folder

shell
$ wget https://repo.informat.cn/downloads/installer/k8s/db/install_db.sh

The directory structure of the database execution script and SQL files is:

shell
├── install_db.sh                       # Script file
├── db                                  # Folder where SQL files are stored
   ├── db_informat2_account_prd_init.sql
   ├── db_informat2_account_prd_init2.sql
   ├── db_informat2_biz_prd_0_init.sql
   ├── db_informat2_biz_prd_0_init2.sql
   └── version
       ├── 2_account.sql
       ├── 2_biz.sql
       ├── 3_account.sql
       ├── 3_biz.sql
       └── ...

Configure Script

shell
$ vim install_db.sh
IP=127.0.0.1 # Replace with your database IP
PORT=5432 # Replace with your database port
USERNAME=postgres # Replace with your username
export PGPASSWORD="12345678" # Replace with user password
...

Execute Database Initialization

bash
$ chmod +x install_db.sh
$ ./install_db.sh

Redis Cache

shell
$ docker pull redis:7.0.5
$ docker run -itd --name redis -p 6379:6379 redis:7.0.5 --requirepass {password}

Message Queue

shell
# Pull image
$ docker pull rabbitmq:3.9.19
$ docker run -d --hostname informat --name rabbit -p 5672:5672 -p 15672:15672 -e RABBITMQ_DEFAULT_USER={user} -e RABBITMQ_DEFAULT_PASS={password} rabbitmq:3.9.19
# Enter container
$ docker exec -it rabbit /bin/bash
# Enable rabbit management backend
$ rabbitmq-plugins enable rabbitmq_management

OnlyOffice File Preview

Download Image

shell
wget https://repo.informat.cn/downloads/installer/k8s/onlyoffice/onlyoffice-7.1.1.tar

Import Image

shell
$ docker load < onlyoffice-7.1.1.tar

Start Service

shell
docker run --restart=always --name onlyoffice -p 9002:9002 -v /data/onlyoffice:/data -e JWT_ENABLED=false onlyoffice:7.1.1

S3 File Storage

shell
$ docker pull minio/minio
$ docker run -d -p 19001:19001 -p 19000:19000 --name minio \
-e "MINIO_ACCESS_KEY=admin" \
-e "MINIO_SECRET_KEY={password}" \
-v {minio-mount-path}/minio/data:/data \
-v {minio-mount-path}/minio/config:/root/.minio \
minio/minio server /data \
--console-address ":19001" --address ":19000"

After installation with the above parameters, you can access the MinIO homepage through the corresponding http://ip:19001, enter the above account name (MINIO_ACCESS_KEY) and password (MINIO_SECRET_KEY), then create a new bucket in the Buckets menu.

informat-account

Download Image Package

$ wget https://repo.informat.cn/downloads/installer/k8s/informat-next/informat-account-2.26.tar

Import Image

shell
$ docker load < informat-account-2.26.tar

Account Container Startup Example:

shell
$ mkdir -p /data/informat-account
$ docker run -d --name informat-account -p 9881:9881 -v /data/informat-account:/data cornerstone365/informat-account:2.26

TIP

  • -p 9881:9881 9881 is the account service port
  • -v /data/informat-account:/data The left /data/informat-account refers to the data storage path on the host, which can be modified according to actual conditions

Account Service Parameter Configuration

shell
$ vim /data/informat-account/informat-next/instance/informat-account/application.yml
...
spring:
  application:
    serverId: informat2-account-prd  #If there are multiple account instances, they need to be unique
    intranetUrl: http://127.0.0.1:19881/ #Replace with the intranet IP of the server where nginx is located
  datasource:
    druid:
      url: jdbc:postgresql://127.0.0.1:5432/db_informat2_account_prd?prepareThreshold=0 # Replace with database IP and port
      username: postgres # Replace with database username
      password: 12345678 # Replace with database login password
  redis:
    database: 0
    host: 127.0.0.1 # Replace with redis service IP
    port: 6379 # Replace with redis service port
    password: 12345678 # Replace with redis login password
  rabbitmq:
    host: 127.0.0.1 # Replace with rabbitmq service IP
    port: 5672 # Replace with rabbitmq service port
    nickname: Informat-Next
    username: admin # Replace with rabbitmq service username
    password: 12345678 # Replace with rabbitmq service user password
...
# Restart service after saving
$ docker restart informat-account

informat-biz

Download Image Package

$ wget https://repo.informat.cn/downloads/installer/k8s/informat-next/informat-biz-2.26.tar

Import Image

shell
docker load < informat-biz-2.26.tar

Biz Container Startup Example:

shell
$ mkdir -p /data/informat-biz
$ docker run -d --name informat-biz -p 8881:8881 -v /data/informat-biz:/data cornerstone365/informat-biz:2.26

TIP

  • -p 8881:8881 8881 is the biz service port
  • -v /data/informat-biz:/data The left /data/informat-biz refers to the data storage path on the host, which can be modified according to actual conditions

Biz Service Parameter Configuration

shell
$ vim /data/informat-biz/informat-next/instance/informat-biz/application.yml
...
spring:
  application:
    serverId: informat2-biz-prd  #If there are multiple biz instances, they need to be unique
    intranetUrl: http://127.0.0.1:19881/ #Replace with the intranet IP of the server where nginx is located
  datasource:
    druid:
      url: jdbc:postgresql://127.0.0.1:5432/db_informat2_biz_prd_0?prepareThreshold=0 # Replace with database IP and port
      username: postgres # Replace with database username
      password: 12345678 # Replace with database login password
  redis:
    database: 0
    host: 127.0.0.1 # Replace with redis service IP
    port: 6379 # Replace with redis service port
    password: 12345678 # Replace with redis login password
  rabbitmq:
    host: 127.0.0.1 # Replace with rabbitmq service IP
    port: 5672 # Replace with rabbitmq service port
    nickname: Informat-Next
    username: admin # Replace with rabbitmq service username
    password: 12345678 # Replace with rabbitmq service user password
...
# Restart service after saving
$ docker restart informat-biz

Nginx

shell
# Pull image
$ docker pull nginx
$ docker run --name nginx -p 80:80 -p 19881:19881 -d nginx

Download Configuration File

shell
$ wget https://repo.informat.cn/downloads/installer/k8s/nginx/informat-next.conf

Modify Configuration

shell
vi informat-next.conf

upstream backend_account {
  hash $proxy_add_x_forwarded_for;
  server 172.17.0.1:9881; # Modify to the IP of the server where informat-account is located
  server 172.17.0.2:9881;
}

upstream backend_biz_s0 {
  hash $proxy_add_x_forwarded_for;
  server 172.17.0.3:8881; # Modify to the IP of the server where informat-biz is located
  server 172.17.0.4:8881;
}

Deploy Configuration File

Copy informat-next.conf to the /etc/nginx/conf.d directory

shell
$ docker cp informat-next.conf nginx:/etc/nginx/conf.d

Delete Default Configuration

shell
$ docker exec -it nginx /bin/bash     #Enter container
$ rm /etc/nginx/conf.d/default.conf

Restart Nginx

shell
docker restart nginx

Restart informat-biz

shell
docker restart informat-biz

View informat-biz Logs

shell
tail -f /data/informat-biz/informat-next/log/informat-biz.log

Modify Backend Configuration Items

Configure Homepage URL

Open "System Information >> Parameter Settings", find "Login and Resources"

Configure File Preview Service

Open "System Information >> Parameter Settings", find "File Preview Service"

Configure File Storage

Add bucket: informat-next

Open "System Information >> Parameter Settings", find "File Storage"

  • Fill in the AccessKey and SecretKey created when creating MinIO
  • Fill in the bucket name just added: informat-next
  • Modify the endpoint address to: http://minio-container-ip:19000

Configure Node Service

Open "System Information >> Parameter Settings", find "Node"

Modify NODE command line to: /usr/local/bin/node

Modify node module path to: /

Configure Git Service

Open "System Information >> Parameter Settings", find "Git"

Modify Git command path to: /usr/bin/git

Common Issues

_ How to know if the service has started completely? _

The first startup will be slower. You can check if the Informat service has started completely by viewing /data/informat-biz/informat-next/log/informat-biz.log You can access the homepage http://server-ip normally

_ How to view Informat logs _

Logs of Informat account service instances are in the /data/informat-account/informat-next/log directory

Logs of Informat biz service instances are in the /data/informat-biz/informat-next/log directory

_ How to restart containers _

shell
$ docker start informat-account
$ docker start informat-biz