Add Graphite (#265)

This commit is contained in:
Semyon Bezrukov 2020-07-23 15:42:17 +03:00 committed by GitHub
parent c2bcd00322
commit 7bfe250035
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 0 deletions

@ -55,6 +55,9 @@ env:
# redis
- config: redis.yml
# graphite
- config: graphite.yml
services:
- docker

@ -181,6 +181,10 @@ Below is the complete list of parameters that can be set using environment varia
- **JWT_HEADER**: Defines the http header that will be used to send the JSON Web Token. Defaults to `Authorization`.
- **JWT_IN_BODY**: Specifies the enabling the token validation in the request body to the ONLYOFFICE Document Server. Defaults to `false`.
- **USE_UNAUTHORIZED_STORAGE**: Set to `true`if using selfsigned certificates for your storage server e.g. Nextcloud. Defaults to `false`
- **METRICS_ENABLED**: Specifies the enabling StatsD for ONLYOFFICE Document Server. Defaults to `false`.
- **METRICS_HOST**: Defines StatsD listening host. Defaults to `localhost`.
- **METRICS_PORT**: Defines StatsD listening port. Defaults to `8125`.
- **METRICS_PREFIX**: Defines StatsD metrics prefix for backend services. Defaults to `ds.`.
## Installing ONLYOFFICE Document Server integrated with Community and Mail Servers

@ -78,6 +78,11 @@ read_setting(){
deprecated_var AMQP_SERVER_URL AMQP_URI
deprecated_var AMQP_SERVER_TYPE AMQP_TYPE
METRICS_ENABLED="${METRICS_ENABLED:-false}"
METRICS_HOST="${METRICS_HOST:-localhost}"
METRICS_PORT="${METRICS_PORT:-8125}"
METRICS_PREFIX="${METRICS_PREFIX:-.ds}"
DB_HOST=${DB_HOST:-${POSTGRESQL_SERVER_HOST:-$(${JSON} services.CoAuthoring.sql.dbHost)}}
case $DB_TYPE in
"postgres")
@ -179,6 +184,15 @@ waiting_for_redis(){
waiting_for_datacontainer(){
waiting_for_connection ${ONLYOFFICE_DATA_CONTAINER_HOST} ${ONLYOFFICE_DATA_CONTAINER_PORT}
}
update_statsd_settings(){
${JSON} -I -e "if(this.statsd===undefined)this.statsd={};"
${JSON} -I -e "this.statsd.useMetrics = '${METRICS_ENABLED}'"
${JSON} -I -e "this.statsd.host = '${METRICS_HOST}'"
${JSON} -I -e "this.statsd.port = '${METRICS_PORT}'"
${JSON} -I -e "this.statsd.prefix = '${METRICS_PREFIX}'"
}
update_db_settings(){
${JSON} -I -e "this.services.CoAuthoring.sql.type = '${DB_TYPE}'"
${JSON} -I -e "this.services.CoAuthoring.sql.dbHost = '${DB_HOST}'"
@ -420,6 +434,10 @@ if [ ${ONLYOFFICE_DATA_CONTAINER_HOST} = "localhost" ]; then
read_setting
if [ $METRICS_ENABLED = "true" ]; then
update_statsd_settings
fi
update_welcome_page
update_log_settings

32
tests/graphite.yml Normal file

@ -0,0 +1,32 @@
version: '2.1'
services:
onlyoffice-documentserver:
container_name: onlyoffice-documentserver
build:
context: ../.
depends_on:
- onlyoffice-graphite
environment:
- METRICS_ENABLED=${METRICS_ENABLED:-true}
- METRICS_HOST=${METRICS_HOST:-localhost}
- METRICS_PORT=${METRICS_PORT:-8125}
- METRICS_PREFIX=${METRICS_PREFIX:-ds.}
stdin_open: true
restart: always
expose:
- '2003'
ports:
- '80:80'
volumes:
- ./graphite/statsd:/var/www/onlyoffice/documentserver/server/Metrics/config
onlyoffice-graphite:
container_name: onlyoffice-graphite
image: graphiteapp/graphite-statsd
environment:
- GRAPHITE_STATSD_HOST=${GRAPHITE_STATSD_HOST:-onlyoffice-documentserver}
- GRAPHITE_TIME_ZONE=${GRAPHITE_TIME_ZONE:-Etc/UTC}
ports:
- '8888:80'
stdin_open: true
restart: always

@ -0,0 +1,7 @@
{
"graphiteHost": "onlyoffice-graphite",
"graphitePort": 2003,
"port": 8125,
"flushInterval": 60000,
"backends": [ "./backends/graphite.js" ]
}