Skip to content

Post-Deployment Configuration

After installing Informat, you may need to adjust some parameters for Informat, such as adjusting thread pool size based on load and modifying maximum upload file size. This chapter introduces you to the directory structure of Informat after installation and the structure of configuration files.

Informat Deployment Directory Structure

shell
│─informat-next
├─informat                           Control program
├─jdk                                JDK
└─instance                           Instance folder
  └─informat-account                Account instance
      └─application.yml             Instance configuration file
      └─logback-spring.xml          Instance log configuration file
      └─informat-account-1.0.0.jar  Instance running jar package
      └─env.properties              Environment variable configuration
      └─pid                         Program PID after running
  └─informat-biz                    Biz instance
      └─application.yml             Instance configuration file
      └─logback-spring.xml          Instance log configuration file
      └─informat-biz-1.0.0.jar      Instance running jar package
      └─env.properties              Environment variable configuration
      └─pid                         Program PID after running
└─log                                Log storage directory
  └─informat-xxx.log                Instance logs

Startup Parameter Configuration File

The startup configuration file application.yml is used to configure and customize application behavior. It provides a simple way to manage application properties and settings without writing additional code.

Application Configuration

Configuration ItemDescription
app.versionApplication version number.
server.portApplication server port number.
server.tomcat.max-http-post-sizeMaximum HTTP POST request size allowed by Tomcat. Set to -1 for no limit.
logging.configSpecifies the location of the log configuration file.

Spring Application Configuration

Configuration ItemDescription
spring.application.nameApplication name.
spring.application.serverIdApplication server ID. Ensure uniqueness when deploying multiple instances.
spring.application.serverIpApplication deployment server IP. Ensure no duplicates when deploying across multiple servers. Example: 192.168.10.53
spring.application.clusterNameCluster name to which the application belongs.
spring.application.accountClusterNameAccount cluster name.
spring.application.intranetUrlInternal URL address to access Account service.
spring.application.asyncTaskCorePoolSizeCore thread count of the asynchronous scheduled task thread pool.
spring.application.asyncTaskMaximumPoolSizeMaximum thread count of the asynchronous scheduled task thread pool.
spring.application.asyncTaskQueueCapacityMaximum capacity of the work queue in the asynchronous scheduled task thread pool. When tasks are submitted to the thread pool, if the work queue is full, an exception log will be thrown and the task will be rejected.
spring.application.asyncSystemTaskCorePoolSizeCore thread count of the asynchronous system task thread pool.
spring.application.asyncSystemTaskMaximumPoolSizeMaximum thread count of the asynchronous system task thread pool.
spring.application.asyncSystemTaskQueueCapacityMaximum capacity of the work queue in the asynchronous system task thread pool.
spring.application.disableMonitorWhether to disable monitoring.
spring.main.allow-bean-definition-overridingWhether to allow bean definition overriding.
spring.main.allow-circular-referencesWhether to allow circular references.
spring.main.register-shutdown-hookWhether to register a hook for JVM shutdown.
spring.application.enableScriptCacheWhether to support script caching.
spring.application.scriptCacheCapacityMaximum capacity of script cache.
spring.application.enableTableOptionListCacheWhether to cache data dictionaries.
spring.application.departmentCacheTypeOrganization structure cache type, redis, local.

TIP

If any of asyncTaskCorePoolSize, asyncTaskMaximumPoolSize, or asyncTaskQueueCapacity is less than or equal to 0, asynchronous tasks will not be enabled. (These three settings are only valid for the informat-biz system and are used for scheduled tasks in applications and internal asynchronous tasks in the system.)

Servlet Configuration

Configuration ItemDescription
spring.servlet.multipart.max-file-sizeMaximum size limit for uploaded files.
spring.servlet.multipart.max-request-sizeMaximum size limit for requests.
spring.servlet.multipart.enabledWhether to enable file upload functionality.

Thymeleaf Template Engine Configuration

Configuration ItemDescription
spring.thymeleaf.cacheWhether to enable Thymeleaf template caching.
spring.thymeleaf.prefixPrefix path for Thymeleaf template files.

Data Source Configuration

