From 853f2b4de89fe2f1013b506619ea674c0062c62f Mon Sep 17 00:00:00 2001 From: dienteperro Date: Wed, 19 Apr 2017 17:04:19 -0400 Subject: [PATCH 1/3] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9da5f6e..66157cb 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,9 @@ Integrating it with ONLYOFFICE Community Server you will be able to: * **RAM**: 4 GB or more * **CPU**: dual-core 2 GHz or higher -* **Swap file**: at least 2 GB +* **Swap**: at least 2 GB * **HDD**: at least 2 GB of free space -* **Distributive**: 64-bit Red Hat, CentOS or other compatible distributive with kernel version 3.8 or later, 64-bit Debian, Ubuntu or other compatible distributive with kernel version 3.8 or later +* **Distribution**: 64-bit Red Hat, CentOS or other compatible distributive with kernel version 3.8 or later, 64-bit Debian, Ubuntu or other compatible distributive with kernel version 3.8 or later * **Docker**: version 1.9.0 or later ## Running Docker Image From 2fd40861737a01abd080138a8154b50c3d4f8c63 Mon Sep 17 00:00:00 2001 From: "Alexey.Golubev" Date: Mon, 24 Apr 2017 20:02:01 +0300 Subject: [PATCH 2/3] Added /var/lib/postgresql volume --- Dockerfile | 2 +- run-document-server.sh | 32 +++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 73a7e32..a25fba9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,6 +41,6 @@ RUN echo "$REPO_URL" | tee /etc/apt/sources.list.d/onlyoffice.list && \ rm -rf /var/log/onlyoffice && \ rm -rf /var/lib/apt/lists/* -VOLUME /etc/onlyoffice /var/log/onlyoffice /var/lib/onlyoffice /var/www/onlyoffice/Data /usr/share/fonts/truetype/custom +VOLUME /etc/onlyoffice /var/log/onlyoffice /var/lib/onlyoffice /var/www/onlyoffice/Data /var/lib/postgresql /usr/share/fonts/truetype/custom CMD bash -C '/app/onlyoffice/run-document-server.sh';'bash' diff --git a/run-document-server.sh b/run-document-server.sh index 4363e9c..bd3e1fa 100644 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -33,6 +33,11 @@ JSON="json -q -f ${ONLYOFFICE_DEFAULT_CONFIG}" LOCAL_SERVICES=() +PG_VERSION=9.3 +PG_NAME=main +PGDATA=/var/lib/postgresql/${PG_VERSION}/${PG_NAME} +PG_NEW_CLUSTER=false + read_setting(){ POSTGRESQL_SERVER_HOST=${POSTGRESQL_SERVER_HOST:-$(${JSON} services.CoAuthoring.sql.dbHost)} POSTGRESQL_SERVER_PORT=${POSTGRESQL_SERVER_PORT:-$(${JSON} services.CoAuthoring.sql.dbPort)} @@ -127,7 +132,24 @@ update_redis_settings(){ ${JSON} -I -e "this.services.CoAuthoring.redis.port = '${REDIS_SERVER_PORT}'" } +create_postgresql_cluster(){ + local pg_conf_dir=/etc/postgresql/${PG_VERSION}/${PG_NAME} + local postgresql_conf=$pg_conf_dir/postgresql.conf + local hba_conf=$pg_conf_dir/pg_hba.conf + + mv $postgresql_conf $postgresql_conf.backup + mv $hba_conf $hba_conf.backup + + pg_createcluster ${PG_VERSION} ${PG_NAME} +} + create_postgresql_db(){ + 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;" +} + +create_postgresql_tbl(){ CONNECTION_PARAMS="-h${POSTGRESQL_SERVER_HOST} -U${POSTGRESQL_SERVER_USER} -w" if [ -n "${POSTGRESQL_SERVER_PASS}" ]; then export PGPASSWORD=${POSTGRESQL_SERVER_PASS} @@ -209,8 +231,12 @@ if [ ${ONLYOFFICE_DATA_CONTAINER_HOST} = "localhost" ]; then if [ ${POSTGRESQL_SERVER_HOST} != "localhost" ]; then update_postgresql_settings waiting_for_postgresql - create_postgresql_db + create_postgresql_tbl else + if [ ! -d ${PGDATA} ]; then + create_postgresql_cluster + PG_NEW_CLUSTER=true + fi LOCAL_SERVICES+=("postgresql") fi @@ -239,6 +265,10 @@ for i in ${LOCAL_SERVICES[@]}; do service $i start done +if [ ${PG_NEW_CLUSTER} = "true" ]; then + create_postgresql_tbl +fi + if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then waiting_for_postgresql waiting_for_rabbitmq From f59f75fd694933b6e8025cfea9036434a8b3b659 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Tue, 25 Apr 2017 14:29:24 +0300 Subject: [PATCH 3/3] debug --- run-document-server.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/run-document-server.sh b/run-document-server.sh index bd3e1fa..3f42949 100644 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -266,6 +266,7 @@ for i in ${LOCAL_SERVICES[@]}; do done if [ ${PG_NEW_CLUSTER} = "true" ]; then + create_postgresql_db create_postgresql_tbl fi