init
commit
6049a665a4
@ -0,0 +1,59 @@
|
||||
ARG product_version=7.5.1
|
||||
ARG build_number=1
|
||||
ARG oo_root='/var/www/onlyoffice/documentserver'
|
||||
ARG build_deps="git make g++ bzip2 python3-dev python3-pip nodejs npm"
|
||||
|
||||
## Setup
|
||||
FROM onlyoffice/documentserver:${product_version}.${build_number} as setup-stage
|
||||
ARG product_version
|
||||
ARG build_number
|
||||
ARG oo_root
|
||||
ARG build_deps
|
||||
|
||||
ENV PRODUCT_VERSION=${product_version}
|
||||
ENV BUILD_NUMBER=${build_number}
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y ${build_deps} && \
|
||||
npm install -g pkg grunt grunt-cli && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
## Clone
|
||||
FROM setup-stage as clone-stage
|
||||
ARG tag=v${PRODUCT_VERSION}.${BUILD_NUMBER}
|
||||
|
||||
RUN git clone --quiet --branch $tag --depth 1 https://github.com/ONLYOFFICE/build_tools.git /build/build_tools
|
||||
RUN git clone --quiet --branch $tag --depth 1 https://github.com/ONLYOFFICE/server.git /build/server
|
||||
|
||||
## Build
|
||||
FROM clone-stage as build-stage
|
||||
|
||||
COPY server.patch /build/server.patch
|
||||
RUN cd /build/server && \
|
||||
git apply --ignore-space-change --ignore-whitespace /build/server.patch
|
||||
|
||||
# build server with license checks patched
|
||||
WORKDIR /build/server
|
||||
RUN make
|
||||
RUN pkg /build/build_tools/out/linux_64/onlyoffice/documentserver/server/FileConverter --targets=node16-linux -o /build/converter
|
||||
RUN pkg /build/build_tools/out/linux_64/onlyoffice/documentserver/server/DocService --targets=node16-linux --options max_old_space_size=4096 -o /build/docservice
|
||||
|
||||
RUN grunt
|
||||
|
||||
## Final image
|
||||
FROM onlyoffice/documentserver:${product_version}.${build_number} as image-stage
|
||||
ARG oo_root
|
||||
|
||||
#server
|
||||
COPY --from=build-stage /build/converter ${oo_root}/server/FileConverter/converter
|
||||
COPY --from=build-stage /build/docservice ${oo_root}/server/DocService/docservice
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y python3-dev python3-pip && \
|
||||
pip install PyCryptodome
|
||||
|
||||
WORKDIR /license
|
||||
COPY license.py /license/license.py
|
||||
COPY license.sh /license/license.sh
|
||||
@ -0,0 +1,6 @@
|
||||
## OnlyOffice Document Server 7.5.1.1
|
||||
|
||||
|
||||
```
|
||||
docker build -t onlyoffice/documentserver-unlim:7.5.1.1 .
|
||||
```
|
||||
@ -0,0 +1,73 @@
|
||||
from Crypto.Hash import SHA, SHA256
|
||||
from Crypto.Signature import PKCS1_v1_5
|
||||
from Crypto.PublicKey import RSA
|
||||
from shutil import copyfile
|
||||
import json
|
||||
import codecs
|
||||
|
||||
hexlify = codecs.getencoder('hex')
|
||||
|
||||
licenseFile = {
|
||||
"branding": False,
|
||||
"connections": 9999,
|
||||
"customization": False,
|
||||
"end_date": "2099-01-01T23:59:59.000Z",
|
||||
"light": "False",
|
||||
"mode": "",
|
||||
"portal_count": "0",
|
||||
"process": 2,
|
||||
"ssbranding": False,
|
||||
"test": "False",
|
||||
"trial": "False",
|
||||
"user_quota": "0",
|
||||
"users_count": 9999,
|
||||
"users_expire": 99999,
|
||||
"whiteLabel": False,
|
||||
"customer_id": "customerID",
|
||||
"start_date": "2020-01-01T00:00:00.000Z",
|
||||
"users": [],
|
||||
"version": 2
|
||||
}
|
||||
|
||||
jsonLicenseFile = codecs.encode(json.dumps(licenseFile, separators=(',', ':')), encoding='utf-8')
|
||||
|
||||
privKey = RSA.generate(1024)
|
||||
publKey = privKey.publickey().exportKey('PEM')
|
||||
|
||||
digest = SHA.new(jsonLicenseFile)
|
||||
signer = PKCS1_v1_5.new(privKey)
|
||||
signature = signer.sign(digest)
|
||||
|
||||
finalSignature = signature.hex()
|
||||
|
||||
licenseFile['signature'] = finalSignature
|
||||
|
||||
f = open("/license/OO_License", "w+")
|
||||
f.write(json.dumps(licenseFile))
|
||||
f.close
|
||||
|
||||
f = open("/license/OO_PubKey", "w+")
|
||||
f.write(publKey.decode('utf-8'))
|
||||
f.close()
|
||||
|
||||
print("The license file has been saved to OO_License. Here's the content :")
|
||||
print(json.dumps(licenseFile))
|
||||
print("It will be placed automatically in the Data directory of OnlyOffice")
|
||||
|
||||
copyfile("/license/OO_License", "/var/www/onlyoffice/Data/license.lic")
|
||||
|
||||
print("Patching docservice and convert...")
|
||||
|
||||
basePath = "/var/www/onlyoffice/documentserver/server/"
|
||||
files = ["DocService/docservice", "FileConverter/converter"]
|
||||
|
||||
for file in files:
|
||||
f = open(basePath+file, 'rb')
|
||||
data = f.read()
|
||||
f.close()
|
||||
|
||||
replacedData = data.replace(b"-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRhGF7X4A0ZVlEg594WmODVVUI\niiPQs04aLmvfg8SborHss5gQXu0aIdUT6nb5rTh5hD2yfpF2WIW6M8z0WxRhwicg\nXwi80H1aLPf6lEPPLvN29EhQNjBpkFkAJUbS8uuhJEeKw0cE49g80eBBF4BCqSL6\nPFQbP9/rByxdxEoAIQIDAQAB\n-----END PUBLIC KEY-----", bytes(publKey))
|
||||
|
||||
f = open(basePath+file, 'wb')
|
||||
f.write(replacedData)
|
||||
f.close()
|
||||
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
FILE=/license/OO_PubKey
|
||||
|
||||
if test -f "$FILE"; then
|
||||
echo Patch has already been applied. Starting DocumentServer...
|
||||
else
|
||||
python3 license.py
|
||||
echo Patching docservice and convert...
|
||||
echo Done! Running Document Server...
|
||||
fi
|
||||
|
||||
/app/ds/run-document-server.sh
|
||||
@ -0,0 +1,102 @@
|
||||
---
|
||||
Common/sources/constants.js | 4 ++--
|
||||
Common/sources/license.js | 22 +++++++++++-----------
|
||||
DocService/sources/server.js | 2 +-
|
||||
FileConverter/sources/convertermaster.js | 2 +-
|
||||
Makefile | 2 +-
|
||||
5 files changed, 16 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/Common/sources/constants.js b/Common/sources/constants.js
|
||||
index 3e8e7aaa..d79daf0e 100644
|
||||
--- a/Common/sources/constants.js
|
||||
+++ b/Common/sources/constants.js
|
||||
@@ -85,8 +85,8 @@ exports.LICENSE_RESULT = {
|
||||
NotBefore: 16
|
||||
};
|
||||
|
||||
-exports.LICENSE_CONNECTIONS = 20;
|
||||
-exports.LICENSE_USERS = 3;
|
||||
+exports.LICENSE_CONNECTIONS = 9999;
|
||||
+exports.LICENSE_USERS = 99;
|
||||
exports.LICENSE_EXPIRE_USERS_ONE_DAY = 24 * 60 * 60; // day in seconds
|
||||
|
||||
exports.AVS_OFFICESTUDIO_FILE_UNKNOWN = 0x0000;
|
||||
diff --git a/Common/sources/license.js b/Common/sources/license.js
|
||||
index 5df8d693..3fd9de14 100644
|
||||
--- a/Common/sources/license.js
|
||||
+++ b/Common/sources/license.js
|
||||
@@ -45,24 +45,24 @@ exports.readLicense = function*() {
|
||||
count: 1,
|
||||
type: c_LR.Success,
|
||||
light: false,
|
||||
- packageType: constants.PACKAGE_TYPE_OS,
|
||||
+ packageType: constants.PACKAGE_TYPE_I,
|
||||
mode: constants.LICENSE_MODE.None,
|
||||
- branding: false,
|
||||
+ branding: true,
|
||||
connections: constants.LICENSE_CONNECTIONS,
|
||||
connectionsView: constants.LICENSE_CONNECTIONS,
|
||||
- customization: false,
|
||||
- advancedApi: false,
|
||||
- usersCount: 0,
|
||||
- usersViewCount: 0,
|
||||
+ customization: true,
|
||||
+ advancedApi: true,
|
||||
+ usersCount: constants.LICENSE_CONNECTIONS,
|
||||
+ usersViewCount: constants.LICENSE_CONNECTIONS,
|
||||
usersExpire: constants.LICENSE_EXPIRE_USERS_ONE_DAY,
|
||||
- hasLicense: false,
|
||||
- plugins: false,
|
||||
+ hasLicense: true,
|
||||
+ plugins: true,
|
||||
buildDate: oBuildDate,
|
||||
startDate: startDate,
|
||||
- endDate: null,
|
||||
+ endDate: new Date("2099-01-01T23:59:59.000Z"),
|
||||
customerId: "",
|
||||
- alias: ""
|
||||
+ alias: "community"
|
||||
}, null];
|
||||
};
|
||||
|
||||
-exports.packageType = constants.PACKAGE_TYPE_OS;
|
||||
+exports.packageType = constants.PACKAGE_TYPE_I;
|
||||
diff --git a/DocService/sources/server.js b/DocService/sources/server.js
|
||||
index 76303af9..9d2e6888 100644
|
||||
--- a/DocService/sources/server.js
|
||||
+++ b/DocService/sources/server.js
|
||||
@@ -109,7 +109,7 @@ if (!(cfgTokenEnableBrowser && cfgTokenEnableRequestInbox && cfgTokenEnableReque
|
||||
}
|
||||
|
||||
updateLicense();
|
||||
-fs.watchFile(cfgLicenseFile, updateLicense);
|
||||
+// fs.watchFile(cfgLicenseFile, updateLicense);
|
||||
setInterval(updateLicense, 86400000);
|
||||
|
||||
if (config.has('services.CoAuthoring.server.static_content')) {
|
||||
diff --git a/FileConverter/sources/convertermaster.js b/FileConverter/sources/convertermaster.js
|
||||
index 46615032..6ce2d3e6 100644
|
||||
--- a/FileConverter/sources/convertermaster.js
|
||||
+++ b/FileConverter/sources/convertermaster.js
|
||||
@@ -92,7 +92,7 @@ if (cluster.isMaster) {
|
||||
|
||||
updateLicense();
|
||||
|
||||
- fs.watchFile(cfgLicenseFile, updateLicense);
|
||||
+ // fs.watchFile(cfgLicenseFile, updateLicense);
|
||||
setInterval(updateLicense, 86400000);
|
||||
} else {
|
||||
const converter = require('./converter');
|
||||
diff --git a/Makefile b/Makefile
|
||||
index e8e1308f..23f7e2ef 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -87,7 +87,7 @@ DEBUG = $(BRANDING_DIR)/debug.js
|
||||
.PHONY: all clean install uninstall build-date
|
||||
|
||||
.NOTPARALLEL:
|
||||
-all: $(SPELLCHECKER_DICTIONARIES) $(TOOLS) $(SCHEMA) $(CORE_FONTS) $(DOCUMENT_TEMPLATES) $(LICENSE) $(WELCOME) $(INFO) build-date
|
||||
+all: $(SCHEMA) $(LICENSE) $(WELCOME) $(INFO) build-date
|
||||
|
||||
build-date: $(GRUNT_FILES)
|
||||
sed "s|\(const buildVersion = \).*|\1'${PRODUCT_VERSION}';|" -i $(COMMON_DEFINES_JS)
|
||||
Loading…
Reference in New Issue