diff --git a/.gitea/workflows/claude-review.yml b/.gitea/workflows/claude-review.yml new file mode 100644 index 0000000..c99c08e --- /dev/null +++ b/.gitea/workflows/claude-review.yml @@ -0,0 +1,23 @@ +name: Claude Code Review + +on: + pull_request: + types: [opened, synchronize] + branches: [master, develop, 'hotfix/**', 'release/**'] + +jobs: + claude-review: + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - uses: ONLYOFFICE/DocSpace-buildtools/.gitea/actions/claude-review@develop + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + gitea_token: ${{ secrets.GITEA_TOKEN }} diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index e953bce..0000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,13 +0,0 @@ -**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:** diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..bcda832 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,83 @@ +name: "Bug report" +description: "Use this template if you're running into issues with DocumentServer Docker container." +body: + - type: checkboxes + id: unique + attributes: + label: "This issue is unique." + options: + - label: "I have used the [search tool](https://github.com/ONLYOFFICE/Docker-DocumentServer/issues?q=) and did not find an issue describing my bug." + required: true + - type: dropdown + id: os + attributes: + label: Operating System + description: "Select the operating system where Docker is running." + multiple: true + options: + - Windows + - macOS + - Linux + validations: + required: true + - type: dropdown + id: architecture + attributes: + label: Architecture + description: "Select the architecture of the system." + options: + - x86_64 + - arm64 + validations: + required: true + - type: input + id: docker-version + attributes: + label: "Docker version" + description: "Provide your Docker version (run `docker --version`)." + placeholder: "Example: Docker version 24.0.5" + validations: + required: true + - type: input + id: docs-version + attributes: + label: "ONLYOFFICE-Docs version" + description: "Please provide the exact version or Docker tag you are using." + placeholder: "Example: 8.0.1 or latest" + validations: + required: true + - type: textarea + id: repro-steps + attributes: + label: "Reproduction Steps" + description: "Provide information on how to reproduce this bug. Make sure your instructions are clear." + placeholder: | + Example: + 1. Pull the latest DocumentServer image + 2. Start container with docker-compose + 3. Access http://localhost + 4. Observe the issue + validations: + required: true + - type: textarea + id: expected + attributes: + label: "Expected Behavior" + description: "What did you expect to happen?" + placeholder: "Example: The container should start successfully and be accessible on port 80." + validations: + required: true + - type: textarea + id: actual + attributes: + label: "Actual Behavior" + description: "What did actually happen?" + placeholder: "Example: The container starts but DocumentServer returns 502 Bad Gateway error." + validations: + required: true + - type: textarea + id: additional + attributes: + label: "Additional information" + description: "If you have any screenshots, error messages, logs, or other information that you feel is necessary to explain the issue, feel free to attach them here." + placeholder: "Example: Container logs, error messages, configuration details, etc." diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..446335f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: DocumentServer Docker Documentation + url: https://helpcenter.onlyoffice.com/docs/installation/developer/docker + about: Check the Docker documentation for configuration and deployment guides. + - name: Community Forum + url: https://community.onlyoffice.com/ + about: Ask questions and get help from the ONLYOFFICE community. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..848be79 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,14 @@ +name: "Feature request" +description: "Use this form to suggest a feature." +body: + - type: checkboxes + attributes: + label: "This issue is unique." + options: + - label: "I have used the [search tool](https://github.com/ONLYOFFICE/Docker-DocumentServer/issues?q=) and did not find an issue describing my idea." + required: true + - type: textarea + attributes: + label: Your idea. + validations: + required: true diff --git a/.github/workflows/4testing-build.yml b/.github/workflows/4testing-build.yml index ab6a01c..0511be7 100644 --- a/.github/workflows/4testing-build.yml +++ b/.github/workflows/4testing-build.yml @@ -77,31 +77,31 @@ jobs: exit 1 fi echo "editions=$(jq -n -c --arg s "${EDITIONS[*]}" '($s|split(" "))')" >> $GITHUB_OUTPUT + echo "platforms=$(jq -c -n '$ARGS.positional' --args "${PLATFORMS[@]}")" >> $GITHUB_OUTPUT outputs: editions: ${{ steps.matrix.outputs.editions }} + platforms: ${{ steps.matrix.outputs.platforms }} build: - name: "Build ${{ matrix.image }}-${{ matrix.edition }}" - runs-on: ubuntu-latest + name: "Build ${{ matrix.image }}-${{ matrix.edition }}:${{ matrix.platform }}" + runs-on: ${{ (matrix.platform == 'arm64') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }} needs: prepare strategy: fail-fast: false matrix: image: ["documentserver"] edition: ${{ fromJSON(needs.prepare.outputs.editions) }} + platform: ${{ fromJSON(needs.prepare.outputs.platforms) }} steps: - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: actions/checkout@v4 - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} @@ -126,8 +126,7 @@ jobs: id: build-ds env: BRANCH_NAME: ${{ github.ref_name }} - AMD64: ${{ github.event.inputs.amd64 }} - ARM64: ${{ github.event.inputs.arm64 }} + PLATFORM: linux/${{ matrix.platform }} BUILD_NUMBER: ${{ github.event.inputs.build }} EDITION: ${{ matrix.edition }} IMAGE: ${{ matrix.image }} @@ -149,10 +148,6 @@ jobs: ;; esac - [ "${AMD64}" = true ] && PLATFORMS+=("amd64") - [ "${ARM64}" = true ] && PLATFORMS+=("arm64") - PLATFORM=$(echo ${PLATFORMS[*]/#/linux/} | tr ' ' ',') - if [ "$BRANCH_NAME" = develop ]; then BUILD_CHANNEL=nightly PRODUCT_VERSION=99.99.99 @@ -164,10 +159,9 @@ jobs: export PRODUCT_EDITION export PACKAGE_VERSION=${PRODUCT_VERSION}-${BUILD_NUMBER} export BUILD_CHANNEL - export PLATFORM export DOCKERFILE=Dockerfile export PREFIX_NAME=4testing- - export TAG=${PRODUCT_VERSION}.${BUILD_NUMBER} + export TAG=${PRODUCT_VERSION}.${BUILD_NUMBER}-${{ matrix.platform }} ### ==>> Build and push images at this step ### @@ -186,6 +180,7 @@ jobs: - name: Trigger zap manualy if: >- matrix.edition == 'community' && + matrix.platform == 'amd64' && (startsWith(steps.build-ds.outputs.branch, 'release/') || startsWith(steps.build-ds.outputs.branch, 'hotfix/')) env: @@ -200,3 +195,156 @@ jobs: -f version="${VERSION}" shell: bash + - name: Save build result to file + if: always() + run: | + mkdir -p build-result + + cat > build-result/info.json < /dev/null 2>&1; then + echo "Found image: $img" + FROM_TAGS+=( "$img" ) + return 0 + fi + + echo "Image not found yet, retrying in ${interval}s..." + sleep $interval + elapsed=$(( elapsed + interval )) + done + + echo "ERROR: Image not found after ${timeout}s: $img" + return 1 + } + + if [[ "${AMD64_STATUS}" == "success" ]]; then + check_image "${COMPANY_NAME}/4testing-${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}-amd64" + fi + + if [[ "${ARM64_STATUS}" == "success" ]]; then + check_image "${COMPANY_NAME}/4testing-${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}-arm64" + fi + + PUSH_TAGS=( + -t "${COMPANY_NAME}/4testing-${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}" + ) + + if [[ "${BUILD_CHANNEL}" == "nightly" ]]; then + PUSH_TAGS+=( -t "${COMPANY_NAME}/4testing-${PRODUCT_NAME}${PRODUCT_EDITION}:latest" ) + fi + + docker buildx imagetools create "${PUSH_TAGS[@]}" "${FROM_TAGS[@]}" + + ### ==>> Cleanup platform-specific tags ### + + REPO="${COMPANY_NAME}/4testing-${PRODUCT_NAME}${PRODUCT_EDITION}" + + echo "Getting Docker Hub token..." + TOKEN=$(curl -s -X POST "https://hub.docker.com/v2/users/login" \ + -H "Content-Type: application/json" \ + -d "{\"username\": \"${DOCKER_PAT_USERNAME}\", \"password\": \"${DOCKER_PAT_ACCESS_TOKEN}\"}" \ + | jq -r .token) + + if [ -z "${TOKEN}" ] || [ "${TOKEN}" = "null" ]; then + echo "ERROR: Failed to get Docker Hub token" + exit 1 + fi + echo "Docker Hub token obtained successfully" + + for IMG in "${FROM_TAGS[@]}"; do + PLATFORM_TAG="${IMG##*:}" + echo "Deleting tag: ${IMG}" + + HTTP_STATUS=$(curl -s -o /tmp/delete_response.json -w "%{http_code}" -X DELETE \ + -H "Authorization: JWT ${TOKEN}" \ + "https://hub.docker.com/v2/repositories/${REPO}/tags/${PLATFORM_TAG}/") + + echo "Response HTTP status: ${HTTP_STATUS}" + echo "Response body: $(cat /tmp/delete_response.json)" + + if [ "${HTTP_STATUS}" = "204" ]; then + echo "Successfully deleted: ${IMG}" + else + echo "WARNING: Unexpected status ${HTTP_STATUS} when deleting ${IMG}" + fi + done diff --git a/.github/workflows/stable-build.yml b/.github/workflows/stable-build.yml index 9d5fcdb..8f08461 100644 --- a/.github/workflows/stable-build.yml +++ b/.github/workflows/stable-build.yml @@ -1,6 +1,6 @@ ### This workflow setup instance then build and push images ### name: Multi-arch build stable -run-name: ${{ inputs.tag }} (${{ inputs.release_number }}) +run-name: ${{ inputs.tag }} (${{ inputs.release_number }}) — ${{ inputs.community && 'CE ' || '' }}${{ inputs.enterprise && 'EE DE' || '' }} on: workflow_dispatch: @@ -19,6 +19,14 @@ on: type: boolean required: true default: true + community: + type: boolean + description: 'Release Community Edition' + default: true + enterprise: + type: boolean + description: 'Release Enterprise editions (-ee and -de)' + default: true env: COMPANY_NAME: "onlyoffice" @@ -28,26 +36,54 @@ env: LATEST: ${{ github.event.inputs.latest }} jobs: + setup: + name: "Prepare editions matrix" + runs-on: ubuntu-latest + outputs: + editions: ${{ steps.set.outputs.editions }} + editions_ucs: ${{ steps.set.outputs.editions_ucs }} + steps: + - name: Build editions list + id: set + shell: bash + env: + INPUT_C: ${{ github.event.inputs.community }} + INPUT_E: ${{ github.event.inputs.enterprise }} + run: | + set -eux + editions=$(jq -nc \ + --argjson c "$INPUT_C" \ + --argjson e "$INPUT_E" \ + '[ if $c then "" else empty end, + if $e then ("-ee", "-de") else empty end ]') + editions_ucs=$(echo "$editions" | jq -c 'map(select(. != "-de"))') + echo "editions=$editions" >> "$GITHUB_OUTPUT" + echo "editions_ucs=$editions_ucs" >> "$GITHUB_OUTPUT" + echo "Matrix editions: $editions" + echo "Matrix editions (UCS): $editions_ucs" + build: name: "Release image: DocumentServer${{ matrix.edition }}" runs-on: ubuntu-latest + needs: [setup] + if: ${{ needs.setup.outputs.editions != '[]' }} strategy: fail-fast: false matrix: images: ["documentserver-stable"] - edition: ["", "-ee", "-de"] + edition: ${{ fromJSON(needs.setup.outputs.editions) }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} @@ -69,16 +105,22 @@ jobs: exit 0 shell: bash - - name: Update Docker Hub README - uses: peter-evans/dockerhub-description@v4 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - repository: ${{ env.COMPANY_NAME }}/${{ env.PRODUCT_NAME }}${{ matrix.edition }} + # Disable for now + # Related with issue: + # https://github.com/peter-evans/dockerhub-description/issues/294 + # + #- name: Update Docker Hub README + # uses: peter-evans/dockerhub-description@v4 + # with: + # username: ${{ secrets.DOCKER_HUB_USERNAME }} + # password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + # repository: ${{ env.COMPANY_NAME }}/${{ env.PRODUCT_NAME }}${{ matrix.edition }} release_4enterprise: name: "Release image: onlyoffice4enterprise" runs-on: ubuntu-latest + needs: [setup] + if: ${{ github.event.inputs.enterprise == 'true' }} steps: - name: Checkout code uses: actions/checkout@v4 @@ -105,25 +147,25 @@ jobs: build-nonexample: name: "Release image: DocumentServer${{ matrix.edition }}-nonExample" runs-on: ubuntu-latest - needs: [build] + needs: [build, setup] if: ${{ false }} strategy: fail-fast: false matrix: images: ["documentserver-nonexample"] - edition: ["", "-ee", "-de"] + edition: ${{ fromJSON(needs.setup.outputs.editions) }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} @@ -142,22 +184,22 @@ jobs: build-ucs-ubuntu20: name: "Release image: DocumentServer${{ matrix.edition }}-ucs" runs-on: ubuntu-latest + if: ${{ needs.setup.outputs.editions_ucs != '[]' }} + needs: [setup] strategy: fail-fast: false matrix: - edition: ["", "-ee"] + edition: ${{ fromJSON(needs.setup.outputs.editions_ucs) }} + platform: ["amd64"] steps: - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: actions/checkout@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} @@ -166,6 +208,7 @@ jobs: env: PACKAGE_BASEURL: ${{ secrets.REPO_BASEURL }} PRODUCT_EDITION: ${{ matrix.edition }} + PLATFORM: linux/${{ matrix.platform }} run: | set -eux export DOCKERFILE=Dockerfile diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..27553ce --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,71 @@ +## Project Overview + +ONLYOFFICE Docker-DocumentServer — single-container Docker image for ONLYOFFICE Docs with all services (docservice, converter, nginx, PostgreSQL, Redis, RabbitMQ) managed by Supervisor. + +## Tech Stack + +Docker, Docker BuildX, Bash, Nginx, Supervisor, PostgreSQL/MySQL/MariaDB/MSSQL/Oracle, Redis, RabbitMQ/ActiveMQ + +## Project Structure + +``` +Dockerfile — Main image (Ubuntu 24.04 base) +production.dockerfile — Stable/release image builder +docker-compose.yml — Local dev CE (documentserver only, no bundled services) +docker-compose.enterprise.yml — Local dev EE (with postgres, rabbitmq, redis) +docker-compose.developer.yml — Local dev DE (with postgres, rabbitmq, redis) +docker-bake.hcl — BuildX multi-platform config +Makefile — Build system (image, deploy, clean targets) +run-document-server.sh — Main entrypoint script (842 lines) +config/supervisor/ds/ — Supervisor service configs (ds, ds-adminpanel, ds-converter, ds-docservice, ds-example, ds-metrics) +config/supervisor/supervisor — Shell script for supervisord startup +tests/ — Integration tests (DB/AMQP/SSL matrix) +fonts/ — Custom fonts directory +oracle/ — Oracle SQLPlus wrapper +``` + +## Build & Run + +```bash +# Build with Makefile +make image PRODUCT_VERSION=9.2.0 BUILD_NUMBER=1 + +# Build with Docker +docker build -t onlyoffice/documentserver . + +# Run +docker run -i -t -d -p 80:80 onlyoffice/documentserver + +# Docker Compose Community Edition +docker-compose up -d + +# Docker Compose Enterprise Edition +docker compose -f docker-compose.enterprise.yml up -d + +# Run tests +cd tests && ./test.sh +``` + +## Key Patterns + +- Single-container architecture: all services in one image via Supervisor +- Three editions: Community, Enterprise (-ee), Developer (-de) +- `run-document-server.sh` handles all configuration, DB init, service startup +- Multi-arch support: amd64, arm64 +- Multiple database backends via DB_TYPE environment variable +- SSL/TLS with Let's Encrypt integration (Certbot) +- Non-root execution possible + +## Review Focus + +**Security**: JWT validation, SSL/TLS config, credential handling in entrypoint +**Shell**: `run-document-server.sh` is critical — quoting, error handling, DB initialization logic +**Docker**: Image size, layer count, base image updates +**Supervisor**: Service configs, process dependencies, restart policies +**Config**: Default ports, exposed services, database connection strings + +## Git Workflow + +- **Main branch**: `master` +- **Integration branch**: `develop` +- **Branch naming**: `feature/*`, `bugfix/*`, `hotfix/*`, `release/*` diff --git a/Dockerfile b/Dockerfile index 0cae600..1e0277b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,15 +2,15 @@ ARG BASE_VERSION=24.04 ARG BASE_IMAGE=ubuntu:$BASE_VERSION -FROM ${BASE_IMAGE} AS documentserver -LABEL maintainer Ascensio System SIA +FROM ${BASE_IMAGE} AS documentserver-base +LABEL maintainer="Ascensio System SIA " ARG BASE_VERSION ARG PG_VERSION=16 ARG PACKAGE_SUFFIX=t64 -ARG OOU_VERSION_MAJOR=9.2.1 +ARG OOU_VERSION_MAJOR=9.4.1 ARG OOU_BUILD=1 ENV OC_RELEASE_NUM=23 @@ -28,14 +28,9 @@ ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=nonint ARG ONLYOFFICE_VALUE=onlyoffice COPY fonts/ /usr/share/fonts/truetype/ -RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ +RUN echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \ apt-get -y update && \ apt-get -yq install wget apt-transport-https gnupg locales lsb-release && \ - wget -q -O /etc/apt/sources.list.d/mssql-release.list "https://packages.microsoft.com/config/ubuntu/$BASE_VERSION/prod.list" && \ - wget -q -O /tmp/microsoft.asc https://packages.microsoft.com/keys/microsoft.asc && \ - apt-key add /tmp/microsoft.asc && \ - gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg < /tmp/microsoft.asc && \ - apt-get -y update && \ locale-gen en_US.UTF-8 && \ echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \ ACCEPT_EULA=Y apt-get -yq install \ @@ -46,9 +41,7 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ cron \ curl \ htop \ - libaio1${PACKAGE_SUFFIX} \ libasound2${PACKAGE_SUFFIX} \ - libboost-regex-dev \ libcairo2 \ libcurl3-gnutls \ libcurl4 \ @@ -59,52 +52,25 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ libxml2 \ libxss1 \ libxtst6 \ - mssql-tools18 \ - mysql-client \ nano \ net-tools \ netcat-openbsd \ nginx-extras \ - postgresql \ - postgresql-client \ pwgen \ - rabbitmq-server \ - redis-server \ sudo \ supervisor \ ttf-mscorefonts-installer \ - unixodbc-dev \ unzip \ xvfb \ xxd \ - zlib1g || dpkg --configure -a && \ - # Added dpkg --configure -a to handle installation issues with rabbitmq-server on arm64 architecture + zlib1g && \ if [ $(find /usr/share/fonts/truetype/msttcorefonts -maxdepth 1 -type f -iname '*.ttf' | wc -l) -lt 30 ]; \ then echo 'msttcorefonts failed to download'; exit 1; fi && \ - echo "SERVER_ADDITIONAL_ERL_ARGS=\"+S 1:1\"" | tee -a /etc/rabbitmq/rabbitmq-env.conf && \ - sed -i "s/bind .*/bind 127.0.0.1/g" /etc/redis/redis.conf && \ - sed 's|\(application\/zip.*\)|\1\n application\/wasm wasm;|' -i /etc/nginx/mime.types && \ - pg_conftool $PG_VERSION main set listen_addresses 'localhost' && \ - service postgresql restart && \ - sudo -u postgres psql -c "CREATE USER $ONLYOFFICE_VALUE WITH password '$ONLYOFFICE_VALUE';" && \ - sudo -u postgres psql -c "CREATE DATABASE $ONLYOFFICE_VALUE OWNER $ONLYOFFICE_VALUE;" && \ - wget -O basic.zip ${OC_DOWNLOAD_URL}/instantclient-basic-linux.$(dpkg --print-architecture | sed 's/amd64/x64/')-${OC_FILE_SUFFIX}.zip && \ - wget -O sqlplus.zip ${OC_DOWNLOAD_URL}/instantclient-sqlplus-linux.$(dpkg --print-architecture | sed 's/amd64/x64/')-${OC_FILE_SUFFIX}.zip && \ - unzip -o basic.zip -d /usr/share && \ - unzip -o sqlplus.zip -d /usr/share && \ - mv /usr/share/instantclient_${OC_VER_DIR} /usr/share/instantclient && \ - find /usr/lib /lib -name "libaio.so.1$PACKAGE_SUFFIX" -exec bash -c 'ln -sf "$0" "$(dirname "$0")/libaio.so.1"' {} \; && \ - service postgresql stop && \ - service redis-server stop && \ - service rabbitmq-server stop && \ - service supervisor stop && \ - service nginx stop && \ rm -rf /var/lib/apt/lists/* COPY config/supervisor/supervisor /etc/init.d/ COPY config/supervisor/ds/*.conf /etc/supervisor/conf.d/ COPY run-document-server.sh /app/ds/run-document-server.sh -COPY oracle/sqlplus /usr/bin/sqlplus EXPOSE 80 443 @@ -121,16 +87,52 @@ ENV COMPANY_NAME=$COMPANY_NAME \ DS_PLUGIN_INSTALLATION=false \ DS_DOCKER_INSTALLATION=true -## 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" && \ -## rm -f /tmp/onlyoffice-documentserver*.deb && \ -RUN wget -q -P /tmp "https://github.com/thomisus/server/releases/download/${OOU_VERSION_MAJOR}.${OOU_BUILD}/onlyoffice-documentserver_${OOU_VERSION_MAJOR}-${OOU_BUILD}.oou_amd64.deb" && \ + +RUN if [ -n "${PRODUCT_EDITION}" ]; then \ + wget -q -O /etc/apt/sources.list.d/mssql-release.list "https://packages.microsoft.com/config/ubuntu/$BASE_VERSION/prod.list" && \ + wget -q -O /tmp/microsoft.asc https://packages.microsoft.com/keys/microsoft.asc && \ + apt-key add /tmp/microsoft.asc && \ + gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg < /tmp/microsoft.asc && \ apt-get -y update && \ + ACCEPT_EULA=Y apt-get -yq install \ + libaio1${PACKAGE_SUFFIX} \ + libboost-regex-dev \ + mssql-tools18 \ + mysql-client \ + unixodbc-dev \ + redis-server \ + postgresql postgresql-client \ + rabbitmq-server && \ + dpkg --configure -a && \ + wget -O basic.zip ${OC_DOWNLOAD_URL}/instantclient-basic-linux.$(dpkg --print-architecture | sed 's/amd64/x64/')-${OC_FILE_SUFFIX}.zip && \ + wget -O sqlplus.zip ${OC_DOWNLOAD_URL}/instantclient-sqlplus-linux.$(dpkg --print-architecture | sed 's/amd64/x64/')-${OC_FILE_SUFFIX}.zip && \ + unzip -o basic.zip -d /usr/share && \ + unzip -o sqlplus.zip -d /usr/share && \ + rm -f basic.zip sqlplus.zip && \ + mv /usr/share/instantclient_${OC_VER_DIR} /usr/share/instantclient && \ + find /usr/lib /lib -name "libaio.so.1$PACKAGE_SUFFIX" -exec bash -c 'ln -sf "$0" "$(dirname "$0")/libaio.so.1"' {} \; && \ + sed -i "s/bind .*/bind 127.0.0.1/g" /etc/redis/redis.conf && \ + echo "SERVER_ADDITIONAL_ERL_ARGS=\"+S 1:1\"" | tee -a /etc/rabbitmq/rabbitmq-env.conf && \ + pg_conftool $PG_VERSION main set listen_addresses 'localhost' && \ service postgresql start && \ - apt-get -yq install /tmp/onlyoffice-documentserver_${OOU_VERSION_MAJOR}-${OOU_BUILD}.oou_amd64.deb && \ - PGPASSWORD=$ONLYOFFICE_VALUE dropdb -h localhost -p 5432 -U $ONLYOFFICE_VALUE $ONLYOFFICE_VALUE && \ - sudo -u postgres psql -c "DROP ROLE onlyoffice;" && \ + sudo -u postgres psql -c "CREATE USER $ONLYOFFICE_VALUE WITH password '$ONLYOFFICE_VALUE';" && \ + sudo -u postgres psql -c "CREATE DATABASE $ONLYOFFICE_VALUE OWNER $ONLYOFFICE_VALUE;" && \ service postgresql stop && \ + rm -rf /var/lib/apt/lists/*; fi + + +RUN wget -q -P /tmp "https://github.com/thomisus/server/releases/download/${OOU_VERSION_MAJOR}.${OOU_BUILD}/onlyoffice-documentserver_${OOU_VERSION_MAJOR}-${OOU_BUILD}.oou_amd64.deb" && \ + apt-get -y update && \ + [ -n "${PRODUCT_EDITION}" ] && service postgresql start || true && \ + apt-get -yq install /tmp/onlyoffice-documentserver_${OOU_VERSION_MAJOR}-${OOU_BUILD}.oou_amd64.deb && \ + if [ -n "${PRODUCT_EDITION}" ]; then \ + PGPASSWORD=$ONLYOFFICE_VALUE dropdb -h localhost -p 5432 -U $ONLYOFFICE_VALUE $ONLYOFFICE_VALUE && \ + sudo -u postgres psql -c "DROP ROLE onlyoffice;" && \ + service postgresql stop; \ + else \ + rm -f /etc/supervisor/conf.d/ds-adminpanel.conf && \ + sed -i 's/,adminpanel//' /etc/supervisor/conf.d/ds.conf; \ + fi && \ chmod 755 /etc/init.d/supervisor && \ sed "s/COMPANY_NAME/${COMPANY_NAME}/g" -i /etc/supervisor/conf.d/*.conf && \ service supervisor stop && \ @@ -141,9 +143,15 @@ RUN wget -q -P /tmp "https://github.com/thomisus/server/releases/download/${O printf "\nexit" >> /var/www/$COMPANY_NAME/documentserver/server/schema/oracle/createdb.sql && \ printf "\nexit" >> /var/www/$COMPANY_NAME/documentserver/server/schema/oracle/removetbl.sql && \ rm -f /tmp/*.deb && \ + rm -f /tmp/$PACKAGE_FILE && \ rm -rf /var/log/$COMPANY_NAME && \ rm -rf /var/lib/apt/lists/* -VOLUME /var/log/$COMPANY_NAME /var/lib/$COMPANY_NAME /var/www/$COMPANY_NAME/Data /var/lib/postgresql /var/lib/rabbitmq /var/lib/redis /usr/share/fonts/truetype/custom - +FROM documentserver-base AS documentserver-community +VOLUME /var/log/$COMPANY_NAME /var/lib/$COMPANY_NAME /var/www/$COMPANY_NAME/Data /usr/share/fonts/truetype/custom +ENTRYPOINT ["/app/ds/run-document-server.sh"] + +FROM documentserver-base AS documentserver-enterprise +COPY oracle/sqlplus /usr/bin/sqlplus +VOLUME /var/log/$COMPANY_NAME /var/lib/$COMPANY_NAME /var/www/$COMPANY_NAME/Data /var/lib/postgresql /var/lib/rabbitmq /var/lib/redis /usr/share/fonts/truetype/custom ENTRYPOINT ["/app/ds/run-document-server.sh"] diff --git a/LICENSE.txt b/LICENSE similarity index 90% rename from LICENSE.txt rename to LICENSE index dba13ed..53bc62c 100644 --- a/LICENSE.txt +++ b/LICENSE @@ -1,7 +1,7 @@ GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -643,7 +643,7 @@ the "copyright" line and a pointer to where the full notice is found. GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -658,4 +658,71 @@ 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 -. +. + +Copyright (C) 2009-2026 Ascensio System SIA + + This Program is licensed under the GNU Affero General Public +License v3.0 (AGPLv3), as supplemented by the terms set forth below. These +terms form an integral part of this License and shall be included in all +copies and distributions of the Program. They define conditions for the +exercise of rights granted under the License, including use, modification, +and distribution of the Program. + Pursuant to Section 7 of the License, the following terms supplement and +clarify the application of these conditions. Failure to comply with these +terms constitutes a violation of the License and may result in termination +of rights under Section 8 of the License. + + Additional Terms + + 1. Retention of Notices and Attribution. + Pursuant to Sections 4, 5, and 7(b) of the License, you must retain all +applicable copyright notices, license notices, warranty disclaimers, and +attribution or origin notices included in the Program. + + 2. Modification Notice Requirement. + + Modified versions of the Program must carry prominent notices stating that +they have been modified, including the date (or dates) of such modification, +and must clearly indicate that they are based on the original ONLYOFFICE +software developed by Ascensio System SIA. + + 3. Appropriate Legal Notices in User Interfaces. + Where the Program, or any modified version thereof, includes interactive +user interfaces, the required notices shall be displayed through a clearly +accessible and prominently visible user interface feature, in accordance +with the requirement to present Appropriate Legal Notices under Section 5 +of the License. Such notices must enable users to: + + (i) identify ONLYOFFICE as the original developer; + + (ii) understand that the version in use may be a modified version; and + + (iii) access the applicable license information. + + 4. No Trademark License. + + In accordance with Section 7(e) this License does not grant any rights to +use the trademarks, service marks, trade names, logos, or branding of the +Licensor. Any use of such trademarks is governed by the Licensor's +Trademark Policy, available at: + + + 5. Non-Code Content Licensing. + + Certain non-code elements included in the Program or its distribution, +including but not limited to illustrations, icon sets, and technical writing +or documentation content, are licensed under the Creative Commons +Attribution-ShareAlike 4.0 International License (CC BY-SA 4.0). For the +avoidance of doubt, this license applies solely to such non-code content +and does not modify or replace the licensing terms applicable to the +Program's source code, which remains subject to the GNU Affero General +Public License v3.0 (AGPLv3). Nothing in this section limits any +obligation to retain copyright notices, attribution, origin information, or +Appropriate Legal Notices under the AGPLv3 and the additional terms +applicable to the Program. The full license text is available at: + + + You can contact Ascensio System SIA by electronic mail at: +info@onlyoffice.com and by postal mail at: 20A-6 Ernesta Birznieka-Upisha +Street, Riga, LV-1050, Latvia, European Union. diff --git a/README.md b/README.md index d2b5136..df872ad 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,13 @@ If you want a production ready release, contact Ascensio System https://www.only - [Storing Data](#storing-data) - [Running ONLYOFFICE Document Server on Different Port](#running-onlyoffice-document-server-on-different-port) - [Running ONLYOFFICE Document Server using HTTPS](#running-onlyoffice-document-server-using-https) + + [Using the automatically generated Let's Encrypt SSL Certificates](#using-the-automatically-generated-lets-encrypt-ssl-certificates) + [Generation of Self Signed Certificates](#generation-of-self-signed-certificates) + [Strengthening the Server Security](#strengthening-the-server-security) + [Installation of the SSL Certificates](#installation-of-the-ssl-certificates) + [Available Configuration Parameters](#available-configuration-parameters) -* [Installing ONLYOFFICE Document Server integrated with Community and Mail Servers](#installing-onlyoffice-document-server-integrated-with-community-and-mail-servers) +* [Installing ONLYOFFICE Document Server using Docker Compose](#installing-onlyoffice-document-server-using-docker-compose) +* [Installing ONLYOFFICE Document Server as a part of ONLYOFFICE Workspace](#installing-onlyoffice-document-server-as-a-part-of-onlyoffice-workspace) * [ONLYOFFICE Document Server ipv6 setup](#onlyoffice-document-server-ipv6-setup) * [Issues](#issues) - [Docker Issues](#docker-issues) @@ -34,7 +36,7 @@ Starting from version 6.0, Document Server is distributed as ONLYOFFICE Docs. It ONLYOFFICE Docs can be used as a part of [ONLYOFFICE DocSpace](https://www.onlyoffice.com/docspace.aspx) and ONLYOFFICE Workspace, or with [third-party sync&share solutions](https://www.onlyoffice.com/all-connectors.aspx) (e.g. Odoo, Moodle, Nextcloud, ownCloud, Seafile, etc.) to enable collaborative editing within their interface. -***Important*** Please update `docker-engine` to latest version (`20.10.21` as of writing this doc) before using it. We use `ubuntu:24.04` as base image and it older versions of docker have compatibility problems with it +***Important*** Please update `docker-engine` to latest version (`20.10.21` as of writing this doc) before using it. We use `ubuntu:24.04` as base image and older versions of docker have compatibility problems with it ## Functionality ## @@ -63,7 +65,7 @@ ONLYOFFICE Docs offer support for plugins allowing you to add specific features * **CPU**: dual-core 2 GHz or higher * **Swap**: at least 2 GB * **HDD**: at least 2 GB of free space -* **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 +* **Distribution**: 64-bit Red Hat, CentOS or other compatible distribution with kernel version 3.8 or later, 64-bit Debian, Ubuntu or other compatible distribution with kernel version 3.8 or later * **Docker**: version 1.9.0 or later ## Running Docker Image @@ -81,16 +83,33 @@ All the data are stored in the specially-designated directories, **data volumes* * **/var/www/onlyoffice/Data** for certificates * **/var/lib/onlyoffice** for file cache * **/var/lib/postgresql** for database +* **/var/lib/rabbitmq** for message broker +* **/var/lib/redis** for cache 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. +**Community Edition:** + +```bash sudo docker run -i -t -d -p 80:80 \ -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 \ + onlyoffice/documentserver +``` + +**Enterprise/Developer Edition** — PostgreSQL, RabbitMQ and Redis are bundled in the image: + +```bash + sudo docker run -i -t -d -p 80:80 \ + -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 \ -v /app/onlyoffice/DocumentServer/rabbitmq:/var/lib/rabbitmq \ -v /app/onlyoffice/DocumentServer/redis:/var/lib/redis \ - -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql onlyoffice/documentserver + onlyoffice/documentserver-ee # or onlyoffice/documentserver-de for Developer Edition +``` 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 @@ -193,24 +212,8 @@ Below is the complete list of parameters that can be set using environment varia - **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` - **NODE_EXTRA_CA_CERTS**: The [NODE_EXTRA_CA_CERTS](https://nodejs.org/api/cli.html#node_extra_ca_certsfile "Node.js documentation") to extend CAs with the extra certificates for Node.js. Defaults to `/var/www/onlyoffice/Data/certs/extra-ca-certs.pem`. -- **DB_TYPE**: The database type. Supported values are `postgres`, `mariadb`, `mysql`, `mssql` or `oracle`. 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 use. Should be existing on container startup. -- **DB_USER**: The new user name with superuser permissions for the database account. -- **DB_PWD**: The password set for the database account. -- **DB_SCHEMA**: Database schema name (optional). - - **PostgreSQL** — schema for [search_path](https://www.postgresql.org/docs/current/ddl-schemas.html#DDL-SCHEMAS-PATH), default `public`. - - **MSSQL** — schema to set as [DEFAULT_SCHEMA](https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-user-transact-sql?view=sql-server-ver17#default_schema---schema_name--null-), default `dbo`. -- **AMQP_URI**: The [AMQP URI](https://www.rabbitmq.com/uri-spec.html "RabbitMQ URI Specification") to connect to message broker server. -- **AMQP_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. -- **REDIS_SERVER_USER**: The Redis server username. The username is not set by default. -- **REDIS_SERVER_PASS**: The Redis server password. The password is not set by default. -- **REDIS_SERVER_DB**: The Redis database index number to select. Defaults to `0`. - **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. +- **NGINX_WORKER_CONNECTIONS**: Sets the maximum number of simultaneous connections that can be opened by a nginx worker process. Defaults to the soft limit from `ulimit -n`. - **NGINX_ACCESS_LOG**: Defines whether access logging is enabled. Defaults to `false`. - **SECURE_LINK_SECRET**: Defines secret for the nginx config directive [secure_link_md5](https://nginx.org/en/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`. @@ -222,6 +225,8 @@ Below is the complete list of parameters that can be set using environment varia - **ALLOW_PRIVATE_IP_ADDRESS**: Defines if it is allowed to connect private IP address or not. Defaults to `false`. - **USE_UNAUTHORIZED_STORAGE**: Set to `true` if using self-signed certificates for your storage server e.g. Nextcloud. Defaults to `false` - **GENERATE_FONTS**: When 'true' regenerates fonts list and the fonts thumbnails etc. at each start. Defaults to `true` +- **ADMINPANEL_ENABLED**: Enables admin panel service autostart. Defaults to `false`. +- **EXAMPLE_ENABLED**: Enables example service autostart. Defaults to `false`. - **METRICS_ENABLED**: Specifies the enabling StatsD for ONLYOFFICE Document Server. Defaults to `false`. - **METRICS_HOST**: Defines StatsD listening host. Defaults to `localhost`. - **METRICS_PORT**: Defines StatsD listening port. Defaults to `8125`. @@ -230,6 +235,28 @@ Below is the complete list of parameters that can be set using environment varia - **LETS_ENCRYPT_MAIL**: Defines the domain administrator mail address for Let's Encrypt certificate. - **PLUGINS_ENABLED**: Defines whether to enable default plugins. Defaults to `true`. +#### Enterprise and Developer Edition Parameters + +The following dependency parameters are supported only in Enterprise and Developer editions. + +- **DB_TYPE**: The database type. Supported values are `postgres`, `mariadb`, `mysql`, `mssql` or `oracle`. 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 use. Should be existing on container startup. +- **DB_USER**: The new user name with superuser permissions for the database account. +- **DB_PWD**: The password set for the database account. +- **DB_SCHEMA**: Database schema name (optional). + - **PostgreSQL** — schema for [search_path](https://www.postgresql.org/docs/current/ddl-schemas.html#DDL-SCHEMAS-PATH), default `public`. + - **MSSQL** — schema to set as [DEFAULT_SCHEMA](https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-user-transact-sql?view=sql-server-ver17#default_schema---schema_name--null-), default `dbo`. +- **AMQP_URI**: The [AMQP URI](https://www.rabbitmq.com/uri-spec.html "RabbitMQ URI Specification") to connect to message broker server. +- **AMQP_TYPE**: The message broker type. Supported values are `rabbitmq` or `activemq`. Defaults to `rabbitmq`. +- **RABBIT_CONNECTIONS**: Sets the maximum number of simultaneous connections that can be opened to the RabbitMQ message broker. Defaults to the soft limit from `ulimit -n`. +- **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. +- **REDIS_SERVER_USER**: The Redis server username. The username is not set by default. +- **REDIS_SERVER_PASS**: The Redis server password. The password is not set by default. +- **REDIS_SERVER_DB**: The Redis database index number to select. Defaults to `0`. + ## Installing ONLYOFFICE Document Server using Docker Compose You can also install ONLYOFFICE Document Server using [docker-compose](https://docs.docker.com/compose/install "docker-compose"). @@ -248,10 +275,24 @@ cd Docker-DocumentServer After that, assuming you have docker-compose installed, execute the following command: +**Community Edition**: + ```bash docker-compose up -d ``` +**Enterprise Edition**: + +```bash +docker compose -f docker-compose.enterprise.yml up -d +``` + +**Developer Edition**: + +```bash +docker compose -f docker-compose.developer.yml up -d +``` + ## Installing ONLYOFFICE Document Server as a part of ONLYOFFICE Workspace ONLYOFFICE Document Server is a part of ONLYOFFICE Workspace that comprises also Community Server, Mail Server, and Control Panel. To install them, follow these easy steps: @@ -265,7 +306,7 @@ 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. +Install MySQL server. You can find MySQL installation instructions in the [official MySQL documentation](https://dev.mysql.com/doc/). **STEP 3**: Generate JWT Secret @@ -284,7 +325,6 @@ sudo docker run --net onlyoffice -i -t -d --restart=always --name onlyoffice-doc -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 ``` @@ -356,14 +396,14 @@ wget https://download.onlyoffice.com/install/workspace-install.sh **STEP 2**: Install ONLYOFFICE Workspace executing the following command: ```bash -workspace-install.sh -md yourdomain.com +bash workspace-install.sh -md yourdomain.com ``` Or, use [docker-compose](https://docs.docker.com/compose/install "docker-compose"). First you need to clone this [GitHub repository](https://github.com/ONLYOFFICE/Docker-CommunityServer/): ```bash wget https://raw.githubusercontent.com/ONLYOFFICE/Docker-CommunityServer/master/docker-compose.groups.yml -docker-compose up -d +docker-compose -f docker-compose.groups.yml up -d ``` ## ONLYOFFICE Document Server ipv6 setup diff --git a/config/supervisor/ds/ds-docservice.conf b/config/supervisor/ds/ds-docservice.conf index 7cb28f7..51c81ce 100644 --- a/config/supervisor/ds/ds-docservice.conf +++ b/config/supervisor/ds/ds-docservice.conf @@ -2,7 +2,7 @@ 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,APPLICATION_NAME=COMPANY_NAME +environment=NODE_ENV=production-linux,NODE_CONFIG_DIR=/etc/COMPANY_NAME/documentserver,NODE_DISABLE_COLORS=1,PKG_NATIVE_CACHE_PATH=/tmp/.cache,APPLICATION_NAME=COMPANY_NAME stdout_logfile=/var/log/COMPANY_NAME/documentserver/docservice/out.log stdout_logfile_backups=0 stdout_logfile_maxbytes=0 diff --git a/docker-bake.hcl b/docker-bake.hcl index 7fe3843..7b1c278 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -87,11 +87,10 @@ variable "UCS_PREFIX" { ### ↑ Variables for UCS build ↑ target "documentserver" { - target = "documentserver" + target = PRODUCT_EDITION == "" ? "documentserver-community" : "documentserver-enterprise" 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": "", + "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}" ] platforms = ["${PLATFORM}"] args = { @@ -121,12 +120,12 @@ target "documentserver-stable" { } target "documentserver-ucs" { - target = "documentserver" + target = PRODUCT_EDITION == "" ? "documentserver-community" : "documentserver-enterprise" dockerfile = "${DOCKERFILE}" tags = [ "docker.io/${COMPANY_NAME}/${PRODUCT_NAME}${PRODUCT_EDITION}-ucs:${TAG}" ] - platforms = ["linux/amd64", "linux/arm64"] + platforms = ["${PLATFORM}"] args = { "PRODUCT_EDITION": "${PRODUCT_EDITION}" "PRODUCT_NAME": "${PRODUCT_NAME}" diff --git a/docker-compose.developer.yml b/docker-compose.developer.yml new file mode 100644 index 0000000..a013bd0 --- /dev/null +++ b/docker-compose.developer.yml @@ -0,0 +1,93 @@ +services: + onlyoffice-documentserver: + build: + context: . + target: documentserver-enterprise + args: + - PRODUCT_EDITION=-de + image: onlyoffice/documentserver-de + container_name: onlyoffice-documentserver + depends_on: + - onlyoffice-postgresql + - onlyoffice-rabbitmq + - onlyoffice-redis + environment: + - DB_TYPE=postgres + - DB_HOST=onlyoffice-postgresql + - DB_PORT=5432 + - DB_NAME=onlyoffice + - DB_USER=onlyoffice + - DB_PWD=onlyoffice + - AMQP_URI=amqp://guest:guest@onlyoffice-rabbitmq + - REDIS_SERVER_HOST=onlyoffice-redis + # Uncomment strings below to enable the JSON Web Token validation. + #- JWT_ENABLED=true + #- JWT_SECRET=secret + #- JWT_HEADER=Authorization + #- JWT_IN_BODY=true + ports: + - '80:80' + - '443:443' + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8000/info/info.json"] + interval: 30s + retries: 5 + start_period: 60s + timeout: 10s + stdin_open: true + restart: always + stop_grace_period: 60s + volumes: + - /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:3 + restart: always + expose: + - '5672' + healthcheck: + test: ["CMD", "rabbitmq-diagnostics", "status"] + interval: 10s + retries: 3 + start_period: 10s + timeout: 10s + + onlyoffice-redis: + container_name: onlyoffice-redis + image: redis:7 + restart: always + expose: + - '6379' + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + retries: 3 + start_period: 10s + timeout: 10s + + onlyoffice-postgresql: + container_name: onlyoffice-postgresql + image: postgres:15 + environment: + - POSTGRES_DB=onlyoffice + - POSTGRES_USER=onlyoffice + - POSTGRES_PASSWORD=onlyoffice + restart: always + expose: + - '5432' + volumes: + - postgresql_data:/var/lib/postgresql + healthcheck: + test: ["CMD-SHELL", "pg_isready -U onlyoffice"] + interval: 10s + retries: 3 + start_period: 10s + timeout: 10s + +volumes: + postgresql_data: diff --git a/docker-compose.enterprise.yml b/docker-compose.enterprise.yml new file mode 100644 index 0000000..1460e20 --- /dev/null +++ b/docker-compose.enterprise.yml @@ -0,0 +1,93 @@ +services: + onlyoffice-documentserver: + build: + context: . + target: documentserver-enterprise + args: + - PRODUCT_EDITION=-ee + image: onlyoffice/documentserver-ee + container_name: onlyoffice-documentserver + depends_on: + - onlyoffice-postgresql + - onlyoffice-rabbitmq + - onlyoffice-redis + environment: + - DB_TYPE=postgres + - DB_HOST=onlyoffice-postgresql + - DB_PORT=5432 + - DB_NAME=onlyoffice + - DB_USER=onlyoffice + - DB_PWD=onlyoffice + - AMQP_URI=amqp://guest:guest@onlyoffice-rabbitmq + - REDIS_SERVER_HOST=onlyoffice-redis + # Uncomment strings below to enable the JSON Web Token validation. + #- JWT_ENABLED=true + #- JWT_SECRET=secret + #- JWT_HEADER=Authorization + #- JWT_IN_BODY=true + ports: + - '80:80' + - '443:443' + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8000/info/info.json"] + interval: 30s + retries: 5 + start_period: 60s + timeout: 10s + stdin_open: true + restart: always + stop_grace_period: 60s + volumes: + - /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:3 + restart: always + expose: + - '5672' + healthcheck: + test: ["CMD", "rabbitmq-diagnostics", "status"] + interval: 10s + retries: 3 + start_period: 10s + timeout: 10s + + onlyoffice-redis: + container_name: onlyoffice-redis + image: redis:7 + restart: always + expose: + - '6379' + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + retries: 3 + start_period: 10s + timeout: 10s + + onlyoffice-postgresql: + container_name: onlyoffice-postgresql + image: postgres:15 + environment: + - POSTGRES_DB=onlyoffice + - POSTGRES_USER=onlyoffice + - POSTGRES_PASSWORD=onlyoffice + restart: always + expose: + - '5432' + volumes: + - postgresql_data:/var/lib/postgresql + healthcheck: + test: ["CMD-SHELL", "pg_isready -U onlyoffice"] + interval: 10s + retries: 3 + start_period: 10s + timeout: 10s + +volumes: + postgresql_data: diff --git a/docker-compose.yml b/docker-compose.yml index 276f8cc..a77a3f6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,18 +2,10 @@ services: onlyoffice-documentserver: build: context: . - image: onlyoffice/documentserver #[-de,-ee] + target: documentserver-community + image: onlyoffice/documentserver 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 @@ -37,38 +29,3 @@ services: - /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:3 - restart: always - expose: - - '5672' - healthcheck: - test: ["CMD", "rabbitmq-diagnostics", "status"] - interval: 10s - retries: 3 - start_period: 10s - timeout: 10s - - onlyoffice-postgresql: - container_name: onlyoffice-postgresql - image: postgres:15 - environment: - - POSTGRES_DB=onlyoffice - - POSTGRES_USER=onlyoffice - - POSTGRES_HOST_AUTH_METHOD=trust - restart: always - expose: - - '5432' - volumes: - - postgresql_data:/var/lib/postgresql - healthcheck: - test: ["CMD-SHELL", "pg_isready -U onlyoffice"] - interval: 10s - retries: 3 - start_period: 10s - timeout: 10s - -volumes: - postgresql_data: diff --git a/run-document-server.sh b/run-document-server.sh index 71d1873..b146378 100644 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -89,7 +89,7 @@ elif [[ -f ${SSL_CERTIFICATE_PATH} ]]; then fi if [[ -n $NODE_EXTRA_ENVIRONMENT ]]; then - sed -i "s|^environment=.*$|&,NODE_EXTRA_CA_CERTS=${NODE_EXTRA_ENVIRONMENT}|" /etc/supervisor/conf.d/*.conf + sed -i "s|^environment=.*$|&,NODE_EXTRA_CA_CERTS=${NODE_EXTRA_ENVIRONMENT}|" ${SUPERVISOR_CONF_DIR}/*.conf fi CA_CERTIFICATES_PATH=${CA_CERTIFICATES_PATH:-${SSL_CERTIFICATES_DIR}/ca-certificates.pem} @@ -98,9 +98,7 @@ SSL_VERIFY_CLIENT=${SSL_VERIFY_CLIENT:-off} USE_UNAUTHORIZED_STORAGE=${USE_UNAUTHORIZED_STORAGE:-false} ONLYOFFICE_HTTPS_HSTS_ENABLED=${ONLYOFFICE_HTTPS_HSTS_ENABLED:-true} ONLYOFFICE_HTTPS_HSTS_MAXAGE=${ONLYOFFICE_HTTPS_HSTS_MAXAGE:-31536000} -SYSCONF_TEMPLATES_DIR="/app/ds/setup/config" -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" @@ -110,20 +108,20 @@ NGINX_CONFIG_PATH="/etc/nginx/nginx.conf" NGINX_WORKER_PROCESSES=${NGINX_WORKER_PROCESSES:-1} NGINX_ACCESS_LOG=${NGINX_ACCESS_LOG:-false} # Limiting the maximum number of simultaneous connections due to possible memory shortage -LIMIT=$(ulimit -n); [ $LIMIT -gt 1048576 ] && LIMIT=1048576 +LIMIT=$(ulimit -n); [ "$LIMIT" = "unlimited" ] || [ "$LIMIT" -gt 1048576 ] && LIMIT=1048576 NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-$LIMIT} RABBIT_CONNECTIONS=${RABBIT_CONNECTIONS:-$LIMIT} JWT_ENABLED=${JWT_ENABLED:-true} -# validate user's vars before usinig in json +# validate user's vars before using in json if [ "${JWT_ENABLED}" == "true" ]; then JWT_ENABLED="true" else JWT_ENABLED="false" fi -[ -z $JWT_SECRET ] && JWT_MESSAGE='JWT is enabled by default. A random secret is generated automatically. Run the command "docker exec $(sudo docker ps -q) sudo documentserver-jwt-status.sh" to get information about JWT.' +[[ "${JWT_ENABLED}" == "true" && -z "${JWT_SECRET}" ]] && JWT_MESSAGE='JWT is enabled by default. A random secret is generated automatically. Run the command "docker exec $(sudo docker ps -q) sudo documentserver-jwt-status.sh" to get information about JWT.' JWT_SECRET=${JWT_SECRET:-$(pwgen -s 32)} JWT_HEADER=${JWT_HEADER:-Authorization} @@ -135,11 +133,8 @@ ALLOW_PRIVATE_IP_ADDRESS=${ALLOW_PRIVATE_IP_ADDRESS:-false} GENERATE_FONTS=${GENERATE_FONTS:-true} -if [[ ${PRODUCT_NAME}${PRODUCT_EDITION} == "documentserver" ]]; then - REDIS_ENABLED=false -else - REDIS_ENABLED=true -fi +[ -n "${PRODUCT_EDITION}" ] && _is_commercial=true || _is_commercial=false +REDIS_AVAILABLE=${_is_commercial} RABBITMQ_AVAILABLE=${_is_commercial} DB_AVAILABLE=${_is_commercial} ADMINPANEL_AVAILABLE=${_is_commercial} ONLYOFFICE_DEFAULT_CONFIG=${CONF_DIR}/local.json ONLYOFFICE_LOG4JS_CONFIG=${CONF_DIR}/log4js/production.json @@ -166,57 +161,62 @@ if [ "${LETS_ENCRYPT_DOMAIN}" != "" -a "${LETS_ENCRYPT_MAIL}" != "" ]; then fi 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 - deprecated_var RABBITMQ_SERVER_URL AMQP_URI - deprecated_var AMQP_SERVER_URL AMQP_URI - deprecated_var AMQP_SERVER_TYPE AMQP_TYPE - METRICS_ENABLED="${METRICS_ENABLED:-false}" METRICS_HOST="${METRICS_HOST:-localhost}" METRICS_PORT="${METRICS_PORT:-8125}" METRICS_PREFIX="${METRICS_PREFIX:-.ds}" - DB_HOST=${DB_HOST:-${POSTGRESQL_SERVER_HOST:-$(${JSON} services.CoAuthoring.sql.dbHost)}} - DB_TYPE=${DB_TYPE:-$(${JSON} services.CoAuthoring.sql.type)} - case $DB_TYPE in - "postgres") - DB_PORT=${DB_PORT:-"5432"} - ;; - "mariadb"|"mysql") - DB_PORT=${DB_PORT:-"3306"} - ;; - "dameng") - DB_PORT=${DB_PORT:-"5236"} - ;; - "mssql") - DB_PORT=${DB_PORT:-"1433"} - ;; - "oracle") - DB_PORT=${DB_PORT:-"1521"} - ;; - "") - 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)}} + if [ ${DB_AVAILABLE} = "true" ]; then + 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)}} + DB_TYPE=${DB_TYPE:-$(${JSON} services.CoAuthoring.sql.type)} + case $DB_TYPE in + "postgres") + DB_PORT=${DB_PORT:-"5432"} + ;; + "mariadb"|"mysql") + DB_PORT=${DB_PORT:-"3306"} + ;; + "dameng") + DB_PORT=${DB_PORT:-"5236"} + ;; + "mssql") + DB_PORT=${DB_PORT:-"1433"} + ;; + "oracle") + DB_PORT=${DB_PORT:-"1521"} + ;; + "") + 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:-${DB_PASSWORD:-${POSTGRESQL_SERVER_PASS:-$(${JSON} services.CoAuthoring.sql.dbPass)}}} + fi - RABBITMQ_SERVER_URL=${RABBITMQ_SERVER_URL:-$(${JSON} rabbitmq.url)} - AMQP_URI=${AMQP_URI:-${AMQP_SERVER_URL:-${RABBITMQ_SERVER_URL}}} - AMQP_TYPE=${AMQP_TYPE:-${AMQP_SERVER_TYPE:-rabbitmq}} - parse_rabbitmq_url ${AMQP_URI} + if [ ${RABBITMQ_AVAILABLE} = "true" ]; then + deprecated_var RABBITMQ_SERVER_URL AMQP_URI + deprecated_var AMQP_SERVER_URL AMQP_URI + deprecated_var AMQP_SERVER_TYPE AMQP_TYPE + RABBITMQ_SERVER_URL=${RABBITMQ_SERVER_URL:-$(${JSON} rabbitmq.url)} + AMQP_URI=${AMQP_URI:-${AMQP_SERVER_URL:-${RABBITMQ_SERVER_URL}}} + AMQP_TYPE=${AMQP_TYPE:-${AMQP_SERVER_TYPE:-rabbitmq}} + parse_rabbitmq_url ${AMQP_URI} + fi - REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-$(${JSON} services.CoAuthoring.redis.host)} - REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-6379} + if [ ${REDIS_AVAILABLE} = "true" ]; then + REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-$(${JSON} services.CoAuthoring.redis.host)} + REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-6379} + fi DS_LOG_LEVEL=${DS_LOG_LEVEL:-$(${JSON_LOG} categories.default.level)} } @@ -542,11 +542,18 @@ upgrade_mssql_tbl() { $MSSQL < "$APP_DIR/server/schema/mssql/createdb.sql" >/dev/null 2>&1 } -upgrade_oracle_tbl() { - ORACLE_SQL="sqlplus $DB_USER/$DB_PWD@//$DB_HOST:$DB_PORT/${DB_NAME}" +run_oracle_sql_file() { + local sql_file="$1" - $ORACLE_SQL @$APP_DIR/server/schema/oracle/removetbl.sql >/dev/null 2>&1 - $ORACLE_SQL @$APP_DIR/server/schema/oracle/createdb.sql >/dev/null 2>&1 + sqlplus -s -L "$DB_USER/$DB_PWD@//$DB_HOST:$DB_PORT/${DB_NAME}" >/dev/null 2>&1 </dev/null 2>&1 + run_oracle_sql_file "$APP_DIR/server/schema/oracle/createdb.sql" } update_welcome_page() { WELCOME_PAGE="${APP_DIR}-example/welcome/docker.html" + EXAMPLE_DISABLED_PAGE="${APP_DIR}-example/welcome/example-disabled.html" + if ${ADMINPANEL_AVAILABLE}; then + ADMIN_DISABLED_PAGE="${APP_DIR}-example/welcome/admin-disabled.html" + sed -Ei 's#sudo systemctl start ds-(adminpanel|example)#sudo docker exec $(sudo docker ps -q) supervisorctl start ds:\1#g' "$ADMIN_DISABLED_PAGE" "$EXAMPLE_DISABLED_PAGE" + else + sed -Ei 's#sudo systemctl start ds-example#sudo docker exec $(sudo docker ps -q) supervisorctl start ds:example#g' "$EXAMPLE_DISABLED_PAGE" + fi + + TARGET_PAGES="$WELCOME_PAGE $EXAMPLE_DISABLED_PAGE${ADMIN_DISABLED_PAGE:+ $ADMIN_DISABLED_PAGE}" if [[ -e $WELCOME_PAGE ]]; then DOCKER_CONTAINER_ID=$(basename $(cat /proc/1/cpuset)) (( ${#DOCKER_CONTAINER_ID} < 12 )) && DOCKER_CONTAINER_ID=$(hostname) if (( ${#DOCKER_CONTAINER_ID} >= 12 )); then if [[ -x $(command -v docker) ]]; then DOCKER_CONTAINER_NAME=$(docker inspect --format="{{.Name}}" $DOCKER_CONTAINER_ID) - sed 's/$(sudo docker ps -q)/'"${DOCKER_CONTAINER_NAME#/}"'/' -i $WELCOME_PAGE + sed 's/$(sudo docker ps -q)/'"${DOCKER_CONTAINER_NAME#/}"'/' -i ${TARGET_PAGES} JWT_MESSAGE=$(echo $JWT_MESSAGE | sed 's/$(sudo docker ps -q)/'"${DOCKER_CONTAINER_NAME#/}"'/') else - sed 's/$(sudo docker ps -q)/'"${DOCKER_CONTAINER_ID::12}"'/' -i $WELCOME_PAGE + sed 's/$(sudo docker ps -q)/'"${DOCKER_CONTAINER_ID::12}"'/' -i ${TARGET_PAGES} JWT_MESSAGE=$(echo $JWT_MESSAGE | sed 's/$(sudo docker ps -q)/'"${DOCKER_CONTAINER_ID::12}"'/') fi fi @@ -677,10 +691,10 @@ update_release_date(){ } # create base folders -for i in converter docservice metrics adminpanel; do - mkdir -p "$DS_LOG_DIR/$i" && touch "$DS_LOG_DIR/$i"/{out,err}.log +for SUPERVISOR_CONF in "${SUPERVISOR_CONF_DIR}"/ds-*.conf; do + SERVICE_NAME=$(sed "s|^${SUPERVISOR_CONF_DIR}/ds-||; s|\.conf$||" <<<"$SUPERVISOR_CONF") + mkdir -p "$DS_LOG_DIR/$SERVICE_NAME" && touch "$DS_LOG_DIR/$SERVICE_NAME"/{out,err}.log done - mkdir -p "${DS_LOG_DIR}-example" && touch "${DS_LOG_DIR}-example"/{out,err}.log # create app folders @@ -713,49 +727,47 @@ if [ ${ONLYOFFICE_DATA_CONTAINER_HOST} = "localhost" ]; then update_ds_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} + if [ ${DB_AVAILABLE} = "true" ]; then + if [ $DB_HOST != "localhost" ]; then + update_db_settings + waiting_for_db + create_db_tbl + else + 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 + if [ ! -d ${PGDATA} ]; then + create_postgresql_cluster + PG_NEW_CLUSTER=true + fi + LOCAL_SERVICES+=("postgresql") fi - LOCAL_SERVICES+=("postgresql") fi - if [ ${AMQP_SERVER_HOST} != "localhost" ]; then - update_rabbitmq_setting - else - # change rights for rabbitmq directory - chown -R rabbitmq:rabbitmq ${RABBITMQ_DATA} - chmod -R go=rX,u=rwX ${RABBITMQ_DATA} - if [ -f ${RABBITMQ_DATA}/.erlang.cookie ]; then - chmod 400 ${RABBITMQ_DATA}/.erlang.cookie + if [ ${RABBITMQ_AVAILABLE} = "true" ]; then + if [ ${AMQP_SERVER_HOST} != "localhost" ]; then + update_rabbitmq_setting + else + chown -R rabbitmq:rabbitmq ${RABBITMQ_DATA} + chmod -R go=rX,u=rwX ${RABBITMQ_DATA} + if [ -f ${RABBITMQ_DATA}/.erlang.cookie ]; then + chmod 400 ${RABBITMQ_DATA}/.erlang.cookie + fi + + sed -i '/^[[:space:]]*ulimit[[:space:]]\+-n[[:space:]]\+/d' /etc/default/rabbitmq-server + printf 'ulimit -n %s\n' "${RABBIT_CONNECTIONS}" >> /etc/default/rabbitmq-server + + LOCAL_SERVICES+=("rabbitmq-server") + rm -rf /var/run/rabbitmq fi - - echo "ulimit -n $RABBIT_CONNECTIONS" >> /etc/default/rabbitmq-server - - LOCAL_SERVICES+=("rabbitmq-server") - # allow Rabbitmq startup after container kill - rm -rf /var/run/rabbitmq fi - if [ ${REDIS_ENABLED} = "true" ]; then + if [ ${REDIS_AVAILABLE} = "true" ]; then if [ ${REDIS_SERVER_HOST} != "localhost" ]; then update_redis_settings else - # change rights for redis directory chown -R redis:redis ${REDIS_DATA} chmod -R 750 ${REDIS_DATA} - LOCAL_SERVICES+=("redis-server") fi fi @@ -764,7 +776,7 @@ else waiting_for_datacontainer # read settings after the data container in ready state - # to prevent get unconfigureted data + # to prevent get unconfigured data read_setting update_welcome_page @@ -777,32 +789,35 @@ for i in ${LOCAL_SERVICES[@]}; do service $i start done -PG_DB_EXISTS=$(PGPASSWORD="$DB_PWD" psql -h ${DB_HOST} -p${DB_PORT} -U "${DB_USER}" -tAc "SELECT 1 FROM pg_database WHERE datname='${DB_NAME}';" 2>/dev/null) -if [ ${PG_NEW_CLUSTER} = "true" ] || [ "${PG_DB_EXISTS}" != "1" ]; then - create_postgresql_db - create_postgresql_tbl +if [ ${DB_AVAILABLE} = "true" ] && [ "${DB_TYPE}" = "postgres" ]; then + PG_DB_EXISTS=$(PGPASSWORD="$DB_PWD" psql -h ${DB_HOST} -p${DB_PORT} -U "${DB_USER}" -tAc "SELECT 1 FROM pg_database WHERE datname='${DB_NAME}';" 2>/dev/null) + if [ ${PG_NEW_CLUSTER} = "true" ] || [ "${PG_DB_EXISTS}" != "1" ]; then + create_postgresql_db + create_postgresql_tbl + fi fi if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then - waiting_for_db - waiting_for_amqp - if [ ${REDIS_ENABLED} = "true" ]; then - waiting_for_redis - fi + [ ${DB_AVAILABLE} = "true" ] && waiting_for_db + [ ${RABBITMQ_AVAILABLE} = "true" ] && waiting_for_amqp + [ ${REDIS_AVAILABLE} = "true" ] && waiting_for_redis if [ "${IS_UPGRADE}" = "true" ]; then - upgrade_db_tbl + [ ${DB_AVAILABLE} = "true" ] && upgrade_db_tbl update_release_date fi update_nginx_settings if [ "${PLUGINS_ENABLED}" = "true" ]; then - echo -n Installing plugins, please wait... - start_process documentserver-pluginsmanager.sh -r false --update=\"${APP_DIR}/sdkjs-plugins/plugin-list-default.json\" >/dev/null - echo Done + ( documentserver-pluginsmanager.sh -r false --update="${APP_DIR}/sdkjs-plugins/plugin-list-default.json" >/dev/null; echo "[pluginsmanager] Plugins initialization finished" >/proc/1/fd/1 ) & fi + ${ADMINPANEL_AVAILABLE} && [ "${ADMINPANEL_ENABLED:-false}" = "true" ] && sed -i 's,autostart=false,autostart=true,' ${SUPERVISOR_CONF_DIR}/ds-adminpanel.conf + [ "${EXAMPLE_ENABLED:-false}" = "true" ] && sed -i 's,autostart=false,autostart=true,' ${SUPERVISOR_CONF_DIR}/ds-example.conf + if ${ADMINPANEL_AVAILABLE}; then + tail -n 0 -F "$DS_LOG_DIR/adminpanel/out.log" & + fi service supervisor start # start cron to enable log rotating @@ -832,4 +847,4 @@ start_process documentserver-static-gzip.sh ${ONLYOFFICE_DATA_CONTAINER} echo "${JWT_MESSAGE}" -start_process bash -c "find '$DS_LOG_DIR' '$DS_LOG_DIR-example' -type f -name '*.log' | xargs tail -F" +start_process bash -c "find '$DS_LOG_DIR' '$DS_LOG_DIR-example' -type f -name '*.log' ! -path '$DS_LOG_DIR/adminpanel/out.log' | xargs tail -F" diff --git a/tests/damengdb/damengdb.Dockerfile b/tests/damengdb/damengdb.Dockerfile index f4f6cf1..bb9918c 100644 --- a/tests/damengdb/damengdb.Dockerfile +++ b/tests/damengdb/damengdb.Dockerfile @@ -1,7 +1,7 @@ -FROM onlyoffice/damengdb:8.1.2 as damengdb +FROM onlyoffice/damengdb:8.1.3 as damengdb ARG DM8_USER="SYSDBA" -ARG DM8_PASS="SYSDBA001" +ARG DM8_PASS="SYSDBA_dm001" ARG DB_HOST="localhost" ARG DB_PORT="5236" ARG DISQL_BIN="/opt/dmdbms/bin" @@ -15,7 +15,7 @@ function wait_dm_ready() { cd /opt/dmdbms/bin for i in `seq 1 10`; do echo `./disql /nolog < /dev/null 2>&1 if [ $? -eq 0 ]; then @@ -41,14 +41,20 @@ GRANT ALL PRIVILEGES ON sysdba.TASK_RESULT TO onlyoffice; EOF +ADD https://raw.githubusercontent.com/ONLYOFFICE/server/master/schema/dameng/createdb.sql /schema/dameng/createdb.sql + +ARG OO_DB_USER="onlyoffice" +ARG OO_DB_PASS="Onlyoffice_2026" + RUN bash /opt/startup.sh > /dev/null 2>&1 \ & mkdir -p /schema/damengdb \ - && apt update -y ; apt install wget -y \ - && wget https://raw.githubusercontent.com/ONLYOFFICE/server/master/schema/dameng/createdb.sql -P /schema/dameng/ \ + && export DEBIAN_FRONTEND=noninteractive \ + && apt-get update \ + && rm -rf /var/lib/apt/lists/* \ && bash ./wait_dm_ready.sh \ && cd ${DISQL_BIN} \ && ./disql $DM8_USER/$DM8_PASS@$DB_HOST:$DB_PORT -e \ - "create user "onlyoffice" identified by "onlyoffice" password_policy 0;" \ + "create user \"${OO_DB_USER}\" identified by \"${OO_DB_PASS}\";" \ && ./disql $DM8_USER/$DM8_PASS@$DB_HOST:$DB_PORT -e \ "GRANT SELECT ON DBA_TAB_COLUMNS TO onlyoffice;" \ && echo "EXIT" | tee -a /schema/dameng/createdb.sql \ diff --git a/tests/damengdb/docker-compose.yml b/tests/damengdb/docker-compose.yml index c28dfb6..816da27 100644 --- a/tests/damengdb/docker-compose.yml +++ b/tests/damengdb/docker-compose.yml @@ -1,10 +1,7 @@ version: '2' services: onlyoffice-documentserver: - build: - context: ../../. - dockerfile: Dockerfile - target: documentserver + image: onlyoffice/documentserver-ee:latest container_name: onlyoffice-documentserver depends_on: - onlyoffice-dameng @@ -15,6 +12,7 @@ services: - DB_PORT=5236 - DB_NAME=onlyoffice - DB_USER=onlyoffice + - DB_PWD=Onlyoffice_2026 - AMQP_URI=amqp://guest:guest@onlyoffice-rabbitmq # Costomize the JSON Web Token validation parameters if needed. #- JWT_ENABLED=false @@ -49,7 +47,7 @@ services: target: damengdb args: DM8_USER: SYSDBA - DM8_PASS: SYSDBA001 + DM8_PASS: SYSDBA_dm001 DB_HOST: localhost DB_PORT: 5236 environment: