From ee8fa827e3a998c51bb85dce6457af8c59e1ac49 Mon Sep 17 00:00:00 2001 From: Roman Demidov <58073444+romandemidov@users.noreply.github.com> Date: Fri, 20 Dec 2019 13:15:59 +0300 Subject: [PATCH] Add external volumes for rabbitmq and redis (#203) --- Dockerfile | 2 +- README.md | 2 ++ run-document-server.sh | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 877388f..810d9eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -77,6 +77,6 @@ RUN echo "$REPO_URL" | tee /etc/apt/sources.list.d/ds.list && \ rm -rf /var/log/$COMPANY_NAME && \ rm -rf /var/lib/apt/lists/* -VOLUME /var/log/$COMPANY_NAME /var/lib/$COMPANY_NAME /var/www/$COMPANY_NAME/Data /var/lib/postgresql /usr/share/fonts/truetype/custom +VOLUME /var/log/$COMPANY_NAME /var/lib/$COMPANY_NAME /var/www/$COMPANY_NAME/Data /var/lib/postgresql /var/lib/rabbitmq /var/lib/redis /usr/share/fonts/truetype/custom ENTRYPOINT /app/ds/run-document-server.sh diff --git a/README.md b/README.md index 29e3a46..b3836c8 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,8 @@ To get access to your data from outside the container, you need to mount the vol -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice \ -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data \ -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice \ + -v /app/onlyoffice/DocumentServer/rabbitmq:/var/lib/rabbitmq \ + -v /app/onlyoffice/DocumentServer/redis:/var/lib/redis \ -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql onlyoffice/documentserver Normally, you do not need to store container data because the container's operation does not depend on its state. Saving data will be useful: diff --git a/run-document-server.sh b/run-document-server.sh index d61be11..d348a43 100755 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -57,6 +57,8 @@ PG_VERSION=9.5 PG_NAME=main PGDATA=${PG_ROOT}/${PG_VERSION}/${PG_NAME} PG_NEW_CLUSTER=false +RABBITMQ_DATA=/var/lib/rabbitmq +REDIS_DATA=/var/lib/redis read_setting(){ deprecated_var POSTGRESQL_SERVER_HOST DB_HOST @@ -434,6 +436,13 @@ if [ ${ONLYOFFICE_DATA_CONTAINER_HOST} = "localhost" ]; then if [ ${AMQP_SERVER_HOST} != "localhost" ]; then update_rabbitmq_setting else + # change rights for rabbitmq directory + chown -R rabbitmq:rabbitmq ${RABBITMQ_DATA} + chmod -R go=rX,u=rwX ${RABBITMQ_DATA} + if [ -f ${RABBITMQ_DATA}/.erlang.cookie ]; then + chmod 400 ${RABBITMQ_DATA}/.erlang.cookie + fi + LOCAL_SERVICES+=("rabbitmq-server") # allow Rabbitmq startup after container kill rm -rf /var/run/rabbitmq @@ -442,6 +451,10 @@ if [ ${ONLYOFFICE_DATA_CONTAINER_HOST} = "localhost" ]; 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") fi else