From 9aa15443ad66fb9ee176669f1f7769a7577ecdce Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Fri, 1 Jul 2016 14:06:44 +0300 Subject: [PATCH 01/36] Added test repo url --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d23b6e6..5adbc13 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ ADD run-document-server.sh /app/onlyoffice/run-document-server.sh EXPOSE 80 443 -RUN echo "deb http://static.teamlab.com/repo/debian/ squeeze main" | tee /etc/apt/sources.list.d/onlyoffice.list && \ +RUN echo "deb http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/onlyoffice-documentserver/{{SVN_TAG}}/{{PACKAGE_VERSION}}/ repo/" | tee /etc/apt/sources.list.d/onlyoffice.list && \ apt-get -y update && \ service mysql start && \ apt-get --force-yes -yq install onlyoffice-documentserver && \ From 69a3516b20aa822c5c64ab9bab96a706e8f26a55 Mon Sep 17 00:00:00 2001 From: "Alexey.Golubev" Date: Fri, 1 Jul 2016 14:59:12 +0300 Subject: [PATCH 02/36] Added Makefile to build and deploy docker --- Makefile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..adde32f --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER) + +ifeq ($(GIT_BRANCH), origin/develop) +DOCKER_TAGS += $(PACKAGE_VERSION) +DOCKER_TAGS += latest +else +DOCKER_TAGS += $(PACKAGE_VERSION)-$(subst /,-,$(GIT_BRANCH)) +endif + +DOCKER_REPO = $(COMPANY_NAME)/4testing-$(PRODUCT_NAME) + +COLON := __colon__ +DOCKER_TARGETS := $(foreach TAG,$(DOCKER_TAGS),$(DOCKER_REPO)$(COLON)$(TAG)) + +.PHONY: all clean clean-docker deploy docker + +$(DOCKER_TARGETS): $(DEB_REPO_DATA) + sed "s|{{GIT_BRANCH}}|$(GIT_BRANCH)|" -i Dockerfile + sed 's/{{PACKAGE_VERSION}}/'$(PACKAGE_VERSION)'/' -i Dockerfile + + sudo docker build -t $(subst $(COLON),:,$@) . &&\ + mkdir -p $$(dirname $@) &&\ + echo "Done" > $@ + +all: $(DOCKER_TARGETS) + +clean: + rm -rfv $(DOCKER_TARGETS) + +clean-docker: + sudo docker rmi -f $$(sudo docker images -q $(COMPANY_NAME)/*) || exit 0 + +deploy: $(DOCKER_TARGETS) + $(foreach TARGET,$(DOCKER_TARGETS),sudo docker push $(subst $(COLON),:,$(TARGET));) From fd1fc534b59ab6707be2f2d8cf2fddb2f37bef13 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Fri, 1 Jul 2016 15:50:57 +0300 Subject: [PATCH 03/36] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5adbc13..819bcfe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ ADD run-document-server.sh /app/onlyoffice/run-document-server.sh EXPOSE 80 443 -RUN echo "deb http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/onlyoffice-documentserver/{{SVN_TAG}}/{{PACKAGE_VERSION}}/ repo/" | tee /etc/apt/sources.list.d/onlyoffice.list && \ +RUN echo "deb http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/onlyoffice-documentserver/{{GIT_TAG}}/{{PACKAGE_VERSION}}/ repo/" | tee /etc/apt/sources.list.d/onlyoffice.list && \ apt-get -y update && \ service mysql start && \ apt-get --force-yes -yq install onlyoffice-documentserver && \ From 97f1c087a20d37e999d82a41f47090d5a3ff792e Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Fri, 1 Jul 2016 16:19:10 +0300 Subject: [PATCH 04/36] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 819bcfe..ad8a962 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ ADD run-document-server.sh /app/onlyoffice/run-document-server.sh EXPOSE 80 443 -RUN echo "deb http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/onlyoffice-documentserver/{{GIT_TAG}}/{{PACKAGE_VERSION}}/ repo/" | tee /etc/apt/sources.list.d/onlyoffice.list && \ +RUN echo "deb http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/onlyoffice-documentserver/{{GIT_BRANCH}}/{{PACKAGE_VERSION}}/ repo/" | tee /etc/apt/sources.list.d/onlyoffice.list && \ apt-get -y update && \ service mysql start && \ apt-get --force-yes -yq install onlyoffice-documentserver && \ From b3ebf467a653ef6378de85d9756064f1728365c6 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Mon, 4 Jul 2016 18:43:58 +0300 Subject: [PATCH 05/36] Create docker-compose.yml --- docker-compose.yml | 99 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9d5cd25 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,99 @@ +-version: '2' + -services: + - onlyoffice-document: + - image: onlyoffice/4testing-documentserver:latest + - depends_on: + - - onlyoffice-mysql + - - onlyoffice-redis + - - onlyoffice-rabbitmq + - environment: + - - MYSQL_SERVER_HOST=onlyoffice-mysql + - - MYSQL_SERVER_PORT=3306 + - - MYSQL_SERVER_DB_NAME=onlyoffice + - - MYSQL_SERVER_USER=root + - - RABBITMQ_SERVER_HOST=onlyoffice-rabbitmq + - - RABBITMQ_SERVER_USER=guest + - - RABBITMQ_SERVER_PASS=guest + - - REDIS_SERVER_HOST=onlyoffice-redis + - - REDIS_SERVER_PORT=6379 + - - HTTP_CHECK=HEAD /healthcheck + - - EXTRA_SETTINGS=http-check expect status 200 + - stdin_open: true + - tty: true + - restart: always + - networks: + - - onlyoffice + - expose: + - - '80' + - - '443' + - volumes: + - - document_data:/var/www/onlyoffice/Data + - - document_log:/var/log/onlyoffice + - - document_files:/var/lib/onlyoffice/documentserver/App_Data/cache/files + - - document_example_files:/var/www/onlyoffice/documentserver-example/public/files + - + - onlyoffice-haproxy: + - container_name: onlyoffice-haproxy + - image: dockercloud/haproxy:1.2.1 + - depends_on: + - - onlyoffice-document + - environment: + - - MODE=tcp + - - TCP_PORTS="80, 443" + - stdin_open: true + - tty: true + - links: + - - onlyoffice-document + - volumes: + - - /var/run/docker.sock:/var/run/docker.sock + - restart: always + - networks: + - - onlyoffice + - ports: + - - '80:80' + - - '443:443' + - - '1936:1936' + - + - onlyoffice-redis: + - container_name: onlyoffice-redis + - image: redis + - restart: always + - networks: + - - onlyoffice + - expose: + - - '6379' + - + - onlyoffice-rabbitmq: + - container_name: onlyoffice-rabbitmq + - image: rabbitmq + - restart: always + - networks: + - - onlyoffice + - expose: + - - '5672' + - + - onlyoffice-mysql: + - container_name: onlyoffice-mysql + - image: mysql:5.5 + - environment: + - - MYSQL_DATABASE=onlyoffice + - - MYSQL_USER=root + - - MYSQL_ALLOW_EMPTY_PASSWORD='true' + - networks: + - - onlyoffice + - restart: always + - expose: + - - '3306' + - volumes: + - - mysql_data:/var/lib/mysql + - + -networks: + - onlyoffice: + - driver: 'bridge' + - + -volumes: + - mysql_data: + - document_data: + - document_log: + - document_files: + - document_example_files: From 0fa55f01927019a03ddf4dd9e3ccc4c9ffea9230 Mon Sep 17 00:00:00 2001 From: "Alexey.Golubev" Date: Thu, 7 Jul 2016 17:13:26 +0300 Subject: [PATCH 06/36] removed "^[\s]-" prefix for all lines of file --- docker-compose.yml | 198 ++++++++++++++++++++++----------------------- 1 file changed, 99 insertions(+), 99 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9d5cd25..a1f44b6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,99 +1,99 @@ --version: '2' - -services: - - onlyoffice-document: - - image: onlyoffice/4testing-documentserver:latest - - depends_on: - - - onlyoffice-mysql - - - onlyoffice-redis - - - onlyoffice-rabbitmq - - environment: - - - MYSQL_SERVER_HOST=onlyoffice-mysql - - - MYSQL_SERVER_PORT=3306 - - - MYSQL_SERVER_DB_NAME=onlyoffice - - - MYSQL_SERVER_USER=root - - - RABBITMQ_SERVER_HOST=onlyoffice-rabbitmq - - - RABBITMQ_SERVER_USER=guest - - - RABBITMQ_SERVER_PASS=guest - - - REDIS_SERVER_HOST=onlyoffice-redis - - - REDIS_SERVER_PORT=6379 - - - HTTP_CHECK=HEAD /healthcheck - - - EXTRA_SETTINGS=http-check expect status 200 - - stdin_open: true - - tty: true - - restart: always - - networks: - - - onlyoffice - - expose: - - - '80' - - - '443' - - volumes: - - - document_data:/var/www/onlyoffice/Data - - - document_log:/var/log/onlyoffice - - - document_files:/var/lib/onlyoffice/documentserver/App_Data/cache/files - - - document_example_files:/var/www/onlyoffice/documentserver-example/public/files - - - - onlyoffice-haproxy: - - container_name: onlyoffice-haproxy - - image: dockercloud/haproxy:1.2.1 - - depends_on: - - - onlyoffice-document - - environment: - - - MODE=tcp - - - TCP_PORTS="80, 443" - - stdin_open: true - - tty: true - - links: - - - onlyoffice-document - - volumes: - - - /var/run/docker.sock:/var/run/docker.sock - - restart: always - - networks: - - - onlyoffice - - ports: - - - '80:80' - - - '443:443' - - - '1936:1936' - - - - onlyoffice-redis: - - container_name: onlyoffice-redis - - image: redis - - restart: always - - networks: - - - onlyoffice - - expose: - - - '6379' - - - - onlyoffice-rabbitmq: - - container_name: onlyoffice-rabbitmq - - image: rabbitmq - - restart: always - - networks: - - - onlyoffice - - expose: - - - '5672' - - - - onlyoffice-mysql: - - container_name: onlyoffice-mysql - - image: mysql:5.5 - - environment: - - - MYSQL_DATABASE=onlyoffice - - - MYSQL_USER=root - - - MYSQL_ALLOW_EMPTY_PASSWORD='true' - - networks: - - - onlyoffice - - restart: always - - expose: - - - '3306' - - volumes: - - - mysql_data:/var/lib/mysql - - - -networks: - - onlyoffice: - - driver: 'bridge' - - - -volumes: - - mysql_data: - - document_data: - - document_log: - - document_files: - - document_example_files: +version: '2' +services: + onlyoffice-document: + image: onlyoffice/4testing-documentserver:latest + depends_on: + - onlyoffice-mysql + - onlyoffice-redis + - onlyoffice-rabbitmq + environment: + - MYSQL_SERVER_HOST=onlyoffice-mysql + - MYSQL_SERVER_PORT=3306 + - MYSQL_SERVER_DB_NAME=onlyoffice + - MYSQL_SERVER_USER=root + - RABBITMQ_SERVER_HOST=onlyoffice-rabbitmq + - RABBITMQ_SERVER_USER=guest + - RABBITMQ_SERVER_PASS=guest + - REDIS_SERVER_HOST=onlyoffice-redis + - REDIS_SERVER_PORT=6379 + - HTTP_CHECK=HEAD /healthcheck + - EXTRA_SETTINGS=http-check expect status 200 + stdin_open: true + tty: true + restart: always + networks: + - onlyoffice + expose: + - '80' + - '443' + volumes: + - document_data:/var/www/onlyoffice/Data + - document_log:/var/log/onlyoffice + - document_files:/var/lib/onlyoffice/documentserver/App_Data/cache/files + - document_example_files:/var/www/onlyoffice/documentserver-example/public/files + + onlyoffice-haproxy: + container_name: onlyoffice-haproxy + image: dockercloud/haproxy:1.2.1 + depends_on: + - onlyoffice-document + environment: + - MODE=tcp + - TCP_PORTS="80, 443" + stdin_open: true + tty: true + links: + - onlyoffice-document + volumes: + - /var/run/docker.sock:/var/run/docker.sock + restart: always + networks: + - onlyoffice + ports: + - '80:80' + - '443:443' + - '1936:1936' + + onlyoffice-redis: + container_name: onlyoffice-redis + image: redis + restart: always + networks: + - onlyoffice + expose: + - '6379' + + onlyoffice-rabbitmq: + container_name: onlyoffice-rabbitmq + image: rabbitmq + restart: always + networks: + - onlyoffice + expose: + - '5672' + + onlyoffice-mysql: + container_name: onlyoffice-mysql + image: mysql:5.5 + environment: + - MYSQL_DATABASE=onlyoffice + - MYSQL_USER=root + - MYSQL_ALLOW_EMPTY_PASSWORD='true' + networks: + - onlyoffice + restart: always + expose: + - '3306' + volumes: + - mysql_data:/var/lib/mysql + +networks: + onlyoffice: + driver: 'bridge' + +volumes: + mysql_data: + document_data: + document_log: + document_files: + document_example_files: From 89de48c8dee8bad200230192ca723ceb968e870c Mon Sep 17 00:00:00 2001 From: "Alexey.Golubev" Date: Mon, 11 Jul 2016 11:47:22 +0300 Subject: [PATCH 07/36] added data container for onlyoffice-documentserver --- docker-compose.yml | 42 +++++--- run-document-server.sh | 214 +++++++++++++++++++++++++---------------- 2 files changed, 158 insertions(+), 98 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a1f44b6..292f7cc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,8 @@ version: '2' services: - onlyoffice-document: + onlyoffice-documentserver-data: + container_name: onlyoffice-documentserver-data image: onlyoffice/4testing-documentserver:latest - depends_on: - - onlyoffice-mysql - - onlyoffice-redis - - onlyoffice-rabbitmq environment: - MYSQL_SERVER_HOST=onlyoffice-mysql - MYSQL_SERVER_PORT=3306 @@ -16,6 +13,26 @@ services: - RABBITMQ_SERVER_PASS=guest - REDIS_SERVER_HOST=onlyoffice-redis - REDIS_SERVER_PORT=6379 + stdin_open: true + tty: true + restart: always + networks: + - onlyoffice + volumes: + - /var/www/onlyoffice/Data + - /var/log/onlyoffice + - /var/lib/onlyoffice/documentserver/App_Data/cache/files + - /var/www/onlyoffice/documentserver-example/public/files + - /usr/share/fonts + + onlyoffice-documentserver: + image: onlyoffice/4testing-documentserver:latest + depends_on: + - onlyoffice-documentserver-data + - onlyoffice-mysql + - onlyoffice-redis + - onlyoffice-rabbitmq + environment: - HTTP_CHECK=HEAD /healthcheck - EXTRA_SETTINGS=http-check expect status 200 stdin_open: true @@ -26,24 +43,21 @@ services: expose: - '80' - '443' - volumes: - - document_data:/var/www/onlyoffice/Data - - document_log:/var/log/onlyoffice - - document_files:/var/lib/onlyoffice/documentserver/App_Data/cache/files - - document_example_files:/var/www/onlyoffice/documentserver-example/public/files + volumes_from: + - onlyoffice-documentserver-data: onlyoffice-haproxy: container_name: onlyoffice-haproxy image: dockercloud/haproxy:1.2.1 depends_on: - - onlyoffice-document + - onlyoffice-documentserver environment: - MODE=tcp - TCP_PORTS="80, 443" stdin_open: true tty: true links: - - onlyoffice-document + - onlyoffice-documentserver volumes: - /var/run/docker.sock:/var/run/docker.sock restart: always @@ -93,7 +107,3 @@ networks: volumes: mysql_data: - document_data: - document_log: - document_files: - document_example_files: diff --git a/run-document-server.sh b/run-document-server.sh index 89a0bcc..901ad09 100644 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -4,7 +4,7 @@ APP_DIR="/var/www/onlyoffice/documentserver" DATA_DIR="/var/www/onlyoffice/Data" LOG_DIR="/var/log/onlyoffice/documentserver" -ONLYOFFICE_HTTPS=${ONLYOFFICE_HTTPS:-false} +ONLYOFFICE_DATA_CONTAINER=${ONLYOFFICE_DATA_CONTAINER:-false} SSL_CERTIFICATES_DIR="${DATA_DIR}/certs" SSL_CERTIFICATE_PATH=${SSL_CERTIFICATE_PATH:-${SSL_CERTIFICATES_DIR}/onlyoffice.crt} @@ -24,76 +24,62 @@ NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-$(ulimit -n)} ONLYOFFICE_DEFAULT_CONFIG=/etc/onlyoffice/documentserver/default.json -MYSQL_SERVER_HOST=${MYSQL_SERVER_HOST:-"localhost"} -MYSQL_SERVER_PORT=${MYSQL_SERVER_PORT:-"3306"} -MYSQL_SERVER_DB_NAME=${MYSQL_SERVER_DB_NAME:-"onlyoffice"} -MYSQL_SERVER_USER=${MYSQL_SERVER_USER:-"root"} -MYSQL_SERVER_PASS=${MYSQL_SERVER_PASS:-""} +JSON="json -q -f ${ONLYOFFICE_DEFAULT_CONFIG}" -RABBITMQ_SERVER_HOST=${RABBITMQ_SERVER_HOST:-"localhost"} -RABBITMQ_SERVER_USER=${RABBITMQ_SERVER_USER:-"guest"} -RABBITMQ_SERVER_PASS=${RABBITMQ_SERVER_PASS:-"guest"} +MYSQL_SERVER_HOST=${MYSQL_SERVER_HOST:-$(${JSON} services.CoAuthoring.sql.dbHost)} +MYSQL_SERVER_PORT=${MYSQL_SERVER_PORT:-$(${JSON} services.CoAuthoring.sql.dbPort)} +MYSQL_SERVER_DB_NAME=${MYSQL_SERVER_DB_NAME:-$(${JSON} services.CoAuthoring.sql.dbName)} +MYSQL_SERVER_USER=${MYSQL_SERVER_USER:-$(${JSON} services.CoAuthoring.sql.dbUser)} +MYSQL_SERVER_PASS=${MYSQL_SERVER_PASS:-$(${JSON} services.CoAuthoring.sql.dbPass)} -REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-"localhost"} -REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-"6379"} +RABBITMQ_SERVER_URL=$(${JSON} rabbitmq.url) +RABBITMQ_SERVER_HOST=${RABBITMQ_SERVER_HOST:-${RABBITMQ_SERVER_URL#'amqp://'}} +RABBITMQ_SERVER_USER=${RABBITMQ_SERVER_USER:-$(${JSON} rabbitmq.login)} +RABBITMQ_SERVER_PASS=${RABBITMQ_SERVER_PASS:-$(${JSON} rabbitmq.password)} +RABBITMQ_SERVER_PORT=${RABBITMQ_SERVER_PORT:-"5672"} -# create base folders -for i in converter docservice spellchecker metrics gc; do - mkdir -p "${LOG_DIR}/$i" -done +REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-$(${JSON} services.CoAuthoring.redis.host)} +REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-$(${JSON} services.CoAuthoring.redis.port)} -mkdir -p ${LOG_DIR}-example +waiting_for_connection(){ + until nc -z -w 3 "$1" "$2"; do + >&2 echo "Waiting for connection to the $1 host on port $2" + sleep 1 + done +} -# Set up nginx -sed 's/^worker_processes.*/'"worker_processes ${NGINX_WORKER_PROCESSES};"'/' -i ${NGINX_CONFIG_PATH} -sed 's/worker_connections.*/'"worker_connections ${NGINX_WORKER_CONNECTIONS};"'/' -i ${NGINX_CONFIG_PATH} -sed 's/access_log.*/'"access_log off;"'/' -i ${NGINX_CONFIG_PATH} +waiting_for_mysql(){ + waiting_for_connection ${MYSQL_SERVER_HOST} ${MYSQL_SERVER_PORT} +} -# setup HTTPS -if [ -f "${SSL_CERTIFICATE_PATH}" -a -f "${SSL_KEY_PATH}" ]; then - cp ${SYSCONF_TEMPLATES_DIR}/nginx/onlyoffice-documentserver-ssl.conf ${NGINX_ONLYOFFICE_PATH} +waiting_for_rabbitmq(){ + waiting_for_connection ${RABBITMQ_SERVER_HOST} ${RABBITMQ_SERVER_PORT} +} - mkdir ${DATA_DIR} +waiting_for_redis(){ + waiting_for_connection ${REDIS_SERVER_HOST} ${REDIS_SERVER_PORT} +} - # configure nginx - sed 's,{{SSL_CERTIFICATE_PATH}},'"${SSL_CERTIFICATE_PATH}"',' -i ${NGINX_ONLYOFFICE_PATH} - sed 's,{{SSL_KEY_PATH}},'"${SSL_KEY_PATH}"',' -i ${NGINX_ONLYOFFICE_PATH} +update_mysql_settings(){ + ${JSON} -I -e "this.services.CoAuthoring.sql.dbHost = '${MYSQL_SERVER_HOST}'" + ${JSON} -I -e "this.services.CoAuthoring.sql.dbPort = '${MYSQL_SERVER_PORT}'" + ${JSON} -I -e "this.services.CoAuthoring.sql.dbName = '${MYSQL_SERVER_DB_NAME}'" + ${JSON} -I -e "this.services.CoAuthoring.sql.dbUser = '${MYSQL_SERVER_USER}'" + ${JSON} -I -e "this.services.CoAuthoring.sql.dbPass = '${MYSQL_SERVER_PASS}'" +} - # if dhparam path is valid, add to the config, otherwise remove the option - if [ -r "${SSL_DHPARAM_PATH}" ]; then - sed 's,{{SSL_DHPARAM_PATH}},'"${SSL_DHPARAM_PATH}"',' -i ${NGINX_ONLYOFFICE_PATH} - else - sed '/ssl_dhparam {{SSL_DHPARAM_PATH}};/d' -i ${NGINX_ONLYOFFICE_PATH} - fi +update_rabbitmq_setting(){ + ${JSON} -I -e "this.rabbitmq.url = 'amqp://${RABBITMQ_SERVER_HOST}'" + ${JSON} -I -e "this.rabbitmq.login = '${RABBITMQ_SERVER_USER}'" + ${JSON} -I -e "this.rabbitmq.password = '${RABBITMQ_SERVER_PASS}'" +} - sed 's,{{SSL_VERIFY_CLIENT}},'"${SSL_VERIFY_CLIENT}"',' -i ${NGINX_ONLYOFFICE_PATH} - - if [ -f "${CA_CERTIFICATES_PATH}" ]; then - sed 's,{{CA_CERTIFICATES_PATH}},'"${CA_CERTIFICATES_PATH}"',' -i ${NGINX_ONLYOFFICE_PATH} - else - sed '/{{CA_CERTIFICATES_PATH}}/d' -i ${NGINX_ONLYOFFICE_PATH} - fi - - if [ "${ONLYOFFICE_HTTPS_HSTS_ENABLED}" == "true" ]; then - sed 's/{{ONLYOFFICE_HTTPS_HSTS_MAXAGE}}/'"${ONLYOFFICE_HTTPS_HSTS_MAXAGE}"'/' -i ${NGINX_ONLYOFFICE_PATH} - else - sed '/{{ONLYOFFICE_HTTPS_HSTS_MAXAGE}}/d' -i ${NGINX_ONLYOFFICE_PATH} - fi -else - cp ${SYSCONF_TEMPLATES_DIR}/nginx/onlyoffice-documentserver.conf ${NGINX_ONLYOFFICE_PATH} -fi - -JSON="json -I -q -f ${ONLYOFFICE_DEFAULT_CONFIG}" - -if [ ${MYSQL_SERVER_HOST} != "localhost" ]; then - - # Change mysql settings - ${JSON} -e "this.services.CoAuthoring.sql.dbHost = '${MYSQL_SERVER_HOST}'" - ${JSON} -e "this.services.CoAuthoring.sql.dbPort = '${MYSQL_SERVER_PORT}'" - ${JSON} -e "this.services.CoAuthoring.sql.dbName = '${MYSQL_SERVER_DB_NAME}'" - ${JSON} -e "this.services.CoAuthoring.sql.dbUser = '${MYSQL_SERVER_USER}'" - ${JSON} -e "this.services.CoAuthoring.sql.dbPass = '${MYSQL_SERVER_PASS}'" +update_redis_settings(){ + ${JSON} -I -e "this.services.CoAuthoring.redis.host = '${REDIS_SERVER_HOST}'" + ${JSON} -I -e "this.services.CoAuthoring.redis.port = '${REDIS_SERVER_PORT}'" +} +create_mysql_db(){ MYSQL="mysql -s -h${MYSQL_SERVER_HOST} -u${MYSQL_SERVER_USER}" if [ -n "${MYSQL_SERVER_PASS}" ]; then MYSQL="$MYSQL -p${MYSQL_SERVER_PASS}" @@ -102,38 +88,102 @@ if [ ${MYSQL_SERVER_HOST} != "localhost" ]; then # Create db on remote server ${MYSQL} -e "CREATE DATABASE IF NOT EXISTS ${MYSQL_SERVER_DB_NAME} CHARACTER SET utf8 COLLATE 'utf8_general_ci';" ${MYSQL} "${MYSQL_SERVER_DB_NAME}" < "${APP_DIR}/server/schema/createdb.sql" +} + +start_nginx(){ + # Set up nginx + sed 's/^worker_processes.*/'"worker_processes ${NGINX_WORKER_PROCESSES};"'/' -i ${NGINX_CONFIG_PATH} + sed 's/worker_connections.*/'"worker_connections ${NGINX_WORKER_CONNECTIONS};"'/' -i ${NGINX_CONFIG_PATH} + sed 's/access_log.*/'"access_log off;"'/' -i ${NGINX_CONFIG_PATH} + + # setup HTTPS + if [ -f "${SSL_CERTIFICATE_PATH}" -a -f "${SSL_KEY_PATH}" ]; then + cp ${SYSCONF_TEMPLATES_DIR}/nginx/onlyoffice-documentserver-ssl.conf ${NGINX_ONLYOFFICE_PATH} + + mkdir ${DATA_DIR} + + # configure nginx + sed 's,{{SSL_CERTIFICATE_PATH}},'"${SSL_CERTIFICATE_PATH}"',' -i ${NGINX_ONLYOFFICE_PATH} + sed 's,{{SSL_KEY_PATH}},'"${SSL_KEY_PATH}"',' -i ${NGINX_ONLYOFFICE_PATH} + + # if dhparam path is valid, add to the config, otherwise remove the option + if [ -r "${SSL_DHPARAM_PATH}" ]; then + sed 's,{{SSL_DHPARAM_PATH}},'"${SSL_DHPARAM_PATH}"',' -i ${NGINX_ONLYOFFICE_PATH} + else + sed '/ssl_dhparam {{SSL_DHPARAM_PATH}};/d' -i ${NGINX_ONLYOFFICE_PATH} + fi + + sed 's,{{SSL_VERIFY_CLIENT}},'"${SSL_VERIFY_CLIENT}"',' -i ${NGINX_ONLYOFFICE_PATH} + + if [ -f "${CA_CERTIFICATES_PATH}" ]; then + sed 's,{{CA_CERTIFICATES_PATH}},'"${CA_CERTIFICATES_PATH}"',' -i ${NGINX_ONLYOFFICE_PATH} + else + sed '/{{CA_CERTIFICATES_PATH}}/d' -i ${NGINX_ONLYOFFICE_PATH} + fi + + if [ "${ONLYOFFICE_HTTPS_HSTS_ENABLED}" == "true" ]; then + sed 's/{{ONLYOFFICE_HTTPS_HSTS_MAXAGE}}/'"${ONLYOFFICE_HTTPS_HSTS_MAXAGE}"'/' -i ${NGINX_ONLYOFFICE_PATH} + else + sed '/{{ONLYOFFICE_HTTPS_HSTS_MAXAGE}}/d' -i ${NGINX_ONLYOFFICE_PATH} + fi + else + cp ${SYSCONF_TEMPLATES_DIR}/nginx/onlyoffice-documentserver.conf ${NGINX_ONLYOFFICE_PATH} + fi + + #start service + service nginx start +} + +start_supervisor(){ + # Copy modified supervisor start script + cp ${SYSCONF_TEMPLATES_DIR}/supervisor/supervisor /etc/init.d/ + # Copy modified supervisor config + cp ${SYSCONF_TEMPLATES_DIR}/supervisor/supervisord.conf /etc/supervisor/supervisord.conf + + #start service + service supervisor start +} + +# create base folders +for i in converter docservice spellchecker metrics gc; do + mkdir -p "${LOG_DIR}/$i" +done + +mkdir -p ${LOG_DIR}-example + +if [ ${MYSQL_SERVER_HOST} != "localhost" ]; then + update_mysql_settings + create_mysql_db else - service mysql start + if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then + service mysql start + fi fi if [ ${RABBITMQ_SERVER_HOST} != "localhost" ]; then - - # Change rabbitmq settings - ${JSON} -e "this.rabbitmq.url = 'amqp://${RABBITMQ_SERVER_HOST}'" - ${JSON} -e "this.rabbitmq.login = '${RABBITMQ_SERVER_USER}'" - ${JSON} -e "this.rabbitmq.password = '${RABBITMQ_SERVER_PASS}'" - + update_rabbitmq_setting else - service redis-server start + if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then + service redis-server start + fi fi if [ ${REDIS_SERVER_HOST} != "localhost" ]; then - - # Change redis settings - ${JSON} -e "this.services.CoAuthoring.redis.host = '${REDIS_SERVER_HOST}'" - ${JSON} -e "this.services.CoAuthoring.redis.port = '${REDIS_SERVER_PORT}'" - + update_redis_settings else - service rabbitmq-server start + if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then + service rabbitmq-server start + fi fi -# Copy modified supervisor start script -cp ${SYSCONF_TEMPLATES_DIR}/supervisor/supervisor /etc/init.d/ -# Copy modified supervisor config -cp ${SYSCONF_TEMPLATES_DIR}/supervisor/supervisord.conf /etc/supervisor/supervisord.conf - -service nginx start -service supervisor start +if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then + waiting_for_mysql + waiting_for_rabbitmq + waiting_for_redis + + start_nginx + start_supervisor +fi # Regenerate the fonts list and the fonts thumbnails -documentserver-generate-allfonts.sh +documentserver-generate-allfonts.sh ${ONLYOFFICE_DATA_CONTAINER} \ No newline at end of file From ca5bc8526d38ba696b25ef4d77e388248c7dc7d9 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Mon, 11 Jul 2016 13:52:09 +0300 Subject: [PATCH 08/36] Update docker-compose.yml fixed missprint --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 292f7cc..e09fc02 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -44,7 +44,7 @@ services: - '80' - '443' volumes_from: - - onlyoffice-documentserver-data: + - onlyoffice-documentserver-data onlyoffice-haproxy: container_name: onlyoffice-haproxy From dbd0e01e867708396ab95e1ee1179449c127f867 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Mon, 11 Jul 2016 13:53:45 +0300 Subject: [PATCH 09/36] Update docker-compose.yml added ONLYOFFICE_DATA_CONTAINER=true to data container --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index e09fc02..0d73142 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,7 @@ services: container_name: onlyoffice-documentserver-data image: onlyoffice/4testing-documentserver:latest environment: + - ONLYOFFICE_DATA_CONTAINER=true - MYSQL_SERVER_HOST=onlyoffice-mysql - MYSQL_SERVER_PORT=3306 - MYSQL_SERVER_DB_NAME=onlyoffice From 0dd2cc1e599b2cc427e410dc9aafca00cde5e1c3 Mon Sep 17 00:00:00 2001 From: "Alexey.Golubev" Date: Tue, 12 Jul 2016 15:07:52 +0300 Subject: [PATCH 10/36] use http proxy instead of tcp proxy. --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0d73142..f2a3a79 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,6 +34,7 @@ services: - onlyoffice-redis - onlyoffice-rabbitmq environment: + - VIRTUAL_HOST="ws://\*/doc/*" - HTTP_CHECK=HEAD /healthcheck - EXTRA_SETTINGS=http-check expect status 200 stdin_open: true @@ -53,8 +54,7 @@ services: depends_on: - onlyoffice-documentserver environment: - - MODE=tcp - - TCP_PORTS="80, 443" + - MODE=http stdin_open: true tty: true links: From 795548735253d5fe49f5626a8d94e928a3a06209 Mon Sep 17 00:00:00 2001 From: "Alexey.Golubev" Date: Tue, 12 Jul 2016 15:37:09 +0300 Subject: [PATCH 11/36] Added uri balanced type. --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index f2a3a79..6421404 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,6 +35,7 @@ services: - onlyoffice-rabbitmq environment: - VIRTUAL_HOST="ws://\*/doc/*" + - BALANCE=uri depth 3 - HTTP_CHECK=HEAD /healthcheck - EXTRA_SETTINGS=http-check expect status 200 stdin_open: true From ad64cea8ec39b6a8091c9f0fad87416250504589 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Tue, 12 Jul 2016 17:27:04 +0300 Subject: [PATCH 12/36] removed unused code --- run-document-server.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/run-document-server.sh b/run-document-server.sh index 901ad09..adfd639 100644 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -100,8 +100,6 @@ start_nginx(){ if [ -f "${SSL_CERTIFICATE_PATH}" -a -f "${SSL_KEY_PATH}" ]; then cp ${SYSCONF_TEMPLATES_DIR}/nginx/onlyoffice-documentserver-ssl.conf ${NGINX_ONLYOFFICE_PATH} - mkdir ${DATA_DIR} - # configure nginx sed 's,{{SSL_CERTIFICATE_PATH}},'"${SSL_CERTIFICATE_PATH}"',' -i ${NGINX_ONLYOFFICE_PATH} sed 's,{{SSL_KEY_PATH}},'"${SSL_KEY_PATH}"',' -i ${NGINX_ONLYOFFICE_PATH} @@ -186,4 +184,4 @@ if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then fi # Regenerate the fonts list and the fonts thumbnails -documentserver-generate-allfonts.sh ${ONLYOFFICE_DATA_CONTAINER} \ No newline at end of file +documentserver-generate-allfonts.sh ${ONLYOFFICE_DATA_CONTAINER} From a81303683010e9dbe891923f3b942dac4dcc9e1f Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Fri, 15 Jul 2016 16:31:53 +0300 Subject: [PATCH 13/36] Updated haproxy container, removed virtual host, added templates for ssl --- docker-compose.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6421404..4d1f8cf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,10 +34,11 @@ services: - onlyoffice-redis - onlyoffice-rabbitmq environment: - - VIRTUAL_HOST="ws://\*/doc/*" - BALANCE=uri depth 3 - HTTP_CHECK=HEAD /healthcheck - EXTRA_SETTINGS=http-check expect status 200 + # Uncomment the string below to redirect HTTP request to HTTPS request. + #- FORCE_SSL=true stdin_open: true tty: true restart: always @@ -45,23 +46,27 @@ services: - onlyoffice expose: - '80' - - '443' volumes_from: - onlyoffice-documentserver-data onlyoffice-haproxy: container_name: onlyoffice-haproxy - image: dockercloud/haproxy:1.2.1 + image: dockercloud/haproxy:1.5.1 depends_on: - onlyoffice-documentserver environment: - MODE=http + # Uncomment the string below to specify the path of ssl certificates + #- CERT_FOLDER=/certs/ stdin_open: true tty: true links: - onlyoffice-documentserver volumes: - /var/run/docker.sock:/var/run/docker.sock + # Uncomment the string below to map a ssl certificate from host + # to the proxy container + #- /app/onlyoffice/DocumentServer/data/certs/onlyoffice.pem:/certs/cert1.pem restart: always networks: - onlyoffice From dd27f00a62310d9c442fd983ea5ff2ea764b5979 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Fri, 15 Jul 2016 17:14:18 +0300 Subject: [PATCH 14/36] Seach for the string "true" in a http body when healthcheack service --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4d1f8cf..df2ba7a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,8 +35,8 @@ services: - onlyoffice-rabbitmq environment: - BALANCE=uri depth 3 - - HTTP_CHECK=HEAD /healthcheck - - EXTRA_SETTINGS=http-check expect status 200 + - HTTP_CHECK=GET /healthcheck + - EXTRA_SETTINGS=http-check expect string true # Uncomment the string below to redirect HTTP request to HTTPS request. #- FORCE_SSL=true stdin_open: true From e7b7e7dd1a39f22245bae6640098476a3eefd1f6 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Wed, 20 Jul 2016 18:56:20 +0300 Subject: [PATCH 15/36] made availability check the data container to ensure the correct order of starting the containers --- docker-compose.yml | 1 + run-document-server.sh | 113 ++++++++++++++++++++++++----------------- 2 files changed, 68 insertions(+), 46 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index df2ba7a..02ffd90 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,6 +34,7 @@ services: - onlyoffice-redis - onlyoffice-rabbitmq environment: + - ONLYOFFICE_DATA_CONTAINER_HOST=onlyoffice-documentserver-data - BALANCE=uri depth 3 - HTTP_CHECK=GET /healthcheck - EXTRA_SETTINGS=http-check expect string true diff --git a/run-document-server.sh b/run-document-server.sh index adfd639..9c67c67 100644 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -5,6 +5,8 @@ DATA_DIR="/var/www/onlyoffice/Data" LOG_DIR="/var/log/onlyoffice/documentserver" ONLYOFFICE_DATA_CONTAINER=${ONLYOFFICE_DATA_CONTAINER:-false} +ONLYOFFICE_DATA_CONTAINER_HOST=${ONLYOFFICE_DATA_CONTAINER_HOST:-localhost} +ONLYOFFICE_DATA_CONTAINER_PORT=80 SSL_CERTIFICATES_DIR="${DATA_DIR}/certs" SSL_CERTIFICATE_PATH=${SSL_CERTIFICATE_PATH:-${SSL_CERTIFICATES_DIR}/onlyoffice.crt} @@ -26,20 +28,24 @@ ONLYOFFICE_DEFAULT_CONFIG=/etc/onlyoffice/documentserver/default.json JSON="json -q -f ${ONLYOFFICE_DEFAULT_CONFIG}" -MYSQL_SERVER_HOST=${MYSQL_SERVER_HOST:-$(${JSON} services.CoAuthoring.sql.dbHost)} -MYSQL_SERVER_PORT=${MYSQL_SERVER_PORT:-$(${JSON} services.CoAuthoring.sql.dbPort)} -MYSQL_SERVER_DB_NAME=${MYSQL_SERVER_DB_NAME:-$(${JSON} services.CoAuthoring.sql.dbName)} -MYSQL_SERVER_USER=${MYSQL_SERVER_USER:-$(${JSON} services.CoAuthoring.sql.dbUser)} -MYSQL_SERVER_PASS=${MYSQL_SERVER_PASS:-$(${JSON} services.CoAuthoring.sql.dbPass)} +LOCAL_SERVICES=() -RABBITMQ_SERVER_URL=$(${JSON} rabbitmq.url) -RABBITMQ_SERVER_HOST=${RABBITMQ_SERVER_HOST:-${RABBITMQ_SERVER_URL#'amqp://'}} -RABBITMQ_SERVER_USER=${RABBITMQ_SERVER_USER:-$(${JSON} rabbitmq.login)} -RABBITMQ_SERVER_PASS=${RABBITMQ_SERVER_PASS:-$(${JSON} rabbitmq.password)} -RABBITMQ_SERVER_PORT=${RABBITMQ_SERVER_PORT:-"5672"} +read_setting(){ + MYSQL_SERVER_HOST=${MYSQL_SERVER_HOST:-$(${JSON} services.CoAuthoring.sql.dbHost)} + MYSQL_SERVER_PORT=${MYSQL_SERVER_PORT:-$(${JSON} services.CoAuthoring.sql.dbPort)} + MYSQL_SERVER_DB_NAME=${MYSQL_SERVER_DB_NAME:-$(${JSON} services.CoAuthoring.sql.dbName)} + MYSQL_SERVER_USER=${MYSQL_SERVER_USER:-$(${JSON} services.CoAuthoring.sql.dbUser)} + MYSQL_SERVER_PASS=${MYSQL_SERVER_PASS:-$(${JSON} services.CoAuthoring.sql.dbPass)} -REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-$(${JSON} services.CoAuthoring.redis.host)} -REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-$(${JSON} services.CoAuthoring.redis.port)} + RABBITMQ_SERVER_URL=$(${JSON} rabbitmq.url) + RABBITMQ_SERVER_HOST=${RABBITMQ_SERVER_HOST:-${RABBITMQ_SERVER_URL#'amqp://'}} + RABBITMQ_SERVER_USER=${RABBITMQ_SERVER_USER:-$(${JSON} rabbitmq.login)} + RABBITMQ_SERVER_PASS=${RABBITMQ_SERVER_PASS:-$(${JSON} rabbitmq.password)} + RABBITMQ_SERVER_PORT=${RABBITMQ_SERVER_PORT:-"5672"} + + REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-$(${JSON} services.CoAuthoring.redis.host)} + REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-$(${JSON} services.CoAuthoring.redis.port)} +} waiting_for_connection(){ until nc -z -w 3 "$1" "$2"; do @@ -59,7 +65,9 @@ waiting_for_rabbitmq(){ waiting_for_redis(){ waiting_for_connection ${REDIS_SERVER_HOST} ${REDIS_SERVER_PORT} } - +waiting_for_datacontainer(){ + waiting_for_connection ${ONLYOFFICE_DATA_CONTAINER_HOST} ${ONLYOFFICE_DATA_CONTAINER_PORT} +} update_mysql_settings(){ ${JSON} -I -e "this.services.CoAuthoring.sql.dbHost = '${MYSQL_SERVER_HOST}'" ${JSON} -I -e "this.services.CoAuthoring.sql.dbPort = '${MYSQL_SERVER_PORT}'" @@ -90,7 +98,7 @@ create_mysql_db(){ ${MYSQL} "${MYSQL_SERVER_DB_NAME}" < "${APP_DIR}/server/schema/createdb.sql" } -start_nginx(){ +update_nginx_settings(){ # Set up nginx sed 's/^worker_processes.*/'"worker_processes ${NGINX_WORKER_PROCESSES};"'/' -i ${NGINX_CONFIG_PATH} sed 's/worker_connections.*/'"worker_connections ${NGINX_WORKER_CONNECTIONS};"'/' -i ${NGINX_CONFIG_PATH} @@ -127,61 +135,74 @@ start_nginx(){ else cp ${SYSCONF_TEMPLATES_DIR}/nginx/onlyoffice-documentserver.conf ${NGINX_ONLYOFFICE_PATH} fi - - #start service - service nginx start } -start_supervisor(){ +update_supervisor_settings(){ # Copy modified supervisor start script cp ${SYSCONF_TEMPLATES_DIR}/supervisor/supervisor /etc/init.d/ # Copy modified supervisor config cp ${SYSCONF_TEMPLATES_DIR}/supervisor/supervisord.conf /etc/supervisor/supervisord.conf - - #start service - service supervisor start } # create base folders for i in converter docservice spellchecker metrics gc; do - mkdir -p "${LOG_DIR}/$i" + mkdir -p "${LOG_DIR}/$i" done mkdir -p ${LOG_DIR}-example -if [ ${MYSQL_SERVER_HOST} != "localhost" ]; then - update_mysql_settings - create_mysql_db -else - if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then - service mysql start +if [ ${ONLYOFFICE_DATA_CONTAINER_HOST} = "localhost" ]; then + + read_setting + + # update settings by env variables + if [ ${MYSQL_SERVER_HOST} != "localhost" ]; then + update_mysql_settings + waiting_for_mysql + create_mysql_db + else + LOCAL_SERVICES+=("mysql") fi + + if [ ${RABBITMQ_SERVER_HOST} != "localhost" ]; then + update_rabbitmq_setting + else + LOCAL_SERVICES+=("redis-server") + fi + + if [ ${REDIS_SERVER_HOST} != "localhost" ]; then + update_redis_settings + else + LOCAL_SERVICES+=("rabbitmq-server") + fi +else + # no need to update settings just wait for remote data + waiting_for_datacontainer + + # read settings after the data container in ready state + # to prevent get unconfigureted data + read_setting fi -if [ ${RABBITMQ_SERVER_HOST} != "localhost" ]; then - update_rabbitmq_setting -else - if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then - service redis-server start - fi -fi - -if [ ${REDIS_SERVER_HOST} != "localhost" ]; then - update_redis_settings -else - if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then - service rabbitmq-server start - fi -fi +#start needed local services +for i in ${LOCAL_SERVICES[@]}; do + service $i start +done if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then waiting_for_mysql waiting_for_rabbitmq waiting_for_redis - - start_nginx - start_supervisor + + update_nginx_settings + + update_supervisor_settings + service supervisor start fi +# nginx used as a proxy, and as data container status service. +# it run in all cases. +service nginx start + # Regenerate the fonts list and the fonts thumbnails documentserver-generate-allfonts.sh ${ONLYOFFICE_DATA_CONTAINER} From 05c96650fddee2f2b5d453930eb7d951f91bf29d Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Wed, 27 Jul 2016 12:18:30 +0300 Subject: [PATCH 16/36] Update docker-compose.yml Fixed ERROR: An HTTP request took too long to complete. --- docker-compose.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 02ffd90..36e8985 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,6 @@ services: - REDIS_SERVER_HOST=onlyoffice-redis - REDIS_SERVER_PORT=6379 stdin_open: true - tty: true restart: always networks: - onlyoffice @@ -41,7 +40,6 @@ services: # Uncomment the string below to redirect HTTP request to HTTPS request. #- FORCE_SSL=true stdin_open: true - tty: true restart: always networks: - onlyoffice @@ -60,7 +58,6 @@ services: # Uncomment the string below to specify the path of ssl certificates #- CERT_FOLDER=/certs/ stdin_open: true - tty: true links: - onlyoffice-documentserver volumes: From 8ec2fe79a5f64c8743a2f85fbca5314038425cd8 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Wed, 27 Jul 2016 14:27:54 +0300 Subject: [PATCH 17/36] Changed version from X.X.X-X to X.X.X.X --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index adde32f..b49df18 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER) +PACKAGE_VERSION := $(PRODUCT_VERSION).$(BUILD_NUMBER) ifeq ($(GIT_BRANCH), origin/develop) DOCKER_TAGS += $(PACKAGE_VERSION) From 421b24c01c9ea3edce087d8e4f0bd794aa3fcfd0 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Wed, 27 Jul 2016 15:24:47 +0300 Subject: [PATCH 18/36] Fixed build crash --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b49df18..7ebb05c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PACKAGE_VERSION := $(PRODUCT_VERSION).$(BUILD_NUMBER) +PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER) ifeq ($(GIT_BRANCH), origin/develop) DOCKER_TAGS += $(PACKAGE_VERSION) @@ -18,7 +18,7 @@ $(DOCKER_TARGETS): $(DEB_REPO_DATA) sed "s|{{GIT_BRANCH}}|$(GIT_BRANCH)|" -i Dockerfile sed 's/{{PACKAGE_VERSION}}/'$(PACKAGE_VERSION)'/' -i Dockerfile - sudo docker build -t $(subst $(COLON),:,$@) . &&\ + sudo docker build -t $(subst -,.,$(subst $(COLON),:,$@)) . &&\ mkdir -p $$(dirname $@) &&\ echo "Done" > $@ @@ -31,4 +31,4 @@ clean-docker: sudo docker rmi -f $$(sudo docker images -q $(COMPANY_NAME)/*) || exit 0 deploy: $(DOCKER_TARGETS) - $(foreach TARGET,$(DOCKER_TARGETS),sudo docker push $(subst $(COLON),:,$(TARGET));) + $(foreach TARGET,$(DOCKER_TARGETS),sudo docker push $(subst -,.,$(subst $(COLON),:,$(TARGET)));) From c515adf6936bc4adcd10d220cdce98e3342c9d06 Mon Sep 17 00:00:00 2001 From: "Alexey.Golubev" Date: Wed, 27 Jul 2016 16:13:52 +0300 Subject: [PATCH 19/36] Remade setup a docker version --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 7ebb05c..4d19f2f 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER) ifeq ($(GIT_BRANCH), origin/develop) -DOCKER_TAGS += $(PACKAGE_VERSION) +DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION)) DOCKER_TAGS += latest else -DOCKER_TAGS += $(PACKAGE_VERSION)-$(subst /,-,$(GIT_BRANCH)) +DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION))-$(subst /,-,$(GIT_BRANCH)) endif DOCKER_REPO = $(COMPANY_NAME)/4testing-$(PRODUCT_NAME) @@ -18,7 +18,7 @@ $(DOCKER_TARGETS): $(DEB_REPO_DATA) sed "s|{{GIT_BRANCH}}|$(GIT_BRANCH)|" -i Dockerfile sed 's/{{PACKAGE_VERSION}}/'$(PACKAGE_VERSION)'/' -i Dockerfile - sudo docker build -t $(subst -,.,$(subst $(COLON),:,$@)) . &&\ + sudo docker build -t $(subst $(COLON),:,$@) . &&\ mkdir -p $$(dirname $@) &&\ echo "Done" > $@ @@ -31,4 +31,4 @@ clean-docker: sudo docker rmi -f $$(sudo docker images -q $(COMPANY_NAME)/*) || exit 0 deploy: $(DOCKER_TARGETS) - $(foreach TARGET,$(DOCKER_TARGETS),sudo docker push $(subst -,.,$(subst $(COLON),:,$(TARGET)));) + $(foreach TARGET,$(DOCKER_TARGETS),sudo docker push $(subst $(COLON),:,$(TARGET));) From 28ac7a080af5d108bc65ad0cb1d0c27f7e5b79ff Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Thu, 28 Jul 2016 12:39:56 +0300 Subject: [PATCH 20/36] Update Dockerfile --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index ad8a962..a5502ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,7 +34,9 @@ RUN echo "deb http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/only service mysql start && \ apt-get --force-yes -yq install onlyoffice-documentserver && \ service mysql stop && \ + service supervisor stop && \ chmod 755 /app/onlyoffice/*.sh && \ + rm -rf /var/log/onlyoffice && \ rm -rf /var/lib/apt/lists/* VOLUME /etc/onlyoffice /var/log/onlyoffice /var/lib/onlyoffice /var/www/onlyoffice/Data From e3b22c436c9cb5d26931ff33f3ce41025694decb Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Wed, 17 Aug 2016 15:54:19 +0300 Subject: [PATCH 21/36] Excluded unused backend --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 36e8985..0584be4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,6 +35,7 @@ services: environment: - 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 # Uncomment the string below to redirect HTTP request to HTTPS request. From befb9c1c6548d73bf425a45b3d1e98aee4a71849 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Tue, 23 Aug 2016 13:45:53 +0300 Subject: [PATCH 22/36] Increase max comnections count --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 0584be4..e7f6500 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -56,6 +56,7 @@ services: - onlyoffice-documentserver environment: - MODE=http + - MAXCONN=65536 # Uncomment the string below to specify the path of ssl certificates #- CERT_FOLDER=/certs/ stdin_open: true From 4859e8f422695716aed08b542c84ef081dc4f90b Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Tue, 23 Aug 2016 17:22:42 +0300 Subject: [PATCH 23/36] Removed setup max connection count --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e7f6500..0584be4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -56,7 +56,6 @@ services: - onlyoffice-documentserver environment: - MODE=http - - MAXCONN=65536 # Uncomment the string below to specify the path of ssl certificates #- CERT_FOLDER=/certs/ stdin_open: true From b9f9ed6ba5c9af2eb09c59e812c879e33a451fc7 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Thu, 25 Aug 2016 19:52:14 +0300 Subject: [PATCH 24/36] mysql -> postgresql --- Dockerfile | 13 +++++---- docker-compose.yml | 27 +++++++++---------- run-document-server.sh | 60 +++++++++++++++++++++++------------------- 3 files changed, 54 insertions(+), 46 deletions(-) diff --git a/Dockerfile b/Dockerfile index a5502ca..a6b483e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,19 +5,22 @@ ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=nonint RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ apt-get -y update && \ - apt-get --force-yes -yq install apt-transport-https && \ + apt-get --force-yes -yq install wget apt-transport-https && \ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D9D0BF019CC8AC0D && \ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1655A0AB68576280 && \ + wget https://www.postgresql.org/media/keys/ACCC4CF8.asc && \ + apt-key add ACCC4CF8.asc && \ echo "deb http://archive.ubuntu.com/ubuntu precise main universe multiverse" >> /etc/apt/sources.list && \ echo "deb https://deb.nodesource.com/node_4.x trusty main" | tee /etc/apt/sources.list.d/nodesource.list && \ + echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | tee /etc/apt/sources.list.d/nodesource.list && \ locale-gen en_US.UTF-8 && \ apt-get -y update && \ echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \ apt-get install --force-yes -yq software-properties-common && \ add-apt-repository ppa:ubuntu-toolchain-r/test && \ apt-get -y update && \ - apt-get --force-yes -yq install software-properties-common adduser mysql-server redis-server rabbitmq-server nginx-extras nodejs libstdc++6 libcurl3 libxml2 libboost-regex-dev zlib1g supervisor fonts-dejavu fonts-liberation ttf-mscorefonts-installer fonts-crosextra-carlito fonts-takao-gothic fonts-opensymbol libxss1 libgtkglext1 libcairo2 xvfb libxtst6 libgconf2-4 libasound2 bomstrip libnspr4 libnss3 libnss3-nssdb nano htop && \ - service mysql stop && \ + apt-get --force-yes -yq install software-properties-common adduser postgresql redis-server rabbitmq-server nginx-extras nodejs libstdc++6 libcurl3 libxml2 libboost-regex-dev zlib1g supervisor fonts-dejavu fonts-liberation ttf-mscorefonts-installer fonts-crosextra-carlito fonts-takao-gothic fonts-opensymbol libxss1 libgtkglext1 libcairo2 xvfb libxtst6 libgconf2-4 libasound2 bomstrip libnspr4 libnss3 libnss3-nssdb nano htop && \ + service postgresql stop && \ service redis-server stop && \ service rabbitmq-server stop && \ service supervisor stop && \ @@ -31,9 +34,9 @@ EXPOSE 80 443 RUN echo "deb http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/onlyoffice-documentserver/{{GIT_BRANCH}}/{{PACKAGE_VERSION}}/ repo/" | tee /etc/apt/sources.list.d/onlyoffice.list && \ apt-get -y update && \ - service mysql start && \ + service postgresql start && \ apt-get --force-yes -yq install onlyoffice-documentserver && \ - service mysql stop && \ + service postgresql stop && \ service supervisor stop && \ chmod 755 /app/onlyoffice/*.sh && \ rm -rf /var/log/onlyoffice && \ diff --git a/docker-compose.yml b/docker-compose.yml index 0584be4..0f7dfde 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,10 +5,10 @@ services: image: onlyoffice/4testing-documentserver:latest environment: - ONLYOFFICE_DATA_CONTAINER=true - - MYSQL_SERVER_HOST=onlyoffice-mysql - - MYSQL_SERVER_PORT=3306 - - MYSQL_SERVER_DB_NAME=onlyoffice - - MYSQL_SERVER_USER=root + - POSTGRESQL_SERVER_HOST=onlyoffice-postgers + - POSTGRESQL_SERVER_PORT=5432 + - POSTGRESQL_SERVER_DB_NAME=onlyoffice + - POSTGRESQL_SERVER_USER=root - RABBITMQ_SERVER_HOST=onlyoffice-rabbitmq - RABBITMQ_SERVER_USER=guest - RABBITMQ_SERVER_PASS=guest @@ -29,7 +29,7 @@ services: image: onlyoffice/4testing-documentserver:latest depends_on: - onlyoffice-documentserver-data - - onlyoffice-mysql + - onlyoffice-postgresql - onlyoffice-redis - onlyoffice-rabbitmq environment: @@ -92,24 +92,23 @@ services: expose: - '5672' - onlyoffice-mysql: - container_name: onlyoffice-mysql - image: mysql:5.5 + onlyoffice-postgresql: + container_name: onlyoffice-postgresql + image: postgres:9.5 environment: - - MYSQL_DATABASE=onlyoffice - - MYSQL_USER=root - - MYSQL_ALLOW_EMPTY_PASSWORD='true' + - POSTGRES_DB=onlyoffice + - POSTGRES_USER=onlyoffice networks: - onlyoffice restart: always expose: - - '3306' + - '5432' volumes: - - mysql_data:/var/lib/mysql + - postgresql_data:/var/lib/postgresql networks: onlyoffice: driver: 'bridge' volumes: - mysql_data: + postgresql_data: diff --git a/run-document-server.sh b/run-document-server.sh index 9c67c67..6f2d058 100644 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -31,11 +31,11 @@ JSON="json -q -f ${ONLYOFFICE_DEFAULT_CONFIG}" LOCAL_SERVICES=() read_setting(){ - MYSQL_SERVER_HOST=${MYSQL_SERVER_HOST:-$(${JSON} services.CoAuthoring.sql.dbHost)} - MYSQL_SERVER_PORT=${MYSQL_SERVER_PORT:-$(${JSON} services.CoAuthoring.sql.dbPort)} - MYSQL_SERVER_DB_NAME=${MYSQL_SERVER_DB_NAME:-$(${JSON} services.CoAuthoring.sql.dbName)} - MYSQL_SERVER_USER=${MYSQL_SERVER_USER:-$(${JSON} services.CoAuthoring.sql.dbUser)} - MYSQL_SERVER_PASS=${MYSQL_SERVER_PASS:-$(${JSON} services.CoAuthoring.sql.dbPass)} + POSTGRESQL_SERVER_HOST=${POSTGRESQL_SERVER_HOST:-$(${JSON} services.CoAuthoring.sql.dbHost)} + POSTGRESQL_SERVER_PORT=${POSTGRESQL_SERVER_PORT:-$(${JSON} services.CoAuthoring.sql.dbPort)} + POSTGRESQL_SERVER_DB_NAME=${POSTGRESQL_SERVER_DB_NAME:-$(${JSON} services.CoAuthoring.sql.dbName)} + POSTGRESQL_SERVER_USER=${POSTGRESQL_SERVER_USER:-$(${JSON} services.CoAuthoring.sql.dbUser)} + POSTGRESQL_SERVER_PASS=${POSTGRESQL_SERVER_PASS:-$(${JSON} services.CoAuthoring.sql.dbPass)} RABBITMQ_SERVER_URL=$(${JSON} rabbitmq.url) RABBITMQ_SERVER_HOST=${RABBITMQ_SERVER_HOST:-${RABBITMQ_SERVER_URL#'amqp://'}} @@ -54,8 +54,8 @@ waiting_for_connection(){ done } -waiting_for_mysql(){ - waiting_for_connection ${MYSQL_SERVER_HOST} ${MYSQL_SERVER_PORT} +waiting_for_postgresql(){ + waiting_for_connection ${POSTGRESQL_SERVER_HOST} ${POSTGRESQL_SERVER_PORT} } waiting_for_rabbitmq(){ @@ -68,12 +68,12 @@ waiting_for_redis(){ waiting_for_datacontainer(){ waiting_for_connection ${ONLYOFFICE_DATA_CONTAINER_HOST} ${ONLYOFFICE_DATA_CONTAINER_PORT} } -update_mysql_settings(){ - ${JSON} -I -e "this.services.CoAuthoring.sql.dbHost = '${MYSQL_SERVER_HOST}'" - ${JSON} -I -e "this.services.CoAuthoring.sql.dbPort = '${MYSQL_SERVER_PORT}'" - ${JSON} -I -e "this.services.CoAuthoring.sql.dbName = '${MYSQL_SERVER_DB_NAME}'" - ${JSON} -I -e "this.services.CoAuthoring.sql.dbUser = '${MYSQL_SERVER_USER}'" - ${JSON} -I -e "this.services.CoAuthoring.sql.dbPass = '${MYSQL_SERVER_PASS}'" +update_postgresql_settings(){ + ${JSON} -I -e "this.services.CoAuthoring.sql.dbHost = '${POSTGRESQL_SERVER_HOST}'" + ${JSON} -I -e "this.services.CoAuthoring.sql.dbPort = '${POSTGRESQL_SERVER_PORT}'" + ${JSON} -I -e "this.services.CoAuthoring.sql.dbName = '${POSTGRESQL_SERVER_DB_NAME}'" + ${JSON} -I -e "this.services.CoAuthoring.sql.dbUser = '${POSTGRESQL_SERVER_USER}'" + ${JSON} -I -e "this.services.CoAuthoring.sql.dbPass = '${POSTGRESQL_SERVER_PASS}'" } update_rabbitmq_setting(){ @@ -87,16 +87,22 @@ update_redis_settings(){ ${JSON} -I -e "this.services.CoAuthoring.redis.port = '${REDIS_SERVER_PORT}'" } -create_mysql_db(){ - MYSQL="mysql -s -h${MYSQL_SERVER_HOST} -u${MYSQL_SERVER_USER}" - if [ -n "${MYSQL_SERVER_PASS}" ]; then - MYSQL="$MYSQL -p${MYSQL_SERVER_PASS}" +create_postgresql_db(){ + CONNECTION_PARAMS="-h${POSTGRESQL_SERVER_HOST} -U${POSTGRESQL_SERVER_USER} -w" + if [ -n "${POSTGRESQL_SERVER_PASS}" ]; then + export PGPASSWORD=${POSTGRESQL_SERVER_PASS} fi - # Create db on remote server - ${MYSQL} -e "CREATE DATABASE IF NOT EXISTS ${MYSQL_SERVER_DB_NAME} CHARACTER SET utf8 COLLATE 'utf8_general_ci';" - ${MYSQL} "${MYSQL_SERVER_DB_NAME}" < "${APP_DIR}/server/schema/createdb.sql" -} + PSQL="psql -q $CONNECTION_PARAMS" + CREATEDB="createdb $CONNECTION_PARAMS" + + # Create db on remote server + if $PSQL -lt | cut -d\| -f 1 | grep -qw | grep 0; then + $CREATEDB $DB_NAME + fi + + $PSQL -d "${POSTGRESQL_SERVER_DB_NAME}" -f "${APP_DIR}/server/schema/postgresql/createdb.sql" +} update_nginx_settings(){ # Set up nginx @@ -156,12 +162,12 @@ if [ ${ONLYOFFICE_DATA_CONTAINER_HOST} = "localhost" ]; then read_setting # update settings by env variables - if [ ${MYSQL_SERVER_HOST} != "localhost" ]; then - update_mysql_settings - waiting_for_mysql - create_mysql_db + if [ ${POSTGRESQL_SERVER_HOST} != "localhost" ]; then + update_postgresql_settings + waiting_for_postgresql + create_postgresql_db else - LOCAL_SERVICES+=("mysql") + LOCAL_SERVICES+=("postgresql") fi if [ ${RABBITMQ_SERVER_HOST} != "localhost" ]; then @@ -190,7 +196,7 @@ for i in ${LOCAL_SERVICES[@]}; do done if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then - waiting_for_mysql + waiting_for_postgresql waiting_for_rabbitmq waiting_for_redis From 6956f211944b822a3f93262f2d3c72250b20bec3 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Fri, 26 Aug 2016 12:18:53 +0300 Subject: [PATCH 25/36] fixed misprint --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a6b483e..0ebc2e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ apt-key add ACCC4CF8.asc && \ echo "deb http://archive.ubuntu.com/ubuntu precise main universe multiverse" >> /etc/apt/sources.list && \ echo "deb https://deb.nodesource.com/node_4.x trusty main" | tee /etc/apt/sources.list.d/nodesource.list && \ - echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | tee /etc/apt/sources.list.d/nodesource.list && \ + echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | tee /etc/apt/sources.list.d/postgresql.list && \ locale-gen en_US.UTF-8 && \ apt-get -y update && \ echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \ From e14b97bd76d8162b1d605c63ac8d3a5adad95dee Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Fri, 26 Aug 2016 13:39:29 +0300 Subject: [PATCH 26/36] Create db and user before install documentserver --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 0ebc2e1..70aa8ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,9 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ add-apt-repository ppa:ubuntu-toolchain-r/test && \ apt-get -y update && \ apt-get --force-yes -yq install software-properties-common adduser postgresql redis-server rabbitmq-server nginx-extras nodejs libstdc++6 libcurl3 libxml2 libboost-regex-dev zlib1g supervisor fonts-dejavu fonts-liberation ttf-mscorefonts-installer fonts-crosextra-carlito fonts-takao-gothic fonts-opensymbol libxss1 libgtkglext1 libcairo2 xvfb libxtst6 libgconf2-4 libasound2 bomstrip libnspr4 libnss3 libnss3-nssdb nano htop && \ + sudo -u postgres psql -c "CREATE DATABASE onlyoffice;" && \ + sudo -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';" && \ + sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;" && \ service postgresql stop && \ service redis-server stop && \ service rabbitmq-server stop && \ From 2d67dfe27d2b1f69d53f9ae4be6dd7d307b99f06 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Fri, 26 Aug 2016 15:10:53 +0300 Subject: [PATCH 27/36] fixed misprint --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0f7dfde..9ede6fd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: image: onlyoffice/4testing-documentserver:latest environment: - ONLYOFFICE_DATA_CONTAINER=true - - POSTGRESQL_SERVER_HOST=onlyoffice-postgers + - POSTGRESQL_SERVER_HOST=onlyoffice-postgresql - POSTGRESQL_SERVER_PORT=5432 - POSTGRESQL_SERVER_DB_NAME=onlyoffice - POSTGRESQL_SERVER_USER=root From 4a362b008c76b8b01fe00073c41d16db9f487c82 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Fri, 26 Aug 2016 15:20:13 +0300 Subject: [PATCH 28/36] changed user name for db --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9ede6fd..e56aa3b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: - POSTGRESQL_SERVER_HOST=onlyoffice-postgresql - POSTGRESQL_SERVER_PORT=5432 - POSTGRESQL_SERVER_DB_NAME=onlyoffice - - POSTGRESQL_SERVER_USER=root + - POSTGRESQL_SERVER_USER=onlyoffice - RABBITMQ_SERVER_HOST=onlyoffice-rabbitmq - RABBITMQ_SERVER_USER=guest - RABBITMQ_SERVER_PASS=guest From 83582dd9c6d57c39167d2296e2e90671124e184e Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Fri, 26 Aug 2016 15:44:32 +0300 Subject: [PATCH 29/36] Add a postgre key without storing a file on disk --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 70aa8ee..0e5fc74 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,7 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ apt-get --force-yes -yq install wget apt-transport-https && \ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D9D0BF019CC8AC0D && \ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1655A0AB68576280 && \ - wget https://www.postgresql.org/media/keys/ACCC4CF8.asc && \ - apt-key add ACCC4CF8.asc && \ + wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \ echo "deb http://archive.ubuntu.com/ubuntu precise main universe multiverse" >> /etc/apt/sources.list && \ echo "deb https://deb.nodesource.com/node_4.x trusty main" | tee /etc/apt/sources.list.d/nodesource.list && \ echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | tee /etc/apt/sources.list.d/postgresql.list && \ From 6ea703a44c75b461f0bc2c7de14a40bdacdc9eb5 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Fri, 26 Aug 2016 17:02:51 +0300 Subject: [PATCH 30/36] MySQL -> PostgreSQL --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2939ef1..89bcea7 100644 --- a/README.md +++ b/README.md @@ -155,11 +155,11 @@ Below is the complete list of parameters that can be set using environment varia - **SSL_KEY_PATH**: The path to the SSL certificate's private key. Defaults to `/var/www/onlyoffice/Data/certs/onlyoffice.key`. - **SSL_DHPARAM_PATH**: The path to the Diffie-Hellman parameter. Defaults to `/var/www/onlyoffice/Data/certs/dhparam.pem`. - **SSL_VERIFY_CLIENT**: Enable verification of client certificates using the `CA_CERTIFICATES_PATH` file. Defaults to `false` -- **MYSQL_SERVER_HOST**: The IP address or the name of the host where the MySQL server is running. -- **MYSQL_SERVER_PORT**: The MySQL server port number. -- **MYSQL_SERVER_DB_NAME**: The name of a MySQL database to be created on the image startup. -- **MYSQL_SERVER_USER**: The new user name with superuser permissions for the MySQL account. -- **MYSQL_SERVER_PASS**: The password set for the MySQL account. +- **POSTGRESQL_SERVER_HOST**: The IP address or the name of the host where the PostgreSQL server is running. +- **POSTGRESQL_SERVER_PORT**: The PostgreSQL server port number. +- **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_HOST**: The IP address or the name of the host where the RabbitMQ server is running. - **RABBITMQ_SERVER_USER**: The RabbitMQ server user name. - **RABBITMQ_SERVER_PASS**: The password set for the RabbitMQ account. From 2518588d7f016380e594f56ce2409a2ef1c6e5b0 Mon Sep 17 00:00:00 2001 From: alexandervnuchkov Date: Tue, 30 Aug 2016 16:44:04 +0300 Subject: [PATCH 31/36] Update README.md Added link to Stack Overflow --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d39a26..d367c2b 100644 --- a/README.md +++ b/README.md @@ -257,6 +257,7 @@ SaaS version: [http://www.onlyoffice.com](http://www.onlyoffice.com "http://www. ## User Feedback and Support -If you have any problems with or questions about this image, please contact us through [dev.onlyoffice.org][1]. +If you have any problems with or questions about this image, please visit our official forum to find answers to your questions: [dev.onlyoffice.org][1] or you can ask and answer ONLYOFFICE development questions on [Stack Overflow][2]. [1]: http://dev.onlyoffice.org + [2]: http://stackoverflow.com/questions/tagged/onlyoffice From 5ef37630c54ada5cedfc35cf33fc1341e6d19cb4 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Tue, 30 Aug 2016 17:06:02 +0300 Subject: [PATCH 32/36] Use ARG to set up documentserver repo --- Dockerfile | 4 +++- Makefile | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0e5fc74..d6c64f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ FROM ubuntu:14.04 MAINTAINER Ascensio System SIA +ARG REPO_URL="deb http://static.teamlab.com/repo/debian/ squeeze main" + ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ @@ -34,7 +36,7 @@ ADD run-document-server.sh /app/onlyoffice/run-document-server.sh EXPOSE 80 443 -RUN echo "deb http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/onlyoffice-documentserver/{{GIT_BRANCH}}/{{PACKAGE_VERSION}}/ repo/" | tee /etc/apt/sources.list.d/onlyoffice.list && \ +RUN echo "$REPO_URL" | tee /etc/apt/sources.list.d/onlyoffice.list && \ apt-get -y update && \ service postgresql start && \ apt-get --force-yes -yq install onlyoffice-documentserver && \ diff --git a/Makefile b/Makefile index 4d19f2f..724126d 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER) +REPO_URL := "deb http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/onlyoffice-documentserver/$(GIT_BRANCH)/$(PACKAGE_VERSION)/ repo/" + ifeq ($(GIT_BRANCH), origin/develop) DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION)) DOCKER_TAGS += latest @@ -15,10 +17,8 @@ DOCKER_TARGETS := $(foreach TAG,$(DOCKER_TAGS),$(DOCKER_REPO)$(COLON)$(TAG)) .PHONY: all clean clean-docker deploy docker $(DOCKER_TARGETS): $(DEB_REPO_DATA) - sed "s|{{GIT_BRANCH}}|$(GIT_BRANCH)|" -i Dockerfile - sed 's/{{PACKAGE_VERSION}}/'$(PACKAGE_VERSION)'/' -i Dockerfile - sudo docker build -t $(subst $(COLON),:,$@) . &&\ + sudo docker build --build-arg REPO_URL=$(REPO_URL) -t $(subst $(COLON),:,$@) . &&\ mkdir -p $$(dirname $@) &&\ echo "Done" > $@ From a015fe4c8c7da6ac2038c80292bdeea81ca6aaf2 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Wed, 31 Aug 2016 11:22:25 +0300 Subject: [PATCH 33/36] Moved down REPO_URL to enable caching --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d6c64f3..15269a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,6 @@ FROM ubuntu:14.04 MAINTAINER Ascensio System SIA -ARG REPO_URL="deb http://static.teamlab.com/repo/debian/ squeeze main" - ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ @@ -36,6 +34,8 @@ ADD run-document-server.sh /app/onlyoffice/run-document-server.sh EXPOSE 80 443 +ARG REPO_URL="deb http://static.teamlab.com/repo/debian/ squeeze main" + RUN echo "$REPO_URL" | tee /etc/apt/sources.list.d/onlyoffice.list && \ apt-get -y update && \ service postgresql start && \ From a5ebbe5cb499f8c22b2c79c83c5e9cd0701745c8 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Wed, 31 Aug 2016 14:06:41 +0300 Subject: [PATCH 34/36] read product name from env variable --- Dockerfile | 3 ++- Makefile | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 15269a9..c85e032 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,11 +35,12 @@ ADD run-document-server.sh /app/onlyoffice/run-document-server.sh EXPOSE 80 443 ARG REPO_URL="deb http://static.teamlab.com/repo/debian/ squeeze main" +ARG PRODUCT_NAME=onlyoffice-documentserver RUN echo "$REPO_URL" | tee /etc/apt/sources.list.d/onlyoffice.list && \ apt-get -y update && \ service postgresql start && \ - apt-get --force-yes -yq install onlyoffice-documentserver && \ + apt-get --force-yes -yq install $PRODUCT_NAME && \ service postgresql stop && \ service supervisor stop && \ chmod 755 /app/onlyoffice/*.sh && \ diff --git a/Makefile b/Makefile index 724126d..eac2ccb 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER) -REPO_URL := "deb http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/onlyoffice-documentserver/$(GIT_BRANCH)/$(PACKAGE_VERSION)/ repo/" +REPO_URL := "deb http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/$(PRODUCT_NAME)/$(GIT_BRANCH)/$(PACKAGE_VERSION)/ repo/" ifeq ($(GIT_BRANCH), origin/develop) DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION)) @@ -18,7 +18,7 @@ DOCKER_TARGETS := $(foreach TAG,$(DOCKER_TAGS),$(DOCKER_REPO)$(COLON)$(TAG)) $(DOCKER_TARGETS): $(DEB_REPO_DATA) - sudo docker build --build-arg REPO_URL=$(REPO_URL) -t $(subst $(COLON),:,$@) . &&\ + sudo docker build --build-arg REPO_URL=$(REPO_URL) --build-arg PRODUCT_NAME=$(PRODUCT_NAME) -t $(subst $(COLON),:,$@) . &&\ mkdir -p $$(dirname $@) &&\ echo "Done" > $@ From fdf21d1a8c703f58303bf2dacdb6df89b3364fbf Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Wed, 31 Aug 2016 14:47:26 +0300 Subject: [PATCH 35/36] Fixed build error --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index eac2ccb..5908900 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER) -REPO_URL := "deb http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/$(PRODUCT_NAME)/$(GIT_BRANCH)/$(PACKAGE_VERSION)/ repo/" +REPO_URL := "deb http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/$(COMPANY_NAME)-$(PRODUCT_NAME)/$(GIT_BRANCH)/$(PACKAGE_VERSION)/ repo/" ifeq ($(GIT_BRANCH), origin/develop) DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION)) @@ -18,7 +18,7 @@ DOCKER_TARGETS := $(foreach TAG,$(DOCKER_TAGS),$(DOCKER_REPO)$(COLON)$(TAG)) $(DOCKER_TARGETS): $(DEB_REPO_DATA) - sudo docker build --build-arg REPO_URL=$(REPO_URL) --build-arg PRODUCT_NAME=$(PRODUCT_NAME) -t $(subst $(COLON),:,$@) . &&\ + sudo docker build --build-arg REPO_URL=$(REPO_URL) --build-arg PRODUCT_NAME=$(COMPANY_NAME)-$(PRODUCT_NAME) -t $(subst $(COLON),:,$@) . &&\ mkdir -p $$(dirname $@) &&\ echo "Done" > $@ From fa6b305fd40f39f831c12e26b46c6ce7b1232db5 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Wed, 31 Aug 2016 19:09:25 +0300 Subject: [PATCH 36/36] Remove custom postgresql --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c85e032..912c658 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,10 +8,8 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ apt-get --force-yes -yq install wget apt-transport-https && \ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D9D0BF019CC8AC0D && \ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1655A0AB68576280 && \ - wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \ echo "deb http://archive.ubuntu.com/ubuntu precise main universe multiverse" >> /etc/apt/sources.list && \ echo "deb https://deb.nodesource.com/node_4.x trusty main" | tee /etc/apt/sources.list.d/nodesource.list && \ - echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | tee /etc/apt/sources.list.d/postgresql.list && \ locale-gen en_US.UTF-8 && \ apt-get -y update && \ echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \