Merge pull request #14 from ONLYOFFICE/develop

Develop
This commit is contained in:
Alexey Bannov 2016-12-06 10:41:06 +03:00 committed by GitHub
commit 06122f0c86
6 changed files with 117 additions and 8 deletions

6
3rd-Party.txt Normal file
View File

@ -0,0 +1,6 @@
Docker-CommunityServer uses code from the following 3rd party projects.
1. wait-for-it (https://github.com/vishnubob/wait-for-it/)
License: MIT
License File: assets\tools\wait-for-it.license

View File

@ -31,7 +31,7 @@ RUN echo "${SOURCE_REPO_URL}" >> /etc/apt/sources.list && \
apt-get -y update && \
apt-get install --force-yes -yq mono-complete ca-certificates-mono && \
echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
apt-get install --force-yes -yq dumb-init mysql-server mysql-client sphinxsearch onlyoffice-communityserver htop nano dnsutils && \
apt-get install --force-yes -yq dumb-init sphinxsearch onlyoffice-communityserver htop nano dnsutils && \
rm -rf /var/lib/apt/lists/*

21
LICENSE.txt Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 ONLYOFFICE
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2016 Giles Hall
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -10,16 +10,42 @@ fastcgi_cache_path /var/cache/nginx/onlyoffice
max_size=256m
inactive=1d;
geo $ip_external {
default 1;
{{DOCKER_ONLYOFFICE_SUBNET}} 0;
127.0.0.1 0;
}
## Normal HTTP host
server {
listen 0.0.0.0:80;
listen [::]:80 default_server;
server_name _;
server_tokens off;
## Redirects all traffic to the HTTPS host
root /nowhere; ## root doesn't have to be a valid path since we are redirecting
rewrite ^ https://$host$request_uri? permanent;
root /nowhere; ## root doesn't have to be a valid path since we are redirecting
location / {
if ($ip_external) {
## Redirects all traffic to the HTTPS host
rewrite ^ https://$host$request_uri? permanent;
}
client_max_body_size 100m;
proxy_pass https://127.0.0.1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_ssl_verify off;
}
}
## HTTPS host

View File

@ -1,5 +1,6 @@
#!/bin/bash
SERVER_HOST="";
ONLYOFFICE_DIR="/var/www/onlyoffice"
ONLYOFFICE_DATA_DIR="${ONLYOFFICE_DIR}/Data"
ONLYOFFICE_SERVICES_DIR="${ONLYOFFICE_DIR}/Services"
@ -13,6 +14,8 @@ ONLYOFFICE_MONOSERVE_COUNT=${ONLYOFFICE_MONOSERVE_COUNT:-2};
ONLYOFFICE_MODE=${ONLYOFFICE_MODE:-"SERVER"};
ONLYOFFICE_GOD_DIR="/etc/god/conf.d"
ONLYOFFICE_CRON_PATH="/etc/cron.d/onlyoffice"
DOCKER_ONLYOFFICE_SUBNET=${DOCKER_ONLYOFFICE_SUBNET:-""};
NGINX_CONF_DIR="/etc/nginx/sites-enabled"
NGINX_ROOT_DIR="/etc/nginx"
@ -56,6 +59,8 @@ MYSQL_SERVER_EXTERNAL=false;
mkdir -p "${SSL_CERTIFICATES_DIR}"
check_partnerdata
re='^[0-9]+$'
if ! [[ ${ONLYOFFICE_MONOSERVE_COUNT} =~ $re ]] ; then
@ -228,6 +233,22 @@ change_connections(){
sed '/'${1}'/s/\(connectionString\s*=\s*\"\)[^\"]*\"/\1Server='${MYSQL_SERVER_HOST}';Port='${MYSQL_SERVER_PORT}';Database='${MYSQL_SERVER_DB_NAME}';User ID='${MYSQL_SERVER_USER}';Password='${MYSQL_SERVER_PASS}';Pooling=true;Character Set=utf8;AutoEnlist=false\"/' -i ${2}
}
check_partnerdata(){
PARTNER_DATA_FILE="${ONLYOFFICE_DATA_DIR}/json-data.txt";
if [ -f ${PARTNER_DATA_FILE} ]; then
for serverID in $(seq 1 ${ONLYOFFICE_MONOSERVE_COUNT});
do
index=$serverID;
if [ $index == 1 ]; then
index="";
fi
cp ${PARTNER_DATA_FILE} ${ONLYOFFICE_ROOT_DIR}${index}/App_Data/static/partnerdata/
done
fi
}
if [ "${MYSQL_SERVER_EXTERNAL}" == "true" ]; then
@ -302,7 +323,8 @@ if [ "${MYSQL_SERVER_EXTERNAL}" == "true" ]; then
else
# create db if not exist
if [ ! -f /var/lib/mysql/ibdata1 ]; then
mysql_install_db
cp /etc/mysql/my.cnf /usr/share/mysql/my-default.cnf
mysql_install_db || true
service mysql start
echo "CREATE DATABASE onlyoffice CHARACTER SET utf8 COLLATE utf8_general_ci" | mysql;
@ -369,6 +391,13 @@ else
cp ${SYSCONF_TEMPLATES_DIR}/nginx/onlyoffice ${SYSCONF_TEMPLATES_DIR}/nginx/prepare-onlyoffice;
fi
if [ ${DOCKER_ONLYOFFICE_SUBNET} ]; then
sed 's,{{DOCKER_ONLYOFFICE_SUBNET}},'"${DOCKER_ONLYOFFICE_SUBNET}"',' -i ${SYSCONF_TEMPLATES_DIR}/nginx/prepare-onlyoffice
else
sed '/{{DOCKER_ONLYOFFICE_SUBNET}}/d' -i ${SYSCONF_TEMPLATES_DIR}/nginx/prepare-onlyoffice
fi
echo "Start=No" >> /etc/init.d/sphinxsearch
if ! grep -q "name=\"textindex\"" ${ONLYOFFICE_SERVICES_DIR}/TeamLabSvc/TeamLabSvc.exe.Config; then
@ -376,14 +405,20 @@ if ! grep -q "name=\"textindex\"" ${ONLYOFFICE_SERVICES_DIR}/TeamLabSvc/TeamLabS
fi
if [ "${DOCUMENT_SERVER_ENABLED}" == "true" ]; then
sed 's,{{DOCUMENT_SERVER_HOST_ADDR}},'"${DOCUMENT_SERVER_PROTOCOL}:\/\/${DOCUMENT_SERVER_HOST}"',' -i ${SYSCONF_TEMPLATES_DIR}/nginx/prepare-onlyoffice
sed 's,{{DOCUMENT_SERVER_HOST_ADDR}},'"${DOCUMENT_SERVER_PROTOCOL}:\/\/${DOCUMENT_SERVER_HOST}"',' -i ${SYSCONF_TEMPLATES_DIR}/nginx/prepare-onlyoffice
# change web.appsettings link to editor
# change web.appsettings link to editor
sed '/files\.docservice\.url\.converter/s!\(value\s*=\s*\"\)[^\"]*\"!\1'${DOCUMENT_SERVER_PROTOCOL}':\/\/'${DOCUMENT_SERVER_HOST}'\/ConvertService\.ashx\"!' -i ${ONLYOFFICE_ROOT_DIR}/web.appsettings.config
sed '/files\.docservice\.url\.api/s!\(value\s*=\s*\"\)[^\"]*\"!\1'${DOCUMENT_SERVER_API_URL}'\"!' -i ${ONLYOFFICE_ROOT_DIR}/web.appsettings.config
sed '/files\.docservice\.url\.storage/s!\(value\s*=\s*\"\)[^\"]*\"!\1'${DOCUMENT_SERVER_PROTOCOL}':\/\/'${DOCUMENT_SERVER_HOST}'\/FileUploader\.ashx\"!' -i ${ONLYOFFICE_ROOT_DIR}/web.appsettings.config
sed '/files\.docservice\.url\.command/s!\(value\s*=\s*\"\)[^\"]*\"!\1'${DOCUMENT_SERVER_PROTOCOL}':\/\/'${DOCUMENT_SERVER_HOST}'\/coauthoring\/CommandService\.ashx\"!' -i ${ONLYOFFICE_ROOT_DIR}/web.appsettings.config
if [ -n "${DOCKER_ONLYOFFICE_SUBNET}" ] && [ -n "${SERVER_HOST}" ]; then
sed '/files\.docservice\.url\.portal/s!\(value\s*=\s*\"\)[^\"]*\"!\1http:\/\/'${SERVER_HOST}'\"!' -i ${ONLYOFFICE_ROOT_DIR}/web.appsettings.config
fi
if ! grep -q "files\.docservice\.url\.command" ${ONLYOFFICE_ROOT_DIR}/web.appsettings.config; then
sed '/files\.docservice\.url\.storage/a <add key=\"files\.docservice\.url\.command\" value=\"'${DOCUMENT_SERVER_PROTOCOL}':\/\/'${DOCUMENT_SERVER_HOST}'\/coauthoring\/CommandService\.ashx\" \/>/' -i ${ONLYOFFICE_ROOT_DIR}/web.appsettings.config
else
@ -647,6 +682,7 @@ else
service onlyofficeMailWatchdog start
service onlyofficeNotify start
service onlyofficeBackup start
#service onlyofficeHealthCheck start
fi
service god start