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
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 ./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
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
the file (e.g. `application/lib/etherpad-lite/var/dirty.db`)
3. Add auto-generated files to the main project `.gitignore`

View file

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

View file

@ -17,6 +17,8 @@ services:
volumes:
- ./src:/opt/etherpad-lite/src
- ./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
- pnpm-store:/home/etherpad/.local/share/pnpm/store/v3
depends_on:

View file

@ -10,14 +10,14 @@
],
"bin": {
"etherpad-healthcheck": "src/bin/etherpad-healthcheck",
"etherpad-lite": "src/node/server.ts"
"etherpad-lite": "src/bin/run"
},
"scripts": {
"lint": "eslint .",
"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",
"dev": "node --import tsx src/node/server.ts",
"prod": "node --import tsx src/node/server.ts",
"dev": "node --import tsx server.ts",
"prod": "node --import tsx server.ts",
"ts-check": "tsc --noEmit",
"ts-check:watch": "tsc --noEmit --watch"
},

View file

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

View file

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

View file

@ -20,7 +20,7 @@ end script
script
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 \
2>> $EPLOGS/error.log
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
# Use 0.0.0.0 to allow external connections to the debugger
# (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"
# 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"
},
"bin": {
"etherpad-healthcheck": "bin/etherpad-healthcheck",
"etherpad-lite": "node/server.ts"
"etherpad-healthcheck": "bin/etherpad-healthcheck"
},
"devDependencies": {
"@types/async": "^3.2.24",
@ -111,8 +110,6 @@
"lint": "eslint .",
"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",
"dev": "node --import tsx node/server.ts",
"prod": "node --import tsx node/server.ts",
"ts-check": "tsc --noEmit",
"ts-check:watch": "tsc --noEmit --watch"
},

View file

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

View file

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