added data container for onlyoffice-documentserver
This commit is contained in:
parent
0fa55f0192
commit
89de48c8de
2 changed files with 158 additions and 98 deletions
|
@ -1,11 +1,8 @@
|
||||||
version: '2'
|
version: '2'
|
||||||
services:
|
services:
|
||||||
onlyoffice-document:
|
onlyoffice-documentserver-data:
|
||||||
|
container_name: onlyoffice-documentserver-data
|
||||||
image: onlyoffice/4testing-documentserver:latest
|
image: onlyoffice/4testing-documentserver:latest
|
||||||
depends_on:
|
|
||||||
- onlyoffice-mysql
|
|
||||||
- onlyoffice-redis
|
|
||||||
- onlyoffice-rabbitmq
|
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_SERVER_HOST=onlyoffice-mysql
|
- MYSQL_SERVER_HOST=onlyoffice-mysql
|
||||||
- MYSQL_SERVER_PORT=3306
|
- MYSQL_SERVER_PORT=3306
|
||||||
|
@ -16,6 +13,26 @@ services:
|
||||||
- RABBITMQ_SERVER_PASS=guest
|
- RABBITMQ_SERVER_PASS=guest
|
||||||
- REDIS_SERVER_HOST=onlyoffice-redis
|
- REDIS_SERVER_HOST=onlyoffice-redis
|
||||||
- REDIS_SERVER_PORT=6379
|
- REDIS_SERVER_PORT=6379
|
||||||
|
stdin_open: true
|
||||||
|
tty: 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-mysql
|
||||||
|
- onlyoffice-redis
|
||||||
|
- onlyoffice-rabbitmq
|
||||||
|
environment:
|
||||||
- HTTP_CHECK=HEAD /healthcheck
|
- HTTP_CHECK=HEAD /healthcheck
|
||||||
- EXTRA_SETTINGS=http-check expect status 200
|
- EXTRA_SETTINGS=http-check expect status 200
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
|
@ -26,24 +43,21 @@ services:
|
||||||
expose:
|
expose:
|
||||||
- '80'
|
- '80'
|
||||||
- '443'
|
- '443'
|
||||||
volumes:
|
volumes_from:
|
||||||
- document_data:/var/www/onlyoffice/Data
|
- onlyoffice-documentserver-data:
|
||||||
- document_log:/var/log/onlyoffice
|
|
||||||
- document_files:/var/lib/onlyoffice/documentserver/App_Data/cache/files
|
|
||||||
- document_example_files:/var/www/onlyoffice/documentserver-example/public/files
|
|
||||||
|
|
||||||
onlyoffice-haproxy:
|
onlyoffice-haproxy:
|
||||||
container_name: onlyoffice-haproxy
|
container_name: onlyoffice-haproxy
|
||||||
image: dockercloud/haproxy:1.2.1
|
image: dockercloud/haproxy:1.2.1
|
||||||
depends_on:
|
depends_on:
|
||||||
- onlyoffice-document
|
- onlyoffice-documentserver
|
||||||
environment:
|
environment:
|
||||||
- MODE=tcp
|
- MODE=tcp
|
||||||
- TCP_PORTS="80, 443"
|
- TCP_PORTS="80, 443"
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
tty: true
|
tty: true
|
||||||
links:
|
links:
|
||||||
- onlyoffice-document
|
- onlyoffice-documentserver
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
restart: always
|
restart: always
|
||||||
|
@ -93,7 +107,3 @@ networks:
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
mysql_data:
|
mysql_data:
|
||||||
document_data:
|
|
||||||
document_log:
|
|
||||||
document_files:
|
|
||||||
document_example_files:
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ 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}
|
||||||
|
|
||||||
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 +24,73 @@ 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"}
|
MYSQL_SERVER_HOST=${MYSQL_SERVER_HOST:-$(${JSON} services.CoAuthoring.sql.dbHost)}
|
||||||
RABBITMQ_SERVER_USER=${RABBITMQ_SERVER_USER:-"guest"}
|
MYSQL_SERVER_PORT=${MYSQL_SERVER_PORT:-$(${JSON} services.CoAuthoring.sql.dbPort)}
|
||||||
RABBITMQ_SERVER_PASS=${RABBITMQ_SERVER_PASS:-"guest"}
|
MYSQL_SERVER_DB_NAME=${MYSQL_SERVER_DB_NAME:-$(${JSON} services.CoAuthoring.sql.dbName)}
|
||||||
|
MYSQL_SERVER_USER=${MYSQL_SERVER_USER:-$(${JSON} services.CoAuthoring.sql.dbUser)}
|
||||||
|
MYSQL_SERVER_PASS=${MYSQL_SERVER_PASS:-$(${JSON} services.CoAuthoring.sql.dbPass)}
|
||||||
|
|
||||||
REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-"localhost"}
|
RABBITMQ_SERVER_URL=$(${JSON} rabbitmq.url)
|
||||||
REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-"6379"}
|
RABBITMQ_SERVER_HOST=${RABBITMQ_SERVER_HOST:-${RABBITMQ_SERVER_URL#'amqp://'}}
|
||||||
|
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"}
|
||||||
|
|
||||||
# create base folders
|
REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-$(${JSON} services.CoAuthoring.redis.host)}
|
||||||
for i in converter docservice spellchecker metrics gc; do
|
REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-$(${JSON} services.CoAuthoring.redis.port)}
|
||||||
mkdir -p "${LOG_DIR}/$i"
|
|
||||||
|
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_mysql(){
|
||||||
|
waiting_for_connection ${MYSQL_SERVER_HOST} ${MYSQL_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}
|
||||||
|
}
|
||||||
|
|
||||||
|
update_mysql_settings(){
|
||||||
|
${JSON} -I -e "this.services.CoAuthoring.sql.dbHost = '${MYSQL_SERVER_HOST}'"
|
||||||
|
${JSON} -I -e "this.services.CoAuthoring.sql.dbPort = '${MYSQL_SERVER_PORT}'"
|
||||||
|
${JSON} -I -e "this.services.CoAuthoring.sql.dbName = '${MYSQL_SERVER_DB_NAME}'"
|
||||||
|
${JSON} -I -e "this.services.CoAuthoring.sql.dbUser = '${MYSQL_SERVER_USER}'"
|
||||||
|
${JSON} -I -e "this.services.CoAuthoring.sql.dbPass = '${MYSQL_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_mysql_db(){
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
start_nginx(){
|
||||||
# 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}
|
||||||
|
@ -83,57 +130,60 @@ 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}"
|
#start service
|
||||||
|
service nginx start
|
||||||
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
|
|
||||||
|
|
||||||
|
start_supervisor(){
|
||||||
# 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
|
#start service
|
||||||
service supervisor start
|
service supervisor 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 [ ${MYSQL_SERVER_HOST} != "localhost" ]; then
|
||||||
|
update_mysql_settings
|
||||||
|
create_mysql_db
|
||||||
|
else
|
||||||
|
if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then
|
||||||
|
service mysql start
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${RABBITMQ_SERVER_HOST} != "localhost" ]; then
|
||||||
|
update_rabbitmq_setting
|
||||||
|
else
|
||||||
|
if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then
|
||||||
|
service redis-server start
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${REDIS_SERVER_HOST} != "localhost" ]; then
|
||||||
|
update_redis_settings
|
||||||
|
else
|
||||||
|
if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then
|
||||||
|
service rabbitmq-server start
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then
|
||||||
|
waiting_for_mysql
|
||||||
|
waiting_for_rabbitmq
|
||||||
|
waiting_for_redis
|
||||||
|
|
||||||
|
start_nginx
|
||||||
|
start_supervisor
|
||||||
|
fi
|
||||||
|
|
||||||
# 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