From d59136d47772daca0386b33e8de498346a32a851 Mon Sep 17 00:00:00 2001 From: Roman Demidov <58073444+romandemidov@users.noreply.github.com> Date: Mon, 23 Dec 2019 12:27:47 +0300 Subject: [PATCH 1/6] Rename AMQP variables (#205) --- .travis.yml | 14 ++++++++++++-- README.md | 4 ++-- docker-compose.yml | 2 +- run-document-server.sh | 15 +++++++++------ tests/activemq.yml | 4 ++-- tests/defaults.env | 4 ++-- tests/rabbitmq-old.yml | 28 ++++++++++++++++++++++++++++ tests/rabbitmq.yml | 28 ++++++++++++++++++++++++++++ 8 files changed, 84 insertions(+), 15 deletions(-) create mode 100644 tests/rabbitmq-old.yml create mode 100644 tests/rabbitmq.yml diff --git a/.travis.yml b/.travis.yml index 5877421..93c8ad5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,8 +30,18 @@ env: # activemq - config: activemq.yml - AMQP_SERVER_TYPE: activemq - AMQP_SERVER_URL: amqp://guest:guest@onlyoffice-activemq + AMQP_TYPE: activemq + AMQP_URI: amqp://guest:guest@onlyoffice-activemq + + # rabbitmq + - config: rabbitmq.yml + AMQP_TYPE: rabbitmq + AMQP_URI: amqp://guest:guest@onlyoffice-rabbitmq + + # rabbitmq old variables + - config: rabbitmq-old.yml + AMQP_SERVER_TYPE: rabbitmq + AMQP_SERVER_URL: amqp://guest:guest@onlyoffice-rabbitmq services: - docker diff --git a/README.md b/README.md index 29e3a46..8d97e96 100644 --- a/README.md +++ b/README.md @@ -168,8 +168,8 @@ Below is the complete list of parameters that can be set using environment varia - **DB_NAME**: The name of a database to be created on the image startup. - **DB_USER**: The new user name with superuser permissions for the database account. - **DB_PWD**: The password set for the database account. -- **AMQP_SERVER_URL**: The [AMQP URL](http://www.rabbitmq.com/uri-spec.html "RabbitMQ URI Specification") to connect to message broker server. -- **AMQP_SERVER_TYPE**: The message broker type. Supported values are `rabbitmq` or `activemq`. Defaults to `rabbitmq`. +- **AMQP_URI**: The [AMQP URI](http://www.rabbitmq.com/uri-spec.html "RabbitMQ URI Specification") to connect to message broker server. +- **AMQP_TYPE**: The message broker type. Supported values are `rabbitmq` or `activemq`. Defaults to `rabbitmq`. - **REDIS_SERVER_HOST**: The IP address or the name of the host where the Redis server is running. - **REDIS_SERVER_PORT**: The Redis server port number. - **NGINX_WORKER_PROCESSES**: Defines the number of nginx worker processes. diff --git a/docker-compose.yml b/docker-compose.yml index 6e73ff5..3ae25f0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: - DB_PORT=5432 - DB_NAME=onlyoffice - DB_USER=onlyoffice - - AMQP_SERVER_URL=amqp://guest:guest@onlyoffice-rabbitmq + - AMQP_URI=amqp://guest:guest@onlyoffice-rabbitmq - REDIS_SERVER_HOST=onlyoffice-redis - REDIS_SERVER_PORT=6379 # Uncomment strings below to enable the JSON Web Token validation. diff --git a/run-document-server.sh b/run-document-server.sh index d61be11..8d0cf0d 100755 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -64,6 +64,9 @@ read_setting(){ deprecated_var POSTGRESQL_SERVER_DB_NAME DB_NAME deprecated_var POSTGRESQL_SERVER_USER DB_USER deprecated_var POSTGRESQL_SERVER_PASS DB_PWD + deprecated_var RABBITMQ_SERVER_URL AMQP_URI + deprecated_var AMQP_SERVER_URL AMQP_URI + deprecated_var AMQP_SERVER_TYPE AMQP_TYPE DB_HOST=${DB_HOST:-${POSTGRESQL_SERVER_HOST:-$(${JSON} services.CoAuthoring.sql.dbHost)}} case $DB_TYPE in @@ -87,9 +90,9 @@ read_setting(){ DB_TYPE=${DB_TYPE:-$(${JSON} services.CoAuthoring.sql.type)} RABBITMQ_SERVER_URL=${RABBITMQ_SERVER_URL:-$(${JSON} rabbitmq.url)} - AMQP_SERVER_URL=${AMQP_SERVER_URL:-${RABBITMQ_SERVER_URL}} - AMQP_SERVER_TYPE=${AMQP_SERVER_TYPE:-rabbitmq} - parse_rabbitmq_url ${AMQP_SERVER_URL} + AMQP_URI=${AMQP_URI:-${AMQP_SERVER_URL:-${RABBITMQ_SERVER_URL}}} + AMQP_TYPE=${AMQP_TYPE:-${AMQP_SERVER_TYPE:-rabbitmq}} + parse_rabbitmq_url ${AMQP_URI} REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-$(${JSON} services.CoAuthoring.redis.host)} REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-6379} @@ -176,13 +179,13 @@ update_db_settings(){ } update_rabbitmq_setting(){ - if [ "${AMQP_SERVER_TYPE}" == "rabbitmq" ]; then + if [ "${AMQP_TYPE}" == "rabbitmq" ]; then ${JSON} -I -e "if(this.queue===undefined)this.queue={};" ${JSON} -I -e "this.queue.type = 'rabbitmq'" - ${JSON} -I -e "this.rabbitmq.url = '${AMQP_SERVER_URL}'" + ${JSON} -I -e "this.rabbitmq.url = '${AMQP_URI}'" fi - if [ "${AMQP_SERVER_TYPE}" == "activemq" ]; then + if [ "${AMQP_TYPE}" == "activemq" ]; then ${JSON} -I -e "if(this.queue===undefined)this.queue={};" ${JSON} -I -e "this.queue.type = 'activemq'" ${JSON} -I -e "if(this.activemq===undefined)this.activemq={};" diff --git a/tests/activemq.yml b/tests/activemq.yml index 14c3884..f9b4823 100644 --- a/tests/activemq.yml +++ b/tests/activemq.yml @@ -4,8 +4,8 @@ services: container_name: onlyoffice-documentserver image: onlyoffice/4testing-documentserver-ie:latest environment: - - AMQP_SERVER_TYPE - - AMQP_SERVER_URL + - AMQP_TYPE + - AMQP_URI stdin_open: true restart: always ports: diff --git a/tests/defaults.env b/tests/defaults.env index 664f342..cb8a2aa 100644 --- a/tests/defaults.env +++ b/tests/defaults.env @@ -6,8 +6,8 @@ DB_PORT=5432 DB_NAME=onlyoffice DB_USER=onlyoffice DB_PWD=onlyoffice -AMQP_SERVER_TYPE=rabbitmq -AMQP_SERVER_URL=amqp://guest:guest@onlyoffice-rabbitmq +AMQP_TYPE=rabbitmq +AMQP_URI=amqp://guest:guest@onlyoffice-rabbitmq REDIS_SERVER_HOST=onlyoffice-redis REDIS_SERVER_PORT=6379 JWT_ENABLED=true diff --git a/tests/rabbitmq-old.yml b/tests/rabbitmq-old.yml new file mode 100644 index 0000000..9301ae4 --- /dev/null +++ b/tests/rabbitmq-old.yml @@ -0,0 +1,28 @@ +version: '2' +services: + onlyoffice-documentserver: + container_name: onlyoffice-documentserver + image: onlyoffice/4testing-documentserver-ie:latest + environment: + - AMQP_SERVER_TYPE + - AMQP_SERVER_URL + stdin_open: true + restart: always + ports: + - '80:80' + - '443:443' + networks: + - onlyoffice + + onlyoffice-rabbitmq: + container_name: onlyoffice-rabbitmq + image: rabbitmq + restart: always + networks: + - onlyoffice + expose: + - '5672' + +networks: + onlyoffice: + driver: 'bridge' diff --git a/tests/rabbitmq.yml b/tests/rabbitmq.yml new file mode 100644 index 0000000..9006cb0 --- /dev/null +++ b/tests/rabbitmq.yml @@ -0,0 +1,28 @@ +version: '2' +services: + onlyoffice-documentserver: + container_name: onlyoffice-documentserver + image: onlyoffice/4testing-documentserver-ie:latest + environment: + - AMQP_TYPE + - AMQP_URI + stdin_open: true + restart: always + ports: + - '80:80' + - '443:443' + networks: + - onlyoffice + + onlyoffice-rabbitmq: + container_name: onlyoffice-rabbitmq + image: rabbitmq + restart: always + networks: + - onlyoffice + expose: + - '5672' + +networks: + onlyoffice: + driver: 'bridge' From be9f986578995fe7df59869c1ee8a2180e5eec8f Mon Sep 17 00:00:00 2001 From: Roman Demidov <58073444+romandemidov@users.noreply.github.com> Date: Mon, 23 Dec 2019 15:59:14 +0300 Subject: [PATCH 2/6] Add redis test (#206) --- .travis.yml | 5 +++++ tests/redis.yml | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 tests/redis.yml diff --git a/.travis.yml b/.travis.yml index 93c8ad5..aad8a55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,6 +43,11 @@ env: AMQP_SERVER_TYPE: rabbitmq AMQP_SERVER_URL: amqp://guest:guest@onlyoffice-rabbitmq + # redis + - config: redis.yml + REDIS_SERVER_HOST: onlyoffice-redis + REDIS_SERVER_PORT: 6379 + services: - docker diff --git a/tests/redis.yml b/tests/redis.yml new file mode 100644 index 0000000..2984ffe --- /dev/null +++ b/tests/redis.yml @@ -0,0 +1,28 @@ +version: '2' +services: + onlyoffice-documentserver: + container_name: onlyoffice-documentserver + image: onlyoffice/4testing-documentserver-ie:latest + environment: + - REDIS_SERVER_HOST + - REDIS_SERVER_PORT + stdin_open: true + restart: always + ports: + - '80:80' + - '443:443' + networks: + - onlyoffice + + onlyoffice-redis: + container_name: onlyoffice-redis + image: redis + restart: always + networks: + - onlyoffice + expose: + - '6379' + +networks: + onlyoffice: + driver: 'bridge' From e721ca102d0b75b0f01099c2b9c10d73db140250 Mon Sep 17 00:00:00 2001 From: Semyon Bezrukov Date: Tue, 28 Apr 2020 15:05:35 +0300 Subject: [PATCH 3/6] Update travis tests (#243) * Remove docker .env file * Add enviroment variables defaults * Update docker-compose version * Update travis tests variables * Build document server image * Fix mariadb * Fix variable names * Revert container name --- .travis.yml | 19 ------------------- tests/activemq.yml | 13 +++++++------ tests/defaults.env | 41 ----------------------------------------- tests/mariadb.yml | 31 ++++++++++++++++--------------- tests/mysql.yml | 25 +++++++++++++------------ tests/postgres-old.yml | 21 +++++++++++---------- tests/postgres.yml | 23 ++++++++++++----------- tests/rabbitmq-old.yml | 9 +++++---- tests/rabbitmq.yml | 9 +++++---- tests/redis.yml | 9 +++++---- tests/test.sh | 10 ---------- 11 files changed, 74 insertions(+), 136 deletions(-) delete mode 100644 tests/defaults.env diff --git a/.travis.yml b/.travis.yml index ef4bcd9..8c4f119 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,43 +16,24 @@ env: # deprecated variables - config: postgres-old.yml - POSTGRESQL_SERVER_HOST: onlyoffice-postgresql - POSTGRESQL_SERVER_PORT: 5432 - POSTGRESQL_SERVER_DB_NAME: onlyoffice - POSTGRESQL_SERVER_USER: onlyoffice - POSTGRESQL_SERVER_PASS: onlyoffice # mysql - config: mysql.yml - DB_TYPE: mysql - DB_HOST: onlyoffice-mysql - DB_PORT: 3306 # mariadb - config: mariadb.yml - DB_TYPE: mysql - DB_HOST: db - DB_PORT: 3306 # activemq - config: activemq.yml - AMQP_TYPE: activemq - AMQP_URI: amqp://guest:guest@onlyoffice-activemq # rabbitmq - config: rabbitmq.yml - AMQP_TYPE: rabbitmq - AMQP_URI: amqp://guest:guest@onlyoffice-rabbitmq # rabbitmq old variables - config: rabbitmq-old.yml - AMQP_SERVER_TYPE: rabbitmq - AMQP_SERVER_URL: amqp://guest:guest@onlyoffice-rabbitmq # redis - config: redis.yml - REDIS_SERVER_HOST: onlyoffice-redis - REDIS_SERVER_PORT: 6379 services: - docker diff --git a/tests/activemq.yml b/tests/activemq.yml index f9b4823..6c3aad7 100644 --- a/tests/activemq.yml +++ b/tests/activemq.yml @@ -1,11 +1,12 @@ -version: '2' +version: '2.1' services: onlyoffice-documentserver: container_name: onlyoffice-documentserver - image: onlyoffice/4testing-documentserver-ie:latest + build: + context: ../. environment: - - AMQP_TYPE - - AMQP_URI + - AMQP_TYPE=${AMQP_TYPE:-activemq} + - AMQP_URI=${AMQP_URI:-amqp://guest:guest@onlyoffice-activemq} stdin_open: true restart: always ports: @@ -18,8 +19,8 @@ services: container_name: onlyoffice-activemq image: webcenter/activemq:5.14.3 environment: - - ACTIVEMQ_USERS_guest - - ACTIVEMQ_GROUPS_owners + - ACTIVEMQ_USERS_guest=${ACTIVEMQ_USERS_guest:-guest} + - ACTIVEMQ_GROUPS_owners=${ACTIVEMQ_GROUPS_owners:-guest} restart: always networks: - onlyoffice diff --git a/tests/defaults.env b/tests/defaults.env deleted file mode 100644 index 070f769..0000000 --- a/tests/defaults.env +++ /dev/null @@ -1,41 +0,0 @@ -# DocumentServer Container -ONLYOFFICE_DATA_CONTAINER=true -DB_TYPE=postgres -DB_HOST=onlyoffice-postgresql -DB_PORT=5432 -DB_NAME=onlyoffice -DB_USER=onlyoffice -DB_PWD=onlyoffice -AMQP_TYPE=rabbitmq -AMQP_URI=amqp://guest:guest@onlyoffice-rabbitmq -REDIS_SERVER_HOST=onlyoffice-redis -REDIS_SERVER_PORT=6379 -JWT_ENABLED=true -JWT_SECRET=secret -JWT_HEADER=Authorization - -ONLYOFFICE_DATA_CONTAINER_HOST=onlyoffice-documentserver-data -BALANCE=uri depth 3 -EXCLUDE_PORTS=443 -HTTP_CHECK=GET /healthcheck -EXTRA_SETTINGS=http-check expect string true -FORCE_SSL=true - -# HAProxy Container -MODE=http -CERT_FOLDER=/certs/ - -# ActiveMQ Container -ACTIVEMQ_USERS_guest=guest -ACTIVEMQ_GROUPS_owners=guest - -# Postgres Container -POSTGRES_DB=onlyoffice -POSTGRES_USER=onlyoffice -POSTGRES_HOST_AUTH_METHOD=trust - -# MySQL Container -MYSQL_DATABASE=onlyoffice -MYSQL_USER=onlyoffice -MYSQL_PASSWORD=onlyoffice -MYSQL_ALLOW_EMPTY_PASSWORD=yes \ No newline at end of file diff --git a/tests/mariadb.yml b/tests/mariadb.yml index c243fb2..91131e2 100644 --- a/tests/mariadb.yml +++ b/tests/mariadb.yml @@ -1,30 +1,31 @@ -version: '2' +version: '2.1' services: ds: container_name: ds - image: onlyoffice/4testing-documentserver-ie:latest + build: + context: ../. depends_on: - - db + - onlyoffice-mariadb environment: - - DB_TYPE - - DB_HOST - - DB_PORT - - DB_NAME - - DB_USER - - DB_PWD + - DB_TYPE=${DB_TYPE:-mysql} + - DB_HOST=${DB_HOST:-onlyoffice-mariadb} + - DB_PORT=${DB_PORT:-3306} + - DB_NAME=${DB_NAME:-onlyoffice} + - DB_USER=${DB_USER:-onlyoffice} + - DB_PWD=${DB_PWD:-onlyoffice} stdin_open: true restart: always ports: - '80:80' - db: - container_name: db + onlyoffice-mariadb: + container_name: onlyoffice-mariadb image: mariadb:10.5 environment: - - MYSQL_DATABASE - - MYSQL_USER - - MYSQL_PASSWORD - - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_DATABASE=${MYSQL_DATABASE:-onlyoffice} + - MYSQL_USER=${MYSQL_USER:-onlyoffice} + - MYSQL_PASSWORD=${MYSQL_PASSWORD:-onlyoffice} + - MYSQL_ALLOW_EMPTY_PASSWORD=${MYSQL_ALLOW_EMPTY_PASSWORD:-yes} restart: always volumes: - mysql_data:/var/lib/mysql diff --git a/tests/mysql.yml b/tests/mysql.yml index 9a4155f..1389a89 100644 --- a/tests/mysql.yml +++ b/tests/mysql.yml @@ -1,17 +1,18 @@ -version: '2' +version: '2.1' services: onlyoffice-documentserver: container_name: onlyoffice-documentserver - image: onlyoffice/4testing-documentserver-ie:latest + build: + context: ../. depends_on: - onlyoffice-mysql environment: - - DB_TYPE - - DB_HOST - - DB_PORT - - DB_NAME - - DB_USER - - DB_PWD + - DB_TYPE=${DB_TYPE:-mysql} + - DB_HOST=${DB_HOST:-onlyoffice-mysql} + - DB_PORT=${DB_PORT:-3306} + - DB_NAME=${DB_NAME:-onlyoffice} + - DB_USER=${DB_USER:-onlyoffice} + - DB_PWD=${DB_PWD:-onlyoffice} stdin_open: true restart: always ports: @@ -21,10 +22,10 @@ services: container_name: onlyoffice-mysql image: mysql:5.7 environment: - - MYSQL_DATABASE - - MYSQL_USER - - MYSQL_PASSWORD - - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_DATABASE=${MYSQL_DATABASE:-onlyoffice} + - MYSQL_USER=${MYSQL_USER:-onlyoffice} + - MYSQL_PASSWORD=${MYSQL_PASSWORD:-onlyoffice} + - MYSQL_ALLOW_EMPTY_PASSWORD=${MYSQL_ALLOW_EMPTY_PASSWORD:-yes} restart: always volumes: - mysql_data:/var/lib/mysql diff --git a/tests/postgres-old.yml b/tests/postgres-old.yml index f795107..237246c 100644 --- a/tests/postgres-old.yml +++ b/tests/postgres-old.yml @@ -1,16 +1,17 @@ -version: '2' +version: '2.1' services: onlyoffice-documentserver: container_name: onlyoffice-documentserver - image: onlyoffice/4testing-documentserver-ie:latest + build: + context: ../. depends_on: - onlyoffice-postgresql environment: - - POSTGRESQL_SERVER_HOST - - POSTGRESQL_SERVER_PORT - - POSTGRESQL_SERVER_DB_NAME - - POSTGRESQL_SERVER_USER - - POSTGRESQL_SERVER_PASS + - POSTGRESQL_SERVER_HOST=${DB_HOST:-onlyoffice-postgresql} + - POSTGRESQL_SERVER_PORT=${DB_PORT:-5432} + - POSTGRESQL_SERVER_DB_NAME=${DB_NAME:-onlyoffice} + - POSTGRESQL_SERVER_USER=${DB_USER:-onlyoffice} + - POSTGRESQL_SERVER_PASS=${DB_PWD:-onlyoffice} stdin_open: true restart: always ports: @@ -20,9 +21,9 @@ services: container_name: onlyoffice-postgresql image: postgres:9.5 environment: - - POSTGRES_DB - - POSTGRES_USER - - POSTGRES_HOST_AUTH_METHOD + - POSTGRES_DB=${POSTGRES_DB:-onlyoffice} + - POSTGRES_USER=${POSTGRES_USER:-onlyoffice} + - POSTGRES_HOST_AUTH_METHOD=${POSTGRES_HOST_AUTH_METHOD:-trust} restart: always expose: - '5432' diff --git a/tests/postgres.yml b/tests/postgres.yml index ed16e43..6ddf134 100644 --- a/tests/postgres.yml +++ b/tests/postgres.yml @@ -1,17 +1,18 @@ -version: '2' +version: '2.1' services: onlyoffice-documentserver: container_name: onlyoffice-documentserver - image: onlyoffice/4testing-documentserver-ie:latest + build: + context: ../. depends_on: - onlyoffice-postgresql environment: - - DB_TYPE - - DB_HOST - - DB_PORT - - DB_NAME - - DB_USER - - DB_PWD + - DB_TYPE=${DB_TYPE:-postgres} + - DB_HOST=${DB_HOST:-onlyoffice-postgresql} + - DB_PORT=${DB_PORT:-5432} + - DB_NAME=${DB_NAME:-onlyoffice} + - DB_USER=${DB_USER:-onlyoffice} + - DB_PWD=${DB_PWD:-onlyoffice} stdin_open: true restart: always ports: @@ -21,9 +22,9 @@ services: container_name: onlyoffice-postgresql image: postgres:9.5 environment: - - POSTGRES_DB - - POSTGRES_USER - - POSTGRES_HOST_AUTH_METHOD + - POSTGRES_DB=${POSTGRES_DB:-onlyoffice} + - POSTGRES_USER=${POSTGRES_USER:-onlyoffice} + - POSTGRES_HOST_AUTH_METHOD=${POSTGRES_HOST_AUTH_METHOD:-trust} restart: always expose: - '5432' diff --git a/tests/rabbitmq-old.yml b/tests/rabbitmq-old.yml index 9301ae4..ce18691 100644 --- a/tests/rabbitmq-old.yml +++ b/tests/rabbitmq-old.yml @@ -1,11 +1,12 @@ -version: '2' +version: '2.1' services: onlyoffice-documentserver: container_name: onlyoffice-documentserver - image: onlyoffice/4testing-documentserver-ie:latest + build: + context: ../. environment: - - AMQP_SERVER_TYPE - - AMQP_SERVER_URL + - AMQP_SERVER_TYPE=${AMQP_SERVER_TYPE:-rabbitmq} + - AMQP_SERVER_URL=${AMQP_SERVER_URL:-amqp://guest:guest@onlyoffice-rabbitmq} stdin_open: true restart: always ports: diff --git a/tests/rabbitmq.yml b/tests/rabbitmq.yml index 9006cb0..f73501f 100644 --- a/tests/rabbitmq.yml +++ b/tests/rabbitmq.yml @@ -1,11 +1,12 @@ -version: '2' +version: '2.1' services: onlyoffice-documentserver: container_name: onlyoffice-documentserver - image: onlyoffice/4testing-documentserver-ie:latest + build: + context: ../. environment: - - AMQP_TYPE - - AMQP_URI + - AMQP_TYPE=${AMQP_TYPE:-rabbitmq} + - AMQP_URI=${AMQP_URI:-amqp://guest:guest@onlyoffice-rabbitmq} stdin_open: true restart: always ports: diff --git a/tests/redis.yml b/tests/redis.yml index 2984ffe..9405b72 100644 --- a/tests/redis.yml +++ b/tests/redis.yml @@ -1,11 +1,12 @@ -version: '2' +version: '2.1' services: onlyoffice-documentserver: container_name: onlyoffice-documentserver - image: onlyoffice/4testing-documentserver-ie:latest + build: + context: ../. environment: - - REDIS_SERVER_HOST - - REDIS_SERVER_PORT + - REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-onlyoffice-redis} + - REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-6379} stdin_open: true restart: always ports: diff --git a/tests/test.sh b/tests/test.sh index 49d57c3..4bd15fa 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -6,16 +6,6 @@ if [[ ! -f $config ]]; then exit 1 fi -env_file=defaults.env - -# Copy .env -if [[ -f $env_file ]]; then - cp $env_file .env -else - echo "File $env_file doesn't exist!" - exit 1 -fi - # Run test environment docker-compose -p ds -f $config up -d From 7bfe2500359c24c6e364f8b35e9089b84c06b1b5 Mon Sep 17 00:00:00 2001 From: Semyon Bezrukov Date: Thu, 23 Jul 2020 15:42:17 +0300 Subject: [PATCH 4/6] Add Graphite (#265) --- .travis.yml | 3 +++ README.md | 4 ++++ run-document-server.sh | 18 ++++++++++++++++++ tests/graphite.yml | 32 ++++++++++++++++++++++++++++++++ tests/graphite/statsd/config.js | 7 +++++++ 5 files changed, 64 insertions(+) create mode 100644 tests/graphite.yml create mode 100644 tests/graphite/statsd/config.js diff --git a/.travis.yml b/.travis.yml index 94a1ff0..4371198 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,6 +55,9 @@ env: # redis - config: redis.yml + # graphite + - config: graphite.yml + services: - docker diff --git a/README.md b/README.md index e11f94c..cdf7c42 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/run-document-server.sh b/run-document-server.sh index b040372..21ddea3 100755 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -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 diff --git a/tests/graphite.yml b/tests/graphite.yml new file mode 100644 index 0000000..2bc4694 --- /dev/null +++ b/tests/graphite.yml @@ -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 diff --git a/tests/graphite/statsd/config.js b/tests/graphite/statsd/config.js new file mode 100644 index 0000000..2ebffe6 --- /dev/null +++ b/tests/graphite/statsd/config.js @@ -0,0 +1,7 @@ +{ + "graphiteHost": "onlyoffice-graphite", + "graphitePort": 2003, + "port": 8125, + "flushInterval": 60000, + "backends": [ "./backends/graphite.js" ] +} From c47a31068330ae67b352e539223327cff99ccd8a Mon Sep 17 00:00:00 2001 From: Semyon Bezrukov Date: Thu, 30 Jul 2020 11:54:46 +0300 Subject: [PATCH 5/6] Fix unary operator expected (Bug 45985) (#270) --- run-document-server.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/run-document-server.sh b/run-document-server.sh index 86e8c09..9f57747 100755 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -483,14 +483,16 @@ if [ ${ONLYOFFICE_DATA_CONTAINER_HOST} = "localhost" ]; then rm -rf /var/run/rabbitmq fi - if [ ${REDIS_SERVER_HOST} != "localhost" ]; then - update_redis_settings - elif [ ${REDIS_ENABLED} = "true" ]; then - # change rights for redis directory - chown -R redis:redis ${REDIS_DATA} - chmod -R 750 ${REDIS_DATA} + if [ ${REDIS_ENABLED} = "true" ]; then + if [ ${REDIS_SERVER_HOST} != "localhost" ]; then + update_redis_settings + else + # change rights for redis directory + chown -R redis:redis ${REDIS_DATA} + chmod -R 750 ${REDIS_DATA} - LOCAL_SERVICES+=("redis-server") + LOCAL_SERVICES+=("redis-server") + fi fi else # no need to update settings just wait for remote data From ecb77ddb56665b9ff3dbb46b5568aea3df5a50bd Mon Sep 17 00:00:00 2001 From: Semyon Bezrukov Date: Thu, 10 Sep 2020 16:57:21 +0300 Subject: [PATCH 6/6] Add more travis tests (#289) * Add version variable for travis tests * Fix typo * Fix activemq variable * Add travis tests * Remove mysql latest * Fixes & refactoring * Add more travis tests * Remove mysql 8 test * Remove mysql 8 test [2] * Add mysql 8 comment * Fix mysql 8 auth plugin Co-authored-by: Alexey Golubev --- .travis.yml | 69 ++++++++++++++++++++++++++++++++++++++++------ tests/activemq.yml | 2 +- tests/mariadb.yml | 2 +- tests/mysql.yml | 3 +- tests/postgres.yml | 2 +- tests/rabbitmq.yml | 2 +- tests/redis.yml | 2 +- 7 files changed, 67 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 37749d6..084cddc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ env: - config: standalone.yml PRODUCT_NAME: documentserver-ie + # certificates (default tls if onlyoffice not exists) - config: certs.yml ssl: true @@ -30,10 +31,27 @@ env: SSL_CERTIFICATE_PATH: /var/www/onlyoffice/Data/certs/mycert.crt SSL_KEY_PATH: /var/www/onlyoffice/Data/certs/mycert.key - # postgresql + + # postgresql 12 + - config: postgres.yml + POSTGRES_VERSION: 12 + + # postgresql 11 + - config: postgres.yml + POSTGRES_VERSION: 11 + + # postgresql 10 + - config: postgres.yml + POSTGRES_VERSION: 10 + + # postgresql 9 + - config: postgres.yml + POSTGRES_VERSION: 9 + + # postgresql 9.5 - config: postgres.yml - # custom values + # postgresql custom values - config: postgres.yml DB_NAME: mydb DB_USER: myuser @@ -41,31 +59,64 @@ env: POSTGRES_DB: mydb POSTGRES_USER: myuser - # deprecated variables + # postgresql deprecated variables - config: postgres-old.yml - # mysql + + # mysql 8 + - config: mysql.yml + MYSQL_VERSION: 8 + + # mysql 5 + - config: mysql.yml + MYSQL_VERSION: 5 + + # mysql 5.7 - config: mysql.yml - # mariadb + + # mariadb 10 + - config: mariadb.yml + MARIADB_VERSION: 10 + + # mariadb 10.5 - config: mariadb.yml - # activemq + + - config: activemq.yml + ACTIVEMQ_VERSION: latest + + # activemq 5.14.3 - config: activemq.yml - # rabbitmq + + # rabbitmq latest - config: rabbitmq.yml + # rabbitmq 3 + - config: rabbitmq.yml + RABBITMQ_VERSION: 3 + # rabbitmq old variables - config: rabbitmq-old.yml - # redis with community edition + + # redis latest with community edition - config: redis.yml - # redis with integraion edition + # redis latest with integraion edition - config: redis.yml PRODUCT_NAME: documentserver-ie + # redis 6 + - config: redis.yml + REDIS_VERSION: 6 + + # redis 5 + - config: redis.yml + REDIS_VERSION: 5 + + # graphite - config: graphite.yml diff --git a/tests/activemq.yml b/tests/activemq.yml index 6c3aad7..5781c64 100644 --- a/tests/activemq.yml +++ b/tests/activemq.yml @@ -17,7 +17,7 @@ services: onlyoffice-activemq: container_name: onlyoffice-activemq - image: webcenter/activemq:5.14.3 + image: webcenter/activemq:${ACTIVEMQ_VERSION:-5.14.3} environment: - ACTIVEMQ_USERS_guest=${ACTIVEMQ_USERS_guest:-guest} - ACTIVEMQ_GROUPS_owners=${ACTIVEMQ_GROUPS_owners:-guest} diff --git a/tests/mariadb.yml b/tests/mariadb.yml index 91131e2..4bb8de5 100644 --- a/tests/mariadb.yml +++ b/tests/mariadb.yml @@ -20,7 +20,7 @@ services: onlyoffice-mariadb: container_name: onlyoffice-mariadb - image: mariadb:10.5 + image: mariadb:${MARIADB_VERSION:-10.5} environment: - MYSQL_DATABASE=${MYSQL_DATABASE:-onlyoffice} - MYSQL_USER=${MYSQL_USER:-onlyoffice} diff --git a/tests/mysql.yml b/tests/mysql.yml index 1389a89..20fcd70 100644 --- a/tests/mysql.yml +++ b/tests/mysql.yml @@ -20,7 +20,8 @@ services: onlyoffice-mysql: container_name: onlyoffice-mysql - image: mysql:5.7 + image: mysql:${MYSQL_VERSION:-5.7} + command: --default-authentication-plugin=mysql_native_password environment: - MYSQL_DATABASE=${MYSQL_DATABASE:-onlyoffice} - MYSQL_USER=${MYSQL_USER:-onlyoffice} diff --git a/tests/postgres.yml b/tests/postgres.yml index 6ddf134..8333b10 100644 --- a/tests/postgres.yml +++ b/tests/postgres.yml @@ -20,7 +20,7 @@ services: onlyoffice-postgresql: container_name: onlyoffice-postgresql - image: postgres:9.5 + image: postgres:${POSTGRES_VERSION:-9.5} environment: - POSTGRES_DB=${POSTGRES_DB:-onlyoffice} - POSTGRES_USER=${POSTGRES_USER:-onlyoffice} diff --git a/tests/rabbitmq.yml b/tests/rabbitmq.yml index f73501f..293045c 100644 --- a/tests/rabbitmq.yml +++ b/tests/rabbitmq.yml @@ -17,7 +17,7 @@ services: onlyoffice-rabbitmq: container_name: onlyoffice-rabbitmq - image: rabbitmq + image: rabbitmq:${RABBITMQ_VERSION:-latest} restart: always networks: - onlyoffice diff --git a/tests/redis.yml b/tests/redis.yml index 5f759ad..849be16 100644 --- a/tests/redis.yml +++ b/tests/redis.yml @@ -19,7 +19,7 @@ services: onlyoffice-redis: container_name: onlyoffice-redis - image: redis + image: redis:${REDIS_VERSION:-latest} restart: always networks: - onlyoffice