move server.ts

This commit is contained in:
Jannik Streek 2024-02-19 15:25:04 +01:00
parent f727adacc7
commit 4cf2e61dc0
13 changed files with 36 additions and 35 deletions

View file

@ -92,6 +92,7 @@ COPY --chown=etherpad:etherpad ./var ./var
FROM build as development FROM build as development
COPY --chown=etherpad:etherpad ./src/package.json .npmrc ./src/pnpm-lock.yaml ./src/ COPY --chown=etherpad:etherpad ./src/package.json .npmrc ./src/pnpm-lock.yaml ./src/
COPY --chown=etherpad:etherpad ./pnpm-lock.yaml ./pnpm-lock.yaml
COPY --chown=etherpad:etherpad ./package.json ./package.json COPY --chown=etherpad:etherpad ./package.json ./package.json
COPY --chown=etherpad:etherpad ./src/bin ./src/bin COPY --chown=etherpad:etherpad ./src/bin ./src/bin

View file

@ -108,7 +108,7 @@ Update to the latest version with `git pull origin`, then run
If cloning to a subdirectory within another project, you may need to do the If cloning to a subdirectory within another project, you may need to do the
following: following:
1. Start the server manually (e.g. `node src/node/server.ts`) 1. Start the server manually (e.g. `node server.ts`)
2. Edit the db `filename` in `settings.json` to the relative directory with 2. Edit the db `filename` in `settings.json` to the relative directory with
the file (e.g. `application/lib/etherpad-lite/var/dirty.db`) the file (e.g. `application/lib/etherpad-lite/var/dirty.db`)
3. Add auto-generated files to the main project `.gitignore` 3. Add auto-generated files to the main project `.gitignore`

View file

@ -2,7 +2,7 @@
These hooks are called on server-side. These hooks are called on server-side.
=== loadSettings === loadSettings
Called from: src/node/server.ts Called from: server.ts
Things in context: Things in context:
@ -11,7 +11,7 @@ Things in context:
Use this hook to receive the global settings in your plugin. Use this hook to receive the global settings in your plugin.
=== shutdown === shutdown
Called from: src/node/server.ts Called from:server.ts
Things in context: None Things in context: None

View file

@ -17,6 +17,8 @@ services:
volumes: volumes:
- ./src:/opt/etherpad-lite/src - ./src:/opt/etherpad-lite/src
- ./package.json:/opt/etherpad-lite/package.json - ./package.json:/opt/etherpad-lite/package.json
- ./pnpm-lock.yaml:/opt/etherpad-lite/pnpm-lock.yaml
- ./server.ts:/opt/etherpad-lite/server.ts
- node_modules:/opt/etherpad-lite/src/node_modules - node_modules:/opt/etherpad-lite/src/node_modules
- pnpm-store:/home/etherpad/.local/share/pnpm/store/v3 - pnpm-store:/home/etherpad/.local/share/pnpm/store/v3
depends_on: depends_on:

View file

@ -10,14 +10,14 @@
], ],
"bin": { "bin": {
"etherpad-healthcheck": "src/bin/etherpad-healthcheck", "etherpad-healthcheck": "src/bin/etherpad-healthcheck",
"etherpad-lite": "src/node/server.ts" "etherpad-lite": "src/bin/run"
}, },
"scripts": { "scripts": {
"lint": "eslint .", "lint": "eslint .",
"test": "mocha --import=tsx --timeout 120000 --recursive src/tests/backend/specs src/node_modules/ep_*/static/tests/backend/specs", "test": "mocha --import=tsx --timeout 120000 --recursive src/tests/backend/specs src/node_modules/ep_*/static/tests/backend/specs",
"test-container": "mocha --import=tsx --timeout 5000 src/tests/container/specs/api", "test-container": "mocha --import=tsx --timeout 5000 src/tests/container/specs/api",
"dev": "node --import tsx src/node/server.ts", "dev": "node --import tsx server.ts",
"prod": "node --import tsx src/node/server.ts", "prod": "node --import tsx server.ts",
"ts-check": "tsc --noEmit", "ts-check": "tsc --noEmit",
"ts-check:watch": "tsc --noEmit --watch" "ts-check:watch": "tsc --noEmit --watch"
}, },

View file