Configuration ItemDescription
spring.datasource.druid.urlDatabase connection URL.
spring.datasource.druid.typeData source type.
spring.datasource.druid.driver-class-nameDatabase driver class name.
spring.datasource.druid.initial-sizeSpecifies the initial connection pool size.
spring.datasource.druid.max-activeSpecifies the maximum number of active connections in the connection pool.
spring.datasource.druid.min-idleSpecifies the minimum number of idle connections in the connection pool.
spring.datasource.druid.max-waitSpecifies the maximum wait time to obtain a connection (in milliseconds).
spring.datasource.druid.pool-prepared-statementsWhether to enable the prepared statement pool.
spring.datasource.druid.max-pool-prepared-statement-per-connection-sizeSpecifies the maximum number of prepared statements per connection.
spring.datasource.druid.time-between-eviction-runs-millisSpecifies the time interval between idle connection recycling (in milliseconds).
spring.datasource.druid.min-evictable-idle-time-millisSpecifies the minimum idle time of a connection in the connection pool (in milliseconds).
spring.datasource.druid.test-while-idleWhether to validate connection validity when idle.
spring.datasource.druid.test-on-borrowWhether to validate connection validity when borrowing from the connection pool.
spring.datasource.druid.test-on-returnWhether to validate connection validity when returning to the connection pool.
spring.datasource.druid.validation-querySpecifies the query statement used to validate connections.
spring.datasource.druid.filtersSpecifies filters in the Druid connection pool (only using statistical filter).
spring.datasource.druid.stat-view-servlet.enabledWhether to enable the Servlet for viewing Druid statistics.
spring.datasource.druid.stat-view-servlet.allowSpecifies IP addresses allowed to access Druid statistics (empty means allow all IPs).
spring.datasource.druid.stat-view-servlet.url-patternSpecifies the URL pattern for the Druid statistics view Servlet.
spring.datasource.druid.stat-view-servlet.login-usernameSpecifies the login username for the Druid statistics view Servlet.
spring.datasource.druid.stat-view-servlet.login-passwordSpecifies the login password for the Druid statistics view Servlet.
spring.datasource.druid.filter.stat.log-slow-sqlWhether to enable slow query logging.
spring.datasource.druid.filter.stat.slow-sql-millisDefines the threshold for slow queries (in milliseconds).
spring.datasource.druid.filter.stat.merge-sqlWhether to enable SQL merging.
spring.datasource.druid.filter.wall.config.multi-statement-allowWhether to allow execution of multiple SQL statements.
spring.datasource.druid.web-stat-filter.enabledWhether to enable Druid's Web statistics filter.
spring.datasource.druid.web-stat-filter.url-patternSpecifies the URL pattern for the Web statistics filter.
spring.datasource.druid.web-stat-filter.exclusionsSpecifies URL patterns to exclude from statistics.
spring.datasource.druid.web-stat-filter.session-stat-enableWhether to enable Session statistics.
spring.datasource.druid.web-stat-filter.session-stat-max-countSpecifies the maximum number of Session statistics to save.

Redis Configuration

Configuration ItemDescription
spring.redis.databaseRedis database index.
spring.redis.hostRedis server host.
spring.redis.portRedis server port.
spring.redis.passwordRedis password.
spring.redis.timeoutConnection timeout with Redis server (in milliseconds).
spring.redis.lettuce.pool.max-activeMaximum number of active connections in Lettuce connection pool.
spring.redis.lettuce.pool.max-waitMaximum wait time to obtain a connection from Lettuce connection pool (-1 means infinite wait).
spring.redis.lettuce.pool.max-idleMaximum number of idle connections in Lettuce connection pool.
spring.redis.lettuce.pool.min-idleMinimum number of idle connections in Lettuce connection pool.

RabbitMQ Configuration

Configuration ItemDescription
spring.rabbitmq.portRabbitMQ server port.
spring.rabbitmq.hostRabbitMQ server hostname.
spring.rabbitmq.nicknameRabbitMQ nickname.
spring.rabbitmq.usernameRabbitMQ username.
spring.rabbitmq.passwordRabbitMQ password.
spring.rabbitmq.publisher-confirm-typeRabbitMQ publisher confirmation type.
spring.rabbitmq.publisher-returnsWhether to enable RabbitMQ publisher returns.
spring.rabbitmq.virtual-hostRabbitMQ virtual host.
spring.rabbitmq.listener.simple.acknowledge-modeRabbitMQ listener acknowledgment mode.
spring.rabbitmq.listener.template.mandatoryWhether the RabbitMQ template should require a mandatory route match during message sending.

Elasticsearch Configuration

Configuration ItemDescription
spring.elasticsearch.cluster-nameElasticsearch cluster name.
spring.elasticsearch.cluster-nodesElasticsearch cluster node addresses.

TIP

