diff --git a/.github/workflows/4testing-build.yml b/.github/workflows/4testing-build.yml index 683bb80..4343507 100644 --- a/.github/workflows/4testing-build.yml +++ b/.github/workflows/4testing-build.yml @@ -115,18 +115,18 @@ jobs: BRANCH_NAME=${GITHUB_REF#refs/heads/} if [ $BRANCH_NAME = develop ]; then - BUILD_CHANNEL=nightly + RELEASE_BRANCH=unstable PRODUCT_VERSION=99.99.99 elif [[ $BRANCH_NAME =~ hotfix || $BRANCH_NAME =~ release ]]; then - BUILD_CHANNEL=test + RELEASE_BRANCH=testing PRODUCT_VERSION=${BRANCH_NAME#*/v} fi BUILD_NUMBER=${{ github.event.inputs.build }} export PRODUCT_EDITION - export PACKAGE_VERSION=${PRODUCT_VERSION}-${BUILD_NUMBER}~stretch - export PACKAGE_BASEURL=${{ secrets.REPO_BASEURL }}/${BUILD_CHANNEL} - export BUILD_CHANNEL + export PACKAGE_VERSION=${PRODUCT_VERSION}-${BUILD_NUMBER} + export PACKAGE_BASEURL=${{ secrets.REPO_BASEURL }}/${RELEASE_BRANCH}/ubuntu + export RELEASE_BRANCH export PLATFORM export DOCKERFILE=Dockerfile export PREFIX_NAME=4testing- diff --git a/.github/workflows/stable-build.yml b/.github/workflows/stable-build.yml index d0cc970..0b6918e 100644 --- a/.github/workflows/stable-build.yml +++ b/.github/workflows/stable-build.yml @@ -44,6 +44,8 @@ jobs: VERSION=${{ github.event.inputs.tag }} PRODUCT_EDITION=${{ matrix.edition }} TESTING_IMAGE=${COMPANY_NAME}/4testing-${PRODUCT_NAME}${PRODUCT_EDITION} + if docker manifest inspect ${TESTING_IMAGE}:${VERSION} > /dev/null; then + echo "Image present on docker.hub >> start build stable version" export PRODUCT_EDITION export TAG=${VERSION} export SHORTER_TAG=${VERSION%.*} @@ -51,13 +53,17 @@ jobs: docker buildx bake -f docker-bake.hcl ${{ matrix.images }} --push echo "DONE: Build success >> exit with 0" exit 0 + else + echo "FAILED: Image with tag ${VERSION} do not presented on docker.hub >> build will not started >> exit with 1" + exit 1 + fi shell: bash build-nonexample: name: "Release image: DocumentServer${{ matrix.edition }}-nonExample" runs-on: ubuntu-latest needs: [build] - if: ${{ false }} + if: always() strategy: fail-fast: false matrix: @@ -86,39 +92,3 @@ jobs: export TAG=${{ github.event.inputs.tag }} docker buildx bake -f docker-bake.hcl ${{ matrix.images }} --push shell: bash - - build-ucs-ubuntu20: - name: "Release image: DocumentServer${{ matrix.edition }}-ucs" - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - edition: ["", "-ee"] - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - - name: build UCS - run: | - set -eux - export PRODUCT_EDITION=${{ matrix.edition }} - export PACKAGE_BASEURL=${{ secrets.REPO_BASEURL }}/test - export DOCKERFILE=Dockerfile - export BASE_IMAGE=ubuntu:20.04 - export PG_VERSION=12 - export TAG=${{ github.event.inputs.tag }} - export PACKAGE_VERSION=$( echo ${TAG} | sed -E 's/(.*)\./\1-/')~stretch - docker buildx bake -f docker-bake.hcl documentserver-ucs --push - shell: bash diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..084cddc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,131 @@ +language: generic + +dist: trusty + +env: + # community edition + - config: standalone.yml + + # integration edition + - config: standalone.yml + PRODUCT_NAME: documentserver-ie + + + # certificates (default tls if onlyoffice not exists) + - config: certs.yml + ssl: true + + # certificates (default onlyoffice if exists) + - config: certs.yml + ssl: true + private_key: onlyoffice.key + certificate_request: onlyoffice.csr + certificate: onlyoffice.crt + + # custom certificates + - config: certs-customized.yml + ssl: true + private_key: mycert.key + certificate_request: mycert.csr + certificate: mycert.crt + SSL_CERTIFICATE_PATH: /var/www/onlyoffice/Data/certs/mycert.crt + SSL_KEY_PATH: /var/www/onlyoffice/Data/certs/mycert.key + + + # postgresql 12 + - config: postgres.yml + POSTGRES_VERSION: 12 + + # postgresql 11 + - config: postgres.yml + POSTGRES_VERSION: 11 + + # postgresql 10 + - config: postgres.yml + POSTGRES_VERSION: 10 + + # postgresql 9 + - config: postgres.yml + POSTGRES_VERSION: 9 + + # postgresql 9.5 + - config: postgres.yml + + # postgresql custom values + - config: postgres.yml + DB_NAME: mydb + DB_USER: myuser + DB_PWD: password + POSTGRES_DB: mydb + POSTGRES_USER: myuser + + # postgresql deprecated variables + - config: postgres-old.yml + + + # mysql 8 + - config: mysql.yml + MYSQL_VERSION: 8 + + # mysql 5 + - config: mysql.yml + MYSQL_VERSION: 5 + + # mysql 5.7 + - config: mysql.yml + + + # mariadb 10 + - config: mariadb.yml + MARIADB_VERSION: 10 + + # mariadb 10.5 + - config: mariadb.yml + + + - config: activemq.yml + ACTIVEMQ_VERSION: latest + + # activemq 5.14.3 + - config: activemq.yml + + + # rabbitmq latest + - config: rabbitmq.yml + + # rabbitmq 3 + - config: rabbitmq.yml + RABBITMQ_VERSION: 3 + + # rabbitmq old variables + - config: rabbitmq-old.yml + + + # redis latest with community edition + - config: redis.yml + + # redis latest with integraion edition + - config: redis.yml + PRODUCT_NAME: documentserver-ie + + # redis 6 + - config: redis.yml + REDIS_VERSION: 6 + + # redis 5 + - config: redis.yml + REDIS_VERSION: 5 + + + # graphite + - config: graphite.yml + +services: + - docker + +script: + # Go to tests dir + - cd ${PWD}/tests + + # Run test. + - ./test.sh diff --git a/Dockerfile b/Dockerfile index 9744e93..66a9137 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,16 @@ -ARG BASE_IMAGE=ubuntu:22.04 +FROM ubuntu:22.04 as documentserver +LABEL maintainer Ascensio System SIA -FROM ${BASE_IMAGE} as documentserver -LABEL maintainer Jiří Štefka - -ARG PG_VERSION=14 - -ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive PG_VERSION=${PG_VERSION} +ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive PG_VERSION=14 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 gnupg locales lsb-release && \ + apt-get -yq install wget apt-transport-https gnupg locales && \ + mkdir -p $HOME/.gnupg && \ + gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/onlyoffice.gpg --keyserver keyserver.ubuntu.com --recv-keys 0x8320ca65cb2de8e5 && \ + chmod 644 /etc/apt/trusted.gpg.d/onlyoffice.gpg && \ locale-gen en_US.UTF-8 && \ echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \ apt-get -yq install \ @@ -75,17 +74,16 @@ EXPOSE 80 443 ARG COMPANY_NAME=onlyoffice ARG PRODUCT_NAME=documentserver ARG PRODUCT_EDITION= -ARG PACKAGE_VERSION= +ARG PACKAGE_VERSION=0.0.0-0 ARG TARGETARCH ARG PACKAGE_BASEURL="http://download.onlyoffice.com/install/documentserver/linux" +ARG PACKAGE_FILE="${COMPANY_NAME}-${PRODUCT_NAME}${PRODUCT_EDITION}_${PACKAGE_VERSION}_${TARGETARCH}.deb" ENV COMPANY_NAME=$COMPANY_NAME \ PRODUCT_NAME=$PRODUCT_NAME \ - PRODUCT_EDITION=$PRODUCT_EDITION \ - DS_DOCKER_INSTALLATION=true + PRODUCT_EDITION=$PRODUCT_EDITION -RUN PACKAGE_FILE="${COMPANY_NAME}-${PRODUCT_NAME}${PRODUCT_EDITION}${PACKAGE_VERSION:+_$PACKAGE_VERSION}_${TARGETARCH:-$(dpkg --print-architecture)}.deb" && \ - wget -q -P /tmp "$PACKAGE_BASEURL/$PACKAGE_FILE" && \ +RUN wget -q -P /tmp "$PACKAGE_BASEURL/$PACKAGE_FILE" && \ apt-get -y update && \ service postgresql start && \ apt-get -yq install /tmp/$PACKAGE_FILE && \ diff --git a/Makefile b/Makefile index 99b749b..e255521 100644 --- a/Makefile +++ b/Makefile @@ -1,36 +1,39 @@ COMPANY_NAME ?= ONLYOFFICE GIT_BRANCH ?= develop -PRODUCT_NAME ?= documentserver +PRODUCT_NAME ?= DocumentServer PRODUCT_EDITION ?= PRODUCT_VERSION ?= 0.0.0 BUILD_NUMBER ?= 0 -BUILD_CHANNEL ?= nightly ONLYOFFICE_VALUE ?= onlyoffice +S3_BUCKET ?= repo-doc-onlyoffice-com +RELEASE_BRANCH ?= unstable COMPANY_NAME_LOW = $(shell echo $(COMPANY_NAME) | tr A-Z a-z) -COMPANY_NAME_ESC = $(subst -,,$(COMPANY_NAME_LOW)) +PRODUCT_NAME_LOW = $(shell echo $(PRODUCT_NAME) | tr A-Z a-z) +COMPANY_NAME_LOW_ESCAPED = $(subst -,,$(COMPANY_NAME_LOW)) -PACKAGE_NAME := $(COMPANY_NAME_LOW)-$(PRODUCT_NAME)$(PRODUCT_EDITION) -PACKAGE_VERSION ?= $(PRODUCT_VERSION)-$(BUILD_NUMBER)~stretch -PACKAGE_BASEURL ?= https://s3.eu-west-1.amazonaws.com/repo-doc-onlyoffice-com/server/linux/debian/$(BUILD_CHANNEL) +PACKAGE_NAME := $(COMPANY_NAME_LOW)-$(PRODUCT_NAME_LOW)$(PRODUCT_EDITION) +PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER) +PACKAGE_BASEURL := https://s3.eu-west-1.amazonaws.com/$(S3_BUCKET)/$(COMPANY_NAME_LOW)/$(RELEASE_BRANCH)/ubuntu -ifeq ($(BUILD_CHANNEL),$(filter $(BUILD_CHANNEL),nightly test)) - DOCKER_TAG := $(PRODUCT_VERSION).$(BUILD_NUMBER) +ifeq ($(RELEASE_BRANCH),$(filter $(RELEASE_BRANCH),unstable testing)) + DOCKER_TAG := $(subst -,.,$(PACKAGE_VERSION)) else - DOCKER_TAG := $(PRODUCT_VERSION).$(BUILD_NUMBER)-$(subst /,-,$(GIT_BRANCH)) + DOCKER_TAG := $(subst -,.,$(PACKAGE_VERSION))-$(subst /,-,$(GIT_BRANCH)) endif -DOCKER_IMAGE := $(COMPANY_NAME_ESC)/4testing-$(PRODUCT_NAME)$(PRODUCT_EDITION) -DOCKER_DUMMY := $(COMPANY_NAME_LOW)-$(PRODUCT_NAME)$(PRODUCT_EDITION)__$(DOCKER_TAG).dummy -DOCKER_ARCH := $(COMPANY_NAME_LOW)-$(PRODUCT_NAME)_$(DOCKER_TAG).tar.gz +DOCKER_IMAGE := $(subst -,,$(COMPANY_NAME_LOW))/4testing-$(PRODUCT_NAME_LOW)$(PRODUCT_EDITION) +DOCKER_DUMMY := $(COMPANY_NAME_LOW)-$(PRODUCT_NAME_LOW)$(PRODUCT_EDITION)__$(DOCKER_TAG).dummy +DOCKER_ARCH := $(COMPANY_NAME_LOW)-$(PRODUCT_NAME_LOW)_$(PACKAGE_VERSION).tar.gz +DOCKER_ARCH_URI := $(COMPANY_NAME_LOW)/$(RELEASE_BRANCH)/docker/$(notdir $(DOCKER_ARCH)) -.PHONY: all clean clean-docker image deploy docker +.PHONY: all clean clean-docker image deploy docker publish $(DOCKER_DUMMY): - docker pull ubuntu:22.04 + docker pull ubuntu:20.04 docker build \ --build-arg COMPANY_NAME=$(COMPANY_NAME_LOW) \ - --build-arg PRODUCT_NAME=$(PRODUCT_NAME) \ + --build-arg PRODUCT_NAME=$(PRODUCT_NAME_LOW) \ --build-arg PRODUCT_EDITION=$(PRODUCT_EDITION) \ --build-arg PACKAGE_VERSION=$(PACKAGE_VERSION) \ --build-arg PACKAGE_BASEURL=$(PACKAGE_BASEURL) \ @@ -58,9 +61,13 @@ deploy: $(DOCKER_DUMMY) for i in {1..3}; do \ docker push $(DOCKER_IMAGE):$(DOCKER_TAG) && break || sleep 1m; \ done -ifeq ($(BUILD_CHANNEL),nightly) +ifeq ($(RELEASE_BRANCH),unstable) docker tag $(DOCKER_IMAGE):$(DOCKER_TAG) $(DOCKER_IMAGE):latest for i in {1..3}; do \ docker push $(DOCKER_IMAGE):latest && break || sleep 1m; \ done endif + +publish: $(DOCKER_ARCH) + aws s3 cp --no-progress --acl public-read \ + $(DOCKER_ARCH) s3://$(S3_BUCKET)/$(DOCKER_ARCH_URI) diff --git a/README.md b/README.md index ab7cff4..5020dfd 100644 --- a/README.md +++ b/README.md @@ -1,193 +1,3 @@ -[![Docker Pulls](https://img.shields.io/docker/pulls/jiriks74/onlyoffice-documentserver.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=pulls&logo=docker)](https://hub.docker.com/r/jiriks74/onlyoffice-documentserver) -[![Docker Stars](https://img.shields.io/docker/stars/jiriks74/onlyoffice-documentserver.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=stars&logo=docker)](https://hub.docker.com/r/jiriks74/onlyoffice-documentserver) -[![Docker Size](https://img.shields.io/docker/image-size/jiriks74/onlyoffice-documentserver/latest.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=Size&logo=docker)](https://hub.docker.com/r/jiriks74/onlyoffice-documentserver) - -[![GitHub Stars](https://img.shields.io/github/stars/jiriks74/Docker-DocumentServer.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github)](https://github.com/jiriks74/Docker-DocumentServer) -[![GitHub Forks](https://img.shields.io/github/forks/jiriks74/Docker-DocumentServer?color=94398d&label=Forks&logo=github&logoColor=ffffff&style=for-the-badge)](https://github.com/jiriks74/Docker-DocumentServer) - -#### This repository is based on the official `Dockerfile` and `docker-compose.yml` files with all the needed files as well - -# Table of contents - -- [Usage](#usage) - - [Setting up secret key with nextcloud](#setting-up-secret-key-with-nextcloud) - - [Larger file limits](#setting-up-larger-file-limits) - - [Generating custom presentation themes](#generating-custom-presentation-themes) -- [Tags on DockerHub](#tags-used-on-dockerhub) -- [Building the image from source](#building-the-image-yourself-not-recommended---may-take-a-lot-of-time) - - [Updating the image yourself](#updating-the-image-yourself) - -## Usage - -#### docker-compose with prebuilt image (recommended) - -- Docker will pull the correct architecture automatically -- Below in `Details` you'll find a `docker-compose.yml` templete. -To use it, make a directory where data from the container will be saved, create -`docker-compose.yml` file in it and put the template from below in it. -Then modify the template to your needs. - -
- -```yml -version: '2' -services: - onlyoffice-documentserver: - image: jiriks74/onlyoffice-documentserver:latest - container_name: onlyoffice-documentserver - depends_on: - - onlyoffice-postgresql - - onlyoffice-rabbitmq - environment: - - DB_TYPE=postgres - - DB_HOST=onlyoffice-postgresql - - DB_PORT=5432 - - DB_NAME=onlyoffice - - DB_USER=onlyoffice - - AMQP_URI=amqp://guest:guest@onlyoffice-rabbitmq - # Uncomment strings below to enable the JSON Web Token validation. - #- JWT_ENABLED=true - #- JWT_SECRET=secret - #- JWT_HEADER=AuthorizationJwt - #- JWT_IN_BODY=true - # Uncomment the line below to set larger file limits (about 1GB) - #- LARGER_FILE_LIMITS=true - ports: - - '80:80' - - '443:443' - stdin_open: true - restart: always - stop_grace_period: 120s - volumes: - # Uncomment the line below to get access to the slide themes directory. - # To use the themes, copy them to the slideThemes directory and run `docker exec -it /usr/bin/documentserver-generate-allfonts.sh` - #- ./slideThemes:/var/www/onlyoffice/documentserver/sdkjs/slide/themes/src - - /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-rabbitmq: - container_name: onlyoffice-rabbitmq - image: rabbitmq - restart: always - expose: - - '5672' - - onlyoffice-postgresql: - container_name: onlyoffice-postgresql - image: postgres:9.5 - environment: - - POSTGRES_DB=onlyoffice - - POSTGRES_USER=onlyoffice - - POSTGRES_HOST_AUTH_METHOD=trust - restart: always - expose: - - '5432' - volumes: - - postgresql_data:/var/lib/postgresql - -volumes: - postgresql_data: -``` - -
- -### Setting up `Secret key` with Nextcloud - -1. Uncomment four lines starting with `JWT` in `docker-compose` -2. Set your secret on line `JWT_SECRET=yourSecret` -3. Open Nexcloud's `config.php` (by default `/var/www/nextcloud/config/config.php`) -4. Add this to the 2nd last line (before the line with `);`) and paste in your secret (3rd last line) - -```php - 'onlyoffice' => - array ( - "jwt_secret" => "yourSecret", - "jwt_header" => "AuthorizationJwt" - ) -``` - -5. Go to your Nextcloud settings, navigate to Onlyoffice settings -6. Add your server Address and Secret key -7. Save - -### Setting up larger file limits - -- Uncomment the `- LARGER_FILE_LIMITS=true` line in `docker-compose.yml` - -### Generating custom presentation themes - -1. Uncomment the -`- ./slideThemes:/var/www/onlyoffice/documentserver/sdkjs/slide/themes/src` -line in `docker-compose.yml` -2. Put your themes into the `slideThemes` directory -3. Run `docker exec -it /usr/bin/documentserver-generate-allfonts.sh` - - (This will take some time. I have totally 35 themes and it took about 30 minutes to generate them on a Raspberry Pi 4 4GB on an external HDD - SSD may be faster) -4. If you want to add more themes later, repeat step 2 and 3. - -## Tags used on DockerHub - -- `latest` - the latest version of the Documentserver -- Version tags (eg. `7.0.1-37`) - these tags are equal to the Documentserver -version of the `onlyoffice-documentserver` debian package used in the image - -## Building the image yourself (not recommended - may take a lot of time) - -#### 1. Clone the repository (for example to your home directory `cd /home/$USER/`) - - `git clone https://github.com/jiriks74/Docker-DocumentServer.git && cd Docker-DocumentServer` - -#### 2. Build the docker image - -##### Building only for the architecture you are building the image on (when building on Raspberry Pi result will be `arm64`, when on pc result will be `amd64`) - - `docker-compose build` - -##### Building for all supported architectures (you have to have your environment setup for emulation of arm64 with `qemu` and build it on `amd64`) - you have to push to DockerHub - - `docker buildx build --push --platform linux/arm64,linux/amd64,linux/386 .` - -#### 3. Create and start the container - - `docker-compose up -d` - - - This will start the server. It is set to be automatically started/restarted so as long you have docker running on startup this will start automatically - -### Updating the image yourself - -#### 1. Stop and delete the old container - - `docker-compose down` - -#### 2. (optional) Clear the docker cache - -#### - ! This will remove all unused cache images ! (good for saving space, bad if you develop with and need cache, but you understand it at that point) - - `docker rmi $(docker images -f "dangling=true" -q)` - -#### 4. Rebuild the image without cache - -##### Building only for the architecture you are building the image on (when building on Raspberry Pi result will be `arm64`, when on pc result will be `amd64`) - - `docker-compose build` - -##### Building for all supported architectures (you have to have your environment setup for emulation of arm64 with `qemu`) - you'll have to push to DockerHub, multiplatform images cannot be saved locally (for whatever reason) - - `docker buildx build --push --platform linux/arm64,linux/amd64,linux/386 .` - -#### 3. Create and start the new container - - `docker-compose up -d` - ---- - -## The rest of this file is the official [`README.md` from OnlyOffice-Documentserver repository](https://github.com/ONLYOFFICE/Docker-DocumentServer). I will not change anything in it, it may not work, but considering the changes I made, it should be fully compatible (beware that you must change the `docker-compose.yml` from building the image locally to using this repository). If you want to change something, make a issue on my repository and we'll figure it out. - -
- - * [Overview](#overview) * [Functionality](#functionality) * [Recommended System Requirements](#recommended-system-requirements) @@ -215,8 +25,6 @@ Starting from version 6.0, Document Server is distributed as ONLYOFFICE Docs. It ONLYOFFICE Docs can be used as a part of ONLYOFFICE Workspace or with third-party sync&share solutions (e.g. Nextcloud, ownCloud, Seafile) to enable collaborative editing within their interface. -***Important*** Please update `docker-enginge` to latest version (`20.10.21` as of writing this doc) before using it. We use `ubuntu:22.04` as base image and it older versions of docker have compatibility problems with it - ## Functionality ## * ONLYOFFICE Document Editor * ONLYOFFICE Spreadsheet Editor @@ -381,8 +189,8 @@ Below is the complete list of parameters that can be set using environment varia - **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. - **SECURE_LINK_SECRET**: Defines secret for the nginx config directive [secure_link_md5](http://nginx.org/ru/docs/http/ngx_http_secure_link_module.html#secure_link_md5). Defaults to `random string`. -- **JWT_ENABLED**: Specifies the enabling the JSON Web Token validation by the ONLYOFFICE Document Server. Defaults to `true`. -- **JWT_SECRET**: Defines the secret key to validate the JSON Web Token in the request to the ONLYOFFICE Document Server. Defaults to random value. +- **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`. - **JWT_IN_BODY**: Specifies the enabling the token validation in the request body to the ONLYOFFICE Document Server. Defaults to `false`. - **WOPI_ENABLED**: Specifies the enabling the wopi handlers. Defaults to `false`. @@ -410,28 +218,18 @@ Then launch containers on it using the 'docker run --net onlyoffice' option: Follow [these steps](#installing-mysql) to install MySQL server. -**STEP 3**: Generate JWT Secret - -JWT secret defines the secret key to validate the JSON Web Token in the request to the **ONLYOFFICE Document Server**. You can specify it yourself or easily get it using the command: -``` -JWT_SECRET=$(cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 12); -``` - -**STEP 4**: Install ONLYOFFICE Document Server. +**STEP 3**: Install ONLYOFFICE Document Server. ```bash sudo docker run --net onlyoffice -i -t -d --restart=always --name onlyoffice-document-server \ - -e JWT_ENABLED=true \ - -e JWT_SECRET=${JWT_SECRET} \ - -e JWT_HEADER=AuthorizationJwt \ - -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 + -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 5**: Install ONLYOFFICE Mail Server. +**STEP 4**: Install ONLYOFFICE Mail Server. For the mail server correct work you need to specify its hostname 'yourdomain.com'. @@ -453,10 +251,10 @@ The additional parameters for mail server are available [here](https://github.co To learn more, refer to the [ONLYOFFICE Mail Server documentation](https://github.com/ONLYOFFICE/Docker-MailServer "ONLYOFFICE Mail Server documentation"). -**STEP 6**: Install ONLYOFFICE Community Server +**STEP 5**: Install ONLYOFFICE Community Server ```bash -sudo docker run --net onlyoffice -i -t -d --privileged --restart=always --name onlyoffice-community-server -p 80:80 -p 443:443 -p 5222:5222 --cgroupns=host \ +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 \ @@ -464,9 +262,6 @@ sudo docker run --net onlyoffice -i -t -d --privileged --restart=always --name o -e MYSQL_SERVER_PASS=onlyoffice_pass \ -e DOCUMENT_SERVER_PORT_80_TCP_ADDR=onlyoffice-document-server \ - -e DOCUMENT_SERVER_JWT_ENABLED=true \ - -e DOCUMENT_SERVER_JWT_SECRET=${JWT_SECRET} \ - -e DOCUMENT_SERVER_JWT_HEADER=AuthorizationJwt \ -e MAIL_SERVER_API_HOST=${MAIL_SERVER_IP} \ -e MAIL_SERVER_DB_HOST=onlyoffice-mysql-server \ @@ -477,14 +272,12 @@ sudo docker run --net onlyoffice -i -t -d --privileged --restart=always --name o -v /app/onlyoffice/CommunityServer/data:/var/www/onlyoffice/Data \ -v /app/onlyoffice/CommunityServer/logs:/var/log/onlyoffice \ - -v /app/onlyoffice/CommunityServer/letsencrypt:/etc/letsencrypt \ - -v /sys/fs/cgroup:/sys/fs/cgroup:rw \ onlyoffice/communityserver ``` Where `${MAIL_SERVER_IP}` is the IP address for **ONLYOFFICE Mail Server**. You can easily get it using the command: ``` -MAIL_SERVER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' onlyoffice-mail-server) +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'. @@ -546,5 +339,3 @@ If you have any problems with or questions about this image, please visit our of [1]: https://forum.onlyoffice.com [2]: https://stackoverflow.com/questions/tagged/onlyoffice - -
diff --git a/build_and_push_all_images.py b/build_and_push_all_images.py deleted file mode 100644 index aae069a..0000000 --- a/build_and_push_all_images.py +++ /dev/null @@ -1,18 +0,0 @@ -import requests -import os - -response = requests.get("https://api.github.com/repos/ONLYOFFICE/DocumentServer/releases/latest") - -print('docker buildx build --push --platform linux/arm64,linux/amd64 --tag jiriks74/onlyoffice-documentserver:latest .') -os.system(f'docker buildx build --push --platform linux/arm64,linux/amd64 --tag jiriks74/onlyoffice-documentserver:latest .') -print("///////////////////////////////////////////////////////////////////////////") -print('Build and push ":latest" .........................................finished') -print("///////////////////////////////////////////////////////////////////////////") -print() - -print(f'docker buildx build --push --platform linux/arm64,linux/amd64 --tag jiriks74/onlyoffice-documentserver:{response.json()["name"].replace("ONLYOFFICE-DocumentServer-", "")} .') -os.system(f'docker buildx build --push --platform linux/arm64,linux/amd64 --tag jiriks74/onlyoffice-documentserver:{response.json()["name"].replace("ONLYOFFICE-DocumentServer-", "")} .') -print("///////////////////////////////////////////////////////////////////////////") -print(f'Build and push ":{response.json()["name"].replace("ONLYOFFICE-DocumentServer-", "")}".........................................finished') -print("///////////////////////////////////////////////////////////////////////////") - diff --git a/cluster.yml b/cluster.yml new file mode 100644 index 0000000..0cb07c1 --- /dev/null +++ b/cluster.yml @@ -0,0 +1,108 @@ +version: '2.1' + +x-ds-image: + &ds-image + ${COMPANY_NAME:-onlyoffice}/${PRODUCT_NAME:-documentserver-de}:${PRODUCT_VERSION:-latest} + +services: + onlyoffice-documentserver-data: + container_name: onlyoffice-documentserver-data + image: *ds-image + environment: + - ONLYOFFICE_DATA_CONTAINER=true + - DB_HOST=onlyoffice-postgresql + - DB_PORT=5432 + - DB_NAME=onlyoffice + - DB_USER=onlyoffice + - AMQP_URI=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 + #- JWT_IN_BODY=true + stdin_open: true + restart: always + 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: *ds-image + 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 + 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 + ports: + - '80:80' + - '443:443' + - '1936:1936' + + onlyoffice-redis: + container_name: onlyoffice-redis + image: redis + restart: always + expose: + - '6379' + + onlyoffice-rabbitmq: + container_name: onlyoffice-rabbitmq + image: rabbitmq + restart: always + expose: + - '5672' + + onlyoffice-postgresql: + container_name: onlyoffice-postgresql + image: postgres:9.5 + environment: + - POSTGRES_DB=onlyoffice + - POSTGRES_USER=onlyoffice + - POSTGRES_HOST_AUTH_METHOD=trust + restart: always + expose: + - '5432' + volumes: + - postgresql_data:/var/lib/postgresql + +volumes: + postgresql_data: diff --git a/config/supervisor/ds/ds-converter.conf b/config/supervisor/ds/ds-converter.conf deleted file mode 100644 index 69285cd..0000000 --- a/config/supervisor/ds/ds-converter.conf +++ /dev/null @@ -1,13 +0,0 @@ -[program:converter] -command=/var/www/COMPANY_NAME/documentserver/server/FileConverter/converter -directory=/var/www/COMPANY_NAME/documentserver/server/FileConverter -user=ds -environment=NODE_ENV=production-linux,NODE_CONFIG_DIR=/etc/COMPANY_NAME/documentserver,NODE_DISABLE_COLORS=1,APPLICATION_NAME=COMPANY_NAME -stdout_logfile=/var/log/COMPANY_NAME/documentserver/converter/out.log -stdout_logfile_backups=0 -stdout_logfile_maxbytes=0 -stderr_logfile=/var/log/COMPANY_NAME/documentserver/converter/err.log -stderr_logfile_backups=0 -stderr_logfile_maxbytes=0 -autostart=true -autorestart=true diff --git a/config/supervisor/ds/ds-docservice.conf b/config/supervisor/ds/ds-docservice.conf deleted file mode 100644 index 4afbc1b..0000000 --- a/config/supervisor/ds/ds-docservice.conf +++ /dev/null @@ -1,13 +0,0 @@ -[program:docservice] -command=/var/www/COMPANY_NAME/documentserver/server/DocService/docservice -directory=/var/www/COMPANY_NAME/documentserver/server/DocService -user=ds -environment=NODE_ENV=production-linux,NODE_CONFIG_DIR=/etc/COMPANY_NAME/documentserver,NODE_DISABLE_COLORS=1 -stdout_logfile=/var/log/COMPANY_NAME/documentserver/docservice/out.log -stdout_logfile_backups=0 -stdout_logfile_maxbytes=0 -stderr_logfile=/var/log/COMPANY_NAME/documentserver/docservice/err.log -stderr_logfile_backups=0 -stderr_logfile_maxbytes=0 -autostart=true -autorestart=true diff --git a/config/supervisor/ds/ds-example.conf b/config/supervisor/ds/ds-example.conf deleted file mode 100644 index 44fa688..0000000 --- a/config/supervisor/ds/ds-example.conf +++ /dev/null @@ -1,14 +0,0 @@ -[program:example] -command=/var/www/COMPANY_NAME/documentserver-example/example -directory=/var/www/COMPANY_NAME/documentserver-example/ -user=ds -environment=NODE_ENV=production-linux,NODE_CONFIG_DIR=/etc/COMPANY_NAME/documentserver-example,NODE_DISABLE_COLORS=1 -stdout_logfile=/var/log/COMPANY_NAME/documentserver-example/out.log -stdout_logfile_backups=0 -stdout_logfile_maxbytes=0 -stderr_logfile=/var/log/COMPANY_NAME/documentserver-example/err.log -stderr_logfile_backups=0 -stderr_logfile_maxbytes=0 -autostart=false -autorestart=true -redirect_stderr=true diff --git a/config/supervisor/ds/ds-metrics.conf b/config/supervisor/ds/ds-metrics.conf deleted file mode 100644 index 1eb858a..0000000 --- a/config/supervisor/ds/ds-metrics.conf +++ /dev/null @@ -1,13 +0,0 @@ -[program:metrics] -command=/var/www/COMPANY_NAME/documentserver/server/Metrics/metrics ./config/config.js -directory=/var/www/COMPANY_NAME/documentserver/server/Metrics -user=ds -environment=NODE_DISABLE_COLORS=1 -stdout_logfile=/var/log/COMPANY_NAME/documentserver/metrics/out.log -stdout_logfile_backups=0 -stdout_logfile_maxbytes=0 -stderr_logfile=/var/log/COMPANY_NAME/documentserver/metrics/err.log -stderr_logfile_backups=0 -stderr_logfile_maxbytes=0 -autostart=true -autorestart=true diff --git a/config/supervisor/ds/ds.conf b/config/supervisor/ds/ds.conf deleted file mode 100644 index c9179df..0000000 --- a/config/supervisor/ds/ds.conf +++ /dev/null @@ -1,2 +0,0 @@ -[group:ds] -programs=docservice,converter,metrics,example diff --git a/docker-bake.hcl b/docker-bake.hcl index 28396a6..b797d46 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -46,28 +46,16 @@ variable "PACKAGE_FILE" { default = "" } -variable "BUILD_CHANNEL" { +variable "RELEASE_BRANCH" { default = "" } -### ↓ Variables for UCS build ↓ - -variable "BASE_IMAGE" { - default = "" -} - -variable "PG_VERSION" { - default = "" -} - -### ↑ Variables for UCS build ↑ - target "documentserver" { target = "documentserver" dockerfile = "${DOCKERFILE}" tags = [ "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}", - equal("nightly",BUILD_CHANNEL) ? "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest": "", + equal("testing",RELEASE_BRANCH) ? "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest": "", ] platforms = ["${PLATFORM}"] args = { @@ -97,24 +85,6 @@ target "documentserver-stable" { } } -target "documentserver-ucs" { - target = "documentserver" - dockerfile = "${DOCKERFILE}" - tags = [ - "docker.io/${COMPANY_NAME}/${PRODUCT_NAME}${PRODUCT_EDITION}-ucs:${TAG}" - ] - platforms = ["linux/amd64", "linux/arm64"] - args = { - "PRODUCT_EDITION": "${PRODUCT_EDITION}" - "PRODUCT_NAME": "${PRODUCT_NAME}" - "COMPANY_NAME": "${COMPANY_NAME}" - "PACKAGE_VERSION": "${PACKAGE_VERSION}" - "PACKAGE_BASEURL": "${PACKAGE_BASEURL}" - "BASE_IMAGE": "${BASE_IMAGE}" - "PG_VERSION": "${PG_VERSION}" - } -} - target "documentserver-nonexample" { target = "documentserver-nonexample" dockerfile = "production.dockerfile" diff --git a/docker-compose.yml b/docker-compose.yml index 62b37e7..51fafb2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,20 +17,15 @@ services: # Uncomment strings below to enable the JSON Web Token validation. #- JWT_ENABLED=true #- JWT_SECRET=secret - #- JWT_HEADER=AuthorizationJwt + #- JWT_HEADER=Authorization #- JWT_IN_BODY=true - # Uncomment the line below to set larger file limits (about 1GB) - #- LARGER_FILE_LIMITS=true ports: - '80:80' - '443:443' stdin_open: true restart: always - stop_grace_period: 120s + stop_grace_period: 60s volumes: - # Uncomment the line below to get access to the slide themes directory. - # To use the themes, copy them to the slideThemes directory and run `docker exec -it /usr/bin/documentserver-generate-allfonts.sh` - #- ./slideThemes:/var/www/onlyoffice/documentserver/sdkjs/slide/themes/src - /var/www/onlyoffice/Data - /var/log/onlyoffice - /var/lib/onlyoffice/documentserver/App_Data/cache/files diff --git a/run-document-server.sh b/run-document-server.sh index a8326a3..fd183a3 100755 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -73,8 +73,7 @@ NGINX_ONLYOFFICE_EXAMPLE_CONF="${NGINX_ONLYOFFICE_EXAMPLE_PATH}/includes/ds-exam NGINX_CONFIG_PATH="/etc/nginx/nginx.conf" NGINX_WORKER_PROCESSES=${NGINX_WORKER_PROCESSES:-1} -# Limiting the maximum number of simultaneous connections due to possible memory shortage -[ $(ulimit -n) -gt 1048576 ] && NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-1048576} || NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-$(ulimit -n)} +NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-$(ulimit -n)} JWT_ENABLED=${JWT_ENABLED:-true} @@ -200,7 +199,7 @@ parse_rabbitmq_url(){ # extract the host local hostport="$(echo ${url/$userpass@/} | cut -d/ -f1)" # by request - try to extract the port - local port="$(echo $hostport | grep : | sed -r 's_^.*:+|/.*$__g')" + 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 @@ -497,8 +496,6 @@ update_supervisor_settings(){ cp ${SYSCONF_TEMPLATES_DIR}/supervisor/supervisor /etc/init.d/ # Copy modified supervisor config cp ${SYSCONF_TEMPLATES_DIR}/supervisor/supervisord.conf /etc/supervisor/supervisord.conf - sed "s/COMPANY_NAME/${COMPANY_NAME}/g" -i ${SYSCONF_TEMPLATES_DIR}/supervisor/ds/*.conf - cp ${SYSCONF_TEMPLATES_DIR}/supervisor/ds/*.conf etc/supervisor/conf.d/ } update_log_settings(){ @@ -653,30 +650,5 @@ documentserver-static-gzip.sh ${ONLYOFFICE_DATA_CONTAINER} echo "${JWT_MESSAGE}" -# Check if lager file limits should be set -if [ "$LARGER_FILE_LIMITS" = "true" ]; then - if [ -e /app/ds/file_limits_set ]; then - echo "" - else - touch /app/ds/file_limits_set - - sed -i -e 's/104857600/10485760000/g' /etc/onlyoffice/documentserver-example/production-linux.json - - sed -i '9iclient_max_body_size 1000M;' /etc/onlyoffice/documentserver-example/nginx/includes/ds-example.conf - sed -i '16iclient_max_body_size 1000M;' /etc/nginx/nginx.conf - - sed -i -e 's/104857600/10485760000/g' /etc/onlyoffice/documentserver/default.json - sed -i -e 's/50MB/5000MB/g' /etc/onlyoffice/documentserver/default.json - sed -i -e 's/300MB/3000MB/g' /etc/onlyoffice/documentserver/default.json - - sed -i 's/^client_max_body_size 100m;$/client_max_body_size 1000m;/' /etc/onlyoffice/documentserver/nginx/includes/ds-common.conf - - service nginx restart - supervisorctl restart all - - fi -fi - tail -f /var/log/${COMPANY_NAME}/**/*.log & wait $! - diff --git a/slideThemes/01_blank.pptx b/slideThemes/01_blank.pptx deleted file mode 100644 index 09e243b..0000000 Binary files a/slideThemes/01_blank.pptx and /dev/null differ diff --git a/slideThemes/02_basic.pptx b/slideThemes/02_basic.pptx deleted file mode 100644 index 5e08ac3..0000000 Binary files a/slideThemes/02_basic.pptx and /dev/null differ diff --git a/slideThemes/03_classic.pptx b/slideThemes/03_classic.pptx deleted file mode 100644 index 4e009f8..0000000 Binary files a/slideThemes/03_classic.pptx and /dev/null differ diff --git a/slideThemes/04_official.pptx b/slideThemes/04_official.pptx deleted file mode 100644 index 84aab37..0000000 Binary files a/slideThemes/04_official.pptx and /dev/null differ diff --git a/slideThemes/05_green leaf.pptx b/slideThemes/05_green leaf.pptx deleted file mode 100644 index d92b846..0000000 Binary files a/slideThemes/05_green leaf.pptx and /dev/null differ diff --git a/slideThemes/06_lines.pptx b/slideThemes/06_lines.pptx deleted file mode 100644 index ed7394f..0000000 Binary files a/slideThemes/06_lines.pptx and /dev/null differ diff --git a/slideThemes/07_office.pptx b/slideThemes/07_office.pptx deleted file mode 100644 index 6ab99d6..0000000 Binary files a/slideThemes/07_office.pptx and /dev/null differ diff --git a/slideThemes/08_safari.pptx b/slideThemes/08_safari.pptx deleted file mode 100644 index e1e6362..0000000 Binary files a/slideThemes/08_safari.pptx and /dev/null differ diff --git a/slideThemes/09_dotted.pptx b/slideThemes/09_dotted.pptx deleted file mode 100644 index 6fe7c2a..0000000 Binary files a/slideThemes/09_dotted.pptx and /dev/null differ diff --git a/slideThemes/10_corner.pptx b/slideThemes/10_corner.pptx deleted file mode 100644 index 1b6ce8e..0000000 Binary files a/slideThemes/10_corner.pptx and /dev/null differ diff --git a/slideThemes/11_tort.pptx b/slideThemes/11_tort.pptx deleted file mode 100644 index b7c5858..0000000 Binary files a/slideThemes/11_tort.pptx and /dev/null differ diff --git a/tests/activemq.yml b/tests/activemq.yml new file mode 100644 index 0000000..5781c64 --- /dev/null +++ b/tests/activemq.yml @@ -0,0 +1,32 @@ +version: '2.1' +services: + onlyoffice-documentserver: + container_name: onlyoffice-documentserver + build: + context: ../. + environment: + - AMQP_TYPE=${AMQP_TYPE:-activemq} + - AMQP_URI=${AMQP_URI:-amqp://guest:guest@onlyoffice-activemq} + stdin_open: true + restart: always + ports: + - '80:80' + - '443:443' + networks: + - onlyoffice + + onlyoffice-activemq: + container_name: onlyoffice-activemq + image: webcenter/activemq:${ACTIVEMQ_VERSION:-5.14.3} + environment: + - ACTIVEMQ_USERS_guest=${ACTIVEMQ_USERS_guest:-guest} + - ACTIVEMQ_GROUPS_owners=${ACTIVEMQ_GROUPS_owners:-guest} + restart: always + networks: + - onlyoffice + expose: + - '5672' + +networks: + onlyoffice: + driver: 'bridge' diff --git a/tests/certs-customized.yml b/tests/certs-customized.yml new file mode 100644 index 0000000..af73081 --- /dev/null +++ b/tests/certs-customized.yml @@ -0,0 +1,18 @@ +version: '2.1' +services: + onlyoffice-documentserver: + container_name: onlyoffice-documentserver + build: + context: ../. + environment: + - SSL_CERTIFICATE_PATH=${SSL_CERTIFICATE_PATH:-/var/www/onlyoffice/Data/certs/tls.crt} + - SSL_KEY_PATH=${SSL_KEY_PATH:-/var/www/onlyoffice/Data/certs/tls.key} + - CA_CERTIFICATES_PATH=${CA_CERTIFICATES_PATH:-/var/www/onlyoffice/Data/certs/ca-certificates.pem} + - SSL_DHPARAM_PATH=${SSL_DHPARAM_PATH:-/var/www/onlyoffice/Data/certs/dhparam.pem} + stdin_open: true + restart: always + ports: + - '80:80' + - '443:443' + volumes: + - ./data:/var/www/onlyoffice/Data diff --git a/tests/certs.yml b/tests/certs.yml new file mode 100644 index 0000000..77d37ce --- /dev/null +++ b/tests/certs.yml @@ -0,0 +1,13 @@ +version: '2.1' +services: + onlyoffice-documentserver: + container_name: onlyoffice-documentserver + build: + context: ../. + stdin_open: true + restart: always + ports: + - '80:80' + - '443:443' + volumes: + - ./data:/var/www/onlyoffice/Data diff --git a/tests/graphite.yml b/tests/graphite.yml new file mode 100644 index 0000000..2bc4694 --- /dev/null +++ b/tests/graphite.yml @@ -0,0 +1,32 @@ +version: '2.1' +services: + onlyoffice-documentserver: + container_name: onlyoffice-documentserver + build: + context: ../. + depends_on: + - onlyoffice-graphite + environment: + - METRICS_ENABLED=${METRICS_ENABLED:-true} + - METRICS_HOST=${METRICS_HOST:-localhost} + - METRICS_PORT=${METRICS_PORT:-8125} + - METRICS_PREFIX=${METRICS_PREFIX:-ds.} + stdin_open: true + restart: always + expose: + - '2003' + ports: + - '80:80' + volumes: + - ./graphite/statsd:/var/www/onlyoffice/documentserver/server/Metrics/config + + onlyoffice-graphite: + container_name: onlyoffice-graphite + image: graphiteapp/graphite-statsd + environment: + - GRAPHITE_STATSD_HOST=${GRAPHITE_STATSD_HOST:-onlyoffice-documentserver} + - GRAPHITE_TIME_ZONE=${GRAPHITE_TIME_ZONE:-Etc/UTC} + ports: + - '8888:80' + stdin_open: true + restart: always diff --git a/tests/graphite/statsd/config.js b/tests/graphite/statsd/config.js new file mode 100644 index 0000000..2ebffe6 --- /dev/null +++ b/tests/graphite/statsd/config.js @@ -0,0 +1,7 @@ +{ + "graphiteHost": "onlyoffice-graphite", + "graphitePort": 2003, + "port": 8125, + "flushInterval": 60000, + "backends": [ "./backends/graphite.js" ] +} diff --git a/tests/mariadb.yml b/tests/mariadb.yml new file mode 100644 index 0000000..4bb8de5 --- /dev/null +++ b/tests/mariadb.yml @@ -0,0 +1,36 @@ +version: '2.1' +services: + ds: + container_name: ds + build: + context: ../. + depends_on: + - onlyoffice-mariadb + environment: + - DB_TYPE=${DB_TYPE:-mysql} + - DB_HOST=${DB_HOST:-onlyoffice-mariadb} + - DB_PORT=${DB_PORT:-3306} + - DB_NAME=${DB_NAME:-onlyoffice} + - DB_USER=${DB_USER:-onlyoffice} + - DB_PWD=${DB_PWD:-onlyoffice} + stdin_open: true + restart: always + ports: + - '80:80' + + onlyoffice-mariadb: + container_name: onlyoffice-mariadb + image: mariadb:${MARIADB_VERSION:-10.5} + environment: + - MYSQL_DATABASE=${MYSQL_DATABASE:-onlyoffice} + - MYSQL_USER=${MYSQL_USER:-onlyoffice} + - MYSQL_PASSWORD=${MYSQL_PASSWORD:-onlyoffice} + - MYSQL_ALLOW_EMPTY_PASSWORD=${MYSQL_ALLOW_EMPTY_PASSWORD:-yes} + restart: always + volumes: + - mysql_data:/var/lib/mysql + expose: + - '3306' + +volumes: + mysql_data: diff --git a/tests/mysql.yml b/tests/mysql.yml new file mode 100644 index 0000000..20fcd70 --- /dev/null +++ b/tests/mysql.yml @@ -0,0 +1,37 @@ +version: '2.1' +services: + onlyoffice-documentserver: + container_name: onlyoffice-documentserver + build: + context: ../. + depends_on: + - onlyoffice-mysql + environment: + - DB_TYPE=${DB_TYPE:-mysql} + - DB_HOST=${DB_HOST:-onlyoffice-mysql} + - DB_PORT=${DB_PORT:-3306} + - DB_NAME=${DB_NAME:-onlyoffice} + - DB_USER=${DB_USER:-onlyoffice} + - DB_PWD=${DB_PWD:-onlyoffice} + stdin_open: true + restart: always + ports: + - '80:80' + + onlyoffice-mysql: + container_name: onlyoffice-mysql + image: mysql:${MYSQL_VERSION:-5.7} + command: --default-authentication-plugin=mysql_native_password + environment: + - MYSQL_DATABASE=${MYSQL_DATABASE:-onlyoffice} + - MYSQL_USER=${MYSQL_USER:-onlyoffice} + - MYSQL_PASSWORD=${MYSQL_PASSWORD:-onlyoffice} + - MYSQL_ALLOW_EMPTY_PASSWORD=${MYSQL_ALLOW_EMPTY_PASSWORD:-yes} + restart: always + volumes: + - mysql_data:/var/lib/mysql + expose: + - '3306' + +volumes: + mysql_data: diff --git a/tests/postgres-old.yml b/tests/postgres-old.yml new file mode 100644 index 0000000..237246c --- /dev/null +++ b/tests/postgres-old.yml @@ -0,0 +1,34 @@ +version: '2.1' +services: + onlyoffice-documentserver: + container_name: onlyoffice-documentserver + build: + context: ../. + depends_on: + - onlyoffice-postgresql + environment: + - POSTGRESQL_SERVER_HOST=${DB_HOST:-onlyoffice-postgresql} + - POSTGRESQL_SERVER_PORT=${DB_PORT:-5432} + - POSTGRESQL_SERVER_DB_NAME=${DB_NAME:-onlyoffice} + - POSTGRESQL_SERVER_USER=${DB_USER:-onlyoffice} + - POSTGRESQL_SERVER_PASS=${DB_PWD:-onlyoffice} + stdin_open: true + restart: always + ports: + - '80:80' + + onlyoffice-postgresql: + container_name: onlyoffice-postgresql + image: postgres:9.5 + environment: + - POSTGRES_DB=${POSTGRES_DB:-onlyoffice} + - POSTGRES_USER=${POSTGRES_USER:-onlyoffice} + - POSTGRES_HOST_AUTH_METHOD=${POSTGRES_HOST_AUTH_METHOD:-trust} + restart: always + expose: + - '5432' + volumes: + - postgresql_data:/var/lib/postgresql + +volumes: + postgresql_data: diff --git a/tests/postgres.yml b/tests/postgres.yml new file mode 100644 index 0000000..8333b10 --- /dev/null +++ b/tests/postgres.yml @@ -0,0 +1,35 @@ +version: '2.1' +services: + onlyoffice-documentserver: + container_name: onlyoffice-documentserver + build: + context: ../. + depends_on: + - onlyoffice-postgresql + environment: + - DB_TYPE=${DB_TYPE:-postgres} + - DB_HOST=${DB_HOST:-onlyoffice-postgresql} + - DB_PORT=${DB_PORT:-5432} + - DB_NAME=${DB_NAME:-onlyoffice} + - DB_USER=${DB_USER:-onlyoffice} + - DB_PWD=${DB_PWD:-onlyoffice} + stdin_open: true + restart: always + ports: + - '80:80' + + onlyoffice-postgresql: + container_name: onlyoffice-postgresql + image: postgres:${POSTGRES_VERSION:-9.5} + environment: + - POSTGRES_DB=${POSTGRES_DB:-onlyoffice} + - POSTGRES_USER=${POSTGRES_USER:-onlyoffice} + - POSTGRES_HOST_AUTH_METHOD=${POSTGRES_HOST_AUTH_METHOD:-trust} + restart: always + expose: + - '5432' + volumes: + - postgresql_data:/var/lib/postgresql + +volumes: + postgresql_data: diff --git a/tests/rabbitmq-old.yml b/tests/rabbitmq-old.yml new file mode 100644 index 0000000..ce18691 --- /dev/null +++ b/tests/rabbitmq-old.yml @@ -0,0 +1,29 @@ +version: '2.1' +services: + onlyoffice-documentserver: + container_name: onlyoffice-documentserver + build: + context: ../. + environment: + - AMQP_SERVER_TYPE=${AMQP_SERVER_TYPE:-rabbitmq} + - AMQP_SERVER_URL=${AMQP_SERVER_URL:-amqp://guest:guest@onlyoffice-rabbitmq} + stdin_open: true + restart: always + ports: + - '80:80' + - '443:443' + networks: + - onlyoffice + + onlyoffice-rabbitmq: + container_name: onlyoffice-rabbitmq + image: rabbitmq + restart: always + networks: + - onlyoffice + expose: + - '5672' + +networks: + onlyoffice: + driver: 'bridge' diff --git a/tests/rabbitmq.yml b/tests/rabbitmq.yml new file mode 100644 index 0000000..293045c --- /dev/null +++ b/tests/rabbitmq.yml @@ -0,0 +1,29 @@ +version: '2.1' +services: + onlyoffice-documentserver: + container_name: onlyoffice-documentserver + build: + context: ../. + environment: + - AMQP_TYPE=${AMQP_TYPE:-rabbitmq} + - AMQP_URI=${AMQP_URI:-amqp://guest:guest@onlyoffice-rabbitmq} + stdin_open: true + restart: always + ports: + - '80:80' + - '443:443' + networks: + - onlyoffice + + onlyoffice-rabbitmq: + container_name: onlyoffice-rabbitmq + image: rabbitmq:${RABBITMQ_VERSION:-latest} + restart: always + networks: + - onlyoffice + expose: + - '5672' + +networks: + onlyoffice: + driver: 'bridge' diff --git a/tests/redis.yml b/tests/redis.yml new file mode 100644 index 0000000..849be16 --- /dev/null +++ b/tests/redis.yml @@ -0,0 +1,31 @@ +version: '2.1' +services: + onlyoffice-documentserver: + container_name: onlyoffice-documentserver + build: + context: ../. + args: + - PRODUCT_NAME=${PRODUCT_NAME:-documentserver} + environment: + - REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-onlyoffice-redis} + - REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-6379} + stdin_open: true + restart: always + ports: + - '80:80' + - '443:443' + networks: + - onlyoffice + + onlyoffice-redis: + container_name: onlyoffice-redis + image: redis:${REDIS_VERSION:-latest} + restart: always + networks: + - onlyoffice + expose: + - '6379' + +networks: + onlyoffice: + driver: 'bridge' diff --git a/tests/standalone.yml b/tests/standalone.yml new file mode 100644 index 0000000..f3de32f --- /dev/null +++ b/tests/standalone.yml @@ -0,0 +1,12 @@ +version: '2.1' +services: + onlyoffice-documentserver: + container_name: onlyoffice-documentserver + build: + context: ../. + args: + - PRODUCT_NAME=${PRODUCT_NAME:-documentserver} + stdin_open: true + restart: always + ports: + - '80:80' diff --git a/tests/test.sh b/tests/test.sh new file mode 100755 index 0000000..535003a --- /dev/null +++ b/tests/test.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +ssl=${ssl:-false} +private_key=${private_key:-tls.key} +certificate_request=${certificate_request:-tls.csr} +certificate=${certificate:-tls.crt} + +# Generate certificate +if [[ $ssl == "true" ]]; then + url=${url:-"https://localhost"} + + mkdir -p data/certs + pushd data/certs + + openssl genrsa -out ${private_key} 2048 + openssl req \ + -new \ + -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" \ + -key ${private_key} \ + -out ${certificate_request} + openssl x509 -req -days 365 -in ${certificate_request} -signkey ${private_key} -out ${certificate} + openssl dhparam -out dhparam.pem 2048 + chmod 400 ${private_key} + + popd +else + url=${url:-"http://localhost"} +fi + +# Check if the yml exists +if [[ ! -f $config ]]; then + echo "File $config doesn't exist!" + exit 1 +fi + +# Run test environment +docker-compose -p ds -f $config up -d + +wakeup_timeout=90 + +# Get documentserver healthcheck status +echo "Wait for service wake up" +sleep $wakeup_timeout +healthcheck_res=$(wget --no-check-certificate -qO - ${url}/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