@ -24,13 +24,13 @@
* limitations under the License. * limitations under the License.
*/ */
import {PluginType} from "./types/Plugin"; import {PluginType} from "./src/node/types/Plugin";
import {ErrorCaused} from "./types/ErrorCaused"; import {ErrorCaused} from "./src/node/types/ErrorCaused";
import {PromiseHooks} from "node:v8"; import {PromiseHooks} from "node:v8";
import log4js from 'log4js'; import log4js from 'log4js';
const settings = require('./utils/Settings'); const settings = require('./src/node/utils/Settings');
let wtfnode: any; let wtfnode: any;
if (settings.dumpOnUncleanExit) { if (settings.dumpOnUncleanExit) {
@ -43,19 +43,19 @@ if (settings.dumpOnUncleanExit) {
* early check for version compatibility before calling * early check for version compatibility before calling
* any modules that require newer versions of NodeJS * any modules that require newer versions of NodeJS
*/ */
const NodeVersion = require('./utils/NodeVersion'); const NodeVersion = require('./src/node/utils/NodeVersion');
NodeVersion.enforceMinNodeVersion('12.17.0'); NodeVersion.enforceMinNodeVersion('12.17.0');
NodeVersion.checkDeprecationStatus('12.17.0', '1.9.0'); NodeVersion.checkDeprecationStatus('12.17.0', '1.9.0');
const UpdateCheck = require('./utils/UpdateCheck'); const UpdateCheck = require('./src/node/utils/UpdateCheck');
const db = require('./db/DB'); const db = require('./src/node/db/DB');
const express = require('./hooks/express'); const express = require('./src/node/hooks/express');
const hooks = require('../static/js/pluginfw/hooks'); const hooks = require('./src/static/js/pluginfw/hooks');
const pluginDefs = require('../static/js/pluginfw/plugin_defs'); const pluginDefs = require('./src/static/js/pluginfw/plugin_defs');
const plugins = require('../static/js/pluginfw/plugins'); const plugins = require('./src/static/js/pluginfw/plugins');
const installer = require('../static/js/pluginfw/installer'); const installer = require('./src/static/js/pluginfw/installer');
const {Gate} = require('./utils/promises'); const {Gate} = require('./src/node/utils/promises');
const stats = require('./stats') const stats = require('./src/node/stats')
const logger = log4js.getLogger('server'); const logger = log4js.getLogger('server');

View file

@ -36,4 +36,4 @@ src/bin/installDeps.sh "$@" || exit 1
#Move to the node folder and start #Move to the node folder and start
echo "Starting Etherpad..." echo "Starting Etherpad..."
cd src cd src
exec node --import tsx ./node/server.ts "$@" exec node --import tsx ../server.ts "$@"

View file

@ -20,7 +20,7 @@ end script
script script
cd $EPHOME/ cd $EPHOME/
exec su -s /bin/sh -c 'exec "$0" "$@"' $EPUSER -- node --import tsx src/node/server.ts \ exec su -s /bin/sh -c 'exec "$0" "$@"' $EPUSER -- node --import tsx server.ts \
>> $EPLOGS/access.log \ >> $EPLOGS/access.log \
2>> $EPLOGS/error.log 2>> $EPLOGS/error.log
echo "Etherpad is running on http://localhost:9001 - To change settings edit /opt/etherpad/settings.json" echo "Etherpad is running on http://localhost:9001 - To change settings edit /opt/etherpad/settings.json"

View file

@ -17,4 +17,4 @@ echo "Open 'chrome://inspect' on Chrome to start debugging."
cd src cd src
# Use 0.0.0.0 to allow external connections to the debugger # Use 0.0.0.0 to allow external connections to the debugger
# (ex: running Etherpad on a docker container). Use default port # (9229) # (ex: running Etherpad on a docker container). Use default port # (9229)
exec node --import tsx --inspect=0.0.0.0:9229 ./node/server.ts "$@" exec node --import tsx --inspect=0.0.0.0:9229 ../server.ts "$@"

View file

@ -19,4 +19,4 @@ cd "${MY_DIR}/../.." || exit 1
echo "Running directly, without checking/installing dependencies" echo "Running directly, without checking/installing dependencies"
# run Etherpad main class # run Etherpad main class
exec node --import tsx src/node/server.ts "$@" exec node --import tsx server.ts "$@"

View file

@ -75,8 +75,7 @@
"wtfnode": "^0.9.1" "wtfnode": "^0.9.1"
}, },
"bin": { "bin": {
"etherpad-healthcheck": "bin/etherpad-healthcheck", "etherpad-healthcheck": "bin/etherpad-healthcheck"
"etherpad-lite": "node/server.ts"
}, },
"devDependencies": { "devDependencies": {
"@types/async": "^3.2.24", "@types/async": "^3.2.24",
@ -111,8 +110,6 @@
"lint": "eslint .", "lint": "eslint .",
"test": "mocha --import=tsx --timeout 120000 --recursive tests/backend/specs ../node_modules/ep_*/static/tests/backend/specs", "test": "mocha --import=tsx --timeout 120000 --recursive tests/backend/specs ../node_modules/ep_*/static/tests/backend/specs",
"test-container": "mocha --import=tsx --timeout 5000 tests/container/specs/api", "test-container": "mocha --import=tsx --timeout 5000 tests/container/specs/api",
"dev": "node --import tsx node/server.ts",
"prod": "node --import tsx node/server.ts",
"ts-check": "tsc --noEmit", "ts-check": "tsc --noEmit",
"ts-check:watch": "tsc --noEmit --watch" "ts-check:watch": "tsc --noEmit --watch"
}, },

13
src/pnpm-lock.yaml generated
View file

@ -112,7 +112,7 @@ dependencies:
version: 8.1.2 version: 8.1.2
terser: terser:
specifier: ^5.27.1 specifier: ^5.27.1
version: 5.27.1 version: 5.27.2
threads: threads:
specifier: ^1.7.0 specifier: ^1.7.0
version: 1.7.0 version: 1.7.0
@ -1889,7 +1889,7 @@ packages:
string.prototype.trimstart: 1.0.7 string.prototype.trimstart: 1.0.7
typed-array-buffer: 1.0.1 typed-array-buffer: 1.0.1
typed-array-byte-length: 1.0.0 typed-array-byte-length: 1.0.0
typed-array-byte-offset: 1.0.0 typed-array-byte-offset: 1.0.1
typed-array-length: 1.0.4 typed-array-length: 1.0.4
unbox-primitive: 1.0.2 unbox-primitive: 1.0.2
which-typed-array: 1.1.14 which-typed-array: 1.1.14
@ -4773,8 +4773,8 @@ packages:
yallist: 4.0.0 yallist: 4.0.0
dev: false dev: false
/terser@5.27.1: /terser@5.27.2:
resolution: {integrity: sha512-29wAr6UU/oQpnTw5HoadwjUZnFQXGdOfj0LjZ4sVxzqwHh/QVkvr7m8y9WoR4iN3FRitVduTc6KdjcW38Npsug==} resolution: {integrity: sha512-sHXmLSkImesJ4p5apTeT63DsV4Obe1s37qT8qvwHRmVxKTBH7Rv9Wr26VcAMmLbmk9UliiwK8z+657NyJHHy/w==}
engines: {node: '>=10'} engines: {node: '>=10'}
hasBin: true hasBin: true
dependencies: dependencies:
@ -4965,13 +4965,14 @@ packages:
is-typed-array: 1.1.13 is-typed-array: 1.1.13
dev: true dev: true
/typed-array-byte-offset@1.0.0: /typed-array-byte-offset@1.0.1:
resolution: {integrity: sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==} resolution: {integrity: sha512-tcqKMrTRXjqvHN9S3553NPCaGL0VPgFI92lXszmrE8DMhiDPLBYLlvo8Uu4WZAAX/aGqp/T1sbA4ph8EWjDF9Q==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
dependencies: dependencies:
available-typed-arrays: 1.0.6 available-typed-arrays: 1.0.6
call-bind: 1.0.7 call-bind: 1.0.7
for-each: 0.3.3 for-each: 0.3.3
gopd: 1.0.1
has-proto: 1.0.1 has-proto: 1.0.1
is-typed-array: 1.1.13 is-typed-array: 1.1.13
dev: true dev: true

View file

@ -2,7 +2,7 @@
<system.webServer> <system.webServer>
<handlers> <handlers>
<add name="iisnode" path="src/node/server.ts" verb="*" modules="iisnode" /> <add name="iisnode" path="server.ts" verb="*" modules="iisnode" />
</handlers> </handlers>
<rewrite> <rewrite>
@ -23,7 +23,7 @@
<conditions> <conditions>
<add input="{{REQUEST_FILENAME}}" matchType="IsFile" negate="True"/> <add input="{{REQUEST_FILENAME}}" matchType="IsFile" negate="True"/>
</conditions> </conditions>
<action type="Rewrite" url="src/node/server.ts" /> <action type="Rewrite" url="server.ts" />
</rule> </rule>
</rules> </rules>
</rewrite> </rewrite>