Elasticsearch configuration is only valid for the informat-biz system and is used for the search engine module.

Mail Server Configuration

Configuration ItemDescription
spring.mail.hostHostname or IP address of the SMTP server.
spring.mail.portPort number of the SMTP server.
spring.mail.usernameUsername for SMTP server authentication.
spring.mail.passwordPassword for SMTP server authentication.
spring.mail.protocolMail transfer protocol, usually "smtp" or "smtps".
spring.mail.default-encodingDefault character encoding for email message text.
spring.mail.properties.mail.smtp.authSpecifies whether authentication is required, usually set to "true".
spring.mail.properties.mail.smtp.starttls.enableEnable or disable STARTTLS support, usually set to "true".
spring.mail.properties.mail.smtp.starttls.requiredSpecifies whether STARTTLS is required, usually set to "true".
spring.mail.properties.mail.smtp.ssl.enableEnable or disable SSL support, usually set to "true".
spring.mail.properties.mail.smtp.ssl.trustHostname of trusted SSL certificates.
spring.mail.properties.mail.smtp.ssl.socketFactory.classSocketFactory class used when configuring SSL/TLS connections for SMTP server.
spring.mail.properties.mail.smtp.ssl.socketFactory.fallbackConfigures the fallback behavior of the SSL/TLS SocketFactory.
spring.mail.properties.mail.debugEnable or disable debug mode, usually set to "true" to view detailed logs in the console.
spring.mail.default-headers.fromDefault sender address for email messages.
spring.mail.default-headers.reply-toDefault reply address for email messages.
spring.mail.default-headers.toDefault recipient address for email messages.
spring.mail.default-headers.ccDefault CC address for email messages.

Log Configuration File

The log configuration file logback-spring.xml allows developers to define log output formats, log levels, log output destinations (such as files, console, etc.), and log rolling strategies. Through this file, you can flexibly manage and control the application's logging behavior, ensuring the effectiveness and readability of log information, which is helpful for troubleshooting and performance monitoring.

How to Modify Log Level?

The default log level is INFO

  • Modifying log level

Find the root tag and modify the level

xml
<root level="INFO">
    <appender-ref ref="file" />
</root>

TIP

Logback log levels are available in the following order from highest to lowest:

  • ERROR: Used to record error events that may cause some functions of the program to not work properly.
  • WARN: Used to record warning information that indicates potential problems but does not immediately affect program operation.
  • INFO: Used to record general information such as program running status and key steps.
  • DEBUG: Used to record debugging information, which is mainly used during development and debugging phases to help developers understand the program's internal state.
  • TRACE: Used to record more granular debugging information than DEBUG level, usually used to trace program execution flow.

Restarting Informat Services

shell
systemctl restart informat-account
systemctl restart informat-biz

Viewing Informat Service Logs

shell
less -R /informat-next/log/informat-account.log
less -R /informat-next/log/informat-biz.log

Installation Paths and Configurations of Other Informat Components

Message Queue: rabbitmq

  • Installation directory: /usr/lib/rabbitmq
  • Configuration file: /etc/rabbitmq/rabbitmq.conf

TIP

RabbitMQ may not have a default main configuration file /etc/rabbitmq/rabbitmq.conf installed because it is not required during installation. However, you can manually create this file for custom configuration. You can create the /etc/rabbitmq/rabbitmq.conf file following these steps:

redis

  • Installation directory: /usr/local/redis
  • Configuration file: /usr/local/redis/bin/redis.conf
  • Log file: /var/log/redis/redis.log

Database

  • Installation directory: /usr/pgsql-13
  • Configuration file: data/pgsql/data/postgresql.conf
  • Log file: /data/pgsql/data/log/

Example: Scheduled Backup

You can use Linux Cron expressions to implement scheduled database backup functionality Backup the database every day at 2 AM

shell
0 2 * * * /informat-next/backup_database.sh

The backup_database.sh script is as follows

shell
#!/bin/bash
current=`date "+%Y%m%d%H%M%S"`
bake=backup_db/$current
mkdir -p $bake
export PGPASSWORD="{database password}"
pg_dump -h 127.0.0.1 -O -p 5432 -U postgres  -d db_informat2_account_prd >  $bake/db_informat2_account_prd.sql
pg_dump -h 127.0.0.1 -O -p 5432 -U postgres  -d db_informat2_biz_prd_0 >  $bake/db_informat2_biz_prd_0.sql

nginx

  • Installation directory: /usr/sbin/nginx
  • Configuration file: /etc/nginx/nginx.conf
  • Log file: /var/log/nginx/

