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] 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'