mirror of
https://github.com/ONLYOFFICE/Docker-DocumentServer.git
synced 2026-04-07 14:01:38 +08:00
Compare commits
64 Commits
feature/on
...
v5.4.2.22
| Author | SHA1 | Date | |
|---|---|---|---|
| 03a96d3765 | |||
| d7833f454b | |||
| c2b6187926 | |||
| db01421f8a | |||
| 77d47eec3d | |||
| ba14b959ce | |||
| acc4da29d5 | |||
| 93a69e601d | |||
| 87aa987e36 | |||
| 9b51b1dd7a | |||
| d34297b159 | |||
| 89c883646d | |||
| 2a78e2f6fa | |||
| b752010202 | |||
| 3f7630c34c | |||
| 2d6a4e0908 | |||
| 5031b7f983 | |||
| 796fce01cd | |||
| 2c44e3833d | |||
| f999dd4214 | |||
| ad4b496181 | |||
| b47a70582a | |||
| 2a96d3c5f0 | |||
| c22686d264 | |||
| 1fe33f849f | |||
| 88f33c5d8f | |||
| f0af6fe971 | |||
| 3642403457 | |||
| 45ce3d40ab | |||
| f8180d1343 | |||
| fbc9f8d208 | |||
| bb24a80deb | |||
| 10d54591de | |||
| 96c37d7312 | |||
| 26f7126cb0 | |||
| e430c76d51 | |||
| 1ff3e1def6 | |||
| c266215700 | |||
| 0154bb08e0 | |||
| 2b2f409edf | |||
| 23d320dc2a | |||
| 0effd2b6b8 | |||
| cc055305c1 | |||
| 3696139db2 | |||
| 2c4668d9e3 | |||
| 9ad9bc8aca | |||
| ae78df1e24 | |||
| 140931bb62 | |||
| 520352dec2 | |||
| d5e18c29b7 | |||
| 9796bd62c6 | |||
| 4c8bac99c6 | |||
| a30463822e | |||
| cf923c57bc | |||
| 01fbb9f231 | |||
| 9a21a9ab27 | |||
| d725cd42a2 | |||
| 904b8ef165 | |||
| 670f1bdf68 | |||
| 96b98337a8 | |||
| d82b075ec3 | |||
| d84f8a2fed | |||
| edf8e51856 | |||
| 974fce146f |
13
.github/ISSUE_TEMPLATE.md
vendored
Normal file
13
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
**Do you want to request a *feature* or report a *bug*?**
|
||||
|
||||
**What is the current behavior?**
|
||||
|
||||
**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.**
|
||||
|
||||
**What is the expected behavior?**
|
||||
|
||||
**Did this work in previous versions of DocumentServer?**
|
||||
|
||||
**DocumentServer Docker tag:**
|
||||
|
||||
**Host Operating System:**
|
||||
31
Dockerfile
31
Dockerfile
@ -3,12 +3,14 @@ LABEL maintainer Ascensio System SIA <support@onlyoffice.com>
|
||||
|
||||
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
ARG ONLYOFFICE_VALUE=onlyoffice
|
||||
|
||||
RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
|
||||
apt-get -y update && \
|
||||
apt-get -yq install wget apt-transport-https curl locales && \
|
||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0x8320ca65cb2de8e5 && \
|
||||
locale-gen en_US.UTF-8 && \
|
||||
curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
|
||||
curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
|
||||
apt-get -y update && \
|
||||
apt-get -yq install \
|
||||
adduser \
|
||||
@ -42,9 +44,9 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
|
||||
supervisor \
|
||||
xvfb \
|
||||
zlib1g && \
|
||||
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;" && \
|
||||
sudo -u postgres psql -c "CREATE DATABASE $ONLYOFFICE_VALUE;" && \
|
||||
sudo -u postgres psql -c "CREATE USER $ONLYOFFICE_VALUE WITH password '$ONLYOFFICE_VALUE';" && \
|
||||
sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE $ONLYOFFICE_VALUE TO $ONLYOFFICE_VALUE;" && \
|
||||
service postgresql stop && \
|
||||
service redis-server stop && \
|
||||
service rabbitmq-server stop && \
|
||||
@ -52,24 +54,27 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
|
||||
service nginx stop && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY config /app/onlyoffice/setup/config/
|
||||
COPY run-document-server.sh /app/onlyoffice/run-document-server.sh
|
||||
COPY config /app/ds/setup/config/
|
||||
COPY run-document-server.sh /app/ds/run-document-server.sh
|
||||
|
||||
EXPOSE 80 443
|
||||
|
||||
ARG REPO_URL="deb http://download.onlyoffice.com/repo/debian squeeze main"
|
||||
ARG PRODUCT_NAME=onlyoffice-documentserver
|
||||
ARG COMPANY_NAME=onlyoffice
|
||||
ARG PRODUCT_NAME=documentserver
|
||||
|
||||
RUN echo "$REPO_URL" | tee /etc/apt/sources.list.d/onlyoffice.list && \
|
||||
ENV COMPANY_NAME=$COMPANY_NAME
|
||||
|
||||
RUN echo "$REPO_URL" | tee /etc/apt/sources.list.d/ds.list && \
|
||||
apt-get -y update && \
|
||||
service postgresql start && \
|
||||
apt-get --allow-unauthenticated -yq install $PRODUCT_NAME && \
|
||||
apt-get -yq install $COMPANY_NAME-$PRODUCT_NAME && \
|
||||
service postgresql stop && \
|
||||
service supervisor stop && \
|
||||
chmod 755 /app/onlyoffice/*.sh && \
|
||||
rm -rf /var/log/onlyoffice && \
|
||||
chmod 755 /app/ds/*.sh && \
|
||||
rm -rf /var/log/$COMPANY_NAME && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
VOLUME /etc/onlyoffice /var/log/onlyoffice /var/lib/onlyoffice /var/www/onlyoffice/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 /usr/share/fonts/truetype/custom
|
||||
|
||||
CMD bash -C '/app/onlyoffice/run-document-server.sh';'bash'
|
||||
ENTRYPOINT /app/ds/run-document-server.sh
|
||||
|
||||
42
Makefile
42
Makefile
@ -1,46 +1,66 @@
|
||||
COMPANY_NAME ?= onlyoffice
|
||||
GIT_BRANCH ?= origin/develop
|
||||
GIT_BRANCH ?= develop
|
||||
PRODUCT_NAME ?= documentserver-ie
|
||||
PRODUCT_VERSION ?= 0.0.0
|
||||
BUILD_NUMBER ?= 0
|
||||
ONLYOFFICE_VALUE ?= onlyoffice
|
||||
|
||||
PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER)
|
||||
|
||||
REPO_URL := "deb http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/$(COMPANY_NAME)-$(PRODUCT_NAME)/$(GIT_BRANCH)/$(PACKAGE_VERSION)/ repo/"
|
||||
REPO_URL := "deb [trusted=yes] http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/$(COMPANY_NAME)-$(PRODUCT_NAME)/$(GIT_BRANCH)/$(PACKAGE_VERSION)/ repo/"
|
||||
|
||||
UPDATE_LATEST := false
|
||||
|
||||
ifneq (,$(findstring develop,$(GIT_BRANCH)))
|
||||
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION))
|
||||
DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))
|
||||
DOCKER_TAGS += latest
|
||||
else ifneq (,$(findstring release,$(GIT_BRANCH)))
|
||||
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION))
|
||||
DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))
|
||||
else ifneq (,$(findstring hotfix,$(GIT_BRANCH)))
|
||||
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION))
|
||||
DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))
|
||||
else
|
||||
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION))-$(subst /,-,$(GIT_BRANCH))
|
||||
DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))-$(subst /,-,$(GIT_BRANCH))
|
||||
endif
|
||||
|
||||
DOCKER_TAGS += $(DOCKER_TAG)
|
||||
|
||||
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_ARCH := $(COMPANY_NAME)-$(PRODUCT_NAME)_$(PACKAGE_VERSION).tar.gz
|
||||
|
||||
.PHONY: all clean clean-docker deploy docker publish
|
||||
|
||||
$(DOCKER_TARGETS): $(DEB_REPO_DATA)
|
||||
|
||||
sudo docker build --build-arg REPO_URL=$(REPO_URL) --build-arg PRODUCT_NAME=$(COMPANY_NAME)-$(PRODUCT_NAME) -t $(subst $(COLON),:,$@) . &&\
|
||||
docker build \
|
||||
--build-arg REPO_URL=$(REPO_URL) \
|
||||
--build-arg COMPANY_NAME=$(COMPANY_NAME) \
|
||||
--build-arg PRODUCT_NAME=$(PRODUCT_NAME) \
|
||||
--build-arg ONLYOFFICE_VALUE=$(ONLYOFFICE_VALUE) \
|
||||
-t $(subst $(COLON),:,$@) . &&\
|
||||
mkdir -p $$(dirname $@) &&\
|
||||
echo "Done" > $@
|
||||
|
||||
$(DOCKER_ARCH): $(DOCKER_TARGETS)
|
||||
docker save $(DOCKER_REPO):$(DOCKER_TAG) | \
|
||||
gzip > $@
|
||||
|
||||
all: $(DOCKER_TARGETS)
|
||||
|
||||
clean:
|
||||
rm -rfv $(DOCKER_TARGETS)
|
||||
rm -rfv $(DOCKER_TARGETS) $(DOCKER_ARCH)
|
||||
|
||||
clean-docker:
|
||||
sudo docker rmi -f $$(sudo docker images -q $(COMPANY_NAME)/*) || exit 0
|
||||
docker rmi -f $$(docker images -q $(COMPANY_NAME)/*) || exit 0
|
||||
|
||||
deploy: $(DOCKER_TARGETS)
|
||||
$(foreach TARGET,$(DOCKER_TARGETS),sudo docker push $(subst $(COLON),:,$(TARGET));)
|
||||
$(foreach TARGET,$(DOCKER_TARGETS),docker push $(subst $(COLON),:,$(TARGET));)
|
||||
|
||||
publish: $(DOCKER_ARCH)
|
||||
aws s3 cp \
|
||||
$(DOCKER_ARCH) \
|
||||
s3://repo-doc-onlyoffice-com.s3.amazonaws.com/docker/amd64/ \
|
||||
--acl public-read
|
||||
|
||||
20
README.md
20
README.md
@ -13,6 +13,7 @@
|
||||
* [Installing ONLYOFFICE Document Server integrated with Community and Mail Servers](#installing-onlyoffice-document-server-integrated-with-community-and-mail-servers)
|
||||
* [Issues](#issues)
|
||||
- [Docker Issues](#docker-issues)
|
||||
- [Document Server usage Issues](#document-server-usage-issues)
|
||||
* [Project Information](#project-information)
|
||||
* [User Feedback and Support](#user-feedback-and-support)
|
||||
|
||||
@ -166,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.
|
||||
@ -281,9 +283,19 @@ As a relatively new project Docker is being worked on and actively developed by
|
||||
|
||||
The known Docker issue with ONLYOFFICE Document Server with rpm-based distributives is that sometimes the processes fail to start inside Docker container. Fedora and RHEL/CentOS users should try disabling selinux with setenforce 0. If it fixes the issue then you can either stick with SELinux disabled which is not recommended by RedHat, or switch to using Ubuntu.
|
||||
|
||||
### Document Server usage issues
|
||||
|
||||
Due to the operational characteristic, **Document Server** saves a document only after the document has been closed by all the users who edited it. To avoid data loss, you must forcefully disconnect the **Document Server** users when you need to stop **Document Server** in cases of the application update, server reboot etc. To do that, execute the following script on the server where **Document Server** is installed:
|
||||
|
||||
```
|
||||
sudo docker exec <CONTAINER> documentserver-prepare4shutdown.sh
|
||||
```
|
||||
|
||||
Please note, that both executing the script and disconnecting users may take a long time (up to 5 minutes).
|
||||
|
||||
## 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")
|
||||
|
||||
@ -291,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
|
||||
|
||||
|
||||
31
activemq.yml
Normal file
31
activemq.yml
Normal file
@ -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'
|
||||
@ -9,14 +9,19 @@ 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
|
||||
# Uncomment strings below to enable the JSON Web Token validation.
|
||||
#- JWT_ENABLED=true
|
||||
#- JWT_SECRET=secret
|
||||
#- JWT_HEADER=Authorization
|
||||
stdin_open: true
|
||||
restart: always
|
||||
networks:
|
||||
- onlyoffice
|
||||
volumes:
|
||||
- /etc/onlyoffice
|
||||
- /var/www/onlyoffice/Data
|
||||
- /var/log/onlyoffice
|
||||
- /var/lib/onlyoffice/documentserver/App_Data/cache/files
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
APP_DIR="/var/www/onlyoffice/documentserver"
|
||||
DATA_DIR="/var/www/onlyoffice/Data"
|
||||
LOG_DIR="/var/log/onlyoffice"
|
||||
# Define '**' behavior explicitly
|
||||
shopt -s globstar
|
||||
|
||||
APP_DIR="/var/www/${COMPANY_NAME}/documentserver"
|
||||
DATA_DIR="/var/www/${COMPANY_NAME}/Data"
|
||||
LOG_DIR="/var/log/${COMPANY_NAME}"
|
||||
DS_LOG_DIR="${LOG_DIR}/documentserver"
|
||||
LIB_DIR="/var/lib/onlyoffice"
|
||||
CONF_DIR="/etc/onlyoffice/documentserver"
|
||||
LIB_DIR="/var/lib/${COMPANY_NAME}"
|
||||
DS_LIB_DIR="${LIB_DIR}/documentserver"
|
||||
CONF_DIR="/etc/${COMPANY_NAME}/documentserver"
|
||||
|
||||
ONLYOFFICE_DATA_CONTAINER=${ONLYOFFICE_DATA_CONTAINER:-false}
|
||||
ONLYOFFICE_DATA_CONTAINER_HOST=${ONLYOFFICE_DATA_CONTAINER_HOST:-localhost}
|
||||
@ -19,13 +23,13 @@ SSL_DHPARAM_PATH=${SSL_DHPARAM_PATH:-${SSL_CERTIFICATES_DIR}/dhparam.pem}
|
||||
SSL_VERIFY_CLIENT=${SSL_VERIFY_CLIENT:-off}
|
||||
ONLYOFFICE_HTTPS_HSTS_ENABLED=${ONLYOFFICE_HTTPS_HSTS_ENABLED:-true}
|
||||
ONLYOFFICE_HTTPS_HSTS_MAXAGE=${ONLYOFFICE_HTTPS_HSTS_MAXAGE:-31536000}
|
||||
SYSCONF_TEMPLATES_DIR="/app/onlyoffice/setup/config"
|
||||
SYSCONF_TEMPLATES_DIR="/app/ds/setup/config"
|
||||
|
||||
NGINX_CONFD_PATH="/etc/nginx/conf.d";
|
||||
NGINX_ONLYOFFICE_CONF="${NGINX_CONFD_PATH}/onlyoffice-documentserver.conf"
|
||||
NGINX_ONLYOFFICE_PATH="${CONF_DIR}/nginx"
|
||||
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}
|
||||
@ -35,39 +39,43 @@ JWT_ENABLED=${JWT_ENABLED:-false}
|
||||
JWT_SECRET=${JWT_SECRET:-secret}
|
||||
JWT_HEADER=${JWT_HEADER:-Authorization}
|
||||
|
||||
ONLYOFFICE_DEFAULT_CONFIG=${CONF_DIR}/default.json
|
||||
ONLYOFFICE_DEFAULT_CONFIG=${CONF_DIR}/local.json
|
||||
ONLYOFFICE_LOG4JS_CONFIG=${CONF_DIR}/log4js/production.json
|
||||
ONLYOFFICE_EXAMPLE_CONFIG=${CONF_DIR}-example/default.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=()
|
||||
|
||||
PG_ROOT=/var/lib/postgresql
|
||||
PG_VERSION=9.5
|
||||
PG_NAME=main
|
||||
PGDATA=/var/lib/postgresql/${PG_VERSION}/${PG_NAME}
|
||||
PGDATA=${PG_ROOT}/${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)}
|
||||
POSTGRESQL_SERVER_PORT=${POSTGRESQL_SERVER_PORT:-5432}
|
||||
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=${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:-$(${JSON} services.CoAuthoring.redis.port)}
|
||||
REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-6379}
|
||||
|
||||
DS_LOG_LEVEL=${DS_LOG_LEVEL:-$(${JSON_LOG} levels.nodeJS)}
|
||||
DS_LOG_LEVEL=${DS_LOG_LEVEL:-$(${JSON_LOG} categories.default.level)}
|
||||
}
|
||||
|
||||
parse_rabbitmq_url(){
|
||||
local amqp=${RABBITMQ_SERVER_URL}
|
||||
local amqp=$1
|
||||
|
||||
# extract the protocol
|
||||
local proto="$(echo $amqp | grep :// | sed -e's,^\(.*://\).*,\1,g')"
|
||||
@ -101,10 +109,11 @@ 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_PROTO=${proto:0:-3}
|
||||
AMQP_SERVER_HOST=$host
|
||||
AMQP_SERVER_USER=$user
|
||||
AMQP_SERVER_PASS=$pass
|
||||
AMQP_SERVER_PORT=$port
|
||||
}
|
||||
|
||||
waiting_for_connection(){
|
||||
@ -118,8 +127,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(){
|
||||
@ -137,7 +146,47 @@ 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 = '${AMQP_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
|
||||
|
||||
case "${AMQP_SERVER_PROTO}" in
|
||||
amqp+ssl|amqps)
|
||||
${JSON} -I -e "this.activemq.connectOptions.transport = 'tls'"
|
||||
;;
|
||||
*)
|
||||
${JSON} -I -e "delete this.activemq.connectOptions.transport"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
update_redis_settings(){
|
||||
@ -147,9 +196,9 @@ update_redis_settings(){
|
||||
|
||||
update_jwt_settings(){
|
||||
if [ "${JWT_ENABLED}" == "true" ]; then
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.enable.browser = '${JWT_ENABLED}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.enable.request.inbox = '${JWT_ENABLED}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.enable.request.outbox = '${JWT_ENABLED}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.enable.browser = ${JWT_ENABLED}"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.enable.request.inbox = ${JWT_ENABLED}"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.enable.request.outbox = ${JWT_ENABLED}"
|
||||
|
||||
${JSON} -I -e "this.services.CoAuthoring.secret.inbox.string = '${JWT_SECRET}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.secret.outbox.string = '${JWT_SECRET}'"
|
||||
@ -158,8 +207,8 @@ update_jwt_settings(){
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.inbox.header = '${JWT_HEADER}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.outbox.header = '${JWT_HEADER}'"
|
||||
|
||||
if [ -f "${ONLYOFFICE_EXAMPLE_CONFIG}" ]; then
|
||||
${JSON_EXAMPLE} -I -e "this.server.token.enable = '${JWT_ENABLED}'"
|
||||
if [ -f "${ONLYOFFICE_EXAMPLE_CONFIG}" ] && [ "${JWT_ENABLED}" == "true" ]; then
|
||||
${JSON_EXAMPLE} -I -e "this.server.token.enable = ${JWT_ENABLED}"
|
||||
${JSON_EXAMPLE} -I -e "this.server.token.secret = '${JWT_SECRET}'"
|
||||
${JSON_EXAMPLE} -I -e "this.server.token.authorizationHeader = '${JWT_HEADER}'"
|
||||
fi
|
||||
@ -184,7 +233,7 @@ create_postgresql_db(){
|
||||
}
|
||||
|
||||
create_postgresql_tbl(){
|
||||
CONNECTION_PARAMS="-h${POSTGRESQL_SERVER_HOST} -U${POSTGRESQL_SERVER_USER} -w"
|
||||
CONNECTION_PARAMS="-h${POSTGRESQL_SERVER_HOST} -p${POSTGRESQL_SERVER_PORT} -U${POSTGRESQL_SERVER_USER} -w"
|
||||
if [ -n "${POSTGRESQL_SERVER_PASS}" ]; then
|
||||
export PGPASSWORD=${POSTGRESQL_SERVER_PASS}
|
||||
fi
|
||||
@ -194,7 +243,7 @@ create_postgresql_tbl(){
|
||||
|
||||
# Create db on remote server
|
||||
if $PSQL -lt | cut -d\| -f 1 | grep -qw | grep 0; then
|
||||
$CREATEDB $DB_NAME
|
||||
$CREATEDB $POSTGRESQL_SERVER_DB_NAME
|
||||
fi
|
||||
|
||||
$PSQL -d "${POSTGRESQL_SERVER_DB_NAME}" -f "${APP_DIR}/server/schema/postgresql/createdb.sql"
|
||||
@ -208,7 +257,7 @@ update_nginx_settings(){
|
||||
|
||||
# setup HTTPS
|
||||
if [ -f "${SSL_CERTIFICATE_PATH}" -a -f "${SSL_KEY_PATH}" ]; then
|
||||
ln -sf ${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}
|
||||
@ -236,7 +285,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
|
||||
@ -252,7 +306,11 @@ update_supervisor_settings(){
|
||||
}
|
||||
|
||||
update_log_settings(){
|
||||
${JSON_LOG} -I -e "this.levels.nodeJS = '${DS_LOG_LEVEL}'"
|
||||
${JSON_LOG} -I -e "this.categories.default.level = '${DS_LOG_LEVEL}'"
|
||||
}
|
||||
|
||||
update_logrotate_settings(){
|
||||
sed 's|\(^su\b\).*|\1 root root|' -i /etc/logrotate.conf
|
||||
}
|
||||
|
||||
# create base folders
|
||||
@ -262,9 +320,14 @@ done
|
||||
|
||||
mkdir -p ${DS_LOG_DIR}-example
|
||||
|
||||
# create app folders
|
||||
for i in App_Data/cache/files App_Data/docbuilder; do
|
||||
mkdir -p "${DS_LIB_DIR}/$i"
|
||||
done
|
||||
|
||||
# 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
|
||||
|
||||
@ -282,6 +345,11 @@ if [ ${ONLYOFFICE_DATA_CONTAINER_HOST} = "localhost" ]; then
|
||||
waiting_for_postgresql
|
||||
create_postgresql_tbl
|
||||
else
|
||||
# change rights for postgres directory
|
||||
chown -R postgres:postgres ${PG_ROOT}
|
||||
chmod -R 700 ${PG_ROOT}
|
||||
|
||||
# create new db if it isn't exist
|
||||
if [ ! -d ${PGDATA} ]; then
|
||||
create_postgresql_cluster
|
||||
PG_NEW_CLUSTER=true
|
||||
@ -289,10 +357,12 @@ 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")
|
||||
# allow Rabbitmq startup after container kill
|
||||
rm -rf /var/run/rabbitmq
|
||||
fi
|
||||
|
||||
if [ ${REDIS_SERVER_HOST} != "localhost" ]; then
|
||||
@ -321,13 +391,17 @@ fi
|
||||
|
||||
if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then
|
||||
waiting_for_postgresql
|
||||
waiting_for_rabbitmq
|
||||
waiting_for_amqp
|
||||
waiting_for_redis
|
||||
|
||||
update_nginx_settings
|
||||
|
||||
update_supervisor_settings
|
||||
service supervisor start
|
||||
|
||||
# start cron to enable log rotating
|
||||
update_logrotate_settings
|
||||
service cron start
|
||||
fi
|
||||
|
||||
# nginx used as a proxy, and as data container status service.
|
||||
@ -337,3 +411,5 @@ service nginx start
|
||||
# Regenerate the fonts list and the fonts thumbnails
|
||||
documentserver-generate-allfonts.sh ${ONLYOFFICE_DATA_CONTAINER}
|
||||
documentserver-static-gzip.sh ${ONLYOFFICE_DATA_CONTAINER}
|
||||
|
||||
tail -f /var/log/${COMPANY_NAME}/**/*.log
|
||||
|
||||
Reference in New Issue
Block a user