TIP

If you need to modify Nginx's default configuration, you can edit the /etc/nginx/nginx.conf and /etc/nginx/conf.d/*.conf files. After editing, restart Nginx using the systemctl restart nginx command for the configuration to take effect.

Configuring HTTPS

TIP

Replace parameters like {account_servers} with actual service parameters

shell
upstream backend_account {
  {account_servers}
}

upstream backend_biz_s0 {
  {biz_servers}
}

server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  server_name {server_name};
  client_max_body_size 2000M;
  ssl_certificate {certificate_path}/informat2.pem;
  ssl_certificate_key {certificate_key_path}/informat2.key;
  ssl_session_timeout 5m;
  ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

  proxy_connect_timeout 1m;
  proxy_send_timeout 30m;
  proxy_read_timeout 30m;
  proxy_set_header Connection '';
  proxy_http_version 1.1;
  chunked_transfer_encoding off;
  proxy_buffering off;
  proxy_cache off;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $remote_addr;
  proxy_set_header X-Forwarded-Server $host;
  add_header 'Access-Control-Allow-Origin' * always;
  add_header 'Access-Control-Allow-Credentials' 'true' always;
  add_header 'Access-Control-Allow-Methods' 'GET,POST,DELETE,PUT,HEAD,OPTIONS' always;
  add_header 'Access-Control-Allow-Headers' 'DNT,token,Authorization,Accept,Origin,Keep-Alive,User-Agent,X-Mx-ReqToken,X-Data-Type,X-Auth-Token,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
  add_header 'Access-Control-Expose-Headers' 'Set-Cookie,Content-Disposition,Content-Range,RequestId,Date' always;

  location / {
    proxy_pass http://backend_account$request_uri;
    access_log /var/log/nginx/informat_next_account_access_web.log;
  }

  location ^~ /web0/ {
    access_log /var/log/nginx/informat_next_biz_api_web.log;
    if ($request_method = 'OPTIONS') {
       return 204;
    }
    proxy_pass http://backend_biz_s0/web/;
  }

  location ^~ /account/ {
    access_log /var/log/nginx/informat_next_account_api_web.log;
    if ($request_method = 'OPTIONS') {
       return 204;
    }
    proxy_pass http://backend_account$request_uri;
  }
}

server {
  listen {intranet_port};
  server_name localhost;

  proxy_connect_timeout 1m;
  proxy_send_timeout 30m;
  proxy_read_timeout 30m;
  proxy_set_header Connection '';
  proxy_http_version 1.1;
  chunked_transfer_encoding off;
  proxy_buffering off;
  proxy_cache off;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $remote_addr;
  proxy_set_header X-Forwarded-Server $host;
  add_header 'Access-Control-Allow-Origin' * always;
  add_header 'Access-Control-Allow-Credentials' 'true' always;
  add_header 'Access-Control-Allow-Methods' 'GET,POST,DELETE,PUT,HEAD,OPTIONS' always;
  add_header 'Access-Control-Allow-Headers' 'DNT,token,Authorization,Accept,Origin,Keep-Alive,User-Agent,X-Mx-ReqToken,X-Data-Type,X-Auth-Token,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
  add_header 'Access-Control-Expose-Headers' 'Set-Cookie,Content-Disposition,Content-Range,RequestId,Date' always;

  location / {
    proxy_pass http://backend_account$request_uri;
    access_log /var/log/nginx/informat_next_account_access_web.log;
  }

  location ^~ /web0/ {
    access_log /var/log/nginx/informat_next_biz_api_web.log;
    if ($request_method = 'OPTIONS') {
       return 204;
    }
    proxy_pass http://backend_biz_s0/web/;
  }

  location ^~ /account/ {
    access_log /var/log/nginx/informat_next_account_api_web.log;
    if ($request_method = 'OPTIONS') {
       return 204;
    }
    proxy_pass http://backend_account$request_uri;
  }
}


server {
  listen 80;
  server_name {server_name};
  rewrite ^(.*)$ https://$host$1 permanent;
}

minio

  • Installation directory: /data/minio_home/
  • Configuration file: /data/minio_home/minio.conf

Elasticsearch

  • Installation directory: /data/elasticsearch-{version}/
  • Configuration file: /data/elasticsearch-{version}/config/*.yml

onlyoffice

  • Installation directory: /var/www/onlyoffice/DocumentServer
  • Configuration file: /etc/onlyoffice/documentserver/default.json