Compare commits
93 commits
feature/up
...
master
Author | SHA1 | Date | |
---|---|---|---|
7fa2f598a1 | |||
3fb3b2f3de | |||
e5f8e69d89 | |||
c7090252ff | |||
730dd71ac5 | |||
1957d38907 | |||
cdc73fe379 | |||
e1d7cfd5e8 | |||
92dd2833d1 | |||
d98eb758b5 | |||
a3973583f8 | |||
fcbbe2979f | |||
311db051fb | |||
46683cbc4e | |||
1c72796657 | |||
e32047ffcc | |||
ad066be1c8 | |||
29bb07d2cb | |||
67fbd9d9c8 | |||
bac88530c1 | |||
b9bfa7b90c | |||
61a5a021cf | |||
713a06e999 | |||
e44acbebf7 | |||
3626f8cc6c | |||
207bd5dac7 | |||
2379128240 | |||
083ab2c6a6 | |||
34180710cf | |||
8887cb7a26 | |||
05c5042985 | |||
2213fc70f5 | |||
06a05223b5 | |||
143e77fdfc | |||
8acbfdbeb7 | |||
c16635ea71 | |||
29e4ec3027 | |||
c7a1fd04a4 | |||
c4ddb99710 | |||
9494e08e8f | |||
86cbb01bbf | |||
a6562f4017 | |||
01606746c1 | |||
558353ee99 | |||
19b66de202 | |||
5c17c711b1 | |||
61d388372b | |||
95e27e2655 | |||
452dfeb56d | |||
80acbe974d | |||
4fb0a1e712 | |||
39d2e303f1 | |||
decb1ed860 | |||
a830c53218 | |||
bb160d345e | |||
3cf36a79cc | |||
e17831904d | |||
21f5019e1c | |||
b2e720e66c | |||
4c959d62b7 | |||
c5fb8f1fe0 | |||
973409cc8f | |||
33faf622c8 | |||
44a96b1fde | |||
26ef312557 | |||
2eb99ffb20 | |||
ca39675055 | |||
a31a579d24 | |||
32a8a24a0f | |||
0613f8a0ca | |||
a23477301e | |||
d654094671 | |||
93a0526a7c | |||
5bf1ff715f | |||
c6e7d68016 | |||
13a01e7c56 | |||
3b830417a2 | |||
245659807a | |||
2f26419ac7 | |||
67df644858 | |||
ca6b3a67a3 | |||
f2c708cff2 | |||
2f26cea790 | |||
30c5612cfb | |||
cbb749d77c | |||
1cfe84b8b8 | |||
30ca844513 | |||
c611b2b080 | |||
9dc5f5d993 | |||
ea0fcf3951 | |||
9676e7aac1 | |||
e7d2cc2cd5 | |||
fd7e1a926a |
139
.github/workflows/4testing-build.yml
vendored
Normal file
139
.github/workflows/4testing-build.yml
vendored
Normal file
|
@ -0,0 +1,139 @@
|
|||
### This workflow setup instance then build and push images ###
|
||||
name: 4testing multiarch-build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
build:
|
||||
description: 'Build number (ex. 45)'
|
||||
type: string
|
||||
required: true
|
||||
amd64:
|
||||
type: boolean
|
||||
description: 'Build AMD64'
|
||||
default: true
|
||||
arm64:
|
||||
type: boolean
|
||||
description: 'Build ARM64'
|
||||
default: true
|
||||
community:
|
||||
type: boolean
|
||||
description: 'Build Community Edition'
|
||||
default: true
|
||||
enterprise:
|
||||
type: boolean
|
||||
description: 'Build Enterprise Edition'
|
||||
default: true
|
||||
developer:
|
||||
type: boolean
|
||||
description: 'Build Developer Edition'
|
||||
default: true
|
||||
|
||||
env:
|
||||
COMPANY_NAME: "onlyoffice"
|
||||
PRODUCT_NAME: "documentserver"
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- id: matrix
|
||||
run: |
|
||||
set -ex
|
||||
|
||||
BRANCH_NAME=${GITHUB_REF#refs/heads/}
|
||||
if ! [[ $BRANCH_NAME == develop || $BRANCH_NAME =~ hotfix || $BRANCH_NAME =~ release ]]; then
|
||||
echo "Wrong branch."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ ${{ github.event.inputs.amd64 }} = true ] && PLATFORMS+=("amd64")
|
||||
[ ${{ github.event.inputs.arm64 }} = true ] && PLATFORMS+=("arm64")
|
||||
if [ -z ${PLATFORMS} ]; then
|
||||
echo "None of the platforms are selected."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ ${{ github.event.inputs.community }} = true ] && EDITIONS+=("community")
|
||||
[ ${{ github.event.inputs.enterprise }} = true ] && EDITIONS+=("enterprise")
|
||||
[ ${{ github.event.inputs.developer }} = true ] && EDITIONS+=("developer")
|
||||
if [ -z ${EDITIONS} ]; then
|
||||
echo "None of the editions are selected."
|
||||
exit 1
|
||||
fi
|
||||
echo "::set-output name=editions::$(jq -n -c --arg s "${EDITIONS[*]}" '($s|split(" "))')"
|
||||
outputs:
|
||||
editions: ${{ steps.matrix.outputs.editions }}
|
||||
|
||||
build:
|
||||
name: "Build ${{ matrix.image }}-${{ matrix.edition }}"
|
||||
runs-on: ubuntu-latest
|
||||
needs: prepare
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
image: ["documentserver"]
|
||||
edition: ${{ fromJSON(needs.prepare.outputs.editions) }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||
|
||||
- name: Build 4testing
|
||||
run: |
|
||||
set -eux
|
||||
|
||||
### ==>> At this step build variable declaration ###
|
||||
|
||||
case ${{ matrix.edition }} in
|
||||
community)
|
||||
PRODUCT_EDITION=""
|
||||
;;
|
||||
enterprise)
|
||||
PRODUCT_EDITION="-ee"
|
||||
;;
|
||||
developer)
|
||||
PRODUCT_EDITION="-de"
|
||||
;;
|
||||
esac
|
||||
|
||||
[ ${{ github.event.inputs.amd64 }} = true ] && PLATFORMS+=("amd64")
|
||||
[ ${{ github.event.inputs.arm64 }} = true ] && PLATFORMS+=("arm64")
|
||||
PLATFORM=$(echo ${PLATFORMS[*]/#/linux/} | tr ' ' ',')
|
||||
|
||||
BRANCH_NAME=${GITHUB_REF#refs/heads/}
|
||||
if [ $BRANCH_NAME = develop ]; then
|
||||
RELEASE_BRANCH=unstable
|
||||
PRODUCT_VERSION=99.99.99
|
||||
elif [[ $BRANCH_NAME =~ hotfix || $BRANCH_NAME =~ release ]]; then
|
||||
RELEASE_BRANCH=testing
|
||||
PRODUCT_VERSION=${BRANCH_NAME#*/v}
|
||||
fi
|
||||
BUILD_NUMBER=${{ github.event.inputs.build }}
|
||||
|
||||
export PRODUCT_EDITION
|
||||
export PACKAGE_VERSION=${PRODUCT_VERSION}-${BUILD_NUMBER}
|
||||
export PACKAGE_BASEURL=${{ secrets.REPO_BASEURL_OLD }}/${RELEASE_BRANCH}/ubuntu
|
||||
export RELEASE_BRANCH
|
||||
export PLATFORM
|
||||
export DOCKERFILE=Dockerfile
|
||||
export PREFIX_NAME=4testing-
|
||||
export TAG=${PRODUCT_VERSION}.${BUILD_NUMBER}
|
||||
|
||||
### ==>> Build and push images at this step ###
|
||||
|
||||
docker buildx bake -f docker-bake.hcl ${{ matrix.image }} --push
|
||||
echo "DONE: Build success"
|
||||
shell: bash
|
130
.github/workflows/stable-build.yml
vendored
Normal file
130
.github/workflows/stable-build.yml
vendored
Normal file
|
@ -0,0 +1,130 @@
|
|||
### This workflow setup instance then build and push images ###
|
||||
name: Multi-arch build stable
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Tag for release (ex. 1.2.3.45)'
|
||||
type: string
|
||||
required: true
|
||||
|
||||
env:
|
||||
COMPANY_NAME: "onlyoffice"
|
||||
PRODUCT_NAME: "documentserver"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: "Release image: DocumentServer${{ matrix.edition }}"
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
images: ["documentserver-stable"]
|
||||
edition: ["", "-ee", "-de"]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||
|
||||
- name: Build documentserver-release
|
||||
run: |
|
||||
set -eux
|
||||
VERSION=${{ github.event.inputs.tag }}
|
||||
PRODUCT_EDITION=${{ matrix.edition }}
|
||||
TESTING_IMAGE=${COMPANY_NAME}/4testing-${PRODUCT_NAME}${PRODUCT_EDITION}
|
||||
if docker manifest inspect ${TESTING_IMAGE}:${VERSION} > /dev/null; then
|
||||
echo "Image present on docker.hub >> start build stable version"
|
||||
export PRODUCT_EDITION
|
||||
export TAG=${VERSION}
|
||||
export SHORTER_TAG=${VERSION%.*}
|
||||
export SHORTEST_TAG=${VERSION%.*.*}
|
||||
docker buildx bake -f docker-bake.hcl ${{ matrix.images }} --push
|
||||
echo "DONE: Build success >> exit with 0"
|
||||
exit 0
|
||||
else
|
||||
echo "FAILED: Image with tag ${VERSION} do not presented on docker.hub >> build will not started >> exit with 1"
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
build-nonexample:
|
||||
name: "Release image: DocumentServer${{ matrix.edition }}-nonExample"
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build]
|
||||
if: ${{ false }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
images: ["documentserver-nonexample"]
|
||||
edition: ["", "-ee", "-de"]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||
|
||||
- name: build image
|
||||
run: |
|
||||
set -eux
|
||||
export PRODUCT_EDITION=${{ matrix.edition }}
|
||||
export TAG=${{ github.event.inputs.tag }}
|
||||
docker buildx bake -f docker-bake.hcl ${{ matrix.images }} --push
|
||||
shell: bash
|
||||
|
||||
build-ucs-ubuntu20:
|
||||
name: "Release image: DocumentServer${{ matrix.edition }}-ucs"
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
edition: ["", "-ee"]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||
|
||||
- name: build UCS
|
||||
run: |
|
||||
set -eux
|
||||
export PRODUCT_EDITION=${{ matrix.edition }}
|
||||
export PACKAGE_BASEURL=${{ secrets.REPO_BASEURL_OLD }}/testing/ubuntu
|
||||
export DOCKERFILE=Dockerfile
|
||||
export BASE_IMAGE=ubuntu:20.04
|
||||
export PG_VERSION=12
|
||||
export TAG=${{ github.event.inputs.tag }}
|
||||
export PACKAGE_VERSION=$( echo ${TAG} | sed -E 's/(.*)\./\1-/')
|
||||
docker buildx bake -f docker-bake.hcl documentserver-ucs --push
|
||||
shell: bash
|
32
Dockerfile
32
Dockerfile
|
@ -1,16 +1,24 @@
|
|||
FROM ubuntu:20.04
|
||||
ARG BASE_IMAGE=ubuntu:22.04
|
||||
|
||||
FROM ${BASE_IMAGE} as documentserver
|
||||
LABEL maintainer Ascensio System SIA <support@onlyoffice.com>
|
||||
|
||||
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive PG_VERSION=12
|
||||
ARG PG_VERSION=14
|
||||
|
||||
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive PG_VERSION=${PG_VERSION}
|
||||
|
||||
ARG ONLYOFFICE_VALUE=onlyoffice
|
||||
|
||||
RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
|
||||
apt-get -y update && \
|
||||
apt-get -yq install wget apt-transport-https gnupg locales && \
|
||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0x8320ca65cb2de8e5 && \
|
||||
apt-get -yq install wget apt-transport-https gnupg locales lsb-release && \
|
||||
mkdir -p $HOME/.gnupg && \
|
||||
gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/onlyoffice.gpg --keyserver keyserver.ubuntu.com --recv-keys 0x8320ca65cb2de8e5 && \
|
||||
chmod 644 /etc/apt/trusted.gpg.d/onlyoffice.gpg && \
|
||||
locale-gen en_US.UTF-8 && \
|
||||
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \
|
||||
wget -O - https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.deb.sh | bash && \
|
||||
if [ $(lsb_release -cs) = focal ]; then RABBITMQ_VERSION=3.8.11-1; else RABBITMQ_VERSION=3.10 ; fi && \
|
||||
apt-get -yq install \
|
||||
adduser \
|
||||
apt-utils \
|
||||
|
@ -39,7 +47,7 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
|
|||
postgresql \
|
||||
postgresql-client \
|
||||
pwgen \
|
||||
rabbitmq-server \
|
||||
rabbitmq-server=${RABBITMQ_VERSION}* \
|
||||
redis-server \
|
||||
software-properties-common \
|
||||
sudo \
|
||||
|
@ -69,20 +77,26 @@ COPY run-document-server.sh /app/ds/run-document-server.sh
|
|||
|
||||
EXPOSE 80 443
|
||||
|
||||
ARG REPO_URL="deb http://download.onlyoffice.com/repo/debian squeeze main"
|
||||
ARG COMPANY_NAME=onlyoffice
|
||||
ARG PRODUCT_NAME=documentserver
|
||||
ARG PRODUCT_EDITION=
|
||||
ARG PACKAGE_VERSION=
|
||||
ARG TARGETARCH
|
||||
ARG PACKAGE_BASEURL="http://download.onlyoffice.com/install/documentserver/linux"
|
||||
|
||||
ENV COMPANY_NAME=$COMPANY_NAME \
|
||||
PRODUCT_NAME=$PRODUCT_NAME
|
||||
PRODUCT_NAME=$PRODUCT_NAME \
|
||||
PRODUCT_EDITION=$PRODUCT_EDITION
|
||||
|
||||
RUN echo "$REPO_URL" | tee /etc/apt/sources.list.d/ds.list && \
|
||||
RUN PACKAGE_FILE="${COMPANY_NAME}-${PRODUCT_NAME}${PRODUCT_EDITION}${PACKAGE_VERSION:+_$PACKAGE_VERSION}_${TARGETARCH:-$(dpkg --print-architecture)}.deb" && \
|
||||
wget -q -P /tmp "$PACKAGE_BASEURL/$PACKAGE_FILE" && \
|
||||
apt-get -y update && \
|
||||
service postgresql start && \
|
||||
apt-get -yq install $COMPANY_NAME-$PRODUCT_NAME && \
|
||||
apt-get -yq install /tmp/$PACKAGE_FILE && \
|
||||
service postgresql stop && \
|
||||
service supervisor stop && \
|
||||
chmod 755 /app/ds/*.sh && \
|
||||
rm -f /tmp/$PACKAGE_FILE && \
|
||||
rm -rf /var/log/$COMPANY_NAME && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
74
Makefile
74
Makefile
|
@ -1,73 +1,73 @@
|
|||
COMPANY_NAME ?= ONLYOFFICE
|
||||
GIT_BRANCH ?= develop
|
||||
PRODUCT_NAME ?= DocumentServer
|
||||
PRODUCT_EDITION ?=
|
||||
PRODUCT_VERSION ?= 0.0.0
|
||||
BUILD_NUMBER ?= 0
|
||||
ONLYOFFICE_VALUE ?= onlyoffice
|
||||
S3_BUCKET ?= repo-doc-onlyoffice-com
|
||||
RELEASE_BRANCH ?= unstable
|
||||
|
||||
COMPANY_NAME_LOW = $(shell echo $(COMPANY_NAME) | tr A-Z a-z)
|
||||
PRODUCT_NAME_LOW = $(shell echo $(PRODUCT_NAME) | tr A-Z a-z)
|
||||
COMPANY_NAME_LOW_ESCAPED = $(subst -,,$(COMPANY_NAME_LOW))
|
||||
|
||||
PACKAGE_NAME := $(COMPANY_NAME_LOW)-$(PRODUCT_NAME_LOW)$(PRODUCT_EDITION)
|
||||
PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER)
|
||||
PACKAGE_BASEURL := https://s3.eu-west-1.amazonaws.com/$(S3_BUCKET)/$(COMPANY_NAME_LOW)/$(RELEASE_BRANCH)/ubuntu
|
||||
|
||||
REPO_URL := "deb [trusted=yes] http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/$(COMPANY_NAME_LOW)-$(PRODUCT_NAME_LOW)/$(GIT_BRANCH)/$(PACKAGE_VERSION)/ repo/"
|
||||
|
||||
UPDATE_LATEST := false
|
||||
|
||||
ifneq (,$(findstring develop,$(GIT_BRANCH)))
|
||||
DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))
|
||||
DOCKER_TAGS += latest
|
||||
else ifneq (,$(findstring release,$(GIT_BRANCH)))
|
||||
DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))
|
||||
else ifneq (,$(findstring hotfix,$(GIT_BRANCH)))
|
||||
DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))
|
||||
ifeq ($(RELEASE_BRANCH),$(filter $(RELEASE_BRANCH),unstable testing))
|
||||
DOCKER_TAG := $(subst -,.,$(PACKAGE_VERSION))
|
||||
else
|
||||
DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))-$(subst /,-,$(GIT_BRANCH))
|
||||
DOCKER_TAG := $(subst -,.,$(PACKAGE_VERSION))-$(subst /,-,$(GIT_BRANCH))
|
||||
endif
|
||||
|
||||
DOCKER_TAGS += $(DOCKER_TAG)
|
||||
|
||||
DOCKER_REPO = $(COMPANY_NAME_LOW_ESCAPED)/4testing-$(PRODUCT_NAME_LOW)
|
||||
|
||||
COLON := __colon__
|
||||
DOCKER_TARGETS := $(foreach TAG,$(DOCKER_TAGS),$(DOCKER_REPO)$(COLON)$(TAG))
|
||||
|
||||
DOCKER_IMAGE := $(subst -,,$(COMPANY_NAME_LOW))/4testing-$(PRODUCT_NAME_LOW)$(PRODUCT_EDITION)
|
||||
DOCKER_DUMMY := $(COMPANY_NAME_LOW)-$(PRODUCT_NAME_LOW)$(PRODUCT_EDITION)__$(DOCKER_TAG).dummy
|
||||
DOCKER_ARCH := $(COMPANY_NAME_LOW)-$(PRODUCT_NAME_LOW)_$(PACKAGE_VERSION).tar.gz
|
||||
DOCKER_ARCH_URI := $(COMPANY_NAME_LOW)/$(RELEASE_BRANCH)/docker/$(notdir $(DOCKER_ARCH))
|
||||
|
||||
.PHONY: all clean clean-docker deploy docker publish
|
||||
.PHONY: all clean clean-docker image deploy docker publish
|
||||
|
||||
$(DOCKER_TARGETS): $(DEB_REPO_DATA)
|
||||
$(DOCKER_DUMMY):
|
||||
docker pull ubuntu:20.04
|
||||
docker build \
|
||||
--build-arg REPO_URL=$(REPO_URL) \
|
||||
--build-arg COMPANY_NAME=$(COMPANY_NAME_LOW) \
|
||||
--build-arg PRODUCT_NAME=$(PRODUCT_NAME_LOW) \
|
||||
--build-arg PRODUCT_EDITION=$(PRODUCT_EDITION) \
|
||||
--build-arg PACKAGE_VERSION=$(PACKAGE_VERSION) \
|
||||
--build-arg PACKAGE_BASEURL=$(PACKAGE_BASEURL) \
|
||||
--build-arg TARGETARCH=amd64 \
|
||||
--build-arg ONLYOFFICE_VALUE=$(ONLYOFFICE_VALUE) \
|
||||
-t $(subst $(COLON),:,$@) . &&\
|
||||
mkdir -p $$(dirname $@) &&\
|
||||
-t $(DOCKER_IMAGE):$(DOCKER_TAG) . && \
|
||||
mkdir -p $$(dirname $@) && \
|
||||
echo "Done" > $@
|
||||
|
||||
$(DOCKER_ARCH): $(DOCKER_TARGETS)
|
||||
docker save $(DOCKER_REPO):$(DOCKER_TAG) | \
|
||||
$(DOCKER_ARCH): $(DOCKER_DUMMY)
|
||||
docker save $(DOCKER_IMAGE):$(DOCKER_TAG) | \
|
||||
gzip > $@
|
||||
|
||||
all: $(DOCKER_TARGETS)
|
||||
all: image
|
||||
|
||||
clean:
|
||||
rm -rfv $(DOCKER_TARGETS) $(DOCKER_ARCH)
|
||||
rm -rfv *.dummy *.tar.gz
|
||||
|
||||
clean-docker:
|
||||
docker rmi -f $$(docker images -q $(COMPANY_NAME_LOW)/*) || exit 0
|
||||
|
||||
deploy: $(DOCKER_TARGETS)
|
||||
$(foreach TARGET,$(DOCKER_TARGETS), \
|
||||
for i in {1..3}; do \
|
||||
docker push $(subst $(COLON),:,$(TARGET)) && break || sleep 1m; \
|
||||
done;)
|
||||
image: $(DOCKER_DUMMY)
|
||||
|
||||
deploy: $(DOCKER_DUMMY)
|
||||
for i in {1..3}; do \
|
||||
docker push $(DOCKER_IMAGE):$(DOCKER_TAG) && break || sleep 1m; \
|
||||
done
|
||||
ifeq ($(RELEASE_BRANCH),unstable)
|
||||
docker tag $(DOCKER_IMAGE):$(DOCKER_TAG) $(DOCKER_IMAGE):latest
|
||||
for i in {1..3}; do \
|
||||
docker push $(DOCKER_IMAGE):latest && break || sleep 1m; \
|
||||
done
|
||||
endif
|
||||
|
||||
publish: $(DOCKER_ARCH)
|
||||
aws s3 cp \
|
||||
$(DOCKER_ARCH) \
|
||||
s3://repo-doc-onlyoffice-com.s3.amazonaws.com/docker/amd64/ \
|
||||
--acl public-read
|
||||
aws s3 cp --no-progress --acl public-read \
|
||||
$(DOCKER_ARCH) s3://$(S3_BUCKET)/$(DOCKER_ARCH_URI)
|
||||
|
|
104
README.md
104
README.md
|
@ -25,6 +25,8 @@ Starting from version 6.0, Document Server is distributed as ONLYOFFICE Docs. It
|
|||
|
||||
ONLYOFFICE Docs can be used as a part of ONLYOFFICE Workspace or with third-party sync&share solutions (e.g. Nextcloud, ownCloud, Seafile) to enable collaborative editing within their interface.
|
||||
|
||||
***Important*** Please update `docker-enginge` to latest version (`20.10.21` as of writing this doc) before using it. We use `ubuntu:22.04` as base image and it older versions of docker have compatibility problems with it
|
||||
|
||||
## Functionality ##
|
||||
* ONLYOFFICE Document Editor
|
||||
* ONLYOFFICE Spreadsheet Editor
|
||||
|
@ -107,7 +109,7 @@ When using CA certified certificates (e.g [Let's encrypt](https://letsencrypt.or
|
|||
|
||||
#### Using the automatically generated Let's Encrypt SSL Certificates
|
||||
|
||||
sudo docker run -i -t -d -p 443:443 \
|
||||
sudo docker run -i -t -d -p 80:80 -p 443:443 \
|
||||
-e LETS_ENCRYPT_DOMAIN=your_domain -e LETS_ENCRYPT_MAIL=your_mail onlyoffice/documentserver
|
||||
|
||||
If you want to get and extend Let's Encrypt SSL Certificates automatically just set LETS_ENCRYPT_DOMAIN and LETS_ENCRYPT_MAIL variables.
|
||||
|
@ -178,19 +180,22 @@ Below is the complete list of parameters that can be set using environment varia
|
|||
- **DB_TYPE**: The database type. Supported values are `postgres`, `mariadb` or `mysql`. Defaults to `postgres`.
|
||||
- **DB_HOST**: The IP address or the name of the host where the database server is running.
|
||||
- **DB_PORT**: The database server port number.
|
||||
- **DB_NAME**: The name of a database to be created on the image startup.
|
||||
- **DB_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.
|
||||
- **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_PASS**: The Redis server password. The password is not set by default.
|
||||
- **NGINX_WORKER_PROCESSES**: Defines the number of nginx worker processes.
|
||||
- **NGINX_WORKER_CONNECTIONS**: Sets the maximum number of simultaneous connections that can be opened by a nginx worker process.
|
||||
- **JWT_ENABLED**: Specifies the enabling the JSON Web Token validation by the ONLYOFFICE Document Server. Defaults to `false`.
|
||||
- **JWT_SECRET**: Defines the secret key to validate the JSON Web Token in the request to the ONLYOFFICE Document Server. Defaults to `secret`.
|
||||
- **SECURE_LINK_SECRET**: Defines secret for the nginx config directive [secure_link_md5](http://nginx.org/ru/docs/http/ngx_http_secure_link_module.html#secure_link_md5). Defaults to `random string`.
|
||||
- **JWT_ENABLED**: Specifies the enabling the JSON Web Token validation by the ONLYOFFICE Document Server. Defaults to `true`.
|
||||
- **JWT_SECRET**: Defines the secret key to validate the JSON Web Token in the request to the ONLYOFFICE Document Server. Defaults to random value.
|
||||
- **JWT_HEADER**: Defines the http header that will be used to send the JSON Web Token. Defaults to `Authorization`.
|
||||
- **JWT_IN_BODY**: Specifies the enabling the token validation in the request body to the ONLYOFFICE Document Server. Defaults to `false`.
|
||||
- **WOPI_ENABLED**: Specifies the enabling the wopi handlers. Defaults to `false`.
|
||||
- **USE_UNAUTHORIZED_STORAGE**: Set to `true`if using selfsigned 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`
|
||||
- **METRICS_ENABLED**: Specifies the enabling StatsD for ONLYOFFICE Document Server. Defaults to `false`.
|
||||
|
@ -200,31 +205,9 @@ Below is the complete list of parameters that can be set using environment varia
|
|||
- **LETS_ENCRYPT_DOMAIN**: Defines the domain for Let's Encrypt certificate.
|
||||
- **LETS_ENCRYPT_MAIL**: Defines the domain administator mail address for Let's Encrypt certificate.
|
||||
|
||||
## Installing ONLYOFFICE Document Server using Docker Compose
|
||||
## Installing ONLYOFFICE Document Server integrated with Community and Mail Servers
|
||||
|
||||
You can also install ONLYOFFICE Document Server using [docker-compose](https://docs.docker.com/compose/install "docker-compose").
|
||||
|
||||
First you need to clone this [GitHub repository](https://github.com/ONLYOFFICE/Docker-DocumentServer/):
|
||||
|
||||
```bash
|
||||
git clone https://github.com/ONLYOFFICE/Docker-DocumentServer
|
||||
```
|
||||
|
||||
After that switch to the repository folder:
|
||||
|
||||
```bash
|
||||
cd Docker-DocumentServer
|
||||
```
|
||||
|
||||
After that, assuming you have docker-compose installed, execute the following command:
|
||||
|
||||
```bash
|
||||
docker-compose 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:
|
||||
ONLYOFFICE Document Server is a part of ONLYOFFICE Community Edition that comprises also Community Server and Mail Server. To install them, follow these easy steps:
|
||||
|
||||
**STEP 1**: Create the `onlyoffice` network.
|
||||
|
||||
|
@ -266,42 +249,31 @@ sudo docker run --init --net onlyoffice --privileged -i -t -d --restart=always -
|
|||
onlyoffice/mailserver
|
||||
```
|
||||
|
||||
The additional parameters for mail server are available [here](https://github.com/ONLYOFFICE/Docker-CommunityServer/blob/master/docker-compose.yml#L75).
|
||||
The additional parameters for mail server are available [here](https://github.com/ONLYOFFICE/Docker-CommunityServer/blob/master/docker-compose.workspace_enterprise.yml#L87).
|
||||
|
||||
To learn more, refer to the [ONLYOFFICE Mail Server documentation](https://github.com/ONLYOFFICE/Docker-MailServer "ONLYOFFICE Mail Server documentation").
|
||||
|
||||
**STEP 5**: Install ONLYOFFICE Control Panel
|
||||
**STEP 5**: Install ONLYOFFICE Community Server
|
||||
|
||||
```bash
|
||||
docker run --net onlyoffice -i -t -d --restart=always --name onlyoffice-control-panel \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v /app/onlyoffice/CommunityServer/data:/app/onlyoffice/CommunityServer/data \
|
||||
-v /app/onlyoffice/ControlPanel/data:/var/www/onlyoffice/Data \
|
||||
-v /app/onlyoffice/ControlPanel/logs:/var/log/onlyoffice onlyoffice/controlpanel
|
||||
```
|
||||
|
||||
**STEP 6**: Install ONLYOFFICE Community Server
|
||||
|
||||
```bash
|
||||
sudo docker run --net onlyoffice -i -t -d --privileged --restart=always --name onlyoffice-community-server -p 80:80 -p 443:443 -p 5222:5222 \
|
||||
sudo docker run --net onlyoffice -i -t -d --restart=always --name onlyoffice-community-server -p 80:80 -p 443:443 -p 5222:5222 \
|
||||
-e MYSQL_SERVER_ROOT_PASSWORD=my-secret-pw \
|
||||
-e MYSQL_SERVER_DB_NAME=onlyoffice \
|
||||
-e MYSQL_SERVER_HOST=onlyoffice-mysql-server \
|
||||
-e MYSQL_SERVER_USER=onlyoffice_user \
|
||||
-e MYSQL_SERVER_PASS=onlyoffice_pass \
|
||||
-e DOCUMENT_SERVER_PORT_80_TCP_ADDR=onlyoffice-document-server \
|
||||
-e MYSQL_SERVER_PASS=onlyoffice_pass \
|
||||
|
||||
-e DOCUMENT_SERVER_PORT_80_TCP_ADDR=onlyoffice-document-server \
|
||||
|
||||
-e MAIL_SERVER_API_HOST=${MAIL_SERVER_IP} \
|
||||
-e MAIL_SERVER_DB_HOST=onlyoffice-mysql-server \
|
||||
-e MAIL_SERVER_DB_NAME=onlyoffice_mailserver \
|
||||
-e MAIL_SERVER_DB_PORT=3306 \
|
||||
-e MAIL_SERVER_DB_USER=root \
|
||||
-e MAIL_SERVER_DB_PASS=my-secret-pw \
|
||||
-e CONTROL_PANEL_PORT_80_TCP=80 \
|
||||
-e CONTROL_PANEL_PORT_80_TCP_ADDR=onlyoffice-control-panel \
|
||||
-e MAIL_SERVER_DB_PASS=my-secret-pw \
|
||||
|
||||
-v /app/onlyoffice/CommunityServer/data:/var/www/onlyoffice/Data \
|
||||
-v /app/onlyoffice/CommunityServer/logs:/var/log/onlyoffice \
|
||||
-v /app/onlyoffice/CommunityServer/letsencrypt:/etc/letsencrypt \
|
||||
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
|
||||
onlyoffice/communityserver
|
||||
```
|
||||
|
||||
|
@ -310,42 +282,24 @@ Where `${MAIL_SERVER_IP}` is the IP address for **ONLYOFFICE Mail Server**. You
|
|||
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' onlyoffice-mail-server
|
||||
```
|
||||
|
||||
Alternatively, you can use an automatic installation script to install ONLYOFFICE Workspace at once. For the mail server correct work you need to specify its hostname 'yourdomain.com'.
|
||||
Alternatively, you can use an automatic installation script to install the whole ONLYOFFICE Community Edition at once. For the mail server correct work you need to specify its hostname 'yourdomain.com'.
|
||||
|
||||
**STEP 1**: Download the ONLYOFFICE Workspace Docker script file
|
||||
**STEP 1**: Download the Community Edition Docker script file
|
||||
|
||||
```bash
|
||||
wget https://download.onlyoffice.com/install/workspace-install.sh
|
||||
wget https://download.onlyoffice.com/install/opensource-install.sh
|
||||
```
|
||||
|
||||
**STEP 2**: Install ONLYOFFICE Workspace executing the following command:
|
||||
**STEP 2**: Install ONLYOFFICE Community Edition executing the following command:
|
||||
|
||||
```bash
|
||||
workspace-install.sh -md yourdomain.com
|
||||
bash opensource-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/):
|
||||
Or, use [docker-compose](https://docs.docker.com/compose/install "docker-compose"). For the mail server correct work you need to specify its hostname 'yourdomain.com'. Assuming you have docker-compose installed, execute the following command:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/ONLYOFFICE/Docker-CommunityServer
|
||||
```
|
||||
|
||||
After that switch to the repository folder:
|
||||
|
||||
```bash
|
||||
cd Docker-CommunityServer
|
||||
```
|
||||
|
||||
For the mail server correct work, open one of the files depending on the product you use:
|
||||
|
||||
* [docker-compose.yml](https://github.com/ONLYOFFICE/Docker-CommunityServer/blob/master/docker-compose.groups.yml) for Community Server (distributed as ONLYOFFICE Groups)
|
||||
* [docker-compose.yml](https://github.com/ONLYOFFICE/Docker-CommunityServer/blob/master/docker-compose.workspace.yml) for ONLYOFFICE Workspace Community Edition
|
||||
* [docker-compose.yml](https://github.com/ONLYOFFICE/Docker-CommunityServer/blob/master/docker-compose.workspace_enterprise.yml) for ONLYOFFICE Workspace Enterprise Edition
|
||||
|
||||
Then replace the `${MAIL_SERVER_HOSTNAME}` variable with your own hostname for the **Mail Server**. After that, assuming you have docker-compose installed, execute the following command:
|
||||
|
||||
```bash
|
||||
cd link-to-your-modified-docker-compose
|
||||
wget https://raw.githubusercontent.com/ONLYOFFICE/Docker-CommunityServer/master/docker-compose.groups.yml
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
|
@ -383,7 +337,7 @@ SaaS version: [https://www.onlyoffice.com/cloud-office.aspx](https://www.onlyoff
|
|||
|
||||
## User Feedback and Support
|
||||
|
||||
If you have any problems with or questions about this image, please visit our official forum to find answers to your questions: [dev.onlyoffice.org][1] or you can ask and answer ONLYOFFICE development questions on [Stack Overflow][2].
|
||||
If you have any problems with or questions about this image, please visit our official forum to find answers to your questions: [forum.onlyoffice.com][1] or you can ask and answer ONLYOFFICE development questions on [Stack Overflow][2].
|
||||
|
||||
[1]: https://dev.onlyoffice.org
|
||||
[1]: https://forum.onlyoffice.com
|
||||
[2]: https://stackoverflow.com/questions/tagged/onlyoffice
|
||||
|
|
129
docker-bake.hcl
Normal file
129
docker-bake.hcl
Normal file
|
@ -0,0 +1,129 @@
|
|||
variable "TAG" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "SHORTER_TAG" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "SHORTEST_TAG" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "COMPANY_NAME" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "PREFIX_NAME" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "PRODUCT_EDITION" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "PRODUCT_NAME" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "PACKAGE_VERSION" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "DOCKERFILE" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "PLATFORM" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "PACKAGE_BASEURL" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "PACKAGE_FILE" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "RELEASE_BRANCH" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
### ↓ Variables for UCS build ↓
|
||||
|
||||
variable "BASE_IMAGE" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "PG_VERSION" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
### ↑ Variables for UCS build ↑
|
||||
|
||||
target "documentserver" {
|
||||
target = "documentserver"
|
||||
dockerfile = "${DOCKERFILE}"
|
||||
tags = [
|
||||
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}",
|
||||
equal("unstable",RELEASE_BRANCH) ? "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest": "",
|
||||
]
|
||||
platforms = ["${PLATFORM}"]
|
||||
args = {
|
||||
"COMPANY_NAME": "${COMPANY_NAME}"
|
||||
"PRODUCT_NAME": "${PRODUCT_NAME}"
|
||||
"PRODUCT_EDITION": "${PRODUCT_EDITION}"
|
||||
"PACKAGE_VERSION": "${PACKAGE_VERSION}"
|
||||
"PACKAGE_BASEURL": "${PACKAGE_BASEURL}"
|
||||
"PLATFORM": "${PLATFORM}"
|
||||
}
|
||||
}
|
||||
|
||||
target "documentserver-stable" {
|
||||
target = "documentserver-stable"
|
||||
dockerfile = "production.dockerfile"
|
||||
tags = ["docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}",
|
||||
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${SHORTER_TAG}",
|
||||
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${SHORTEST_TAG}",
|
||||
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest",
|
||||
equal("-ee",PRODUCT_EDITION) ? "docker.io/${COMPANY_NAME}4enterprise/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}": "",]
|
||||
platforms = ["linux/amd64", "linux/arm64"]
|
||||
args = {
|
||||
"TAG": "${TAG}"
|
||||
"COMPANY_NAME": "${COMPANY_NAME}"
|
||||
"PRODUCT_NAME": "${PRODUCT_NAME}"
|
||||
"PRODUCT_EDITION": "${PRODUCT_EDITION}"
|
||||
}
|
||||
}
|
||||
|
||||
target "documentserver-ucs" {
|
||||
target = "documentserver"
|
||||
dockerfile = "${DOCKERFILE}"
|
||||
tags = [
|
||||
"docker.io/${COMPANY_NAME}/${PRODUCT_NAME}${PRODUCT_EDITION}-ucs:${TAG}"
|
||||
]
|
||||
platforms = ["linux/amd64", "linux/arm64"]
|
||||
args = {
|
||||
"PRODUCT_EDITION": "${PRODUCT_EDITION}"
|
||||
"PRODUCT_NAME": "${PRODUCT_NAME}"
|
||||
"COMPANY_NAME": "${COMPANY_NAME}"
|
||||
"PACKAGE_VERSION": "${PACKAGE_VERSION}"
|
||||
"PACKAGE_BASEURL": "${PACKAGE_BASEURL}"
|
||||
"BASE_IMAGE": "${BASE_IMAGE}"
|
||||
"PG_VERSION": "${PG_VERSION}"
|
||||
}
|
||||
}
|
||||
|
||||
target "documentserver-nonexample" {
|
||||
target = "documentserver-nonexample"
|
||||
dockerfile = "production.dockerfile"
|
||||
tags = [ "docker.io/${COMPANY_NAME}/${PRODUCT_NAME}${PREFIX_NAME}${PRODUCT_EDITION}:${TAG}-nonexample" ]
|
||||
platforms = ["linux/amd64", "linux/arm64"]
|
||||
args = {
|
||||
"TAG": "${TAG}"
|
||||
"COMPANY_NAME": "${COMPANY_NAME}"
|
||||
"PRODUCT_NAME": "${PRODUCT_NAME}"
|
||||
"PRODUCT_EDITION": "${PRODUCT_EDITION}"
|
||||
}
|
||||
}
|
24
production.dockerfile
Normal file
24
production.dockerfile
Normal file
|
@ -0,0 +1,24 @@
|
|||
### Arguments avavlivable only for FROM instruction ###
|
||||
ARG TAG=latest
|
||||
ARG COMPANY_NAME=onlyoffice
|
||||
ARG PRODUCT_EDITION=
|
||||
|
||||
### Build main-release ###
|
||||
|
||||
FROM ${COMPANY_NAME}/4testing-documentserver${PRODUCT_EDITION}:${TAG} as documentserver-stable
|
||||
|
||||
### Build nonexample ###
|
||||
|
||||
FROM ${COMPANY_NAME}/documentserver${PRODUCT_EDITION}:${TAG} as documentserver-nonexample
|
||||
|
||||
ARG COMPANY_NAME=onlyoffice
|
||||
ARG PRODUCT_NAME=documentserver
|
||||
ARG DS_SUPERVISOR_CONF=/etc/supervisor/conf.d/ds.conf
|
||||
|
||||
### Remove all documentserver-example data ###
|
||||
|
||||
RUN rm -rf /var/www/$COMPANY_NAME/$PRODUCT_NAME-example \
|
||||
&& rm -rf /etc/$COMPANY_NAME/$PRODUCT_NAME-example \
|
||||
&& rm -f $DS_SUPERVISOR_CONF \
|
||||
&& rm -f /etc/nginx/includes/ds-example.conf \
|
||||
&& ln -s /etc/$COMPANY_NAME/$PRODUCT_NAME/supervisor/ds.conf $DS_SUPERVISOR_CONF
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
umask 0022
|
||||
|
||||
function clean_exit {
|
||||
/usr/bin/documentserver-prepare4shutdown.sh
|
||||
}
|
||||
|
@ -11,24 +13,47 @@ shopt -s globstar
|
|||
|
||||
APP_DIR="/var/www/${COMPANY_NAME}/documentserver"
|
||||
DATA_DIR="/var/www/${COMPANY_NAME}/Data"
|
||||
PRIVATE_DATA_DIR="${DATA_DIR}/.private"
|
||||
DS_RELEASE_DATE="${PRIVATE_DATA_DIR}/ds_release_date"
|
||||
LOG_DIR="/var/log/${COMPANY_NAME}"
|
||||
DS_LOG_DIR="${LOG_DIR}/documentserver"
|
||||
LIB_DIR="/var/lib/${COMPANY_NAME}"
|
||||
DS_LIB_DIR="${LIB_DIR}/documentserver"
|
||||
CONF_DIR="/etc/${COMPANY_NAME}/documentserver"
|
||||
IS_UPGRADE="false"
|
||||
|
||||
ONLYOFFICE_DATA_CONTAINER=${ONLYOFFICE_DATA_CONTAINER:-false}
|
||||
ONLYOFFICE_DATA_CONTAINER_HOST=${ONLYOFFICE_DATA_CONTAINER_HOST:-localhost}
|
||||
ONLYOFFICE_DATA_CONTAINER_PORT=80
|
||||
|
||||
SSL_CERTIFICATES_DIR="${DATA_DIR}/certs"
|
||||
if [[ -z $SSL_CERTIFICATE_PATH ]] && [[ -f ${SSL_CERTIFICATES_DIR}/onlyoffice.crt ]]; then
|
||||
SSL_CERTIFICATE_PATH=${SSL_CERTIFICATES_DIR}/onlyoffice.crt
|
||||
RELEASE_DATE="$(stat -c="%y" ${APP_DIR}/server/DocService/docservice | sed -r 's/=([0-9]+)-([0-9]+)-([0-9]+) ([0-9:.+ ]+)/\1-\2-\3/')";
|
||||
if [ -f ${DS_RELEASE_DATE} ]; then
|
||||
PREV_RELEASE_DATE=$(head -n 1 ${DS_RELEASE_DATE})
|
||||
else
|
||||
PREV_RELEASE_DATE="0"
|
||||
fi
|
||||
|
||||
if [ "${RELEASE_DATE}" != "${PREV_RELEASE_DATE}" ]; then
|
||||
if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then
|
||||
IS_UPGRADE="true";
|
||||
fi
|
||||
fi
|
||||
|
||||
SSL_CERTIFICATES_DIR="/usr/share/ca-certificates/ds"
|
||||
mkdir -p ${SSL_CERTIFICATES_DIR}
|
||||
if [[ -d ${DATA_DIR}/certs ]] && [ -e ${DATA_DIR}/certs/*.crt ]; then
|
||||
cp -f ${DATA_DIR}/certs/* ${SSL_CERTIFICATES_DIR}
|
||||
chmod 644 ${SSL_CERTIFICATES_DIR}/*.crt ${SSL_CERTIFICATES_DIR}/*.pem
|
||||
chmod 400 ${SSL_CERTIFICATES_DIR}/*.key
|
||||
fi
|
||||
|
||||
if [[ -z $SSL_CERTIFICATE_PATH ]] && [[ -f ${SSL_CERTIFICATES_DIR}/${COMPANY_NAME}.crt ]]; then
|
||||
SSL_CERTIFICATE_PATH=${SSL_CERTIFICATES_DIR}/${COMPANY_NAME}.crt
|
||||
else
|
||||
SSL_CERTIFICATE_PATH=${SSL_CERTIFICATE_PATH:-${SSL_CERTIFICATES_DIR}/tls.crt}
|
||||
fi
|
||||
if [[ -z $SSL_KEY_PATH ]] && [[ -f ${SSL_CERTIFICATES_DIR}/onlyoffice.key ]]; then
|
||||
SSL_KEY_PATH=${SSL_CERTIFICATES_DIR}/onlyoffice.key
|
||||
if [[ -z $SSL_KEY_PATH ]] && [[ -f ${SSL_CERTIFICATES_DIR}/${COMPANY_NAME}.key ]]; then
|
||||
SSL_KEY_PATH=${SSL_CERTIFICATES_DIR}/${COMPANY_NAME}.key
|
||||
else
|
||||
SSL_KEY_PATH=${SSL_KEY_PATH:-${SSL_CERTIFICATES_DIR}/tls.key}
|
||||
fi
|
||||
|
@ -48,16 +73,29 @@ NGINX_ONLYOFFICE_EXAMPLE_CONF="${NGINX_ONLYOFFICE_EXAMPLE_PATH}/includes/ds-exam
|
|||
|
||||
NGINX_CONFIG_PATH="/etc/nginx/nginx.conf"
|
||||
NGINX_WORKER_PROCESSES=${NGINX_WORKER_PROCESSES:-1}
|
||||
NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-$(ulimit -n)}
|
||||
# Limiting the maximum number of simultaneous connections due to possible memory shortage
|
||||
[ $(ulimit -n) -gt 1048576 ] && NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-1048576} || NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-$(ulimit -n)}
|
||||
|
||||
JWT_ENABLED=${JWT_ENABLED:-false}
|
||||
JWT_SECRET=${JWT_SECRET:-secret}
|
||||
JWT_ENABLED=${JWT_ENABLED:-true}
|
||||
|
||||
# validate user's vars before usinig 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_SECRET=${JWT_SECRET:-$(pwgen -s 20)}
|
||||
JWT_HEADER=${JWT_HEADER:-Authorization}
|
||||
JWT_IN_BODY=${JWT_IN_BODY:-false}
|
||||
|
||||
WOPI_ENABLED=${WOPI_ENABLED:-false}
|
||||
|
||||
GENERATE_FONTS=${GENERATE_FONTS:-true}
|
||||
|
||||
if [[ ${PRODUCT_NAME} == "documentserver" ]]; then
|
||||
if [[ ${PRODUCT_NAME}${PRODUCT_EDITION} == "documentserver" ]]; then
|
||||
REDIS_ENABLED=false
|
||||
else
|
||||
REDIS_ENABLED=true
|
||||
|
@ -103,6 +141,7 @@ read_setting(){
|
|||
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"}
|
||||
|
@ -121,7 +160,6 @@ read_setting(){
|
|||
DB_NAME=${DB_NAME:-${POSTGRESQL_SERVER_DB_NAME:-$(${JSON} services.CoAuthoring.sql.dbName)}}
|
||||
DB_USER=${DB_USER:-${POSTGRESQL_SERVER_USER:-$(${JSON} services.CoAuthoring.sql.dbUser)}}
|
||||
DB_PWD=${DB_PWD:-${POSTGRESQL_SERVER_PASS:-$(${JSON} services.CoAuthoring.sql.dbPass)}}
|
||||
DB_TYPE=${DB_TYPE:-$(${JSON} services.CoAuthoring.sql.type)}
|
||||
|
||||
RABBITMQ_SERVER_URL=${RABBITMQ_SERVER_URL:-$(${JSON} rabbitmq.url)}
|
||||
AMQP_URI=${AMQP_URI:-${AMQP_SERVER_URL:-${RABBITMQ_SERVER_URL}}}
|
||||
|
@ -162,7 +200,7 @@ parse_rabbitmq_url(){
|
|||
# extract the host
|
||||
local hostport="$(echo ${url/$userpass@/} | cut -d/ -f1)"
|
||||
# by request - try to extract the port
|
||||
local port="$(echo $hostport | sed -e 's,^.*:,:,g' -e 's,.*:\([0-9]*\).*,\1,g' -e 's,[^0-9],,g')"
|
||||
local port="$(echo $hostport | grep : | sed -r 's_^.*:+|/.*$__g')"
|
||||
|
||||
local host
|
||||
if [ -n "$port" ]; then
|
||||
|
@ -266,37 +304,46 @@ update_rabbitmq_setting(){
|
|||
}
|
||||
|
||||
update_redis_settings(){
|
||||
${JSON} -I -e "if(this.services.CoAuthoring.redis===undefined)this.services.CoAuthoring.redis={};"
|
||||
${JSON} -I -e "this.services.CoAuthoring.redis.host = '${REDIS_SERVER_HOST}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.redis.port = '${REDIS_SERVER_PORT}'"
|
||||
|
||||
if [ -n "${REDIS_SERVER_PASS}" ]; then
|
||||
${JSON} -I -e "this.services.CoAuthoring.redis.options = {'password':'${REDIS_SERVER_PASS}'}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
update_ds_settings(){
|
||||
if [ "${JWT_ENABLED}" == "true" ]; then
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.enable.browser = ${JWT_ENABLED}"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.enable.request.inbox = ${JWT_ENABLED}"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.enable.request.outbox = ${JWT_ENABLED}"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.enable.browser = ${JWT_ENABLED}"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.enable.request.inbox = ${JWT_ENABLED}"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.enable.request.outbox = ${JWT_ENABLED}"
|
||||
|
||||
${JSON} -I -e "this.services.CoAuthoring.secret.inbox.string = '${JWT_SECRET}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.secret.outbox.string = '${JWT_SECRET}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.secret.session.string = '${JWT_SECRET}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.secret.inbox.string = '${JWT_SECRET}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.secret.outbox.string = '${JWT_SECRET}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.secret.session.string = '${JWT_SECRET}'"
|
||||
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.inbox.header = '${JWT_HEADER}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.outbox.header = '${JWT_HEADER}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.inbox.header = '${JWT_HEADER}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.outbox.header = '${JWT_HEADER}'"
|
||||
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.inbox.inBody = ${JWT_IN_BODY}"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.outbox.inBody = ${JWT_IN_BODY}"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.inbox.inBody = ${JWT_IN_BODY}"
|
||||
${JSON} -I -e "this.services.CoAuthoring.token.outbox.inBody = ${JWT_IN_BODY}"
|
||||
|
||||
if [ -f "${ONLYOFFICE_EXAMPLE_CONFIG}" ] && [ "${JWT_ENABLED}" == "true" ]; then
|
||||
${JSON_EXAMPLE} -I -e "this.server.token.enable = ${JWT_ENABLED}"
|
||||
${JSON_EXAMPLE} -I -e "this.server.token.secret = '${JWT_SECRET}'"
|
||||
${JSON_EXAMPLE} -I -e "this.server.token.authorizationHeader = '${JWT_HEADER}'"
|
||||
fi
|
||||
if [ -f "${ONLYOFFICE_EXAMPLE_CONFIG}" ]; then
|
||||
${JSON_EXAMPLE} -I -e "this.server.token.enable = ${JWT_ENABLED}"
|
||||
${JSON_EXAMPLE} -I -e "this.server.token.secret = '${JWT_SECRET}'"
|
||||
${JSON_EXAMPLE} -I -e "this.server.token.authorizationHeader = '${JWT_HEADER}'"
|
||||
fi
|
||||
|
||||
|
||||
if [ "${USE_UNAUTHORIZED_STORAGE}" == "true" ]; then
|
||||
${JSON} -I -e "if(this.services.CoAuthoring.requestDefaults===undefined)this.services.CoAuthoring.requestDefaults={}"
|
||||
${JSON} -I -e "if(this.services.CoAuthoring.requestDefaults.rejectUnauthorized===undefined)this.services.CoAuthoring.requestDefaults.rejectUnauthorized=false"
|
||||
fi
|
||||
|
||||
if [ "${WOPI_ENABLED}" == "true" ]; then
|
||||
${JSON} -I -e "if(this.wopi===undefined)this.wopi={}"
|
||||
${JSON} -I -e "this.wopi.enable = true"
|
||||
fi
|
||||
}
|
||||
|
||||
create_postgresql_cluster(){
|
||||
|
@ -327,6 +374,36 @@ create_db_tbl() {
|
|||
esac
|
||||
}
|
||||
|
||||
upgrade_db_tbl() {
|
||||
case $DB_TYPE in
|
||||
"postgres")
|
||||
upgrade_postgresql_tbl
|
||||
;;
|
||||
"mariadb"|"mysql")
|
||||
upgrade_mysql_tbl
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
upgrade_postgresql_tbl() {
|
||||
if [ -n "$DB_PWD" ]; then
|
||||
export PGPASSWORD=$DB_PWD
|
||||
fi
|
||||
|
||||
PSQL="psql -q -h$DB_HOST -p$DB_PORT -d$DB_NAME -U$DB_USER -w"
|
||||
|
||||
$PSQL -f "$APP_DIR/server/schema/postgresql/removetbl.sql"
|
||||
$PSQL -f "$APP_DIR/server/schema/postgresql/createdb.sql"
|
||||
}
|
||||
|
||||
upgrade_mysql_tbl() {
|
||||
CONNECTION_PARAMS="-h$DB_HOST -P$DB_PORT -u$DB_USER -p$DB_PWD -w"
|
||||
MYSQL="mysql -q $CONNECTION_PARAMS"
|
||||
|
||||
$MYSQL $DB_NAME < "$APP_DIR/server/schema/mysql/removetbl.sql" >/dev/null 2>&1
|
||||
$MYSQL $DB_NAME < "$APP_DIR/server/schema/mysql/createdb.sql" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
create_postgresql_tbl() {
|
||||
if [ -n "$DB_PWD" ]; then
|
||||
export PGPASSWORD=$DB_PWD
|
||||
|
@ -350,11 +427,16 @@ update_welcome_page() {
|
|||
WELCOME_PAGE="${APP_DIR}-example/welcome/docker.html"
|
||||
if [[ -e $WELCOME_PAGE ]]; then
|
||||
DOCKER_CONTAINER_ID=$(basename $(cat /proc/1/cpuset))
|
||||
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
|
||||
else
|
||||
sed 's/$(sudo docker ps -q)/'"${DOCKER_CONTAINER_ID::12}"'/' -i $WELCOME_PAGE
|
||||
(( ${#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
|
||||
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
|
||||
JWT_MESSAGE=$(echo $JWT_MESSAGE | sed 's/$(sudo docker ps -q)/'"${DOCKER_CONTAINER_ID::12}"'/')
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -406,6 +488,8 @@ update_nginx_settings(){
|
|||
if [ -f "${NGINX_ONLYOFFICE_EXAMPLE_CONF}" ]; then
|
||||
sed 's/linux/docker/' -i ${NGINX_ONLYOFFICE_EXAMPLE_CONF}
|
||||
fi
|
||||
|
||||
documentserver-update-securelink.sh -s ${SECURE_LINK_SECRET:-$(pwgen -s 20)} -r false
|
||||
}
|
||||
|
||||
update_supervisor_settings(){
|
||||
|
@ -423,8 +507,13 @@ update_logrotate_settings(){
|
|||
sed 's|\(^su\b\).*|\1 root root|' -i /etc/logrotate.conf
|
||||
}
|
||||
|
||||
update_release_date(){
|
||||
mkdir -p ${PRIVATE_DATA_DIR}
|
||||
echo ${RELEASE_DATE} > ${DS_RELEASE_DATE}
|
||||
}
|
||||
|
||||
# create base folders
|
||||
for i in converter docservice spellchecker metrics; do
|
||||
for i in converter docservice metrics; do
|
||||
mkdir -p "${DS_LOG_DIR}/$i"
|
||||
done
|
||||
|
||||
|
@ -436,7 +525,7 @@ for i in ${DS_LIB_DIR}/App_Data/cache/files ${DS_LIB_DIR}/App_Data/docbuilder ${
|
|||
done
|
||||
|
||||
# change folder rights
|
||||
for i in ${LOG_DIR} ${LIB_DIR} ${DATA_DIR}; do
|
||||
for i in ${LOG_DIR} ${LIB_DIR}; do
|
||||
chown -R ds:ds "$i"
|
||||
chmod -R 755 "$i"
|
||||
done
|
||||
|
@ -510,6 +599,8 @@ else
|
|||
update_welcome_page
|
||||
fi
|
||||
|
||||
find /etc/${COMPANY_NAME} -exec chown ds:ds {} \;
|
||||
|
||||
#start needed local services
|
||||
for i in ${LOCAL_SERVICES[@]}; do
|
||||
service $i start
|
||||
|
@ -527,6 +618,11 @@ if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then
|
|||
waiting_for_redis
|
||||
fi
|
||||
|
||||
if [ "${IS_UPGRADE}" = "true" ]; then
|
||||
upgrade_db_tbl
|
||||
update_release_date
|
||||
fi
|
||||
|
||||
update_nginx_settings
|
||||
|
||||
update_supervisor_settings
|
||||
|
@ -553,5 +649,7 @@ if [ "${GENERATE_FONTS}" == "true" ]; then
|
|||
fi
|
||||
documentserver-static-gzip.sh ${ONLYOFFICE_DATA_CONTAINER}
|
||||
|
||||
echo "${JWT_MESSAGE}"
|
||||
|
||||
tail -f /var/log/${COMPANY_NAME}/**/*.log &
|
||||
wait $!
|
||||
|
|
Loading…
Reference in a new issue