diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..4af5e0e4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "6" + - "4" \ No newline at end of file diff --git a/Common/sources/license.js b/Common/sources/license.js index 9fdefd7f..48b4b167 100644 --- a/Common/sources/license.js +++ b/Common/sources/license.js @@ -35,9 +35,14 @@ const fs = require('fs'); const config = require('config').get('license'); const constants = require('./constants'); +const buildVersion = '4.0.0'; +const buildNumber = 19; +const buildDate = '6/29/2016'; +const oBuildDate = new Date(buildDate); + exports.readLicense = function() { const resMax = {count: 999999, type: constants.LICENSE_RESULT.Success}; - var res = {count: 1, type: constants.LICENSE_RESULT.Error}; + var res = {count: 1, type: constants.LICENSE_RESULT.Error, light: false}; try { var oLicense = JSON.parse(fs.readFileSync(config.get('license_file')).toString()); const sign = oLicense['signature']; @@ -48,12 +53,14 @@ exports.readLicense = function() { const publicKey = '-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRhGF7X4A0ZVlEg594WmODVVUI\niiPQs04aLmvfg8SborHss5gQXu0aIdUT6nb5rTh5hD2yfpF2WIW6M8z0WxRhwicg\nXwi80H1aLPf6lEPPLvN29EhQNjBpkFkAJUbS8uuhJEeKw0cE49g80eBBF4BCqSL6\nPFQbP9/rByxdxEoAIQIDAQAB\n-----END PUBLIC KEY-----\n'; if (verify.verify(publicKey, sign, 'hex')) { const endDate = new Date(oLicense['end_date']); - if (endDate >= new Date() && 2 <= oLicense['version']) { + if (endDate >= oBuildDate && 2 <= oLicense['version']) { res.count = Math.min(Math.max(res.count, oLicense['process'] >> 0), resMax.count); res.type = constants.LICENSE_RESULT.Success; } else { res.type = constants.LICENSE_RESULT.Expired; } + + res.light = !!oLicense['light']; } } catch(e) { res.count = 1; diff --git a/DocService/sources/DocsCoServer.js b/DocService/sources/DocsCoServer.js index cca15dca..9cebba2b 100644 --- a/DocService/sources/DocsCoServer.js +++ b/DocService/sources/DocsCoServer.js @@ -135,7 +135,7 @@ var redisClient = pubsubRedis.getClientRedis(); var pubsub; var queue; var clientStatsD = statsDClient.getClient(); -var licenseInfo = constants.LICENSE_RESULT.Error; +var licenseInfo = {type: constants.LICENSE_RESULT.Error, light: false}; var shutdownFlag = false; var asc_coAuthV = '3.0.9'; // Версия сервера совместного редактирования @@ -1855,9 +1855,9 @@ exports.install = function(server, callbackFunction) { function _checkLicense(conn) { return co(function* () { try { - var license = licenseInfo; - if (constants.LICENSE_RESULT.Success !== licenseInfo) { - license = constants.LICENSE_RESULT.Success; + var licenseType = licenseInfo.type; + if (constants.LICENSE_RESULT.Success !== licenseType) { + licenseType = constants.LICENSE_RESULT.Success; var count = constants.LICENSE_CONNECTIONS; var cursor = '0', sum = 0, scanRes, tmp, length, i, users; @@ -1868,7 +1868,7 @@ exports.install = function(server, callbackFunction) { for (i = 0; i < length; ++i) { if (sum >= count) { - license = constants.LICENSE_RESULT.Connections; + licenseType = constants.LICENSE_RESULT.Connections; break; } @@ -1877,7 +1877,7 @@ exports.install = function(server, callbackFunction) { } if (sum >= count) { - license = constants.LICENSE_RESULT.Connections; + licenseType = constants.LICENSE_RESULT.Connections; break; } @@ -1887,7 +1887,7 @@ exports.install = function(server, callbackFunction) { } } } - sendData(conn, {type: 'license', license: license}); + sendData(conn, {type: 'license', license: {type: licenseType, light: licenseInfo.light}}); } catch (err) { logger.error('_checkLicense error:\r\n%s', err.stack); } diff --git a/DocService/sources/server.js b/DocService/sources/server.js index b10323f8..e80fa67a 100644 --- a/DocService/sources/server.js +++ b/DocService/sources/server.js @@ -49,7 +49,7 @@ if (cluster.isMaster) { workersCount = 1; //Math.min(licenseInfo.count, Math.ceil(numCPUs * cfgWorkerPerCpu)); }; const updateLicenseWorker = (worker) => { - worker.send({data: licenseInfo.type}); + worker.send({data: licenseInfo}); }; const updateWorkers = () => { var i; diff --git a/Makefile b/Makefile index c24d2461..cb5516ce 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,10 @@ GRUNT_FILES = Gruntfile.js.out FILE_CONVERTER = $(OUTPUT)/FileConverter/bin FILE_CONVERTER_FILES += ../core/build/lib/linux_64/*.so -FILE_CONVERTER_FILES += ../core/build/bin/icu/linux_64/*.so* +FILE_CONVERTER_FILES += /usr/local/lib/libicudata.so.55* +FILE_CONVERTER_FILES += /usr/local/lib/libicuuc.so.55* FILE_CONVERTER_FILES += ../core/build/bin/linux/x2t -FILE_CONVERTER_FILES += ../core/build/bin/linux/icudtl_dat.S +FILE_CONVERTER_FILES += ../v8/third_party/icu/linux/icudtl_dat.S HTML_FILE_INTERNAL := $(FILE_CONVERTER)/HtmlFileInternal HTML_FILE_INTERNAL_FILES += ../core/build/lib/linux_64/HtmlFileInternal @@ -30,6 +31,8 @@ TOOLS = $(OUTPUT)/$(TOOLS_DIR)/ LICENSE_FILES = LICENSE.txt 3rd-Party.txt license/ LICENSE = $(addsuffix $(OUTPUT)/, LICENSE_FILES) +.PHONY: all clean install uninstall + all: $(FILE_CONVERTER) $(SPELLCHECKER_DICTIONARIES) $(TOOLS) $(SCHEMA) $(LICENSE) $(FILE_CONVERTER): $(GRUNT_FILES) @@ -63,4 +66,49 @@ $(GRUNT_FILES): clean: rm -rf $(OUTPUT) $(GRUNT_FILES) + +install: + sudo adduser --quiet --home /var/www/onlyoffice --system --group onlyoffice + + sudo mkdir -p /var/log/onlyoffice + sudo mkdir -p /var/lib/onlyoffice/documentserver/App_Data + + sudo chown onlyoffice:onlyoffice -R /var/www/onlyoffice + sudo chown onlyoffice:onlyoffice -R /var/log/onlyoffice + sudo chown onlyoffice:onlyoffice -R /var/lib/onlyoffice + + sudo cp -r build/. /var/www/onlyoffice/documentserver/ + sudo ln -s /var/www/onlyoffice/documentserver/server/FileConverter/Bin/libDjVuFile.so /lib/libDjVuFile.so + sudo ln -s /var/www/onlyoffice/documentserver/server/FileConverter/Bin/libdoctrenderer.so /lib/libdoctrenderer.so + sudo ln -s /var/www/onlyoffice/documentserver/server/FileConverter/Bin/libHtmlFile.so /lib/libHtmlFile.so + sudo ln -s /var/www/onlyoffice/documentserver/server/FileConverter/Bin/libHtmlRenderer.so /lib/libHtmlRenderer.so + sudo ln -s /var/www/onlyoffice/documentserver/server/FileConverter/Bin/libPdfReader.so /lib/libPdfReader.so + sudo ln -s /var/www/onlyoffice/documentserver/server/FileConverter/Bin/libPdfWriter.so /lib/libPdfWriter.so + sudo ln -s /var/www/onlyoffice/documentserver/server/FileConverter/Bin/libXpsFile.so /lib/libXpsFile.so + sudo ln -s /var/www/onlyoffice/documentserver/server/FileConverter/Bin/libUnicodeConverter.so /lib/libUnicodeConverter.so + sudo ln -s /var/www/onlyoffice/documentserver/server/FileConverter/Bin/libicudata.so.55 /lib/libicudata.so.55 + sudo ln -s /var/www/onlyoffice/documentserver/server/FileConverter/Bin/libicuuc.so.55 /lib/libicuuc.so.55 + + sudo -u onlyoffice "/var/www/onlyoffice/documentserver/server/tools/AllFontsGen"\ + "/usr/share/fonts"\ + "/var/www/onlyoffice/documentserver/sdkjs/common/AllFonts.js"\ + "/var/www/onlyoffice/documentserver/sdkjs/common/Images"\ + "/var/www/onlyoffice/documentserver/server/FileConverter/bin/font_selection.bin" +uninstall: + sudo userdel onlyoffice + + sudo unlink /lib/libDjVuFile.so + sudo unlink /lib/libdoctrenderer.so + sudo unlink /lib/libHtmlFile.so + sudo unlink /lib/libHtmlRenderer.so + sudo unlink /lib/libPdfReader.so + sudo unlink /lib/libPdfWriter.so + sudo unlink /lib/libXpsFile.so + sudo unlink /lib/libUnicodeConverter.so + sudo unlink /lib/libicudata.so.55 + sudo unlink /lib/libicuuc.so.55 + + sudo rm -rf /var/www/onlyoffice/documentserver + sudo rm -rf /var/log/onlyoffice/documentserver + sudo rm -rf /var/lib/onlyoffice/documentserver diff --git a/Readme.md b/Readme.md new file mode 100644 index 00000000..58a4e871 --- /dev/null +++ b/Readme.md @@ -0,0 +1,84 @@ + +[![License](https://img.shields.io/badge/License-GNU%20AGPL%20V3-green.svg?style=flat)](http://www.gnu.org/licenses/agpl-3.0.ru.html) ![Release](https://img.shields.io/badge/Release-v4.0.1-blue.svg?style=flat) + +## Server +The backend server software layer which is the part of [ONLYOFFICE Document Server][2] and is the base for all other components. + +## Document service set up + +This instruction describes document service deployment for Windows based platform. + +### Installing necessary components + +For the document service to work correctly it is necessary to install the following components for your Windows system (if not specified additionally, the latest version for 32 or 64 bit Windows can be installed with default settings): + +a) Node.js 4.0.x 32 bit version (https://nodejs.org/dist/v4.0.0/node-v4.0.0-x86.msi) + +To find out which Node.js version is used on your system currently run the `node -v` command + +The 32 bit version is necessary for the spellchecking module only. In case you do not plan to use this module, you can install 64 bit Node.js version. + +b) MySql Server version 5.5 or later (http://dev.mysql.com/downloads/windows/installer/). When installing use the `onlyoffice` password for the `root` user + +c) Erlang (http://www.erlang.org/download.html) + +d) RabbitMQ (https://www.rabbitmq.com/releases/rabbitmq-server/v3.5.4/rabbitmq-server-3.5.4.exe) + +e) Redis (https://github.com/MSOpenTech/redis/releases/download/win-2.8.2102/Redis-x64-2.8.2102.msi) + +f) Python 2.7.x (http://www.python.org/download/releases/2.7.3/#download) + +g) Microsoft Visual C++ Express 2010 (necessary for the spellchecker modules build) + +### Setting up the system + +a) Database setup + +Run the schema/createdb.sql script for MySQL + +b) Install the Web Monitor for RabbitMQ (see the details for the installation here - https://www.rabbitmq.com/management.html) + +Open the command line `cmd` executable. Switch to the installation directory using the `cd /d Installation-directory/sbin` command. + +Run the following command: + +``` +rabbitmq-plugins.bat enable rabbitmq_management +``` + +The Web Monitor is located at the http://localhost:15672/ address. Use the `guest/guest` for the login/password combination. + +c) If Redis does not start or crashes after the start for some reason, try to change the `maxheap` parameter in the config settings. For 64 bit version of Windows 7 the config file can be found here: C:\Program Files\Redis\redis.windows-service.conf. + +Find the `# maxheap ` line and change it to, e.g. + +``` +maxheap 128MB +``` + +Restart the service. + +### Running the service + +Run the `run.bat` script to start the service. + +Notes + +All config files for the server part can be foun in the `Common\config` folder +* `default.json` - common config files similar for all production versions. +* `production-windows.json` - config files for the production version running on a Windows based platform. +* `production-linux.json` - config files for the production version running on a Linux based platform. +* `development-windows.json` - config files for the development version running on a Windows based platform (this configuration is used when running the 'run.bat' script). + +In case it is necessary to temporarily edit the config files, create the local.json file and reassign the values there. It will allow to prevent from uploading local changes and losing config files when updating the repository. See https://github.com/lorenwest/node-config/wiki/Configuration-Files for more information about the configuration files. + +## User Feedback and Support + +If you have any problems with or questions about [ONLYOFFICE Document Server][2], please visit our official forum to find answers to your questions: [dev.onlyoffice.org][1]. + + [1]: http://dev.onlyoffice.org + [2]: https://github.com/ONLYOFFICE/DocumentServer + +## License + +Server is released under an GNU AGPL v3.0 license. See the LICENSE file for more information. diff --git a/Readme.txt b/Readme.txt deleted file mode 100644 index d6138f66..00000000 --- a/Readme.txt +++ /dev/null @@ -1,50 +0,0 @@ -Настройка сервиса документов -============================ - -ВНИМАНИЕ, инструкция описывает разворачивание сервиса документов на Windows-платформе. - -1. Установка необходимых компонентов - -Для работы сервиса документов необходимо установить в системе следующие компоненты (если не указано дополнительно, нужно ставить последнюю стабильную версию, любой разрядности, с дефолтными настройками): - а) 32-х разрядную версии Node.js 4.0.x (https://nodejs.org/dist/v4.0.0/node-v4.0.0-x86.msi) - Для уточнения существующей версии Node.js выполните 'node -v' - 32-х разрядная версия требуется только для модуля проверки орфографии, если не планируется использовать этот модуль можно использовать 64-х разрядную версию. - б) MySql Server 5.5 и выше (http://dev.mysql.com/downloads/windows/installer/) При установке для пользователя root используйте пароль onlyoffice - в) Erlang (http://www.erlang.org/download.html) - г) RabbitMQ (https://www.rabbitmq.com/releases/rabbitmq-server/v3.5.4/rabbitmq-server-3.5.4.exe) - д) Redis (https://github.com/MSOpenTech/redis/releases/download/win-2.8.2102/Redis-x64-2.8.2102.msi) - е) Python 2.7.x (http://www.python.org/download/releases/2.7.3/#download) - ё) Microsoft Visual C++ Express 2010 (?) (требуется для сборки модулей для Spellchecker) - -2. Настройка системы - - а) Настройка БД - Выполните скрипт в mysql schema/createdb.sql - - - б) Установка Web Monitor для RabbitMQ подробности(https://www.rabbitmq.com/management.html) - открытивает cmd. переходим в папку (`cd /d Installation-directory/sbin`) - вызываем(rabbitmq-plugins.bat enable rabbitmq_management) - Web Monitor распологается по адресу(http://localhost:15672/). логин/пароль(guest/guest) - - в) Если по какой-то причине у вас не стартует Redis, либо он стартует и через какое-то время падает, попробуйте в настройках конфига выставить размер параметра maxheap. Для WIN7 x64 файл конфига лежит тут: C:\Program Files\Redis\redis.windows-service.conf. В файле ищем строку - # maxheap - и меняет ее, например, на - maxheap 128MB. - Перезапускаем сервис. - - -3. Запуск сервиса - -Запустите скрипт `run.bat` - -Замечания - - а) Все конфиги для серверной части храняться в папке Common\config - - default.json общие конфиги одинаковые для всех версий продакшина. - - production-windows.json конфиги для запуска продакшин-версии на windows платформе - - production-linux.json конфиги для запуска продакшин-версии на linux платформе - - development-windows.json конфиги для запуска девелоперской-версии на windows платформе (Эта конфигурация используется при запуске run.bat) - - При необходимости внести временные изменения в конфиги создайте файл local.json и переопределите значения там. Это позволит случайно не залить локальные правки и избежать потери конфига при обновлении репозитория. Подробно о файлах конфигурации см. https://github.com/lorenwest/node-config/wiki/Configuration-Files -