diff --git a/README.md b/README.md index 3d01edf..c921efb 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,8 @@ Below is the complete list of parameters that can be set using environment varia - **POSTGRESQL_SERVER_DB_NAME**: The name of a PostgreSQL database to be created on the image startup. - **POSTGRESQL_SERVER_USER**: The new user name with superuser permissions for the PostgreSQL account. - **POSTGRESQL_SERVER_PASS**: The password set for the PostgreSQL account. -- **RABBITMQ_SERVER_URL**: The [AMQP URL](http://www.rabbitmq.com/uri-spec.html "RabbitMQ URI Specification") to connect to RabbitMQ server. +- **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`. - **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. @@ -294,7 +295,7 @@ Please note, that both executing the script and disconnecting users may take a l ## Project Information -Official website: [http://www.onlyoffice.org](http://onlyoffice.org "http://www.onlyoffice.org") +Official website: [https://www.onlyoffice.com](https://www.onlyoffice.com/?utm_source=github&utm_medium=cpc&utm_campaign=GitHubDockerDS) Code repository: [https://github.com/ONLYOFFICE/DocumentServer](https://github.com/ONLYOFFICE/DocumentServer "https://github.com/ONLYOFFICE/DocumentServer") @@ -302,7 +303,9 @@ Docker Image: [https://github.com/ONLYOFFICE/Docker-DocumentServer](https://gith License: [GNU AGPL v3.0](https://help.onlyoffice.com/products/files/doceditor.aspx?fileid=4358397&doc=K0ZUdlVuQzQ0RFhhMzhZRVN4ZFIvaHlhUjN2eS9XMXpKR1M5WEppUk1Gcz0_IjQzNTgzOTci0 "GNU AGPL v3.0") -SaaS version: [http://www.onlyoffice.com](http://www.onlyoffice.com "http://www.onlyoffice.com") +Free version vs commercial builds comparison: https://github.com/ONLYOFFICE/DocumentServer#onlyoffice-document-server-editions + +SaaS version: [https://www.onlyoffice.com/cloud-office.aspx](https://www.onlyoffice.com/cloud-office.aspx?utm_source=github&utm_medium=cpc&utm_campaign=GitHubDockerDS) ## User Feedback and Support diff --git a/activemq.yml b/activemq.yml new file mode 100644 index 0000000..f6a5fed --- /dev/null +++ b/activemq.yml @@ -0,0 +1,31 @@ +version: '2' +services: + onlyoffice-documentserver: + container_name: onlyoffice-documentserver + image: onlyoffice/4testing-documentserver-ie:latest + environment: + - AMQP_SERVER_URL=amqp://guest:guest@onlyoffice-activemq + - AMQP_SERVER_TYPE=activemq + stdin_open: true + restart: always + ports: + - '80:80' + - '443:443' + networks: + - onlyoffice + + onlyoffice-activemq: + container_name: onlyoffice-activemq + image: webcenter/activemq:5.14.3 + environment: + - ACTIVEMQ_USERS_guest=guest + - ACTIVEMQ_GROUPS_owners=guest + restart: always + networks: + - onlyoffice + expose: + - '5672' + +networks: + onlyoffice: + driver: 'bridge' diff --git a/docker-compose.yml b/docker-compose.yml index 044093a..b170947 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,7 @@ services: - POSTGRESQL_SERVER_PORT=5432 - POSTGRESQL_SERVER_DB_NAME=onlyoffice - POSTGRESQL_SERVER_USER=onlyoffice - - RABBITMQ_SERVER_URL=amqp://guest:guest@onlyoffice-rabbitmq + - AMQP_SERVER_URL=amqp://guest:guest@onlyoffice-rabbitmq - REDIS_SERVER_HOST=onlyoffice-redis - REDIS_SERVER_PORT=6379 stdin_open: true diff --git a/run-document-server.sh b/run-document-server.sh index d8585f7..29ea5be 100755 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -26,9 +26,9 @@ SYSCONF_TEMPLATES_DIR="/app/onlyoffice/setup/config" NGINX_CONFD_PATH="/etc/nginx/conf.d"; NGINX_ONLYOFFICE_PATH="${CONF_DIR}/nginx" -NGINX_ONLYOFFICE_CONF="${NGINX_ONLYOFFICE_PATH}/onlyoffice-documentserver.conf" +NGINX_ONLYOFFICE_CONF="${NGINX_ONLYOFFICE_PATH}/ds.conf" NGINX_ONLYOFFICE_EXAMPLE_PATH="${CONF_DIR}-example/nginx" -NGINX_ONLYOFFICE_EXAMPLE_CONF="${NGINX_ONLYOFFICE_EXAMPLE_PATH}/includes/onlyoffice-documentserver-example.conf" +NGINX_ONLYOFFICE_EXAMPLE_CONF="${NGINX_ONLYOFFICE_EXAMPLE_PATH}/includes/ds-example.conf" NGINX_CONFIG_PATH="/etc/nginx/nginx.conf" NGINX_WORKER_PROCESSES=${NGINX_WORKER_PROCESSES:-1} @@ -42,9 +42,10 @@ ONLYOFFICE_DEFAULT_CONFIG=${CONF_DIR}/local.json ONLYOFFICE_LOG4JS_CONFIG=${CONF_DIR}/log4js/production.json ONLYOFFICE_EXAMPLE_CONFIG=${CONF_DIR}-example/local.json -JSON="json -q -f ${ONLYOFFICE_DEFAULT_CONFIG}" -JSON_LOG="json -q -f ${ONLYOFFICE_LOG4JS_CONFIG}" -JSON_EXAMPLE="json -q -f ${ONLYOFFICE_EXAMPLE_CONFIG}" +JSON_BIN=${APP_DIR}/npm/node_modules/.bin/json +JSON="${JSON_BIN} -q -f ${ONLYOFFICE_DEFAULT_CONFIG}" +JSON_LOG="${JSON_BIN} -q -f ${ONLYOFFICE_LOG4JS_CONFIG}" +JSON_EXAMPLE="${JSON_BIN} -q -f ${ONLYOFFICE_EXAMPLE_CONFIG}" LOCAL_SERVICES=() @@ -62,7 +63,9 @@ read_setting(){ POSTGRESQL_SERVER_PASS=${POSTGRESQL_SERVER_PASS:-$(${JSON} services.CoAuthoring.sql.dbPass)} RABBITMQ_SERVER_URL=${RABBITMQ_SERVER_URL:-$(${JSON} rabbitmq.url)} - parse_rabbitmq_url + AMQP_SERVER_URL=${AMQP_SERVER_URL:-${RABBITMQ_SERVER_URL}} + AMQP_SERVER_TYPE=${AMQP_SERVER_TYPE:-rabbitmq} + parse_rabbitmq_url ${AMQP_SERVER_URL} REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-$(${JSON} services.CoAuthoring.redis.host)} REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-6379} @@ -71,7 +74,7 @@ read_setting(){ } parse_rabbitmq_url(){ - local amqp=${RABBITMQ_SERVER_URL} + local amqp=$1 # extract the protocol local proto="$(echo $amqp | grep :// | sed -e's,^\(.*://\).*,\1,g')" @@ -105,10 +108,10 @@ parse_rabbitmq_url(){ # extract the path (if any) local path="$(echo $url | grep / | cut -d/ -f2-)" - RABBITMQ_SERVER_HOST=$host - RABBITMQ_SERVER_USER=$user - RABBITMQ_SERVER_PASS=$pass - RABBITMQ_SERVER_PORT=$port + AMQP_SERVER_HOST=$host + AMQP_SERVER_USER=$user + AMQP_SERVER_PASS=$pass + AMQP_SERVER_PORT=$port } waiting_for_connection(){ @@ -122,8 +125,8 @@ waiting_for_postgresql(){ waiting_for_connection ${POSTGRESQL_SERVER_HOST} ${POSTGRESQL_SERVER_PORT} } -waiting_for_rabbitmq(){ - waiting_for_connection ${RABBITMQ_SERVER_HOST} ${RABBITMQ_SERVER_PORT} +waiting_for_amqp(){ + waiting_for_connection ${AMQP_SERVER_HOST} ${AMQP_SERVER_PORT} } waiting_for_redis(){ @@ -141,7 +144,38 @@ update_postgresql_settings(){ } update_rabbitmq_setting(){ - ${JSON} -I -e "this.rabbitmq.url = '${RABBITMQ_SERVER_URL}'" + if [ "${AMQP_SERVER_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 = '${RABBITMQ_SERVER_URL}'" + fi + + if [ "${AMQP_SERVER_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={};" + ${JSON} -I -e "if(this.activemq.connectOptions===undefined)this.activemq.connectOptions={};" + + ${JSON} -I -e "this.activemq.connectOptions.host = '${AMQP_SERVER_HOST}'" + + if [ ! "${AMQP_SERVER_PORT}" == "" ]; then + ${JSON} -I -e "this.activemq.connectOptions.port = '${AMQP_SERVER_PORT}'" + else + ${JSON} -I -e "delete this.activemq.connectOptions.port" + fi + + if [ ! "${AMQP_SERVER_USER}" == "" ]; then + ${JSON} -I -e "this.activemq.connectOptions.username = '${AMQP_SERVER_USER}'" + else + ${JSON} -I -e "delete this.activemq.connectOptions.username" + fi + + if [ ! "${AMQP_SERVER_PASS}" == "" ]; then + ${JSON} -I -e "this.activemq.connectOptions.password = '${AMQP_SERVER_PASS}'" + else + ${JSON} -I -e "delete this.activemq.connectOptions.password" + fi + fi } update_redis_settings(){ @@ -212,7 +246,7 @@ update_nginx_settings(){ # setup HTTPS if [ -f "${SSL_CERTIFICATE_PATH}" -a -f "${SSL_KEY_PATH}" ]; then - cp -f ${NGINX_ONLYOFFICE_PATH}/onlyoffice-documentserver-ssl.conf.template ${NGINX_ONLYOFFICE_CONF} + cp -f ${NGINX_ONLYOFFICE_PATH}/ds-ssl.conf.tmpl ${NGINX_ONLYOFFICE_CONF} # configure nginx sed 's,{{SSL_CERTIFICATE_PATH}},'"${SSL_CERTIFICATE_PATH}"',' -i ${NGINX_ONLYOFFICE_CONF} @@ -240,7 +274,12 @@ update_nginx_settings(){ sed '/max-age=/d' -i ${NGINX_ONLYOFFICE_CONF} fi else - ln -sf ${NGINX_ONLYOFFICE_PATH}/onlyoffice-documentserver.conf.template ${NGINX_ONLYOFFICE_CONF} + ln -sf ${NGINX_ONLYOFFICE_PATH}/ds.conf.tmpl ${NGINX_ONLYOFFICE_CONF} + fi + + # check if ipv6 supported otherwise remove it from nginx config + if [ ! -f /proc/net/if_inet6 ]; then + sed '/listen\s\+\[::[0-9]*\].\+/d' -i $NGINX_ONLYOFFICE_CONF fi if [ -f "${NGINX_ONLYOFFICE_EXAMPLE_CONF}" ]; then @@ -272,7 +311,7 @@ mkdir -p ${DS_LOG_DIR}-example # change folder rights for i in ${LOG_DIR} ${LIB_DIR} ${DATA_DIR}; do - chown -R onlyoffice:onlyoffice "$i" + chown -R ds:ds "$i" chmod -R 755 "$i" done @@ -302,7 +341,7 @@ if [ ${ONLYOFFICE_DATA_CONTAINER_HOST} = "localhost" ]; then LOCAL_SERVICES+=("postgresql") fi - if [ ${RABBITMQ_SERVER_HOST} != "localhost" ]; then + if [ ${AMQP_SERVER_HOST} != "localhost" ]; then update_rabbitmq_setting else LOCAL_SERVICES+=("rabbitmq-server") @@ -336,7 +375,7 @@ fi if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then waiting_for_postgresql - waiting_for_rabbitmq + waiting_for_amqp waiting_for_redis update_nginx_settings