14 Commits

Author SHA1 Message Date
Alexander Hofbauer
697835396d 6.2.2.21 2021-04-26 12:19:26 +02:00
Alexander Hofbauer
73bd42b61b 6.2.1.24 2021-04-26 12:19:26 +02:00
Alexander Hofbauer
bd859cd0b1 Add github action 2021-04-26 11:34:06 +02:00
Alexander Hofbauer
ce96de1d2b 6.2.0.123 2021-03-19 21:41:45 +01:00
Alexander Hofbauer
f78cf9366c 6.1.1.53 2021-02-23 21:34:42 +01:00
Alexander Hofbauer
4418f05958 Switch to multi-staged build
Fixes #9
2021-02-15 21:32:28 +01:00
Alexander Hofbauer
a6e7e5dc2a 6.1.0.83 2021-02-15 21:23:42 +01:00
Alexander Hofbauer
b9a687f4f9 6.0.1.32 2020-10-28 21:01:15 +01:00
Alexander Hofbauer
b40abf44f3 Various updates for 6.0.0.105 2020-10-18 18:50:02 +02:00
Alexander Hofbauer
1105492df0 Fix sed typo, consolidate patching
Wrong ordering created a backup copy we don't need.
2020-10-03 18:32:40 +02:00
Alexander Hofbauer
3c264e164a Document podman/buildah 2020-09-26 23:40:22 +02:00
Alexander Hofbauer
ad729642be 5.6.5.3 2020-09-26 12:21:15 +02:00
Alexander Hofbauer
b0858e052f 5.6.4.20 2020-09-15 20:42:54 +02:00
Alexander Hofbauer
21a3f620a5 Document dockerhub
Closes #2
2020-08-30 16:10:07 +02:00
4 changed files with 226 additions and 119 deletions

