Skip to content

Commit

Permalink
feature/ZCS-10534 : Scripts to install rabbitmq, start and stop docse…
Browse files Browse the repository at this point in the history
…rvice/spellchecker/coverter; https for docservice; change in connection limit; mysql as db
  • Loading branch information
sreejan-chowdhury committed May 26, 2021
1 parent 279f651 commit df31f2d
Show file tree
Hide file tree
Showing 19 changed files with 794 additions and 19 deletions.
28 changes: 13 additions & 15 deletions Common/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,14 @@
"ttl" : 300,
"cachesize" : 1000
},
"openpgpjs": {
"config": {
},
"encrypt": {
"passwords": ["verysecretstring"]
},
"decrypt": {
"passwords": ["verysecretstring"]
}
},
"services": {
"CoAuthoring": {
"ssl" :{
"key" : "",
"cert" : ""
},
"server": {
"port": 8000,
"port": 7084,
"workerpercpu": 1,
"mode": "development",
"limits_tempfile_upload": 104857600,
Expand Down Expand Up @@ -119,11 +113,11 @@
"limits_image_types_upload": "jpg;jpeg;jpe;png;gif;bmp"
},
"sql": {
"type": "postgres",
"type": "mysql",
"tableChanges": "doc_changes",
"tableResult": "task_result",
"dbHost": "localhost",
"dbPort": 5432,
"dbPort": 7306,
"dbName": "onlyoffice",
"dbUser": "onlyoffice",
"dbPass": "onlyoffice",
Expand Down Expand Up @@ -215,7 +209,7 @@
"autostart": []
},
"editor":{
"spellcheckerUrl": "",
"spellcheckerUrl": "/spellchecker",
"reconnection":{
"attempts": 50,
"delay": "2s"
Expand Down Expand Up @@ -296,8 +290,12 @@
"silent": true
},
"SpellChecker": {
"ssl" :{
"key" : "",
"cert" : ""
},
"server": {
"port": 8080,
"port": 7085,
"mode": "development"
}
}
Expand Down
15 changes: 15 additions & 0 deletions Common/config/log4js/logconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"appenders": {
"default": {
"type": "file",
"filename": "../onlyoffice.log",
"layout": {
"type": "pattern",
"pattern": "[%d] [%p] %c - %.10000m"
}
}
},
"categories": {
"default": { "appenders": [ "default" ], "level": "WARN" }
}
}
70 changes: 70 additions & 0 deletions Common/config/onlyofficeconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"log": {
"filePath": "../documentserver/server/Common/config/log4js/logconfig.json"
},
"storage": {
"fs": {
"folderPath": "../documentserver/App_Data/cache/files"
}
},
"services": {
"CoAuthoring": {
"server": {
"static_content": {
"/fonts": {
"path": "../documentserver/fonts",
"options": {"maxAge": "7d"}
},
"/sdkjs": {
"path": "../documentserver/sdkjs",
"options": {"maxAge": "7d"}
},
"/web-apps": {
"path": "../documentserver/web-apps",
"options": {"maxAge": "7d"}
},
"/sdkjs-plugins": {
"path": "../documentserver/sdkjs-plugins",
"options": {"maxAge": "7d"}
},
"/App_Data": {
"path": "../documentserver/App_Data",
"options": {"maxAge": "7d"}
}
}
},
"utils": {
"utils_common_fontdir": "/usr/share/fonts"
},
"request-filtering-agent" : {
"allowPrivateIPAddress": true,
"allowMetaIPAddress": true
},
"sockjs": {
"sockjs_url": "../documentserver/web-apps/vendor/sockjs/sockjs.min.js"
}
}
},
"license": {
"license_file": "./../documentserver/license.lic",
"warning_limit_percents": 70,
"packageType": 0
},
"FileConverter": {
"converter": {
"fontDir": "/usr/share/fonts",
"presentationThemesDir": "../documentserver/sdkjs/slide/themes",
"x2tPath": "../documentserver/server/FileConverter/bin/x2t",
"docbuilderPath": "../documentserver/server/FileConverter/bin/docbuilder",
"docbuilderAllFontsPath": "../documentserver/App_Data/docbuilder/AllFonts.js"
}
},
"FileStorage": {
"directory": "../documentserver/App_Data"
},
"SpellChecker": {
"server": {
"dictDir": "../documentserver/server/SpellChecker/dictionaries"
}
}
}
2 changes: 1 addition & 1 deletion Common/sources/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ exports.LICENSE_RESULT = {
ExpiredLimited: 11
};

exports.LICENSE_CONNECTIONS = 20;
exports.LICENSE_CONNECTIONS = 99999;
exports.LICENSE_EXPIRE_USERS_ONE_DAY = 24 * 60 * 60; // day in seconds

exports.AVS_OFFICESTUDIO_FILE_UNKNOWN = 0x0000;
Expand Down
15 changes: 14 additions & 1 deletion DocService/sources/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const fs = require('fs');

const express = require('express');
const http = require('http');
const https = require('https');
const urlModule = require('url');
const path = require('path');
const bodyParser = require("body-parser");
Expand All @@ -55,7 +56,19 @@ const utils = require('./../../Common/sources/utils');
const commonDefines = require('./../../Common/sources/commondefines');
const configStorage = configCommon.get('storage');
const app = express();
const server = http.createServer(app);

let server = null;

if (config.has('ssl')) {
const privateKey = fs.readFileSync(config.get('ssl.key')).toString();
const certificateKey = fs.readFileSync(config.get('ssl.cert')).toString();
//See detailed options format here: http://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener
const options = {key: privateKey, cert: certificateKey};

server = https.createServer(options, app);
} else {
server = http.createServer(app);
}

let licenseInfo, updatePluginsTime, userPlugins, pluginsLoaded;

Expand Down
4 changes: 2 additions & 2 deletions SpellChecker/sources/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ if (cluster.isMaster) {
if (config.has('ssl')) {
const privateKey = fs.readFileSync(config.get('ssl.key')).toString();
const certificateKey = fs.readFileSync(config.get('ssl.cert')).toString();
const trustedCertificate = fs.readFileSync(config.get('ssl.ca')).toString();
//const trustedCertificate = fs.readFileSync(config.get('ssl.ca')).toString();
//See detailed options format here: http://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener
const options = {key: privateKey, cert: certificateKey, ca: [trustedCertificate]};
const options = {key: privateKey, cert: certificateKey};

server = https.createServer(options, app);
} else {
Expand Down
63 changes: 63 additions & 0 deletions bin/common_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import json
import os.path
import os
import sys

def check_services_running():
with open(processid_file_path, "r") as f:
data = json.load(f)

if(data["docservice"] > 0 and check_pid(data["docservice"])):
sys.exit("Error : docservice running with pid (" + str(data["docservice"]) + ") ")
if(data["spellchecker"] > 0 and check_pid(data["spellchecker"])):
sys.exit("Error : spellchecker running with pid (" + str(data["spellchecker"]) + ") ")
if(data["converter"] > 0 and check_pid(data["converter"])):
sys.exit("Error : converter running with pid (" + str(data["converter"]) + ") ")

def check_docservice_running():
with open(processid_file_path, "r") as f:
data = json.load(f)

if(data["docservice"] > 0 and check_pid(data["docservice"])):
sys.exit("Error : docservice running with pid (" + str(data["docservice"]) + ") ")

def check_spellchecker_running():
with open(processid_file_path, "r") as f:
data = json.load(f)

if(data["spellchecker"] > 0 and check_pid(data["spellchecker"])):
sys.exit("Error : spellchecker running with pid (" + str(data["spellchecker"]) + ") ")

def check_converter_running():
with open(processid_file_path, "r") as f:
data = json.load(f)

if(data["converter"] > 0 and check_pid(data["converter"])):
sys.exit("Error : converter running with pid (" + str(data["converter"]) + ") ")

def check_pid(pid):
try:
os.kill(pid, 0)
except OSError:
return False
else:
return True

def update_processid(docservice_process_id, spellchecker_process_id, converter_process_id):
with open(processid_file_path, "r") as f:
data = json.load(f)

if(docservice_process_id > 0):
data["docservice"] = docservice_process_id
if(spellchecker_process_id > 0):
data["spellchecker"] = spellchecker_process_id
if(converter_process_id > 0):
data["converter"] = converter_process_id

with open(processid_file_path, "w") as jsonFile:
json.dump(data, jsonFile, indent=4)

with open(processid_file_path, "r") as f:
dataupdated = json.load(f)
#print("Process IDS docservice, spellchecker, converter :: "+str(dataupdated))
processid_file_path = "process_id.json"
Loading

0 comments on commit df31f2d

Please sign in to comment.