Merge branch 'release/v4.1.0'
This commit is contained in:
commit
7b5dda41a9
22
Dockerfile
22
Dockerfile
|
@ -5,7 +5,7 @@ ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=nonint
|
||||||
|
|
||||||
RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
|
RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
|
||||||
apt-get -y update && \
|
apt-get -y update && \
|
||||||
apt-get --force-yes -yq install apt-transport-https && \
|
apt-get --force-yes -yq install wget apt-transport-https && \
|
||||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D9D0BF019CC8AC0D && \
|
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D9D0BF019CC8AC0D && \
|
||||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1655A0AB68576280 && \
|
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1655A0AB68576280 && \
|
||||||
echo "deb http://archive.ubuntu.com/ubuntu precise main universe multiverse" >> /etc/apt/sources.list && \
|
echo "deb http://archive.ubuntu.com/ubuntu precise main universe multiverse" >> /etc/apt/sources.list && \
|
||||||
|
@ -16,8 +16,11 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
|
||||||
apt-get install --force-yes -yq software-properties-common && \
|
apt-get install --force-yes -yq software-properties-common && \
|
||||||
add-apt-repository ppa:ubuntu-toolchain-r/test && \
|
add-apt-repository ppa:ubuntu-toolchain-r/test && \
|
||||||
apt-get -y update && \
|
apt-get -y update && \
|
||||||
apt-get --force-yes -yq install software-properties-common adduser mysql-server redis-server rabbitmq-server nginx-extras nodejs libstdc++6 libcurl3 libxml2 libboost-regex-dev zlib1g supervisor fonts-dejavu fonts-liberation ttf-mscorefonts-installer fonts-crosextra-carlito fonts-takao-gothic fonts-opensymbol libxss1 libgtkglext1 libcairo2 xvfb libxtst6 libgconf2-4 libasound2 bomstrip libnspr4 libnss3 libnss3-nssdb nano htop && \
|
apt-get --force-yes -yq install software-properties-common adduser postgresql redis-server rabbitmq-server nginx-extras nodejs libstdc++6 libcurl3 libxml2 libboost-regex-dev zlib1g supervisor fonts-dejavu fonts-liberation ttf-mscorefonts-installer fonts-crosextra-carlito fonts-takao-gothic fonts-opensymbol libxss1 libgtkglext1 libcairo2 xvfb libxtst6 libgconf2-4 libasound2 bomstrip libnspr4 libnss3 libnss3-nssdb nano htop && \
|
||||||
service mysql stop && \
|
sudo -u postgres psql -c "CREATE DATABASE onlyoffice;" && \
|
||||||
|
sudo -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';" && \
|
||||||
|
sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;" && \
|
||||||
|
service postgresql stop && \
|
||||||
service redis-server stop && \
|
service redis-server stop && \
|
||||||
service rabbitmq-server stop && \
|
service rabbitmq-server stop && \
|
||||||
service supervisor stop && \
|
service supervisor stop && \
|
||||||
|
@ -29,12 +32,17 @@ ADD run-document-server.sh /app/onlyoffice/run-document-server.sh
|
||||||
|
|
||||||
EXPOSE 80 443
|
EXPOSE 80 443
|
||||||
|
|
||||||
RUN echo "deb http://static.teamlab.com/repo/debian/ squeeze main" | tee /etc/apt/sources.list.d/onlyoffice.list && \
|
ARG REPO_URL="deb http://static.teamlab.com/repo/debian/ squeeze main"
|
||||||
|
ARG PRODUCT_NAME=onlyoffice-documentserver
|
||||||
|
|
||||||
|
RUN echo "$REPO_URL" | tee /etc/apt/sources.list.d/onlyoffice.list && \
|
||||||
apt-get -y update && \
|
apt-get -y update && \
|
||||||
service mysql start && \
|
service postgresql start && \
|
||||||
apt-get --force-yes -yq install onlyoffice-documentserver && \
|
apt-get --force-yes -yq install $PRODUCT_NAME && \
|
||||||
service mysql stop && \
|
service postgresql stop && \
|
||||||
|
service supervisor stop && \
|
||||||
chmod 755 /app/onlyoffice/*.sh && \
|
chmod 755 /app/onlyoffice/*.sh && \
|
||||||
|
rm -rf /var/log/onlyoffice && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
VOLUME /etc/onlyoffice /var/log/onlyoffice /var/lib/onlyoffice /var/www/onlyoffice/Data
|
VOLUME /etc/onlyoffice /var/log/onlyoffice /var/lib/onlyoffice /var/www/onlyoffice/Data
|
||||||
|
|
34
Makefile
Normal file
34
Makefile
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER)
|
||||||
|
|
||||||
|
REPO_URL := "deb http://repo-doc-onlyoffice-com.s3.amazonaws.com/ubuntu/trusty/$(COMPANY_NAME)-$(PRODUCT_NAME)/$(GIT_BRANCH)/$(PACKAGE_VERSION)/ repo/"
|
||||||
|
|
||||||
|
ifeq ($(GIT_BRANCH), origin/develop)
|
||||||
|
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION))
|
||||||
|
DOCKER_TAGS += latest
|
||||||
|
else
|
||||||
|
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION))-$(subst /,-,$(GIT_BRANCH))
|
||||||
|
endif
|
||||||
|
|
||||||
|
DOCKER_REPO = $(COMPANY_NAME)/4testing-$(PRODUCT_NAME)
|
||||||
|
|
||||||
|
COLON := __colon__
|
||||||
|
DOCKER_TARGETS := $(foreach TAG,$(DOCKER_TAGS),$(DOCKER_REPO)$(COLON)$(TAG))
|
||||||
|
|
||||||
|
.PHONY: all clean clean-docker deploy docker
|
||||||
|
|
||||||
|
$(DOCKER_TARGETS): $(DEB_REPO_DATA)
|
||||||
|
|
||||||
|
sudo docker build --build-arg REPO_URL=$(REPO_URL) --build-arg PRODUCT_NAME=$(COMPANY_NAME)-$(PRODUCT_NAME) -t $(subst $(COLON),:,$@) . &&\
|
||||||
|
mkdir -p $$(dirname $@) &&\
|
||||||
|
echo "Done" > $@
|
||||||
|
|
||||||
|
all: $(DOCKER_TARGETS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rfv $(DOCKER_TARGETS)
|
||||||
|
|
||||||
|
clean-docker:
|
||||||
|
sudo docker rmi -f $$(sudo docker images -q $(COMPANY_NAME)/*) || exit 0
|
||||||
|
|
||||||
|
deploy: $(DOCKER_TARGETS)
|
||||||
|
$(foreach TARGET,$(DOCKER_TARGETS),sudo docker push $(subst $(COLON),:,$(TARGET));)
|
13
README.md
13
README.md
|
@ -148,11 +148,11 @@ Below is the complete list of parameters that can be set using environment varia
|
||||||
- **SSL_KEY_PATH**: The path to the SSL certificate's private key. Defaults to `/var/www/onlyoffice/Data/certs/onlyoffice.key`.
|
- **SSL_KEY_PATH**: The path to the SSL certificate's private key. Defaults to `/var/www/onlyoffice/Data/certs/onlyoffice.key`.
|
||||||
- **SSL_DHPARAM_PATH**: The path to the Diffie-Hellman parameter. Defaults to `/var/www/onlyoffice/Data/certs/dhparam.pem`.
|
- **SSL_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`
|
- **SSL_VERIFY_CLIENT**: Enable verification of client certificates using the `CA_CERTIFICATES_PATH` file. Defaults to `false`
|
||||||
- **MYSQL_SERVER_HOST**: The IP address or the name of the host where the MySQL server is running.
|
- **POSTGRESQL_SERVER_HOST**: The IP address or the name of the host where the PostgreSQL server is running.
|
||||||
- **MYSQL_SERVER_PORT**: The MySQL server port number.
|
- **POSTGRESQL_SERVER_PORT**: The PostgreSQL server port number.
|
||||||
- **MYSQL_SERVER_DB_NAME**: The name of a MySQL database to be created on the image startup.
|
- **POSTGRESQL_SERVER_DB_NAME**: The name of a PostgreSQL database to be created on the image startup.
|
||||||
- **MYSQL_SERVER_USER**: The new user name with superuser permissions for the MySQL account.
|
- **POSTGRESQL_SERVER_USER**: The new user name with superuser permissions for the PostgreSQL account.
|
||||||
- **MYSQL_SERVER_PASS**: The password set for the MySQL account.
|
- **POSTGRESQL_SERVER_PASS**: The password set for the PostgreSQL account.
|
||||||
- **RABBITMQ_SERVER_HOST**: The IP address or the name of the host where the RabbitMQ server is running.
|
- **RABBITMQ_SERVER_HOST**: The IP address or the name of the host where the RabbitMQ server is running.
|
||||||
- **RABBITMQ_SERVER_USER**: The RabbitMQ server user name.
|
- **RABBITMQ_SERVER_USER**: The RabbitMQ server user name.
|
||||||
- **RABBITMQ_SERVER_PASS**: The password set for the RabbitMQ account.
|
- **RABBITMQ_SERVER_PASS**: The password set for the RabbitMQ account.
|
||||||
|
@ -257,6 +257,7 @@ SaaS version: [http://www.onlyoffice.com](http://www.onlyoffice.com "http://www.
|
||||||
|
|
||||||
## User Feedback and Support
|
## User Feedback and Support
|
||||||
|
|
||||||
If you have any problems with or questions about this image, please contact us through [dev.onlyoffice.org][1].
|
If you have any problems with or questions about this image, please visit our official forum to find answers to your questions: [dev.onlyoffice.org][1] or you can ask and answer ONLYOFFICE development questions on [Stack Overflow][2].
|
||||||
|
|
||||||
[1]: http://dev.onlyoffice.org
|
[1]: http://dev.onlyoffice.org
|
||||||
|
[2]: http://stackoverflow.com/questions/tagged/onlyoffice
|
||||||
|
|
114
docker-compose.yml
Normal file
114
docker-compose.yml
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
version: '2'
|
||||||
|
services:
|
||||||
|
onlyoffice-documentserver-data:
|
||||||
|
container_name: onlyoffice-documentserver-data
|
||||||
|
image: onlyoffice/4testing-documentserver:latest
|
||||||
|
environment:
|
||||||
|
- ONLYOFFICE_DATA_CONTAINER=true
|
||||||
|
- POSTGRESQL_SERVER_HOST=onlyoffice-postgresql
|
||||||
|
- POSTGRESQL_SERVER_PORT=5432
|
||||||
|
- POSTGRESQL_SERVER_DB_NAME=onlyoffice
|
||||||
|
- POSTGRESQL_SERVER_USER=onlyoffice
|
||||||
|
- RABBITMQ_SERVER_HOST=onlyoffice-rabbitmq
|
||||||
|
- RABBITMQ_SERVER_USER=guest
|
||||||
|
- RABBITMQ_SERVER_PASS=guest
|
||||||
|
- REDIS_SERVER_HOST=onlyoffice-redis
|
||||||
|
- REDIS_SERVER_PORT=6379
|
||||||
|
stdin_open: true
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- onlyoffice
|
||||||
|
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-documentserver:
|
||||||
|
image: onlyoffice/4testing-documentserver:latest
|
||||||
|
depends_on:
|
||||||
|
- onlyoffice-documentserver-data
|
||||||
|
- onlyoffice-postgresql
|
||||||
|
- onlyoffice-redis
|
||||||
|
- onlyoffice-rabbitmq
|
||||||
|
environment:
|
||||||
|
- ONLYOFFICE_DATA_CONTAINER_HOST=onlyoffice-documentserver-data
|
||||||
|
- BALANCE=uri depth 3
|
||||||
|
- EXCLUDE_PORTS=443
|
||||||
|
- HTTP_CHECK=GET /healthcheck
|
||||||
|
- EXTRA_SETTINGS=http-check expect string true
|
||||||
|
# Uncomment the string below to redirect HTTP request to HTTPS request.
|
||||||
|
#- FORCE_SSL=true
|
||||||
|
stdin_open: true
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- onlyoffice
|
||||||
|
expose:
|
||||||
|
- '80'
|
||||||
|
volumes_from:
|
||||||
|
- onlyoffice-documentserver-data
|
||||||
|
|
||||||
|
onlyoffice-haproxy:
|
||||||
|
container_name: onlyoffice-haproxy
|
||||||
|
image: dockercloud/haproxy:1.5.1
|
||||||
|
depends_on:
|
||||||
|
- onlyoffice-documentserver
|
||||||
|
environment:
|
||||||
|
- MODE=http
|
||||||
|
# Uncomment the string below to specify the path of ssl certificates
|
||||||
|
#- CERT_FOLDER=/certs/
|
||||||
|
stdin_open: true
|
||||||
|
links:
|
||||||
|
- onlyoffice-documentserver
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
# Uncomment the string below to map a ssl certificate from host
|
||||||
|
# to the proxy container
|
||||||
|
#- /app/onlyoffice/DocumentServer/data/certs/onlyoffice.pem:/certs/cert1.pem
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- onlyoffice
|
||||||
|
ports:
|
||||||
|
- '80:80'
|
||||||
|
- '443:443'
|
||||||
|
- '1936:1936'
|
||||||
|
|
||||||
|
onlyoffice-redis:
|
||||||
|
container_name: onlyoffice-redis
|
||||||
|
image: redis
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- onlyoffice
|
||||||
|
expose:
|
||||||
|
- '6379'
|
||||||
|
|
||||||
|
onlyoffice-rabbitmq:
|
||||||
|
container_name: onlyoffice-rabbitmq
|
||||||
|
image: rabbitmq
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- onlyoffice
|
||||||
|
expose:
|
||||||
|
- '5672'
|
||||||
|
|
||||||
|
onlyoffice-postgresql:
|
||||||
|
container_name: onlyoffice-postgresql
|
||||||
|
image: postgres:9.5
|
||||||
|
environment:
|
||||||
|
- POSTGRES_DB=onlyoffice
|
||||||
|
- POSTGRES_USER=onlyoffice
|
||||||
|
networks:
|
||||||
|
- onlyoffice
|
||||||
|
restart: always
|
||||||
|
expose:
|
||||||
|
- '5432'
|
||||||
|
volumes:
|
||||||
|
- postgresql_data:/var/lib/postgresql
|
||||||
|
|
||||||
|
networks:
|
||||||
|
onlyoffice:
|
||||||
|
driver: 'bridge'
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgresql_data:
|
|
@ -4,7 +4,9 @@ APP_DIR="/var/www/onlyoffice/documentserver"
|
||||||
DATA_DIR="/var/www/onlyoffice/Data"
|
DATA_DIR="/var/www/onlyoffice/Data"
|
||||||
LOG_DIR="/var/log/onlyoffice/documentserver"
|
LOG_DIR="/var/log/onlyoffice/documentserver"
|
||||||
|
|
||||||
ONLYOFFICE_HTTPS=${ONLYOFFICE_HTTPS:-false}
|
ONLYOFFICE_DATA_CONTAINER=${ONLYOFFICE_DATA_CONTAINER:-false}
|
||||||
|
ONLYOFFICE_DATA_CONTAINER_HOST=${ONLYOFFICE_DATA_CONTAINER_HOST:-localhost}
|
||||||
|
ONLYOFFICE_DATA_CONTAINER_PORT=80
|
||||||
|
|
||||||
SSL_CERTIFICATES_DIR="${DATA_DIR}/certs"
|
SSL_CERTIFICATES_DIR="${DATA_DIR}/certs"
|
||||||
SSL_CERTIFICATE_PATH=${SSL_CERTIFICATE_PATH:-${SSL_CERTIFICATES_DIR}/onlyoffice.crt}
|
SSL_CERTIFICATE_PATH=${SSL_CERTIFICATE_PATH:-${SSL_CERTIFICATES_DIR}/onlyoffice.crt}
|
||||||
|
@ -24,26 +26,85 @@ NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-$(ulimit -n)}
|
||||||
|
|
||||||
ONLYOFFICE_DEFAULT_CONFIG=/etc/onlyoffice/documentserver/default.json
|
ONLYOFFICE_DEFAULT_CONFIG=/etc/onlyoffice/documentserver/default.json
|
||||||
|
|
||||||
MYSQL_SERVER_HOST=${MYSQL_SERVER_HOST:-"localhost"}
|
JSON="json -q -f ${ONLYOFFICE_DEFAULT_CONFIG}"
|
||||||
MYSQL_SERVER_PORT=${MYSQL_SERVER_PORT:-"3306"}
|
|
||||||
MYSQL_SERVER_DB_NAME=${MYSQL_SERVER_DB_NAME:-"onlyoffice"}
|
|
||||||
MYSQL_SERVER_USER=${MYSQL_SERVER_USER:-"root"}
|
|
||||||
MYSQL_SERVER_PASS=${MYSQL_SERVER_PASS:-""}
|
|
||||||
|
|
||||||
RABBITMQ_SERVER_HOST=${RABBITMQ_SERVER_HOST:-"localhost"}
|
LOCAL_SERVICES=()
|
||||||
RABBITMQ_SERVER_USER=${RABBITMQ_SERVER_USER:-"guest"}
|
|
||||||
RABBITMQ_SERVER_PASS=${RABBITMQ_SERVER_PASS:-"guest"}
|
|
||||||
|
|
||||||
REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-"localhost"}
|
read_setting(){
|
||||||
REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-"6379"}
|
POSTGRESQL_SERVER_HOST=${POSTGRESQL_SERVER_HOST:-$(${JSON} services.CoAuthoring.sql.dbHost)}
|
||||||
|
POSTGRESQL_SERVER_PORT=${POSTGRESQL_SERVER_PORT:-$(${JSON} services.CoAuthoring.sql.dbPort)}
|
||||||
|
POSTGRESQL_SERVER_DB_NAME=${POSTGRESQL_SERVER_DB_NAME:-$(${JSON} services.CoAuthoring.sql.dbName)}
|
||||||
|
POSTGRESQL_SERVER_USER=${POSTGRESQL_SERVER_USER:-$(${JSON} services.CoAuthoring.sql.dbUser)}
|
||||||
|
POSTGRESQL_SERVER_PASS=${POSTGRESQL_SERVER_PASS:-$(${JSON} services.CoAuthoring.sql.dbPass)}
|
||||||
|
|
||||||
# create base folders
|
RABBITMQ_SERVER_URL=$(${JSON} rabbitmq.url)
|
||||||
for i in converter docservice spellchecker metrics gc; do
|
RABBITMQ_SERVER_HOST=${RABBITMQ_SERVER_HOST:-${RABBITMQ_SERVER_URL#'amqp://'}}
|
||||||
mkdir -p "${LOG_DIR}/$i"
|
RABBITMQ_SERVER_USER=${RABBITMQ_SERVER_USER:-$(${JSON} rabbitmq.login)}
|
||||||
|
RABBITMQ_SERVER_PASS=${RABBITMQ_SERVER_PASS:-$(${JSON} rabbitmq.password)}
|
||||||
|
RABBITMQ_SERVER_PORT=${RABBITMQ_SERVER_PORT:-"5672"}
|
||||||
|
|
||||||
|
REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-$(${JSON} services.CoAuthoring.redis.host)}
|
||||||
|
REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-$(${JSON} services.CoAuthoring.redis.port)}
|
||||||
|
}
|
||||||
|
|
||||||
|
waiting_for_connection(){
|
||||||
|
until nc -z -w 3 "$1" "$2"; do
|
||||||
|
>&2 echo "Waiting for connection to the $1 host on port $2"
|
||||||
|
sleep 1
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
mkdir -p ${LOG_DIR}-example
|
waiting_for_postgresql(){
|
||||||
|
waiting_for_connection ${POSTGRESQL_SERVER_HOST} ${POSTGRESQL_SERVER_PORT}
|
||||||
|
}
|
||||||
|
|
||||||
|
waiting_for_rabbitmq(){
|
||||||
|
waiting_for_connection ${RABBITMQ_SERVER_HOST} ${RABBITMQ_SERVER_PORT}
|
||||||
|
}
|
||||||
|
|
||||||
|
waiting_for_redis(){
|
||||||
|
waiting_for_connection ${REDIS_SERVER_HOST} ${REDIS_SERVER_PORT}
|
||||||
|
}
|
||||||
|
waiting_for_datacontainer(){
|
||||||
|
waiting_for_connection ${ONLYOFFICE_DATA_CONTAINER_HOST} ${ONLYOFFICE_DATA_CONTAINER_PORT}
|
||||||
|
}
|
||||||
|
update_postgresql_settings(){
|
||||||
|
${JSON} -I -e "this.services.CoAuthoring.sql.dbHost = '${POSTGRESQL_SERVER_HOST}'"
|
||||||
|
${JSON} -I -e "this.services.CoAuthoring.sql.dbPort = '${POSTGRESQL_SERVER_PORT}'"
|
||||||
|
${JSON} -I -e "this.services.CoAuthoring.sql.dbName = '${POSTGRESQL_SERVER_DB_NAME}'"
|
||||||
|
${JSON} -I -e "this.services.CoAuthoring.sql.dbUser = '${POSTGRESQL_SERVER_USER}'"
|
||||||
|
${JSON} -I -e "this.services.CoAuthoring.sql.dbPass = '${POSTGRESQL_SERVER_PASS}'"
|
||||||
|
}
|
||||||
|
|
||||||
|
update_rabbitmq_setting(){
|
||||||
|
${JSON} -I -e "this.rabbitmq.url = 'amqp://${RABBITMQ_SERVER_HOST}'"
|
||||||
|
${JSON} -I -e "this.rabbitmq.login = '${RABBITMQ_SERVER_USER}'"
|
||||||
|
${JSON} -I -e "this.rabbitmq.password = '${RABBITMQ_SERVER_PASS}'"
|
||||||
|
}
|
||||||
|
|
||||||
|
update_redis_settings(){
|
||||||
|
${JSON} -I -e "this.services.CoAuthoring.redis.host = '${REDIS_SERVER_HOST}'"
|
||||||
|
${JSON} -I -e "this.services.CoAuthoring.redis.port = '${REDIS_SERVER_PORT}'"
|
||||||
|
}
|
||||||
|
|
||||||
|
create_postgresql_db(){
|
||||||
|
CONNECTION_PARAMS="-h${POSTGRESQL_SERVER_HOST} -U${POSTGRESQL_SERVER_USER} -w"
|
||||||
|
if [ -n "${POSTGRESQL_SERVER_PASS}" ]; then
|
||||||
|
export PGPASSWORD=${POSTGRESQL_SERVER_PASS}
|
||||||
|
fi
|
||||||
|
|
||||||
|
PSQL="psql -q $CONNECTION_PARAMS"
|
||||||
|
CREATEDB="createdb $CONNECTION_PARAMS"
|
||||||
|
|
||||||
|
# Create db on remote server
|
||||||
|
if $PSQL -lt | cut -d\| -f 1 | grep -qw | grep 0; then
|
||||||
|
$CREATEDB $DB_NAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
$PSQL -d "${POSTGRESQL_SERVER_DB_NAME}" -f "${APP_DIR}/server/schema/postgresql/createdb.sql"
|
||||||
|
}
|
||||||
|
|
||||||
|
update_nginx_settings(){
|
||||||
# Set up nginx
|
# Set up nginx
|
||||||
sed 's/^worker_processes.*/'"worker_processes ${NGINX_WORKER_PROCESSES};"'/' -i ${NGINX_CONFIG_PATH}
|
sed 's/^worker_processes.*/'"worker_processes ${NGINX_WORKER_PROCESSES};"'/' -i ${NGINX_CONFIG_PATH}
|
||||||
sed 's/worker_connections.*/'"worker_connections ${NGINX_WORKER_CONNECTIONS};"'/' -i ${NGINX_CONFIG_PATH}
|
sed 's/worker_connections.*/'"worker_connections ${NGINX_WORKER_CONNECTIONS};"'/' -i ${NGINX_CONFIG_PATH}
|
||||||
|
@ -53,8 +114,6 @@ sed 's/access_log.*/'"access_log off;"'/' -i ${NGINX_CONFIG_PATH}
|
||||||
if [ -f "${SSL_CERTIFICATE_PATH}" -a -f "${SSL_KEY_PATH}" ]; then
|
if [ -f "${SSL_CERTIFICATE_PATH}" -a -f "${SSL_KEY_PATH}" ]; then
|
||||||
cp ${SYSCONF_TEMPLATES_DIR}/nginx/onlyoffice-documentserver-ssl.conf ${NGINX_ONLYOFFICE_PATH}
|
cp ${SYSCONF_TEMPLATES_DIR}/nginx/onlyoffice-documentserver-ssl.conf ${NGINX_ONLYOFFICE_PATH}
|
||||||
|
|
||||||
mkdir ${DATA_DIR}
|
|
||||||
|
|
||||||
# configure nginx
|
# configure nginx
|
||||||
sed 's,{{SSL_CERTIFICATE_PATH}},'"${SSL_CERTIFICATE_PATH}"',' -i ${NGINX_ONLYOFFICE_PATH}
|
sed 's,{{SSL_CERTIFICATE_PATH}},'"${SSL_CERTIFICATE_PATH}"',' -i ${NGINX_ONLYOFFICE_PATH}
|
||||||
sed 's,{{SSL_KEY_PATH}},'"${SSL_KEY_PATH}"',' -i ${NGINX_ONLYOFFICE_PATH}
|
sed 's,{{SSL_KEY_PATH}},'"${SSL_KEY_PATH}"',' -i ${NGINX_ONLYOFFICE_PATH}
|
||||||
|
@ -82,58 +141,74 @@ if [ -f "${SSL_CERTIFICATE_PATH}" -a -f "${SSL_KEY_PATH}" ]; then
|
||||||
else
|
else
|
||||||
cp ${SYSCONF_TEMPLATES_DIR}/nginx/onlyoffice-documentserver.conf ${NGINX_ONLYOFFICE_PATH}
|
cp ${SYSCONF_TEMPLATES_DIR}/nginx/onlyoffice-documentserver.conf ${NGINX_ONLYOFFICE_PATH}
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
JSON="json -I -q -f ${ONLYOFFICE_DEFAULT_CONFIG}"
|
update_supervisor_settings(){
|
||||||
|
|
||||||
if [ ${MYSQL_SERVER_HOST} != "localhost" ]; then
|
|
||||||
|
|
||||||
# Change mysql settings
|
|
||||||
${JSON} -e "this.services.CoAuthoring.sql.dbHost = '${MYSQL_SERVER_HOST}'"
|
|
||||||
${JSON} -e "this.services.CoAuthoring.sql.dbPort = '${MYSQL_SERVER_PORT}'"
|
|
||||||
${JSON} -e "this.services.CoAuthoring.sql.dbName = '${MYSQL_SERVER_DB_NAME}'"
|
|
||||||
${JSON} -e "this.services.CoAuthoring.sql.dbUser = '${MYSQL_SERVER_USER}'"
|
|
||||||
${JSON} -e "this.services.CoAuthoring.sql.dbPass = '${MYSQL_SERVER_PASS}'"
|
|
||||||
|
|
||||||
MYSQL="mysql -s -h${MYSQL_SERVER_HOST} -u${MYSQL_SERVER_USER}"
|
|
||||||
if [ -n "${MYSQL_SERVER_PASS}" ]; then
|
|
||||||
MYSQL="$MYSQL -p${MYSQL_SERVER_PASS}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create db on remote server
|
|
||||||
${MYSQL} -e "CREATE DATABASE IF NOT EXISTS ${MYSQL_SERVER_DB_NAME} CHARACTER SET utf8 COLLATE 'utf8_general_ci';"
|
|
||||||
${MYSQL} "${MYSQL_SERVER_DB_NAME}" < "${APP_DIR}/server/schema/createdb.sql"
|
|
||||||
else
|
|
||||||
service mysql start
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${RABBITMQ_SERVER_HOST} != "localhost" ]; then
|
|
||||||
|
|
||||||
# Change rabbitmq settings
|
|
||||||
${JSON} -e "this.rabbitmq.url = 'amqp://${RABBITMQ_SERVER_HOST}'"
|
|
||||||
${JSON} -e "this.rabbitmq.login = '${RABBITMQ_SERVER_USER}'"
|
|
||||||
${JSON} -e "this.rabbitmq.password = '${RABBITMQ_SERVER_PASS}'"
|
|
||||||
|
|
||||||
else
|
|
||||||
service redis-server start
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${REDIS_SERVER_HOST} != "localhost" ]; then
|
|
||||||
|
|
||||||
# Change redis settings
|
|
||||||
${JSON} -e "this.services.CoAuthoring.redis.host = '${REDIS_SERVER_HOST}'"
|
|
||||||
${JSON} -e "this.services.CoAuthoring.redis.port = '${REDIS_SERVER_PORT}'"
|
|
||||||
|
|
||||||
else
|
|
||||||
service rabbitmq-server start
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Copy modified supervisor start script
|
# Copy modified supervisor start script
|
||||||
cp ${SYSCONF_TEMPLATES_DIR}/supervisor/supervisor /etc/init.d/
|
cp ${SYSCONF_TEMPLATES_DIR}/supervisor/supervisor /etc/init.d/
|
||||||
# Copy modified supervisor config
|
# Copy modified supervisor config
|
||||||
cp ${SYSCONF_TEMPLATES_DIR}/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
|
cp ${SYSCONF_TEMPLATES_DIR}/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
|
||||||
|
}
|
||||||
|
|
||||||
service nginx start
|
# create base folders
|
||||||
|
for i in converter docservice spellchecker metrics gc; do
|
||||||
|
mkdir -p "${LOG_DIR}/$i"
|
||||||
|
done
|
||||||
|
|
||||||
|
mkdir -p ${LOG_DIR}-example
|
||||||
|
|
||||||
|
if [ ${ONLYOFFICE_DATA_CONTAINER_HOST} = "localhost" ]; then
|
||||||
|
|
||||||
|
read_setting
|
||||||
|
|
||||||
|
# update settings by env variables
|
||||||
|
if [ ${POSTGRESQL_SERVER_HOST} != "localhost" ]; then
|
||||||
|
update_postgresql_settings
|
||||||
|
waiting_for_postgresql
|
||||||
|
create_postgresql_db
|
||||||
|
else
|
||||||
|
LOCAL_SERVICES+=("postgresql")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${RABBITMQ_SERVER_HOST} != "localhost" ]; then
|
||||||
|
update_rabbitmq_setting
|
||||||
|
else
|
||||||
|
LOCAL_SERVICES+=("redis-server")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${REDIS_SERVER_HOST} != "localhost" ]; then
|
||||||
|
update_redis_settings
|
||||||
|
else
|
||||||
|
LOCAL_SERVICES+=("rabbitmq-server")
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# no need to update settings just wait for remote data
|
||||||
|
waiting_for_datacontainer
|
||||||
|
|
||||||
|
# read settings after the data container in ready state
|
||||||
|
# to prevent get unconfigureted data
|
||||||
|
read_setting
|
||||||
|
fi
|
||||||
|
|
||||||
|
#start needed local services
|
||||||
|
for i in ${LOCAL_SERVICES[@]}; do
|
||||||
|
service $i start
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then
|
||||||
|
waiting_for_postgresql
|
||||||
|
waiting_for_rabbitmq
|
||||||
|
waiting_for_redis
|
||||||
|
|
||||||
|
update_nginx_settings
|
||||||
|
|
||||||
|
update_supervisor_settings
|
||||||
service supervisor start
|
service supervisor start
|
||||||
|
fi
|
||||||
|
|
||||||
|
# nginx used as a proxy, and as data container status service.
|
||||||
|
# it run in all cases.
|
||||||
|
service nginx start
|
||||||
|
|
||||||
# Regenerate the fonts list and the fonts thumbnails
|
# Regenerate the fonts list and the fonts thumbnails
|
||||||
documentserver-generate-allfonts.sh
|
documentserver-generate-allfonts.sh ${ONLYOFFICE_DATA_CONTAINER}
|
||||||
|
|
Loading…
Reference in a new issue