mirror of
https://github.com/ONLYOFFICE/Docker-DocumentServer.git
synced 2026-04-07 14:01:38 +08:00
Compare commits
230 Commits
v3.6
...
v5.4.99.16
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d1606bc95 | |||
| b590340a10 | |||
| 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 | |||
| d613f02ec2 | |||
| edf8e51856 | |||
| ac1e741f87 | |||
| c4f20cf8ca | |||
| 974fce146f | |||
| 8a02d9fbe4 | |||
| 1546c72cf0 | |||
| 56c0805754 | |||
| b2d8ce41f4 | |||
| 3f3a493507 | |||
| 428b616681 | |||
| 89fd259804 | |||
| f541c97720 | |||
| 7ce422f662 | |||
| e0a4fc60ab | |||
| 2060a03b2c | |||
| 5fbfe49fbd | |||
| ea505411e8 | |||
| 2461d07035 | |||
| 0d6fdee656 | |||
| e2a60ff07c | |||
| 355ae98867 | |||
| 36f036d951 | |||
| 42a7abffb8 | |||
| 9cceb81469 | |||
| ae259d64e5 | |||
| 417d62e8d4 | |||
| bbf336a980 | |||
| 3efb68e169 | |||
| 990a0ab127 | |||
| 306926402c | |||
| 7f8c4fd3e8 | |||
| 5a0a4be801 | |||
| 9559beeddf | |||
| 1e012972c9 | |||
| 6cf41fa955 | |||
| bcdf1ebd78 | |||
| ef8826aca4 | |||
| 914ffa6de2 | |||
| 716a85ef6d | |||
| 58f6e1cc8e | |||
| b3bb7ec642 | |||
| f52ad9f804 | |||
| 64f3e1b19b | |||
| 20063dfe03 | |||
| b663638b95 | |||
| dd9583498a | |||
| 810d49fd53 | |||
| 91c987705c | |||
| f859561507 | |||
| 5c15c04ebe | |||
| c2117fce29 | |||
| d2003e9516 | |||
| 3f8ac6ee7e | |||
| e0686e5927 | |||
| af131c3007 | |||
| 9f1048c9f7 | |||
| dfceae2523 | |||
| c3c6a356d7 | |||
| d9003c5bae | |||
| 32e1c4b1cc | |||
| a96a5f7048 | |||
| 47f2766920 | |||
| 8ae9329c8e | |||
| 61a56eb31e | |||
| 1b8b77c03b | |||
| 452b31f235 | |||
| f59f75fd69 | |||
| be8d335063 | |||
| 2fd4086173 | |||
| 89ad87d538 | |||
| 853f2b4de8 | |||
| 77f7b813f7 | |||
| ced029b304 | |||
| 278bdd870e | |||
| 0d8f2ed1a7 | |||
| a0cc6ab7ba | |||
| 3e86381bb8 | |||
| 57759c43d9 | |||
| 7a14e43467 | |||
| f3d9d9b9f9 | |||
| 84bbcd78b7 | |||
| 468420cfcd | |||
| d31b9e8454 | |||
| adf29bc63b | |||
| ac86f08696 | |||
| 716f9afb94 | |||
| 387d1d0cb9 | |||
| 259d6df478 | |||
| 1047e5189a | |||
| b60bd1cebb | |||
| 3f8c314da0 | |||
| dd08a39bed | |||
| 43806526d5 | |||
| be3f768358 | |||
| daa1850ed8 | |||
| c3fbb79748 | |||
| ab992841fd | |||
| 8b812ac491 | |||
| 47b0ab27bc | |||
| 39ef3f4dae | |||
| 4f55d140cb | |||
| f0035e1e27 | |||
| 7db1f72dd8 | |||
| f8064da1fd | |||
| a4bc2294d5 | |||
| 23107e65d0 | |||
| 9cac2cdf42 | |||
| 00ed64fa7c | |||
| 6a8bdfe6ba | |||
| 704bfff215 | |||
| b03f07b8a1 | |||
| 27f4bdaf53 | |||
| 24d8fd6a97 | |||
| 7b5dda41a9 | |||
| fa6b305fd4 | |||
| fdf21d1a8c | |||
| a5ebbe5cb4 | |||
| a015fe4c8c | |||
| 7d60ffe26d | |||
| 5ef37630c5 | |||
| 2518588d7f | |||
| 4236d71fe3 | |||
| 65fe888648 | |||
| 6ea703a44c | |||
| 83582dd9c6 | |||
| 4a362b008c | |||
| 2d67dfe27d | |||
| e14b97bd76 | |||
| 6956f21194 | |||
| b9f9ed6ba5 | |||
| 4859e8f422 | |||
| befb9c1c65 | |||
| e3b22c436c | |||
| 48eb2b4afb | |||
| 5eb38213d3 | |||
| 5b9c158da2 | |||
| e40bec3bac | |||
| 28ac7a080a | |||
| be0a9e50c1 | |||
| d262c96c11 | |||
| bad15130c4 | |||
| c515adf693 | |||
| 421b24c01c | |||
| 8ec2fe79a5 | |||
| 05c96650fd | |||
| e7b7e7dd1a | |||
| d0e1228330 | |||
| dd27f00a62 | |||
| b1053d4512 | |||
| a813036830 | |||
| ad64cea8ec | |||
| 7955487352 | |||
| 0dd2cc1e59 | |||
| d31b8939f8 | |||
| dbd0e01e86 | |||
| ca5bc8526d | |||
| 89de48c8de | |||
| 0fa55f0192 | |||
| b3ebf467a6 | |||
| 0253fe3ece | |||
| 97f1c087a2 | |||
| fd1fc534b5 | |||
| 69a3516b20 | |||
| 9aa15443ad | |||
| 033c77b2ab | |||
| 3e84c55dd5 | |||
| 5d761b4b58 | |||
| 1125fc0900 |
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:**
|
||||
44
.travis.yml
Normal file
44
.travis.yml
Normal file
@ -0,0 +1,44 @@
|
||||
language: generic
|
||||
|
||||
dist: trusty
|
||||
|
||||
env:
|
||||
# postgresql
|
||||
- config: postgres.yml
|
||||
|
||||
# custom values
|
||||
- config: postgres.yml
|
||||
DB_NAME: mydb
|
||||
DB_USER: myuser
|
||||
DB_PWD: password
|
||||
POSTGRES_DB: mydb
|
||||
POSTGRES_USER: myuser
|
||||
|
||||
# deprecated variables
|
||||
- config: postgres-old.yml
|
||||
POSTGRESQL_SERVER_HOST: onlyoffice-postgresql
|
||||
POSTGRESQL_SERVER_PORT: 5432
|
||||
POSTGRESQL_SERVER_DB_NAME: onlyoffice
|
||||
POSTGRESQL_SERVER_USER: onlyoffice
|
||||
POSTGRESQL_SERVER_PASS: onlyoffice
|
||||
|
||||
# mysql
|
||||
- config: mysql.yml
|
||||
DB_TYPE: mysql
|
||||
DB_HOST: onlyoffice-mysql
|
||||
DB_PORT: 3306
|
||||
|
||||
# activemq
|
||||
- config: activemq.yml
|
||||
AMQP_SERVER_TYPE: activemq
|
||||
AMQP_SERVER_URL: amqp://guest:guest@onlyoffice-activemq
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
script:
|
||||
# Go to tests dir
|
||||
- cd ${PWD}/tests
|
||||
|
||||
# Run test.
|
||||
- ./test.sh
|
||||
92
Dockerfile
92
Dockerfile
@ -1,36 +1,76 @@
|
||||
FROM ubuntu:14.04
|
||||
MAINTAINER Ascensio System SIA <support@onlyoffice.com>
|
||||
FROM ubuntu:16.04
|
||||
LABEL maintainer Ascensio System SIA <support@onlyoffice.com>
|
||||
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LANGUAGE en_US:en
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
|
||||
RUN apt-get update && apt-get -y -q install libreoffice
|
||||
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 && \
|
||||
echo "deb http://static.teamlab.com.s3.amazonaws.com/repo/debian/ squeeze main" >> /etc/apt/sources.list && \
|
||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D9D0BF019CC8AC0D && \
|
||||
echo "deb http://download.mono-project.com/repo/debian wheezy/snapshots/3.12.0 main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list && \
|
||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \
|
||||
echo "deb http://archive.ubuntu.com/ubuntu precise main universe multiverse" >> /etc/apt/sources.list && \
|
||||
DEBIAN_FRONTEND=noninteractive && \
|
||||
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_8.x | bash - && \
|
||||
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 gcc-4.9 onlyoffice-documentserver nano htop && \
|
||||
apt-get -yq install \
|
||||
adduser \
|
||||
bomstrip \
|
||||
htop \
|
||||
libasound2 \
|
||||
libboost-regex-dev \
|
||||
libcairo2 \
|
||||
libcurl3 \
|
||||
libgconf2-4 \
|
||||
libgtkglext1 \
|
||||
libnspr4 \
|
||||
libnss3 \
|
||||
libnss3-nssdb \
|
||||
libstdc++6 \
|
||||
libxml2 \
|
||||
libxss1 \
|
||||
libxtst6 \
|
||||
mysql-client \
|
||||
nano \
|
||||
net-tools \
|
||||
netcat \
|
||||
nginx-extras \
|
||||
nodejs \
|
||||
postgresql \
|
||||
postgresql-client \
|
||||
pwgen \
|
||||
rabbitmq-server \
|
||||
redis-server \
|
||||
software-properties-common \
|
||||
sudo \
|
||||
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;" && \
|
||||
service postgresql stop && \
|
||||
service redis-server stop && \
|
||||
service rabbitmq-server stop && \
|
||||
service supervisor stop && \
|
||||
service nginx stop && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ADD config /app/onlyoffice/setup/config/
|
||||
ADD run-document-server.sh /app/onlyoffice/run-document-server.sh
|
||||
RUN chmod 755 /app/onlyoffice/*.sh
|
||||
COPY config /app/onlyoffice/setup/config/
|
||||
COPY run-document-server.sh /app/onlyoffice/run-document-server.sh
|
||||
|
||||
VOLUME ["/var/log/onlyoffice"]
|
||||
VOLUME ["/var/www/onlyoffice/Data"]
|
||||
EXPOSE 80 443
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
ARG REPO_URL="deb http://download.onlyoffice.com/repo/debian squeeze main"
|
||||
ARG PRODUCT_NAME=onlyoffice-documentserver
|
||||
|
||||
CMD bash -C '/app/onlyoffice/run-document-server.sh';'bash'
|
||||
RUN echo "$REPO_URL" | tee /etc/apt/sources.list.d/onlyoffice.list && \
|
||||
apt-get -y update && \
|
||||
service postgresql start && \
|
||||
apt-get -yq install $PRODUCT_NAME && \
|
||||
service postgresql stop && \
|
||||
service supervisor stop && \
|
||||
chmod 755 /app/onlyoffice/*.sh && \
|
||||
rm -rf /var/log/onlyoffice && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
VOLUME /var/log/onlyoffice /var/lib/onlyoffice /var/www/onlyoffice/Data /var/lib/postgresql /usr/share/fonts/truetype/custom
|
||||
|
||||
ENTRYPOINT /app/onlyoffice/run-document-server.sh
|
||||
|
||||
@ -658,4 +658,4 @@ specific requirements.
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
46
Makefile
Normal file
46
Makefile
Normal file
@ -0,0 +1,46 @@
|
||||
COMPANY_NAME ?= onlyoffice
|
||||
GIT_BRANCH ?= origin/develop
|
||||
PRODUCT_NAME ?= documentserver-ie
|
||||
PRODUCT_VERSION ?= 0.0.0
|
||||
BUILD_NUMBER ?= 0
|
||||
|
||||
PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER)
|
||||
|
||||
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_TAGS += latest
|
||||
else ifneq (,$(findstring release,$(GIT_BRANCH)))
|
||||
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION))
|
||||
else ifneq (,$(findstring hotfix,$(GIT_BRANCH)))
|
||||
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION))
|
||||
else
|
||||
DOCKER_TAGS += $(subst -,.,$(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)
|
||||
|
||||
docker build --build-arg REPO_URL=$(REPO_URL) --build-arg PRODUCT_NAME=$(COMPANY_NAME)-$(PRODUCT_NAME) -t $(subst $(COLON),:,$@) . &&\
|
||||
mkdir -p $$(dirname $@) &&\
|
||||
echo "Done" > $@
|
||||
|
||||
all: $(DOCKER_TARGETS)
|
||||
|
||||
clean:
|
||||
rm -rfv $(DOCKER_TARGETS)
|
||||
|
||||
clean-docker:
|
||||
docker rmi -f $$(docker images -q $(COMPANY_NAME)/*) || exit 0
|
||||
|
||||
deploy: $(DOCKER_TARGETS)
|
||||
$(foreach TARGET,$(DOCKER_TARGETS),docker push $(subst $(COLON),:,$(TARGET));)
|
||||
160
README.md
160
README.md
@ -13,7 +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)
|
||||
- [Mono Issues](#mono-issues)
|
||||
- [Document Server usage Issues](#document-server-usage-issues)
|
||||
* [Project Information](#project-information)
|
||||
* [User Feedback and Support](#user-feedback-and-support)
|
||||
|
||||
@ -40,10 +40,10 @@ 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
|
||||
* **Docker**: version 1.4.1 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
|
||||
|
||||
@ -58,14 +58,21 @@ Use this command if you wish to install ONLYOFFICE Document Server separately. T
|
||||
All the data are stored in the specially-designated directories, **data volumes**, at the following location:
|
||||
* **/var/log/onlyoffice** for ONLYOFFICE Document Server logs
|
||||
* **/var/www/onlyoffice/Data** for certificates
|
||||
* **/var/lib/onlyoffice** for file cache
|
||||
* **/var/lib/postgresql** for database
|
||||
|
||||
To get access to your data from outside the container, you need to mount the volumes. It can be done by specifying the '-v' option in the docker run command.
|
||||
|
||||
sudo docker run -i -t -d -p 80:80 \
|
||||
-v /opt/onlyoffice/Logs:/var/log/onlyoffice \
|
||||
-v /opt/onlyoffice/Data:/var/www/onlyoffice/Data onlyoffice/documentserver
|
||||
-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/db:/var/lib/postgresql onlyoffice/documentserver
|
||||
|
||||
Storing the data on the host machine allows you to easily update ONLYOFFICE once the new version is released without losing your data.
|
||||
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:
|
||||
* For easy access to container data, such as logs
|
||||
* To remove the limit on the size of the data inside the container
|
||||
* When using services launched outside the container such as PostgreSQL, Redis, RabbitMQ
|
||||
|
||||
### Running ONLYOFFICE Document Server on Different Port
|
||||
|
||||
@ -76,7 +83,7 @@ To change the port, use the -p command. E.g.: to make your portal accessible via
|
||||
### Running ONLYOFFICE Document Server using HTTPS
|
||||
|
||||
sudo docker run -i -t -d -p 443:443 \
|
||||
-v /opt/onlyoffice/Data:/var/www/onlyoffice/Data onlyoffice/documentserver
|
||||
-v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data onlyoffice/documentserver
|
||||
|
||||
Access to the onlyoffice application can be secured using SSL so as to prevent unauthorized access. While a CA certified SSL certificate allows for verification of trust via the CA, a self signed certificates can also provide an equal level of trust verification as long as each client takes some additional steps to verify the identity of your website. Below the instructions on achieving this are provided.
|
||||
|
||||
@ -87,8 +94,8 @@ To secure the application via SSL basically two things are needed:
|
||||
|
||||
So you need to create and install the following files:
|
||||
|
||||
/opt/onlyoffice/Data/certs/onlyoffice.key
|
||||
/opt/onlyoffice/Data/certs/onlyoffice.crt
|
||||
/app/onlyoffice/DocumentServer/data/certs/onlyoffice.key
|
||||
/app/onlyoffice/DocumentServer/data/certs/onlyoffice.crt
|
||||
|
||||
When using CA certified certificates, these files are provided to you by the CA. When using self-signed certificates you need to generate these files yourself. Skip the following section if you are have CA certified SSL certificates.
|
||||
|
||||
@ -131,14 +138,14 @@ Out of the four files generated above, you need to install the `onlyoffice.key`,
|
||||
|
||||
The default path that the onlyoffice application is configured to look for the SSL certificates is at `/var/www/onlyoffice/Data/certs`, this can however be changed using the `SSL_KEY_PATH`, `SSL_CERTIFICATE_PATH` and `SSL_DHPARAM_PATH` configuration options.
|
||||
|
||||
The `/var/www/onlyoffice/Data/` path is the path of the data store, which means that you have to create a folder named certs inside `/opt/onlyoffice/Data/` and copy the files into it and as a measure of security you will update the permission on the `onlyoffice.key` file to only be readable by the owner.
|
||||
The `/var/www/onlyoffice/Data/` path is the path of the data store, which means that you have to create a folder named certs inside `/app/onlyoffice/DocumentServer/data/` and copy the files into it and as a measure of security you will update the permission on the `onlyoffice.key` file to only be readable by the owner.
|
||||
|
||||
```bash
|
||||
mkdir -p /opt/onlyoffice/Data/certs
|
||||
cp onlyoffice.key /opt/onlyoffice/Data/certs/
|
||||
cp onlyoffice.crt /opt/onlyoffice/Data/certs/
|
||||
cp dhparam.pem /opt/onlyoffice/Data/certs/
|
||||
chmod 400 /opt/onlyoffice/Data/certs/onlyoffice.key
|
||||
mkdir -p /app/onlyoffice/DocumentServer/data/certs
|
||||
cp onlyoffice.key /app/onlyoffice/DocumentServer/data/certs/
|
||||
cp onlyoffice.crt /app/onlyoffice/DocumentServer/data/certs/
|
||||
cp dhparam.pem /app/onlyoffice/DocumentServer/data/certs/
|
||||
chmod 400 /app/onlyoffice/DocumentServer/data/certs/onlyoffice.key
|
||||
```
|
||||
|
||||
You are now just one step away from having our application secured.
|
||||
@ -155,37 +162,114 @@ 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`
|
||||
- **DB_TYPE**: The database type. Supported values are `postgres`, `mariadb` or `mysql`. Defaults to `postgres`.
|
||||
- **DB_HOST**: The IP address or the name of the host where the database server is running.
|
||||
- **DB_PORT**: The database server port number.
|
||||
- **DB_NAME**: The name of a database to be created on the image startup.
|
||||
- **DB_USER**: The new user name with superuser permissions for the database account.
|
||||
- **DB_PWD**: The password set for the database account.
|
||||
- **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.
|
||||
- **NGINX_WORKER_CONNECTIONS**: Sets the maximum number of simultaneous connections that can be opened by a nginx worker process.
|
||||
- **JWT_ENABLED**: Specifies the enabling the JSON Web Token validation by the ONLYOFFICE Document Server. Defaults to `false`.
|
||||
- **JWT_SECRET**: Defines the secret key to validate the JSON Web Token in the request to the ONLYOFFICE Document Server. Defaults to `secret`.
|
||||
- **JWT_HEADER**: Defines the http header that will be used to send the JSON Web Token. Defaults to `Authorization`.
|
||||
|
||||
## Installing ONLYOFFICE Document Server integrated with Community and Mail Servers
|
||||
|
||||
ONLYOFFICE Document Server is a part of ONLYOFFICE Free Edition that comprises also Community Server and Mail Server. To install them, follow these easy steps:
|
||||
ONLYOFFICE Document Server is a part of ONLYOFFICE Community Edition that comprises also Community Server and Mail Server. To install them, follow these easy steps:
|
||||
|
||||
**STEP 1**: Install ONLYOFFICE Document Server.
|
||||
**STEP 1**: Create the `onlyoffice` network.
|
||||
|
||||
```bash
|
||||
sudo docker run -i -t -d --name onlyoffice-document-server onlyoffice/documentserver
|
||||
docker network create --driver bridge onlyoffice
|
||||
```
|
||||
Then launch containers on it using the 'docker run --net onlyoffice' option:
|
||||
|
||||
**STEP 2**: Install MySQL.
|
||||
|
||||
Follow [these steps](#installing-mysql) to install MySQL server.
|
||||
|
||||
**STEP 3**: Install ONLYOFFICE Document Server.
|
||||
|
||||
```bash
|
||||
sudo docker run --net onlyoffice -i -t -d --restart=always --name onlyoffice-document-server \
|
||||
-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/db:/var/lib/postgresql \
|
||||
onlyoffice/documentserver
|
||||
```
|
||||
|
||||
**STEP 2**: Install ONLYOFFICE Mail Server.
|
||||
**STEP 4**: Install ONLYOFFICE Mail Server.
|
||||
|
||||
For the mail server correct work you need to specify its hostname 'yourdomain.com'.
|
||||
To learn more, refer to the [ONLYOFFICE Mail Server documentation](https://github.com/ONLYOFFICE/MailServer "ONLYOFFICE Mail Server documentation").
|
||||
|
||||
```bash
|
||||
sudo docker run --privileged -i -t -d --name onlyoffice-mail-server -p 25:25 -p 143:143 -p 587:587 \
|
||||
-h yourdomain.com onlyoffice/mailserver
|
||||
sudo docker run --init --net onlyoffice --privileged -i -t -d --restart=always --name onlyoffice-mail-server -p 25:25 -p 143:143 -p 587:587 \
|
||||
-e MYSQL_SERVER=onlyoffice-mysql-server \
|
||||
-e MYSQL_SERVER_PORT=3306 \
|
||||
-e MYSQL_ROOT_USER=root \
|
||||
-e MYSQL_ROOT_PASSWD=my-secret-pw \
|
||||
-e MYSQL_SERVER_DB_NAME=onlyoffice_mailserver \
|
||||
-v /app/onlyoffice/MailServer/data:/var/vmail \
|
||||
-v /app/onlyoffice/MailServer/data/certs:/etc/pki/tls/mailserver \
|
||||
-v /app/onlyoffice/MailServer/logs:/var/log \
|
||||
-h yourdomain.com \
|
||||
onlyoffice/mailserver
|
||||
```
|
||||
|
||||
**STEP 3**: Install ONLYOFFICE Community Server
|
||||
The additional parameters for mail server are available [here](https://github.com/ONLYOFFICE/Docker-CommunityServer/blob/master/docker-compose.yml#L75).
|
||||
|
||||
To learn more, refer to the [ONLYOFFICE Mail Server documentation](https://github.com/ONLYOFFICE/Docker-MailServer "ONLYOFFICE Mail Server documentation").
|
||||
|
||||
**STEP 5**: Install ONLYOFFICE Community Server
|
||||
|
||||
```bash
|
||||
sudo docker run -i -t -d -p 80:80 -p 5222:5222 -p 443:443 \
|
||||
--link onlyoffice-mail-server:mail_server \
|
||||
--link onlyoffice-document-server:document_server \
|
||||
onlyoffice/communityserver
|
||||
sudo docker run --net onlyoffice -i -t -d --restart=always --name onlyoffice-community-server -p 80:80 -p 443:443 -p 5222:5222 \
|
||||
-e MYSQL_SERVER_ROOT_PASSWORD=my-secret-pw \
|
||||
-e MYSQL_SERVER_DB_NAME=onlyoffice \
|
||||
-e MYSQL_SERVER_HOST=onlyoffice-mysql-server \
|
||||
-e MYSQL_SERVER_USER=onlyoffice_user \
|
||||
-e MYSQL_SERVER_PASS=onlyoffice_pass \
|
||||
|
||||
-e DOCUMENT_SERVER_PORT_80_TCP_ADDR=onlyoffice-document-server \
|
||||
|
||||
-e MAIL_SERVER_API_HOST=${MAIL_SERVER_IP} \
|
||||
-e MAIL_SERVER_DB_HOST=onlyoffice-mysql-server \
|
||||
-e MAIL_SERVER_DB_NAME=onlyoffice_mailserver \
|
||||
-e MAIL_SERVER_DB_PORT=3306 \
|
||||
-e MAIL_SERVER_DB_USER=root \
|
||||
-e MAIL_SERVER_DB_PASS=my-secret-pw \
|
||||
|
||||
-v /app/onlyoffice/CommunityServer/data:/var/www/onlyoffice/Data \
|
||||
-v /app/onlyoffice/CommunityServer/logs:/var/log/onlyoffice \
|
||||
onlyoffice/communityserver
|
||||
```
|
||||
|
||||
Alternatively, you can use [docker-compose](https://docs.docker.com/compose/install "docker-compose") to install the whole ONLYOFFICE Free Edition at once. For the mail server correct work you need to specify its hostname 'yourdomain.com'. Assuming you have docker-compose installed, execute the following command:
|
||||
Where `${MAIL_SERVER_IP}` is the IP address for **ONLYOFFICE Mail Server**. You can easily get it using the command:
|
||||
```
|
||||
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' onlyoffice-mail-server
|
||||
```
|
||||
|
||||
Alternatively, you can use an automatic installation script to install the whole ONLYOFFICE Community Edition at once. For the mail server correct work you need to specify its hostname 'yourdomain.com'.
|
||||
|
||||
**STEP 1**: Download the Community Edition Docker script file
|
||||
|
||||
```bash
|
||||
wget http://download.onlyoffice.com/install/opensource-install.sh
|
||||
```
|
||||
|
||||
**STEP 2**: Install ONLYOFFICE Community Edition executing the following command:
|
||||
|
||||
```bash
|
||||
bash opensource-install.sh -md yourdomain.com
|
||||
```
|
||||
|
||||
Or, use [docker-compose](https://docs.docker.com/compose/install "docker-compose"). For the mail server correct work you need to specify its hostname 'yourdomain.com'. Assuming you have docker-compose installed, execute the following command:
|
||||
|
||||
```bash
|
||||
wget https://raw.githubusercontent.com/ONLYOFFICE/Docker-CommunityServer/master/docker-compose.yml
|
||||
@ -200,14 +284,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.
|
||||
|
||||
### Mono Issues
|
||||
### Document Server usage issues
|
||||
|
||||
ONLYOFFICE installation requires the presence of mono (tested for version 3.12.1 or [older](http://www.mono-project.com/docs/getting-started/install/linux/#accessing-older-releases "older")) that may cause problems for some Linux kernel versions. The full list of supported kernel versions is available [here](http://onlyo.co/1PABPEI "here").
|
||||
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")
|
||||
|
||||
@ -215,10 +304,13 @@ 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
|
||||
|
||||
If you have any problems with or questions about this image, please contact us through a [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
|
||||
|
||||
@ -1,114 +0,0 @@
|
||||
## Normal HTTP host
|
||||
server {
|
||||
listen 0.0.0.0:80;
|
||||
listen [::]:80 default_server;
|
||||
server_name _;
|
||||
server_tokens off;
|
||||
|
||||
## Redirects all traffic to the HTTPS host
|
||||
root /nowhere; ## root doesn't have to be a valid path since we are redirecting
|
||||
rewrite ^ https://$host$request_uri? permanent;
|
||||
}
|
||||
|
||||
upstream fastcgi_backend {
|
||||
server 127.0.0.1:9001;
|
||||
keepalive 32;
|
||||
}
|
||||
|
||||
## HTTPS host
|
||||
server {
|
||||
listen 0.0.0.0:443 ssl spdy;
|
||||
listen [::]:443 ssl spdy default_server;
|
||||
server_tokens off;
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
## Increase this if you want to upload large attachments
|
||||
client_max_body_size 100m;
|
||||
|
||||
## Strong SSL Security
|
||||
## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
|
||||
ssl on;
|
||||
ssl_certificate {{SSL_CERTIFICATE_PATH}};
|
||||
ssl_certificate_key {{SSL_KEY_PATH}};
|
||||
ssl_verify_client {{SSL_VERIFY_CLIENT}};
|
||||
ssl_client_certificate {{CA_CERTIFICATES_PATH}};
|
||||
|
||||
ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA128:DHE-RSA-AES128-GCM-SHA384:DHE-RSA-AES128-GCM-SHA128:ECDHE-RSA-AES128-SHA384:ECDHE-RSA-AES128-SHA128:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA384:AES128-GCM-SHA128:AES128-SHA128:AES128-SHA128:AES128-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
|
||||
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_session_cache builtin:1000 shared:SSL:10m;
|
||||
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
add_header Strict-Transport-Security max-age={{ONLYOFFICE_HTTPS_HSTS_MAXAGE}};
|
||||
# add_header X-Frame-Options SAMEORIGIN;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
|
||||
## [Optional] If your certficate has OCSP, enable OCSP stapling to reduce the overhead and latency of running SSL.
|
||||
## Replace with your ssl_trusted_certificate. For more info see:
|
||||
## - https://medium.com/devops-programming/4445f4862461
|
||||
## - https://www.ruby-forum.com/topic/4419319
|
||||
## - https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx
|
||||
# ssl_stapling on;
|
||||
# ssl_stapling_verify on;
|
||||
# ssl_trusted_certificate /etc/nginx/ssl/stapling.trusted.crt;
|
||||
# resolver 208.67.222.222 208.67.222.220 valid=300s; # Can change to your DNS resolver if desired
|
||||
# resolver_timeout 10s;
|
||||
|
||||
## [Optional] Generate a stronger DHE parameter:
|
||||
## cd /etc/ssl/certs
|
||||
## sudo openssl dhparam -out dhparam.pem 4096
|
||||
##
|
||||
ssl_dhparam {{SSL_DHPARAM_PATH}};
|
||||
|
||||
gzip on;
|
||||
gzip_types text/plain
|
||||
text/xml
|
||||
text/css
|
||||
text/csv
|
||||
application/xml
|
||||
application/javascript
|
||||
application/x-javascript
|
||||
application/json
|
||||
application/octet-stream
|
||||
application/pdf
|
||||
application/rtf
|
||||
application/msword
|
||||
application/vnd.ms-excel
|
||||
application/vnd.ms-powerpoint;
|
||||
#application/vnd.oasis.opendocument.text
|
||||
#application/vnd.oasis.opendocument.spreadsheet
|
||||
#application/vnd.oasis.opendocument.presentation
|
||||
#application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
||||
#application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
||||
#application/vnd.openxmlformats-officedocument.presentationml.presentation;
|
||||
|
||||
|
||||
location / {
|
||||
root /var/www/onlyoffice/documentserver/DocService/;
|
||||
index index.html index.htm default.aspx Default.aspx;
|
||||
fastcgi_index Default.aspx;
|
||||
fastcgi_keep_conn on;
|
||||
fastcgi_pass fastcgi_backend;
|
||||
include /etc/onlyoffice/documentserver/fastcgi_params;
|
||||
}
|
||||
|
||||
location ~ \/OfficeWeb\/(?!sdk\/Fonts\/) {
|
||||
root /var/www/onlyoffice/documentserver/DocService;
|
||||
}
|
||||
|
||||
location /coauthoring/ {
|
||||
proxy_pass http://localhost:8000/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
location /spellchecker/ {
|
||||
proxy_pass http://localhost:8080/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
}
|
||||
|
||||
176
config/supervisor/supervisor
Normal file
176
config/supervisor/supervisor
Normal file
@ -0,0 +1,176 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# skeleton example file to build /etc/init.d/ scripts.
|
||||
# This file should be used to construct scripts for /etc/init.d.
|
||||
#
|
||||
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
|
||||
# Modified for Debian
|
||||
# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
|
||||
# Further changes by Javier Fernandez-Sanguino <jfs@debian.org>
|
||||
#
|
||||
# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: supervisor
|
||||
# Required-Start: $remote_fs $network $named
|
||||
# Required-Stop: $remote_fs $network $named
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start/stop supervisor
|
||||
# Description: Start/stop supervisor daemon and its configured
|
||||
# subprocesses.
|
||||
### END INIT INFO
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
DAEMON=/usr/bin/supervisord
|
||||
NAME=supervisord
|
||||
DESC=supervisor
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
LOGDIR=/var/log/supervisor
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
PS_COUNT=0
|
||||
DODTIME=5 # Time to wait for the server to die, in seconds
|
||||
# If this value is set too low you might not
|
||||
# let some servers to die gracefully and
|
||||
# 'restart' will not work
|
||||
|
||||
# Include supervisor defaults if available
|
||||
if [ -f /etc/default/supervisor ] ; then
|
||||
. /etc/default/supervisor
|
||||
fi
|
||||
DAEMON_OPTS="-c /etc/supervisor/supervisord.conf $DAEMON_OPTS"
|
||||
|
||||
set -e
|
||||
|
||||
running_pid()
|
||||
{
|
||||
# Check if a given process pid's cmdline matches a given name
|
||||
pid=$1
|
||||
name=$2
|
||||
[ -z "$pid" ] && return 1
|
||||
[ ! -d /proc/$pid ] && return 1
|
||||
(cat /proc/$pid/cmdline | tr "\000" "\n"|grep -q $name) || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
running()
|
||||
{
|
||||
# Check if the process is running looking at /proc
|
||||
# (works for all users)
|
||||
|
||||
# No pidfile, probably no daemon present
|
||||
[ ! -f "$PIDFILE" ] && return 1
|
||||
# Obtain the pid and check it against the binary name
|
||||
pid=`cat $PIDFILE`
|
||||
running_pid $pid $DAEMON || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
force_stop() {
|
||||
# Forcefully kill the process
|
||||
[ ! -f "$PIDFILE" ] && return
|
||||
if running ; then
|
||||
kill -15 $pid
|
||||
# Is it really dead?
|
||||
[ -n "$DODTIME" ] && sleep "$DODTIME"s
|
||||
if running ; then
|
||||
kill -9 $pid
|
||||
[ -n "$DODTIME" ] && sleep "$DODTIME"s
|
||||
if running ; then
|
||||
echo "Cannot kill $LABEL (pid=$pid)!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
rm -f $PIDFILE
|
||||
return 0
|
||||
}
|
||||
|
||||
get_pid() {
|
||||
PS_COUNT=$(pgrep -fc $DAEMON || true)
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
get_pid
|
||||
if [ $PS_COUNT -eq 0 ]; then
|
||||
rm -f "$PIDFILE"
|
||||
fi
|
||||
echo -n "Starting $DESC: "
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE \
|
||||
--startas $DAEMON -- $DAEMON_OPTS
|
||||
test -f $PIDFILE || sleep 1
|
||||
if running ; then
|
||||
echo "$NAME."
|
||||
else
|
||||
echo " ERROR."
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping $DESC: "
|
||||
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
|
||||
echo "$NAME."
|
||||
;;
|
||||
force-stop)
|
||||
echo -n "Forcefully stopping $DESC: "
|
||||
force_stop
|
||||
if ! running ; then
|
||||
echo "$NAME."
|
||||
else
|
||||
echo " ERROR."
|
||||
fi
|
||||
;;
|
||||
#reload)
|
||||
#
|
||||
# If the daemon can reload its config files on the fly
|
||||
# for example by sending it SIGHUP, do it here.
|
||||
#
|
||||
# If the daemon responds to changes in its config file
|
||||
# directly anyway, make this a do-nothing entry.
|
||||
#
|
||||
# echo "Reloading $DESC configuration files."
|
||||
# start-stop-daemon --stop --signal 1 --quiet --pidfile \
|
||||
# /var/run/$NAME.pid --exec $DAEMON
|
||||
#;;
|
||||
force-reload)
|
||||
#
|
||||
# If the "reload" option is implemented, move the "force-reload"
|
||||
# option to the "reload" entry above. If not, "force-reload" is
|
||||
# just the same as "restart" except that it does nothing if the
|
||||
# daemon isn't already running.
|
||||
# check wether $DAEMON is running. If so, restart
|
||||
start-stop-daemon --stop --test --quiet --pidfile $PIDFILE \
|
||||
--startas $DAEMON \
|
||||
&& $0 restart \
|
||||
|| exit 0
|
||||
;;
|
||||
restart)
|
||||
echo -n "Restarting $DESC: "
|
||||
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
|
||||
[ -n "$DODTIME" ] && sleep $DODTIME
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE \
|
||||
--startas $DAEMON -- $DAEMON_OPTS
|
||||
echo "$NAME."
|
||||
;;
|
||||
status)
|
||||
echo -n "$LABEL is "
|
||||
if running ; then
|
||||
echo "running"
|
||||
else
|
||||
echo " not running."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
N=/etc/init.d/$NAME
|
||||
# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
|
||||
echo "Usage: $N {start|stop|restart|force-reload|status|force-stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
27
config/supervisor/supervisord.conf
Normal file
27
config/supervisor/supervisord.conf
Normal file
@ -0,0 +1,27 @@
|
||||
; supervisor config file
|
||||
|
||||
[inet_http_server]
|
||||
port = 127.0.0.1:9001
|
||||
|
||||
[supervisord]
|
||||
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
|
||||
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
|
||||
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
|
||||
|
||||
; the below section must remain in the config file for RPC
|
||||
; (supervisorctl/web interface) to work, additional interfaces may be
|
||||
; added by defining them in separate rpcinterface: sections
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl = http://localhost:9001 ; use a unix:// URL for a unix socket
|
||||
|
||||
; The [include] section can just contain the "files" setting. This
|
||||
; setting can list multiple files (separated by whitespace or
|
||||
; newlines). It can also contain wildcards. The filenames are
|
||||
; interpreted as relative to this file. Included files *cannot*
|
||||
; include files themselves.
|
||||
|
||||
[include]
|
||||
files = /etc/supervisor/conf.d/*.conf
|
||||
118
docker-compose.yml
Normal file
118
docker-compose.yml
Normal file
@ -0,0 +1,118 @@
|
||||
version: '2'
|
||||
services:
|
||||
onlyoffice-documentserver-data:
|
||||
container_name: onlyoffice-documentserver-data
|
||||
image: onlyoffice/documentserver:latest
|
||||
environment:
|
||||
- ONLYOFFICE_DATA_CONTAINER=true
|
||||
- DB_TYPE=postgres
|
||||
- DB_HOST=onlyoffice-postgresql
|
||||
- DB_PORT=5432
|
||||
- DB_NAME=onlyoffice
|
||||
- DB_USER=onlyoffice
|
||||
- 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
|
||||
- /var/www/onlyoffice/documentserver-example/public/files
|
||||
- /usr/share/fonts
|
||||
|
||||
onlyoffice-documentserver:
|
||||
image: onlyoffice/documentserver:latest
|
||||
depends_on:
|
||||
- onlyoffice-documentserver-data
|
||||
- onlyoffice-postgresql
|
||||
- onlyoffice-redis
|
||||
- onlyoffice-rabbitmq
|
||||
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.
|
||||
#- FORCE_SSL=true
|
||||
stdin_open: true
|
||||
restart: always
|
||||
networks:
|
||||
- onlyoffice
|
||||
expose:
|
||||
- '80'
|
||||
volumes_from:
|
||||
- onlyoffice-documentserver-data
|
||||
|
||||
onlyoffice-haproxy:
|
||||
container_name: onlyoffice-haproxy
|
||||
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
|
||||
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
|
||||
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-postgresql:
|
||||
container_name: onlyoffice-postgresql
|
||||
image: postgres:9.5
|
||||
environment:
|
||||
- POSTGRES_DB=onlyoffice
|
||||
- POSTGRES_USER=onlyoffice
|
||||
networks:
|
||||
- onlyoffice
|
||||
restart: always
|
||||
expose:
|
||||
- '5432'
|
||||
volumes:
|
||||
- postgresql_data:/var/lib/postgresql
|
||||
|
||||
networks:
|
||||
onlyoffice:
|
||||
driver: 'bridge'
|
||||
|
||||
volumes:
|
||||
postgresql_data:
|
||||
486
run-document-server.sh
Normal file → Executable file
486
run-document-server.sh
Normal file → Executable file
@ -1,76 +1,464 @@
|
||||
#!/bin/bash
|
||||
|
||||
sed "/user=/s/onlyoffice/root/" -i /etc/supervisor/conf.d/CoAuthoringService.conf
|
||||
sed "/user=/s/onlyoffice/root/" -i /etc/supervisor/conf.d/DocService.conf
|
||||
sed "/user=/s/onlyoffice/root/" -i /etc/supervisor/conf.d/FileConverterService.conf
|
||||
sed "/user=/s/onlyoffice/root/" -i /etc/supervisor/conf.d/LibreOfficeService.conf
|
||||
sed "/user=/s/onlyoffice/root/" -i /etc/supervisor/conf.d/SpellCheckerService.conf
|
||||
|
||||
sed "/sudo /s/-u onlyoffice//" -i /var/www/onlyoffice/documentserver/Tools/CheckDocService.sh
|
||||
sed "/sudo /s/-u onlyoffice//" -i /var/www/onlyoffice/documentserver/Tools/GenerateAllFonts.sh
|
||||
|
||||
chown root /var/www/onlyoffice
|
||||
chown root /var/lib/onlyoffice
|
||||
|
||||
adduser --quiet www-data root
|
||||
# Define '**' behavior explicitly
|
||||
shopt -s globstar
|
||||
|
||||
APP_DIR="/var/www/onlyoffice/documentserver"
|
||||
DATA_DIR="/var/www/onlyoffice/Data"
|
||||
LOG_DIR="/var/log/onlyoffice"
|
||||
DS_LOG_DIR="${LOG_DIR}/documentserver"
|
||||
LIB_DIR="/var/lib/onlyoffice"
|
||||
DS_LIB_DIR="${LIB_DIR}/documentserver"
|
||||
CONF_DIR="/etc/onlyoffice/documentserver"
|
||||
|
||||
ONLYOFFICE_HTTPS=${ONLYOFFICE_HTTPS:-false}
|
||||
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}
|
||||
SSL_KEY_PATH=${SSL_KEY_PATH:-${SSL_CERTIFICATES_DIR}/onlyoffice.key}
|
||||
CA_CERTIFICATES_PATH=${CA_CERTIFICATES_PATH:-${SSL_CERTIFICATES_DIR}/ca-certificates.pem}
|
||||
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_MAXAG:-31536000}
|
||||
ONLYOFFICE_HTTPS_HSTS_MAXAGE=${ONLYOFFICE_HTTPS_HSTS_MAXAGE:-31536000}
|
||||
SYSCONF_TEMPLATES_DIR="/app/onlyoffice/setup/config"
|
||||
|
||||
NGINX_ONLYOFFICE_PATH="/etc/nginx/sites-enabled/onlyoffice-documentserver";
|
||||
NGINX_CONFD_PATH="/etc/nginx/conf.d";
|
||||
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/ds-example.conf"
|
||||
|
||||
NGINX_CONFIG_PATH="/etc/nginx/nginx.conf"
|
||||
NGINX_WORKER_PROCESSES=${NGINX_WORKER_PROCESSES:-1}
|
||||
NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-$(ulimit -n)}
|
||||
|
||||
JWT_ENABLED=${JWT_ENABLED:-false}
|
||||
JWT_SECRET=${JWT_SECRET:-secret}
|
||||
JWT_HEADER=${JWT_HEADER:-Authorization}
|
||||
|
||||
ONLYOFFICE_DEFAULT_CONFIG=${CONF_DIR}/local.json
|
||||
ONLYOFFICE_LOG4JS_CONFIG=${CONF_DIR}/log4js/production.json
|
||||
ONLYOFFICE_EXAMPLE_CONFIG=${CONF_DIR}-example/local.json
|
||||
|
||||
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=${PG_ROOT}/${PG_VERSION}/${PG_NAME}
|
||||
PG_NEW_CLUSTER=false
|
||||
|
||||
read_setting(){
|
||||
deprecated_var POSTGRESQL_SERVER_HOST DB_HOST
|
||||
deprecated_var POSTGRESQL_SERVER_PORT DB_PORT
|
||||
deprecated_var POSTGRESQL_SERVER_DB_NAME DB_NAME
|
||||
deprecated_var POSTGRESQL_SERVER_USER DB_USER
|
||||
deprecated_var POSTGRESQL_SERVER_PASS DB_PWD
|
||||
|
||||
DB_HOST=${DB_HOST:-${POSTGRESQL_SERVER_HOST:-$(${JSON} services.CoAuthoring.sql.dbHost)}}
|
||||
case $DB_TYPE in
|
||||
"postgres")
|
||||
DB_PORT=${DB_PORT:-"5432"}
|
||||
;;
|
||||
"mariadb"|"mysql")
|
||||
DB_PORT=${DB_PORT:-"3306"}
|
||||
;;
|
||||
"")
|
||||
DB_PORT=${DB_PORT:-${POSTGRESQL_SERVER_PORT:-$(${JSON} services.CoAuthoring.sql.dbPort)}}
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: unknown database type"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
DB_NAME=${DB_NAME:-${POSTGRESQL_SERVER_DB_NAME:-$(${JSON} services.CoAuthoring.sql.dbName)}}
|
||||
DB_USER=${DB_USER:-${POSTGRESQL_SERVER_USER:-$(${JSON} services.CoAuthoring.sql.dbUser)}}
|
||||
DB_PWD=${DB_PWD:-${POSTGRESQL_SERVER_PASS:-$(${JSON} services.CoAuthoring.sql.dbPass)}}
|
||||
DB_TYPE=${DB_TYPE:-$(${JSON} services.CoAuthoring.sql.type)}
|
||||
|
||||
RABBITMQ_SERVER_URL=${RABBITMQ_SERVER_URL:-$(${JSON} rabbitmq.url)}
|
||||
AMQP_SERVER_URL=${AMQP_SERVER_URL:-${RABBITMQ_SERVER_URL}}
|
||||
AMQP_SERVER_TYPE=${AMQP_SERVER_TYPE:-rabbitmq}
|
||||
parse_rabbitmq_url ${AMQP_SERVER_URL}
|
||||
|
||||
REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-$(${JSON} services.CoAuthoring.redis.host)}
|
||||
REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-6379}
|
||||
|
||||
DS_LOG_LEVEL=${DS_LOG_LEVEL:-$(${JSON_LOG} categories.default.level)}
|
||||
}
|
||||
|
||||
deprecated_var() {
|
||||
if [[ -n ${!1} ]]; then
|
||||
echo "Variable $1 is deprecated. Use $2 instead."
|
||||
fi
|
||||
}
|
||||
|
||||
parse_rabbitmq_url(){
|
||||
local amqp=$1
|
||||
|
||||
# extract the protocol
|
||||
local proto="$(echo $amqp | grep :// | sed -e's,^\(.*://\).*,\1,g')"
|
||||
# remove the protocol
|
||||
local url="$(echo ${amqp/$proto/})"
|
||||
|
||||
# extract the user and password (if any)
|
||||
local userpass="`echo $url | grep @ | cut -d@ -f1`"
|
||||
local pass=`echo $userpass | grep : | cut -d: -f2`
|
||||
|
||||
local user
|
||||
if [ -n "$pass" ]; then
|
||||
user=`echo $userpass | grep : | cut -d: -f1`
|
||||
else
|
||||
user=$userpass
|
||||
fi
|
||||
|
||||
# extract the host
|
||||
local hostport="$(echo ${url/$userpass@/} | cut -d/ -f1)"
|
||||
# by request - try to extract the port
|
||||
local port="$(echo $hostport | sed -e 's,^.*:,:,g' -e 's,.*:\([0-9]*\).*,\1,g' -e 's,[^0-9],,g')"
|
||||
|
||||
local host
|
||||
if [ -n "$port" ]; then
|
||||
host=`echo $hostport | grep : | cut -d: -f1`
|
||||
else
|
||||
host=$hostport
|
||||
port="5672"
|
||||
fi
|
||||
|
||||
# extract the path (if any)
|
||||
local path="$(echo $url | grep / | cut -d/ -f2-)"
|
||||
|
||||
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(){
|
||||
until nc -z -w 3 "$1" "$2"; do
|
||||
>&2 echo "Waiting for connection to the $1 host on port $2"
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
waiting_for_db(){
|
||||
waiting_for_connection $DB_HOST $DB_PORT
|
||||
}
|
||||
|
||||
waiting_for_amqp(){
|
||||
waiting_for_connection ${AMQP_SERVER_HOST} ${AMQP_SERVER_PORT}
|
||||
}
|
||||
|
||||
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_db_settings(){
|
||||
${JSON} -I -e "this.services.CoAuthoring.sql.type = '${DB_TYPE}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.sql.dbHost = '${DB_HOST}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.sql.dbPort = '${DB_PORT}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.sql.dbName = '${DB_NAME}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.sql.dbUser = '${DB_USER}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.sql.dbPass = '${DB_PWD}'"
|
||||
}
|
||||
|
||||
update_rabbitmq_setting(){
|
||||
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(){
|
||||
${JSON} -I -e "this.services.CoAuthoring.redis.host = '${REDIS_SERVER_HOST}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.redis.port = '${REDIS_SERVER_PORT}'"
|
||||
}
|
||||
|
||||
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.secret.inbox.string = '${JWT_SECRET}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.secret.outbox.string = '${JWT_SECRET}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.secret.session.string = '${JWT_SECRET}'"
|
||||
|
||||
${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}" ] && [ "${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
|
||||
fi
|
||||
}
|
||||
|
||||
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_db_tbl() {
|
||||
case $DB_TYPE in
|
||||
"postgres")
|
||||
create_postgresql_tbl
|
||||
;;
|
||||
"mariadb"|"mysql")
|
||||
create_mysql_tbl
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
create_postgresql_tbl() {
|
||||
CONNECTION_PARAMS="-h$DB_HOST -p$DB_PORT -U$DB_USER -w"
|
||||
if [ -n "$DB_PWD" ]; then
|
||||
export PGPASSWORD=$DB_PWD
|
||||
fi
|
||||
|
||||
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 "$DB_NAME" -f "$APP_DIR/server/schema/postgresql/createdb.sql"
|
||||
}
|
||||
|
||||
create_mysql_tbl() {
|
||||
CONNECTION_PARAMS="-h$DB_HOST -P$DB_PORT -u$DB_USER -p$DB_PWD -w"
|
||||
MYSQL="mysql -q $CONNECTION_PARAMS"
|
||||
|
||||
# Create db on remote server
|
||||
$MYSQL -e "CREATE DATABASE IF NOT EXISTS $DB_NAME DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;" >/dev/null 2>&1
|
||||
|
||||
$MYSQL $DB_NAME < "$APP_DIR/server/schema/mysql/createdb.sql" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
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}
|
||||
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 -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}
|
||||
sed 's,{{SSL_KEY_PATH}},'"${SSL_KEY_PATH}"',' -i ${NGINX_ONLYOFFICE_CONF}
|
||||
|
||||
# turn on http2
|
||||
sed 's,\(443 ssl\),\1 http2,' -i ${NGINX_ONLYOFFICE_CONF}
|
||||
|
||||
# if dhparam path is valid, add to the config, otherwise remove the option
|
||||
if [ -r "${SSL_DHPARAM_PATH}" ]; then
|
||||
sed 's,\(\#* *\)\?\(ssl_dhparam \).*\(;\)$,'"\2${SSL_DHPARAM_PATH}\3"',' -i ${NGINX_ONLYOFFICE_CONF}
|
||||
else
|
||||
sed '/ssl_dhparam/d' -i ${NGINX_ONLYOFFICE_CONF}
|
||||
fi
|
||||
|
||||
sed 's,\(ssl_verify_client \).*\(;\)$,'"\1${SSL_VERIFY_CLIENT}\2"',' -i ${NGINX_ONLYOFFICE_CONF}
|
||||
|
||||
if [ -f "${CA_CERTIFICATES_PATH}" ]; then
|
||||
sed '/ssl_verify_client/a '"ssl_client_certificate ${CA_CERTIFICATES_PATH}"';' -i ${NGINX_ONLYOFFICE_CONF}
|
||||
fi
|
||||
|
||||
if [ "${ONLYOFFICE_HTTPS_HSTS_ENABLED}" == "true" ]; then
|
||||
sed 's,\(max-age=\).*\(;\)$,'"\1${ONLYOFFICE_HTTPS_HSTS_MAXAGE}\2"',' -i ${NGINX_ONLYOFFICE_CONF}
|
||||
else
|
||||
sed '/max-age=/d' -i ${NGINX_ONLYOFFICE_CONF}
|
||||
fi
|
||||
else
|
||||
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
|
||||
sed 's/linux/docker/' -i ${NGINX_ONLYOFFICE_EXAMPLE_CONF}
|
||||
fi
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
update_log_settings(){
|
||||
${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
|
||||
mkdir -p /var/log/onlyoffice/documentserver/FileConverterService/
|
||||
mkdir -p /var/log/onlyoffice/documentserver/CoAuthoringService/
|
||||
mkdir -p /var/log/onlyoffice/documentserver/DocService/
|
||||
mkdir -p /var/log/onlyoffice/documentserver/SpellCheckerService/
|
||||
mkdir -p /var/log/onlyoffice/documentserver/LibreOfficeService/
|
||||
mkdir -p /var/log/onlyoffice/documentserver/WatchDogService/
|
||||
for i in converter docservice spellchecker metrics gc; do
|
||||
mkdir -p "${DS_LOG_DIR}/$i"
|
||||
done
|
||||
|
||||
# setup HTTPS
|
||||
if [ -f "${SSL_CERTIFICATE_PATH}" -a -f "${SSL_KEY_PATH}" ]; then
|
||||
cp ${SYSCONF_TEMPLATES_DIR}/nginx/onlyoffice-ssl ${NGINX_ONLYOFFICE_PATH}
|
||||
mkdir -p ${DS_LOG_DIR}-example
|
||||
|
||||
mkdir ${DATA_DIR}
|
||||
mkdir ${LOG_DIR}/nginx
|
||||
# create app folders
|
||||
for i in App_Data/cache/files App_Data/docbuilder; do
|
||||
mkdir -p "${DS_LIB_DIR}/$i"
|
||||
done
|
||||
|
||||
# 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}
|
||||
# change folder rights
|
||||
for i in ${LOG_DIR} ${LIB_DIR} ${DATA_DIR}; do
|
||||
chown -R ds:ds "$i"
|
||||
chmod -R 755 "$i"
|
||||
done
|
||||
|
||||
# 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
|
||||
if [ ${ONLYOFFICE_DATA_CONTAINER_HOST} = "localhost" ]; then
|
||||
|
||||
sed 's,{{SSL_VERIFY_CLIENT}},'"${SSL_VERIFY_CLIENT}"',' -i ${NGINX_ONLYOFFICE_PATH}
|
||||
read_setting
|
||||
|
||||
if [ -f /usr/local/share/ca-certificates/ca.crt ]; then
|
||||
sed 's,{{CA_CERTIFICATES_PATH}},'"${CA_CERTIFICATES_PATH}"',' -i ${NGINX_ONLYOFFICE_PATH}
|
||||
else
|
||||
sed '/{{CA_CERTIFICATES_PATH}}/d' -i ${NGINX_ONLYOFFICE_PATH}
|
||||
fi
|
||||
update_log_settings
|
||||
|
||||
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
|
||||
update_jwt_settings
|
||||
|
||||
# update settings by env variables
|
||||
if [ $DB_HOST != "localhost" ]; then
|
||||
update_db_settings
|
||||
waiting_for_db
|
||||
create_db_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
|
||||
fi
|
||||
LOCAL_SERVICES+=("postgresql")
|
||||
fi
|
||||
|
||||
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
|
||||
update_redis_settings
|
||||
else
|
||||
LOCAL_SERVICES+=("redis-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
|
||||
|
||||
service mysql start
|
||||
#start needed local services
|
||||
for i in ${LOCAL_SERVICES[@]}; do
|
||||
service $i start
|
||||
done
|
||||
|
||||
if [ ${PG_NEW_CLUSTER} = "true" ]; then
|
||||
create_postgresql_db
|
||||
create_postgresql_tbl
|
||||
fi
|
||||
|
||||
if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then
|
||||
waiting_for_db
|
||||
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.
|
||||
# it run in all cases.
|
||||
service nginx start
|
||||
service supervisor 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/onlyoffice/**/*.log
|
||||
|
||||
31
tests/activemq.yml
Normal file
31
tests/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_TYPE
|
||||
- AMQP_SERVER_URL
|
||||
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
|
||||
- ACTIVEMQ_GROUPS_owners
|
||||
restart: always
|
||||
networks:
|
||||
- onlyoffice
|
||||
expose:
|
||||
- '5672'
|
||||
|
||||
networks:
|
||||
onlyoffice:
|
||||
driver: 'bridge'
|
||||
40
tests/defaults.env
Normal file
40
tests/defaults.env
Normal file
@ -0,0 +1,40 @@
|
||||
# DocumentServer Container
|
||||
ONLYOFFICE_DATA_CONTAINER=true
|
||||
DB_TYPE=postgres
|
||||
DB_HOST=onlyoffice-postgresql
|
||||
DB_PORT=5432
|
||||
DB_NAME=onlyoffice
|
||||
DB_USER=onlyoffice
|
||||
DB_PWD=onlyoffice
|
||||
AMQP_SERVER_TYPE=rabbitmq
|
||||
AMQP_SERVER_URL=amqp://guest:guest@onlyoffice-rabbitmq
|
||||
REDIS_SERVER_HOST=onlyoffice-redis
|
||||
REDIS_SERVER_PORT=6379
|
||||
JWT_ENABLED=true
|
||||
JWT_SECRET=secret
|
||||
JWT_HEADER=Authorization
|
||||
|
||||
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
|
||||
FORCE_SSL=true
|
||||
|
||||
# HAProxy Container
|
||||
MODE=http
|
||||
CERT_FOLDER=/certs/
|
||||
|
||||
# ActiveMQ Container
|
||||
ACTIVEMQ_USERS_guest=guest
|
||||
ACTIVEMQ_GROUPS_owners=guest
|
||||
|
||||
# Postgres Container
|
||||
POSTGRES_DB=onlyoffice
|
||||
POSTGRES_USER=onlyoffice
|
||||
|
||||
# MySQL Container
|
||||
MYSQL_DATABASE=onlyoffice
|
||||
MYSQL_USER=onlyoffice
|
||||
MYSQL_PASSWORD=onlyoffice
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
||||
35
tests/mysql.yml
Normal file
35
tests/mysql.yml
Normal file
@ -0,0 +1,35 @@
|
||||
version: '2'
|
||||
services:
|
||||
onlyoffice-documentserver:
|
||||
container_name: onlyoffice-documentserver
|
||||
image: onlyoffice/4testing-documentserver-ie:latest
|
||||
depends_on:
|
||||
- onlyoffice-mysql
|
||||
environment:
|
||||
- DB_TYPE
|
||||
- DB_HOST
|
||||
- DB_PORT
|
||||
- DB_NAME
|
||||
- DB_USER
|
||||
- DB_PWD
|
||||
stdin_open: true
|
||||
restart: always
|
||||
ports:
|
||||
- '80:80'
|
||||
|
||||
onlyoffice-mysql:
|
||||
container_name: onlyoffice-mysql
|
||||
image: mysql:5.7
|
||||
environment:
|
||||
- MYSQL_DATABASE
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ALLOW_EMPTY_PASSWORD
|
||||
restart: always
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
expose:
|
||||
- '3306'
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
||||
32
tests/postgres-old.yml
Normal file
32
tests/postgres-old.yml
Normal file
@ -0,0 +1,32 @@
|
||||
version: '2'
|
||||
services:
|
||||
onlyoffice-documentserver:
|
||||
container_name: onlyoffice-documentserver
|
||||
image: onlyoffice/4testing-documentserver-ie:latest
|
||||
depends_on:
|
||||
- onlyoffice-postgresql
|
||||
environment:
|
||||
- POSTGRESQL_SERVER_HOST
|
||||
- POSTGRESQL_SERVER_PORT
|
||||
- POSTGRESQL_SERVER_DB_NAME
|
||||
- POSTGRESQL_SERVER_USER
|
||||
- POSTGRESQL_SERVER_PASS
|
||||
stdin_open: true
|
||||
restart: always
|
||||
ports:
|
||||
- '80:80'
|
||||
|
||||
onlyoffice-postgresql:
|
||||
container_name: onlyoffice-postgresql
|
||||
image: postgres:9.5
|
||||
environment:
|
||||
- POSTGRES_DB
|
||||
- POSTGRES_USER
|
||||
restart: always
|
||||
expose:
|
||||
- '5432'
|
||||
volumes:
|
||||
- postgresql_data:/var/lib/postgresql
|
||||
|
||||
volumes:
|
||||
postgresql_data:
|
||||
33
tests/postgres.yml
Normal file
33
tests/postgres.yml
Normal file
@ -0,0 +1,33 @@
|
||||
version: '2'
|
||||
services:
|
||||
onlyoffice-documentserver:
|
||||
container_name: onlyoffice-documentserver
|
||||
image: onlyoffice/4testing-documentserver-ie:latest
|
||||
depends_on:
|
||||
- onlyoffice-postgresql
|
||||
environment:
|
||||
- DB_TYPE
|
||||
- DB_HOST
|
||||
- DB_PORT
|
||||
- DB_NAME
|
||||
- DB_USER
|
||||
- DB_PWD
|
||||
stdin_open: true
|
||||
restart: always
|
||||
ports:
|
||||
- '80:80'
|
||||
|
||||
onlyoffice-postgresql:
|
||||
container_name: onlyoffice-postgresql
|
||||
image: postgres:9.5
|
||||
environment:
|
||||
- POSTGRES_DB
|
||||
- POSTGRES_USER
|
||||
restart: always
|
||||
expose:
|
||||
- '5432'
|
||||
volumes:
|
||||
- postgresql_data:/var/lib/postgresql
|
||||
|
||||
volumes:
|
||||
postgresql_data:
|
||||
37
tests/test.sh
Executable file
37
tests/test.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if the yml exists
|
||||
if [[ ! -f $config ]]; then
|
||||
echo "File $config doesn't exist!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
env_file=defaults.env
|
||||
|
||||
# Copy .env
|
||||
if [[ -f $env_file ]]; then
|
||||
cp $env_file .env
|
||||
else
|
||||
echo "File $env_file doesn't exist!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run test environment
|
||||
docker-compose -p ds -f $config up -d
|
||||
|
||||
wakeup_timeout=30
|
||||
|
||||
# Get documentserver healthcheck status
|
||||
echo "Wait for service wake up"
|
||||
sleep $wakeup_timeout
|
||||
healthcheck_res=$(wget --no-check-certificate -qO - localhost/healthcheck)
|
||||
|
||||
# Fail if it isn't true
|
||||
if [[ $healthcheck_res == "true" ]]; then
|
||||
echo "Healthcheck passed."
|
||||
else
|
||||
echo "Healthcheck failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker-compose -p ds -f $config down
|
||||
Reference in New Issue
Block a user