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..b798712 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ARG BASE_IMAGE=ubuntu:22.04 FROM ${BASE_IMAGE} as documentserver -LABEL maintainer Jiří Štefka +LABEL maintainer Ascensio System SIA ARG PG_VERSION=14 diff --git a/README.md b/README.md index ab7cff4..a2723cc 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) @@ -546,5 +356,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/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..91a96b5 100755 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -653,30 +653,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