25
.github/workflows/docker-image.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Docker Image CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set version
id: version
run: echo ::set-output name=release_version::${GITHUB_REF#refs/*/}
- name: Build Docker image
run: |
echo Building version ${{ steps.version.outputs.release_version }}...
docker build . --file Dockerfile --tag alehoho/oo-ce-docker-license:${{ steps.version.outputs.release_version }}

View File

@@ -1,45 +1,66 @@
ARG oo_version=5.6.3.2
FROM onlyoffice/documentserver:$oo_version
ARG oo_version=5.6.3.2
## Build stage
ARG product_version=6.2.2
ARG build_number=21
ARG oo_root='/var/www/onlyoffice/documentserver'
FROM onlyoffice/documentserver:${product_version}.${build_number} as build-stage
ARG product_version
ARG build_number
ARG oo_root
ENV PRODUCT_VERSION=${product_version}
ENV BUILD_NUMBER=${build_number}
# Mobile apps patching
ARG me_search='isSupportEditFeature:function(){return!1}'
ARG me_patch='s/isSupportEditFeature:function(){return!1}/isSupportEditFeature:function(){return true}/g'
RUN grep -q "${me_search}" ${oo_root}/web-apps/apps/documenteditor/mobile/app.js \
&& sed -si "${me_patch}" ${oo_root}/web-apps/apps/documenteditor/mobile/app.js
RUN grep -q "${me_search}" ${oo_root}/web-apps/apps/presentationeditor/mobile/app.js \
&& sed -si "${me_patch}" ${oo_root}/web-apps/apps/presentationeditor/mobile/app.js
RUN grep -q "${me_search}" ${oo_root}/web-apps/apps/spreadsheeteditor/mobile/app.js \
&& sed -si "${me_patch}" ${oo_root}/web-apps/apps/spreadsheeteditor/mobile/app.js
RUN sed -is \
's/isSupportEditFeature:function(){return!1}/isSupportEditFeature:function(){return true}/g' \
/var/www/onlyoffice/documentserver/web-apps/apps/documenteditor/mobile/app.js
# Rebuild with license checks replaced
ARG build_deps="git make g++ nodejs npm"
RUN apt-get update && apt-get install -y ${build_deps}
RUN sed -is \
's/isSupportEditFeature:function(){return!1}/isSupportEditFeature:function(){return true}/g' \
/var/www/onlyoffice/documentserver/web-apps/apps/presentationeditor/mobile/app.js
RUN sed -is \
's/isSupportEditFeature:function(){return!1}/isSupportEditFeature:function(){return true}/g' \
/var/www/onlyoffice/documentserver/web-apps/apps/spreadsheeteditor/mobile/app.js
ARG tag=v${product_version}.${build_number}
RUN mkdir /build \
&& git clone --quiet --branch $tag --depth 1 https://github.com/ONLYOFFICE/build_tools.git /build/build_tools \
&& git clone --quiet --branch $tag --depth 1 https://github.com/ONLYOFFICE/server.git /build/server
# source patching and compilation
RUN apt-get update && apt-get install -y \
git \
curl \
&& curl -sL https://deb.nodesource.com/setup_10.x | bash - \
&& apt install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build/server
RUN mkdir /build
WORKDIR /build
RUN git clone --branch v$oo_version --depth 1 https://github.com/ONLYOFFICE/server.git .
RUN npm install -g pkg grunt grunt-cli
COPY license.patch /build/
RUN git apply license.patch
RUN git apply /build/license.patch
RUN make \
&& pkg /build/build_tools/out/linux_64/onlyoffice/documentserver/server/FileConverter --targets=node10-linux -o /build/converter \
&& pkg /build/build_tools/out/linux_64/onlyoffice/documentserver/server/DocService --targets=node10-linux --options max_old_space_size=4096 -o /build/docservice \
&& cp /build/converter ${oo_root}/server/FileConverter/converter \
&& cp /build/docservice ${oo_root}/server/DocService/docservice
RUN npm install pkg grunt-cli \
&& make \
&& node_modules/.bin/pkg --targets=linux build/server/FileConverter \
&& node_modules/.bin/pkg --targets=linux build/server/DocService \
&& cp fileconverter /var/www/onlyoffice/documentserver/server/FileConverter/converter \
&& cp coauthoring /var/www/onlyoffice/documentserver/server/DocService/docservice
## Prod image
FROM onlyoffice/documentserver:${product_version}.${build_number}
ARG oo_root
WORKDIR /
RUN rm -rf /build
COPY --from=build-stage ${oo_root}/web-apps/apps/documenteditor/mobile/app.js \
${oo_root}/web-apps/apps/documenteditor/mobile/app.js
COPY --from=build-stage ${oo_root}/web-apps/apps/presentationeditor/mobile/app.js \
${oo_root}/web-apps/apps/presentationeditor/mobile/app.js
COPY --from=build-stage ${oo_root}/web-apps/apps/spreadsheeteditor/mobile/app.js \
${oo_root}/web-apps/apps/spreadsheeteditor/mobile/app.js
COPY --from=build-stage ${oo_root}/server/FileConverter/converter \
${oo_root}/server/FileConverter/converter
COPY --from=build-stage ${oo_root}/server/DocService/docservice \
${oo_root}/server/DocService/docservice

View File

@@ -1,8 +1,51 @@
# OnlyOffice Community server with license
## Usage
### CLI
### Podman CLI
```sh
podman run \
--name=onlyoffice \
--detach \
--publish=80:80 \
docker.io/alehoho/oo-ce-docker-license
```
### Docker CLI
```sh
docker run \
--name=onlyoffice \
--detach \
--publish=80:80 \
alehoho/oo-ce-docker-license
```
### docker-compose.yml
```yml
services:
onlyoffice:
container_name: onlyoffice
image: alehoho/oo-ce-docker-license
ports:
- "80"
```
## Build
### Buildah CLI
```sh
buildah build-using-dockerfile \
--tag=onlyoffice-patched \
https://github.com/aleho/onlyoffice-ce-docker-license.git
```
### Docker CLI
```sh
docker build \
@@ -10,12 +53,6 @@ docker build \
https://github.com/aleho/onlyoffice-ce-docker-license.git
```
```sh
docker run \
--name=onlyoffice \
--detach \
onlyoffice-patched
```
### docker-compose.yml
@@ -26,6 +63,7 @@ services:
image: onlyoffice-patched
build:
context: https://github.com/aleho/onlyoffice-ce-docker-license.git
```
### Verify

View File

@@ -1,128 +1,151 @@
From 49041ccf02617c5a9b92693b3bf65870e6b79006 Mon Sep 17 00:00:00 2001
From ae791a4d73a613138a2fee024e04bf8009032617 Mon Sep 17 00:00:00 2001
From: Alexander Hofbauer <alex@derhofbauer.at>
Date: Mon, 3 Aug 2020 11:44:57 +0200
Subject: [PATCH] Enable rebuild with fake license
Date: Sun, 27 Dec 2020 21:49:37 +0100
Subject: [PATCH] Patch for license
---
Common/sources/commondefines.js | 5 ++--
Common/sources/license.js | 52 ++++++++-------------------------
Makefile | 6 ++--
3 files changed, 18 insertions(+), 45 deletions(-)
Common/sources/commondefines.js | 4 ++--
Common/sources/constants.js | 2 +-
Common/sources/license.js | 16 ++++++++--------
DocService/sources/DocsCoServer.js | 5 +++--
DocService/sources/server.js | 1 -
FileConverter/sources/convertermaster.js | 1 -
Makefile | 2 +-
7 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/Common/sources/commondefines.js b/Common/sources/commondefines.js
index 694a13a..eb85e04 100644
index a57f353..78edbd3 100644
--- a/Common/sources/commondefines.js
+++ b/Common/sources/commondefines.js
@@ -975,8 +975,9 @@ const c_oAscUnlockRes = {
@@ -992,8 +992,8 @@ const c_oAscUnlockRes = {
Empty: 2
};
-const buildVersion = '4.1.2';
-const buildNumber = 37;
+const buildVersion = '5.6.3';
+const buildNumber = 2
+exports.buildDate = '2020-08-17T10:18:00.000+02:00'
+const buildVersion = '6.2.2';
+const buildNumber = 21;
exports.TaskQueueData = TaskQueueData;
exports.CMailMergeSendData = CMailMergeSendData;
diff --git a/Common/sources/constants.js b/Common/sources/constants.js
index 2b79e02..738df37 100644
--- a/Common/sources/constants.js
+++ b/Common/sources/constants.js
@@ -70,7 +70,7 @@ exports.LICENSE_RESULT = {
ExpiredLimited: 11
};
-exports.LICENSE_CONNECTIONS = 20;
+exports.LICENSE_CONNECTIONS = 9999;
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 290d85d..5a1ab21 100644
index 19f0b61..43adc9b 100644
--- a/Common/sources/license.js
+++ b/Common/sources/license.js
@@ -32,53 +32,25 @@
@@ -34,7 +34,7 @@
'use strict';
-const config = require('config');
-const configL = config.get('license');
const constants = require('./constants');
-const logger = require('./logger');
-const editorDataStorage = require('./../../DocService/sources/' + config.get('services.CoAuthoring.server.editorDataStorage'));
-
-const buildDate = '6/29/2016';
-const oBuildDate = new Date(buildDate);
-const oPackageType = configL.get('packageType');
-
-const cfgRedisPrefix = config.get('services.CoAuthoring.redis.prefix');
-const redisKeyLicense = cfgRedisPrefix + constants.REDIS_KEY_LICENSE;
-
-let editorData = new editorDataStorage();
+const commonDefines = require('./commondefines');
+const buildDate = '2021-04-19T14:36:00.000Z';
const oBuildDate = new Date(buildDate);
exports.readLicense = function*() {
- const c_LR = constants.LICENSE_RESULT;
- const res = {
+ return {
@@ -43,17 +43,17 @@ exports.readLicense = function*() {
count: 1,
- type: c_LR.Error,
+ type: constants.LICENSE_RESULT.Success,
type: c_LR.Success,
light: false,
- packageType: oPackageType,
- packageType: constants.PACKAGE_TYPE_OS,
+ packageType: constants.PACKAGE_TYPE_I,
mode: constants.LICENSE_MODE.None,
branding: false,
- connections: constants.LICENSE_CONNECTIONS,
+ connections: 9999,
customization: false,
- usersCount: 0,
connections: constants.LICENSE_CONNECTIONS,
- customization: false,
+ customization: true,
usersCount: 0,
- usersExpire: constants.LICENSE_EXPIRE_USERS_ONE_DAY,
- hasLicense: false,
- plugins: false,
- buildDate: oBuildDate,
- endDate: null
+ usersCount: 9999,
+ usersExpire: 99999,
+ usersExpire: new Date("2099-01-01T23:59:59.000Z").getTime() / 1000,
+ hasLicense: true,
+ plugins: true,
+ buildDate: commonDefines.buildDate,
buildDate: oBuildDate,
- endDate: null
+ endDate: "2099-01-01T23:59:59.000Z"
};
-
- if (yield* _getFileState()) {
- res.type = c_LR.ExpiredTrial;
- }
-
- if (res.type === c_LR.Expired || res.type === c_LR.ExpiredTrial) {
- res.count = 1;
- logger.error('License: License Expired!!!');
- }
-
- return res;
};
-exports.packageType = oPackageType;
-
-function* _getFileState() {
- return yield editorData.getLicense(redisKeyLicense);
-}
-exports.packageType = constants.PACKAGE_TYPE_OS;
+exports.packageType = constants.PACKAGE_TYPE_I;
diff --git a/DocService/sources/DocsCoServer.js b/DocService/sources/DocsCoServer.js
index bd209ea..9151489 100644
--- a/DocService/sources/DocsCoServer.js
+++ b/DocService/sources/DocsCoServer.js
@@ -103,6 +103,7 @@ const pubsubService = require('./pubsubRabbitMQ');
const queueService = require('./../../Common/sources/taskqueueRabbitMQ');
const rabbitMQCore = require('./../../Common/sources/rabbitMQCore');
const activeMQCore = require('./../../Common/sources/activeMQCore');
+const license = require('./../../Common/sources/license');
const editorDataStorage = require('./' + configCommon.get('services.CoAuthoring.server.editorDataStorage'));
let cfgEditor = JSON.parse(JSON.stringify(config.get('editor')));
@@ -162,7 +163,7 @@ let connections = []; // Активные соединения
let lockDocumentsTimerId = {};//to drop connection that can't unlockDocument
let pubsub;
let queue;
-let licenseInfo = {type: constants.LICENSE_RESULT.Error, light: false, branding: false, customization: false, plugins: false};
+let licenseInfo = license.readLicense().next().value;
let shutdownFlag = false;
const MIN_SAVE_EXPIRATION = 60000;
@@ -2976,7 +2977,7 @@ exports.install = function(server, callbackFunction) {
});
};
exports.setLicenseInfo = function(data) {
- licenseInfo = data;
+ logger.debug('Not updating license info', data)
};
exports.getLicenseInfo = function() {
return licenseInfo;
diff --git a/DocService/sources/server.js b/DocService/sources/server.js
index b623759..29574bd 100644
--- a/DocService/sources/server.js
+++ b/DocService/sources/server.js
@@ -129,7 +129,6 @@ try {
} catch (e) {
logger.warn('Failed to subscribe to plugin folder updates. When changing the list of plugins, you must restart the server. https://nodejs.org/docs/latest/api/fs.html#fs_availability');
}
-fs.watchFile(configCommon.get('license').get('license_file'), updateLicense);
setInterval(updateLicense, 86400000);
// Если захочется использовать 'development' и 'production',
diff --git a/FileConverter/sources/convertermaster.js b/FileConverter/sources/convertermaster.js
index c246bb8..9fe3d41 100644
--- a/FileConverter/sources/convertermaster.js
+++ b/FileConverter/sources/convertermaster.js
@@ -85,7 +85,6 @@ if (cluster.isMaster) {
updateLicense();
- fs.watchFile(configCommon.get('license').get('license_file'), updateLicense);
setInterval(updateLicense, 86400000);
} else {
const converter = require('./converter');
diff --git a/Makefile b/Makefile
index 40bf93e..7109dbd 100644
index 40bf93e..1df9c10 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-GRUNT = grunt
+GRUNT = ./node_modules/.bin/grunt
GRUNT_FLAGS = --no-color -v
GRUNT_FILES = Gruntfile.js.out
@@ -46,7 +46,7 @@ endif
TARGET := $(PLATFORM)_$(ARCHITECTURE)
-OUTPUT = ../build_tools/out/$(TARGET)/onlyoffice/documentserver/server
+OUTPUT = build/out/$(TARGET)/onlyoffice/documentserver/server
SPELLCHECKER_DICTIONARIES := $(OUTPUT)/SpellChecker/dictionaries
SPELLCHECKER_DICTIONARY_FILES += ../dictionaries/*_*
@@ -83,7 +83,7 @@ DEBUG = $(BRANDING_DIR)/debug.js
.PHONY: all clean install uninstall build-date
.NOTPARALLEL:
-all: $(SPELLCHECKER_DICTIONARIES) $(TOOLS) $(SCHEMA) $(CORE_FONTS) $(LICENSE) $(WELCOME) $(INFO) build-date
+all: build-date
+all: $(SCHEMA) $(LICENSE) $(WELCOME) $(INFO) build-date
build-date: $(GRUNT_FILES)
sed "s|\(const buildVersion = \).*|\1'${PRODUCT_VERSION}';|" -i $(COMMON_DEFINES_JS)
--
2.28.0
2.30.2