cleanup after workspace refactoring (#6174)

* fix bin folder and workflows as far its possible

cleanup of dockerfile

changed paths of scripts

add lock file

fix working directory for workflows

fix windows bin

fix travis (is travis used anyway?)

fix package refs

remove pnpm-lock file in root as these conflicts with the docker volume setup

optimize comments

use install again

refactor prod image call to run

fix --workspace can only be used inside a workspace

correct comment

try fix pipeline

try fix pipeline for upgrade-from-latest-release

install all deps

smaller adjustments

save

update dockerfile

remove workspace command

fix run test command

start repair latest release workflow

start repair latest release workflow

start repair latest release workflow

further repairs

* remove test plugin from docker compose
This commit is contained in:
JannikStreek 2024-02-21 21:50:11 +01:00 committed by GitHub
parent 4f53142d7f
commit 04063d664b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
75 changed files with 158 additions and 192 deletions

View file

@ -53,10 +53,10 @@ jobs:
sudo apt install -y --no-install-recommends libreoffice libreoffice-pdfimport sudo apt install -y --no-install-recommends libreoffice libreoffice-pdfimport
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh run: bin/installDeps.sh
- -
name: Run the backend tests name: Run the backend tests
run: cd src && pnpm test run: pnpm test
withpluginsLinux: withpluginsLinux:
# run on pushes to any branch # run on pushes to any branch
@ -102,10 +102,11 @@ jobs:
sudo add-apt-repository -y ppa:libreoffice/ppa sudo add-apt-repository -y ppa:libreoffice/ppa
sudo apt update sudo apt update
sudo apt install -y --no-install-recommends libreoffice libreoffice-pdfimport sudo apt install -y --no-install-recommends libreoffice libreoffice-pdfimport
-
name: Install all dependencies and symlink for ep_etherpad-lite
run: bin/installDeps.sh
- -
name: Install Etherpad plugins name: Install Etherpad plugins
# The --legacy-peer-deps flag is required to work around a bug in npm v7:
# https://github.com/npm/cli/issues/2199
run: > run: >
pnpm install --workspace-root pnpm install --workspace-root
ep_align ep_align
@ -121,21 +122,9 @@ jobs:
ep_spellcheck ep_spellcheck
ep_subscript_and_superscript ep_subscript_and_superscript
ep_table_of_contents ep_table_of_contents
# Etherpad core dependencies must be installed after installing the
# plugin's dependencies, otherwise npm will try to hoist common
# dependencies by removing them from src/node_modules and installing them
# in the top-level node_modules. As of v6.14.10, npm's hoist logic appears
# to be buggy, because it sometimes removes dependencies from
# src/node_modules but fails to add them to the top-level node_modules.
# Even if npm correctly hoists the dependencies, the hoisting seems to
# confuse tools such as `npm outdated`, `npm update`, and some ESLint
# rules.
-
name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh
- -
name: Run the backend tests name: Run the backend tests
run: cd src && pnpm test run: pnpm test
withoutpluginsWindows: withoutpluginsWindows:
# run on pushes to any branch # run on pushes to any branch
@ -173,7 +162,7 @@ jobs:
run: pnpm config set auto-install-peers false run: pnpm config set auto-install-peers false
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installOnWindows.bat run: bin/installOnWindows.bat
- -
name: Fix up the settings.json name: Fix up the settings.json
run: | run: |
@ -248,7 +237,7 @@ jobs:
# rules. # rules.
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installOnWindows.bat run: bin/installOnWindows.bat
- -
name: Fix up the settings.json name: Fix up the settings.json
run: | run: |

View file

@ -60,7 +60,7 @@ jobs:
name: Test name: Test
run: | run: |
docker run --rm -d -p 9001:9001 --name test ${{ env.TEST_TAG }} docker run --rm -d -p 9001:9001 --name test ${{ env.TEST_TAG }}
./src/bin/installDeps.sh ./bin/installDeps.sh
docker logs -f test & docker logs -f test &
while true; do while true; do
echo "Waiting for Docker container to start..." echo "Waiting for Docker container to start..."

View file

@ -67,7 +67,7 @@ jobs:
# rules. # rules.
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh run: bin/installDeps.sh
- -
name: Install etherpad plugins name: Install etherpad plugins
run: rm -Rf node_modules/ep_align/static/tests/* run: rm -Rf node_modules/ep_align/static/tests/*

View file

@ -46,7 +46,7 @@ jobs:
run: pnpm config set auto-install-peers false run: pnpm config set auto-install-peers false
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh run: bin/installDeps.sh
- -
name: export GIT_HASH to env name: export GIT_HASH to env
id: environment id: environment
@ -142,7 +142,7 @@ jobs:
# rules. # rules.
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh run: bin/installDeps.sh
- -
name: export GIT_HASH to env name: export GIT_HASH to env
id: environment id: environment

View file

@ -43,7 +43,7 @@ jobs:
run: pnpm config set auto-install-peers false run: pnpm config set auto-install-peers false
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh run: bin/installDeps.sh
- -
name: Install etherpad-load-test name: Install etherpad-load-test
run: sudo npm install -g etherpad-load-test-socket-io run: sudo npm install -g etherpad-load-test-socket-io
@ -117,7 +117,7 @@ jobs:
# rules. # rules.
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh run: bin/installDeps.sh
- -
name: Run load test name: Run load test
run: src/tests/frontend/travis/runnerLoadTest.sh 25 50 run: src/tests/frontend/travis/runnerLoadTest.sh 25 50
@ -158,7 +158,7 @@ jobs:
run: pnpm config set auto-install-peers false run: pnpm config set auto-install-peers false
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh run: bin/installDeps.sh
- -
name: Install etherpad-load-test name: Install etherpad-load-test
run: sudo npm install -g etherpad-load-test-socket-io run: sudo npm install -g etherpad-load-test-socket-io

View file

@ -41,7 +41,6 @@ jobs:
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: ./bin/installDeps.sh run: ./bin/installDeps.sh
working-directory: ./src
- name: Perform type check - name: Perform type check
working-directory: ./src working-directory: ./src
run: npm run ts-check run: npm run ts-check

View file

@ -57,7 +57,7 @@ jobs:
docker run --rm --network ep_net --ip 172.23.42.3 --name anotherip -dt anotherip docker run --rm --network ep_net --ip 172.23.42.3 --name anotherip -dt anotherip
- -
name: install dependencies and create symlink for ep_etherpad-lite name: install dependencies and create symlink for ep_etherpad-lite
run: src/bin/installDeps.sh run: bin/installDeps.sh
- -
name: run rate limit test name: run rate limit test
run: | run: |

View file

@ -29,30 +29,13 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: ${{ matrix.node }} node-version: ${{ matrix.node }}
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Only install direct dependencies
run: pnpm config set auto-install-peers false
- -
name: Install Etherpad plugins name: Install Etherpad plugins
# The --legacy-peer-deps flag is required to work around a bug in npm # Important: Installer for old master which does not have pnpm right now
# v7: https://github.com/npm/cli/issues/2199 # The --legacy-peer-deps flag is required to work around a bug in npm v7:
# https://github.com/npm/cli/issues/2199
run: > run: >
pnpm install --workspace root npm install --no-save --legacy-peer-deps
ep_align ep_align
ep_author_hover ep_author_hover
ep_cursortrace ep_cursortrace
@ -66,21 +49,12 @@ jobs:
ep_spellcheck ep_spellcheck
ep_subscript_and_superscript ep_subscript_and_superscript
ep_table_of_contents ep_table_of_contents
# Etherpad core dependencies must be installed after installing the
# plugin's dependencies, otherwise npm will try to hoist common
# dependencies by removing them from src/node_modules and installing them
# in the top-level node_modules. As of v6.14.10, npm's hoist logic appears
# to be buggy, because it sometimes removes dependencies from
# src/node_modules but fails to add them to the top-level node_modules.
# Even if npm correctly hoists the dependencies, the hoisting seems to
# confuse tools such as `npm outdated`, `npm update`, and some ESLint
# rules.
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh run: src/bin/installDeps.sh
- -
name: Run the backend tests name: Run the backend tests
run: cd src && pnpm test run: cd src && npm test
# Because actions/checkout@v4 is called with "ref: master" and without # Because actions/checkout@v4 is called with "ref: master" and without
# "fetch-depth: 0", the local clone does not have the ${GITHUB_SHA} # "fetch-depth: 0", the local clone does not have the ${GITHUB_SHA}
# commit. Fetch ${GITHUB_REF} to get the ${GITHUB_SHA} commit. Note that a # commit. Fetch ${GITHUB_REF} to get the ${GITHUB_SHA} commit. Note that a
@ -96,13 +70,36 @@ jobs:
# For pull requests, ${GITHUB_SHA} is the automatically generated merge # For pull requests, ${GITHUB_SHA} is the automatically generated merge
# commit that merges the PR's source branch to its destination branch. # commit that merges the PR's source branch to its destination branch.
run: git checkout "${GITHUB_SHA}" run: git checkout "${GITHUB_SHA}"
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
run_install: false
- name: Only install direct dependencies
run: pnpm config set auto-install-peers false
-
name: Install libreoffice
run: |
sudo add-apt-repository -y ppa:libreoffice/ppa
sudo apt update
sudo apt install -y --no-install-recommends libreoffice libreoffice-pdfimport
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh run: bin/installDeps.sh
- -
name: Run the backend tests name: Run the backend tests
working-directory: ./src run: pnpm test
run: npm test
- -
name: Install Cypress name: Install Cypress
working-directory: ./src working-directory: ./src
@ -111,6 +108,6 @@ jobs:
name: Run Etherpad & Test Frontend name: Run Etherpad & Test Frontend
working-directory: ./src working-directory: ./src
run: | run: |
npm run dev & pnpm run dev &
curl --connect-timeout 10 --max-time 20 --retry 5 --retry-delay 10 --retry-max-time 60 --retry-connrefused http://127.0.0.1:9001/p/test curl --connect-timeout 10 --max-time 20 --retry 5 --retry-delay 10 --retry-max-time 60 --retry-connrefused http://127.0.0.1:9001/p/test
./node_modules/cypress/bin/cypress run --config-file tests/frontend/cypress/cypress.config.js ./node_modules/cypress/bin/cypress run --config-file tests/frontend/cypress/cypress.config.js

View file

@ -50,7 +50,7 @@ jobs:
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
shell: msys2 {0} shell: msys2 {0}
run: src/bin/installDeps.sh run: bin/installDeps.sh
- -
name: Run the backend tests name: Run the backend tests
shell: msys2 {0} shell: msys2 {0}
@ -58,7 +58,7 @@ jobs:
- -
name: Build the .zip name: Build the .zip
shell: msys2 {0} shell: msys2 {0}
run: src/bin/buildForWindows.sh run: bin/buildForWindows.sh
- -
name: Archive production artifacts name: Archive production artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -91,7 +91,7 @@ jobs:
name: Create installer name: Create installer
uses: joncloud/makensis-action@v4.1 uses: joncloud/makensis-action@v4.1
with: with:
script-file: 'src/bin/nsis/etherpad.nsi' script-file: 'bin/nsis/etherpad.nsi'
- -
name: Archive production artifacts name: Archive production artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -143,7 +143,7 @@ jobs:
run: pnpm config set auto-install-peers false run: pnpm config set auto-install-peers false
- name: Install all dependencies and symlink for ep_etherpad-lite - name: Install all dependencies and symlink for ep_etherpad-lite
run: .\bin\installOnWindows.bat run: .\bin\installOnWindows.bat
working-directory: etherpad/src working-directory: etherpad
- -
name: Run Etherpad name: Run Etherpad
working-directory: etherpad/src working-directory: etherpad/src

3
.gitignore vendored
View file

@ -22,5 +22,4 @@ out/
/src/bin/convertSettings.json /src/bin/convertSettings.json
/src/bin/etherpad-1.deb /src/bin/etherpad-1.deb
/src/bin/node.exe /src/bin/node.exe
plugin_packages plugin_packages
/pnpm-lock.yaml

View file

@ -55,7 +55,7 @@ jobs:
- *set_loglevel_warn - *set_loglevel_warn
- *enable_admin_tests - *enable_admin_tests
- "src/tests/frontend/travis/sauce_tunnel.sh" - "src/tests/frontend/travis/sauce_tunnel.sh"
- "src/bin/installDeps.sh" - "bin/installDeps.sh"
- "export GIT_HASH=$(git rev-parse --verify --short HEAD)" - "export GIT_HASH=$(git rev-parse --verify --short HEAD)"
script: script:
- "./src/tests/frontend/travis/runner.sh" - "./src/tests/frontend/travis/runner.sh"
@ -63,7 +63,7 @@ jobs:
install: install:
- *install_libreoffice - *install_libreoffice
- *set_loglevel_warn - *set_loglevel_warn
- "src/bin/installDeps.sh" - "bin/installDeps.sh"
- "cd src && pnpm install && cd -" - "cd src && pnpm install && cd -"
script: script:
- "cd src && pnpm test" - "cd src && pnpm test"
@ -77,7 +77,7 @@ jobs:
- name: "Load test Etherpad without Plugins" - name: "Load test Etherpad without Plugins"
install: install:
- *set_loglevel_warn - *set_loglevel_warn
- "src/bin/installDeps.sh" - "bin/installDeps.sh"
- "cd src && pnpm install && cd -" - "cd src && pnpm install && cd -"
- "npm install -g etherpad-load-test" - "npm install -g etherpad-load-test"
script: script:
@ -90,7 +90,7 @@ jobs:
- *set_loglevel_warn - *set_loglevel_warn
- *enable_admin_tests - *enable_admin_tests
- "src/tests/frontend/travis/sauce_tunnel.sh" - "src/tests/frontend/travis/sauce_tunnel.sh"
- "src/bin/installDeps.sh" - "bin/installDeps.sh"
- "rm src/tests/frontend/specs/*" - "rm src/tests/frontend/specs/*"
- *install_plugins - *install_plugins
- "export GIT_HASH=$(git rev-parse --verify --short HEAD)" - "export GIT_HASH=$(git rev-parse --verify --short HEAD)"
@ -105,7 +105,7 @@ jobs:
install: install:
- *install_libreoffice - *install_libreoffice
- *set_loglevel_warn - *set_loglevel_warn
- "src/bin/installDeps.sh" - "bin/installDeps.sh"
- *install_plugins - *install_plugins
- "cd src && pnpm install && cd -" - "cd src && pnpm install && cd -"
script: script:
@ -120,7 +120,7 @@ jobs:
- name: "Load test Etherpad with Plugins" - name: "Load test Etherpad with Plugins"
install: install:
- *set_loglevel_warn - *set_loglevel_warn
- "src/bin/installDeps.sh" - "bin/installDeps.sh"
- *install_plugins - *install_plugins
- "cd src && npm install && cd -" - "cd src && npm install && cd -"
- "npm install -g etherpad-load-test" - "npm install -g etherpad-load-test"
@ -135,7 +135,7 @@ jobs:
- "docker run -p 8081:80 --rm --network ep_net --ip 172.23.42.1 -d nginx-latest" - "docker run -p 8081:80 --rm --network ep_net --ip 172.23.42.1 -d nginx-latest"
- "docker run --name etherpad-docker -p 9000:9001 --rm --network ep_net --ip 172.23.42.2 -e 'TRUST_PROXY=true' epl-debian-slim &" - "docker run --name etherpad-docker -p 9000:9001 --rm --network ep_net --ip 172.23.42.2 -e 'TRUST_PROXY=true' epl-debian-slim &"
- "docker run --rm --network ep_net --ip 172.23.42.3 --name anotherip -dt anotherip" - "docker run --rm --network ep_net --ip 172.23.42.3 --name anotherip -dt anotherip"
- "./src/bin/installDeps.sh" - "./bin/installDeps.sh"
script: script:
- "cd src/tests/ratelimit && bash testlimits.sh" - "cd src/tests/ratelimit && bash testlimits.sh"

View file

@ -88,40 +88,25 @@ COPY --chown=etherpad:etherpad ./.git/HEAD ./.git/HEAD
COPY --chown=etherpad:etherpad ./.git/refs ./.git/refs COPY --chown=etherpad:etherpad ./.git/refs ./.git/refs
COPY --chown=etherpad:etherpad ${SETTINGS} ./settings.json COPY --chown=etherpad:etherpad ${SETTINGS} ./settings.json
COPY --chown=etherpad:etherpad ./var ./var COPY --chown=etherpad:etherpad ./var ./var
COPY --chown=etherpad:etherpad ./package.json ./package.json COPY --chown=etherpad:etherpad ./bin ./bin
COPY --chown=etherpad:etherpad ./pnpm-workspace.yaml ./pnpm-workspace.yaml COPY --chown=etherpad:etherpad ./pnpm-workspace.yaml ./package.json ./
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 ./src/bin ./src/bin RUN bin/installDeps.sh && { [ -z "${ETHERPAD_PLUGINS}" ] || \
pnpm install --workspace-root ${ETHERPAD_PLUGINS}; }
RUN { [ -z "${ETHERPAD_PLUGINS}" ] || \
pnpm install --workspace-root ${ETHERPAD_PLUGINS}; } && \
src/bin/installDeps.sh
FROM build as production FROM build as production
# By default, Etherpad container is built and run in "production" mode. This is
# leaner (development dependencies are not installed) and runs faster (among
# other things, assets are minified & compressed).
ENV NODE_ENV=production ENV NODE_ENV=production
ENV ETHERPAD_PRODUCTION=true ENV ETHERPAD_PRODUCTION=true
COPY --chown=etherpad:etherpad ./src ./src COPY --chown=etherpad:etherpad ./src ./src
# Plugins must be installed before installing Etherpad's dependencies, otherwise RUN bin/installDeps.sh && { [ -z "${ETHERPAD_PLUGINS}" ] || \
# npm will try to hoist common dependencies by removing them from
# src/node_modules and installing them in the top-level node_modules. As of
# v6.14.10, npm's hoist logic appears to be buggy, because it sometimes removes
# dependencies from src/node_modules but fails to add them to the top-level
# node_modules. Even if npm correctly hoists the dependencies, the hoisting
# seems to confuse tools such as `npm outdated`, `npm update`, and some ESLint
# rules.
RUN { [ -z "${ETHERPAD_PLUGINS}" ] || \
pnpm install --workspace-root ${ETHERPAD_PLUGINS}; } && \ pnpm install --workspace-root ${ETHERPAD_PLUGINS}; } && \
src/bin/installDeps.sh && \
rm -rf ~/.npm rm -rf ~/.npm
# Copy the configuration file. # Copy the configuration file.
@ -137,4 +122,4 @@ HEALTHCHECK --interval=5s --timeout=3s \
CMD curl --silent http://localhost:9001/health | grep -E "pass|ok|up" > /dev/null || exit 1 CMD curl --silent http://localhost:9001/health | grep -E "pass|ok|up" > /dev/null || exit 1
EXPOSE 9001 EXPOSE 9001
CMD ["npm", "run", "prod", "--prefix", "./src"] CMD ["pnpm", "run", "prod"]

1
bin
View file

@ -1 +0,0 @@
src/bin

View file

@ -14,7 +14,7 @@ rm -rf ${DIST}
mkdir -p ${DIST}/ mkdir -p ${DIST}/
rm -rf ${SRC} rm -rf ${SRC}
rsync -a src/bin/deb-src/ ${SRC}/ rsync -a bin/deb-src/ ${SRC}/
mkdir -p ${SYSROOT}/opt/ mkdir -p ${SYSROOT}/opt/
rsync --exclude '.git' -a . ${SYSROOT}/opt/etherpad/ --delete rsync --exclude '.git' -a . ${SYSROOT}/opt/etherpad/ --delete

View file

@ -47,7 +47,7 @@ rm -rf node_modules || true
rm -rf src/node_modules || true rm -rf src/node_modules || true
#log "do a normal unix install first..." #log "do a normal unix install first..."
#$(try cd src && ./bin/installDeps.sh) #$(try cd ./bin/installDeps.sh)
log "copy the windows settings template..." log "copy the windows settings template..."
try cp settings.json.template settings.json try cp settings.json.template settings.json

View file

@ -7,12 +7,12 @@
// unhandled rejection into an uncaught exception, which does cause Node.js to exit. // unhandled rejection into an uncaught exception, which does cause Node.js to exit.
process.on('unhandledRejection', (err) => { throw err; }); process.on('unhandledRejection', (err) => { throw err; });
if (process.argv.length !== 2) throw new Error('Use: node src/bin/checkAllPads.js'); if (process.argv.length !== 2) throw new Error('Use: node bin/checkAllPads.js');
(async () => { (async () => {
const db = require('../node/db/DB'); const db = require('./src/node/db/DB');
await db.init(); await db.init();
const padManager = require('../node/db/PadManager'); const padManager = require('./src/node/db/PadManager');
await Promise.all((await padManager.listAllPads()).padIDs.map(async (padId) => { await Promise.all((await padManager.listAllPads()).padIDs.map(async (padId) => {
const pad = await padManager.getPad(padId); const pad = await padManager.getPad(padId);
try { try {

View file

@ -7,12 +7,12 @@
// unhandled rejection into an uncaught exception, which does cause Node.js to exit. // unhandled rejection into an uncaught exception, which does cause Node.js to exit.
process.on('unhandledRejection', (err) => { throw err; }); process.on('unhandledRejection', (err) => { throw err; });
if (process.argv.length !== 3) throw new Error('Use: node src/bin/checkPad.js $PADID'); if (process.argv.length !== 3) throw new Error('Use: node bin/checkPad.js $PADID');
const padId = process.argv[2]; const padId = process.argv[2];
(async () => { (async () => {
const db = require('../node/db/DB'); const db = require('./src/node/db/DB');
await db.init(); await db.init();
const padManager = require('../node/db/PadManager'); const padManager = require('./src/node/db/PadManager');
if (!await padManager.doesPadExists(padId)) throw new Error('Pad does not exist'); if (!await padManager.doesPadExists(padId)) throw new Error('Pad does not exist');
const pad = await padManager.getPad(padId); const pad = await padManager.getPad(padId);
await pad.check(); await pad.check();

View file

@ -2,10 +2,10 @@
# Move to the Etherpad base directory. # Move to the Etherpad base directory.
MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1 MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${MY_DIR}/../.." || exit 1 cd "${MY_DIR}/.." || exit 1
# Source constants and useful functions # Source constants and useful functions
. src/bin/functions.sh . bin/functions.sh
ignoreRoot=0 ignoreRoot=0
for ARG in "$@" for ARG in "$@"
@ -31,7 +31,7 @@ fi
rm -rf src/node_modules rm -rf src/node_modules
#Prepare the environment #Prepare the environment
src/bin/installDeps.sh "$@" || exit 1 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..."

View file

@ -134,7 +134,7 @@ function create_builds {
git clone $ETHER_WEB_REPO git clone $ETHER_WEB_REPO
echo "Creating windows build..." echo "Creating windows build..."
cd etherpad-lite cd etherpad-lite
src/bin/buildForWindows.sh bin/buildForWindows.sh
[[ $? != 0 ]] && echo "Aborting: Error creating build for windows" && exit 1 [[ $? != 0 ]] && echo "Aborting: Error creating build for windows" && exit 1
echo "Creating docs..." echo "Creating docs..."
make docs make docs

View file

@ -12,13 +12,13 @@ process.on('unhandledRejection', (err) => { throw err; });
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const querystring = require('querystring'); const querystring = require('querystring');
const settings = require('../node/utils/Settings'); const settings = require('./src/node/utils/Settings');
const supertest = require('supertest'); const supertest = require('supertest');
(async () => { (async () => {
const api = supertest(`http://${settings.ip}:${settings.port}`); const api = supertest(`http://${settings.ip}:${settings.port}`);
const filePath = path.join(__dirname, '../../APIKEY.txt'); const filePath = path.join(__dirname, '../APIKEY.txt');
const apikey = fs.readFileSync(filePath, {encoding: 'utf-8'}); const apikey = fs.readFileSync(filePath, {encoding: 'utf-8'});
let res; let res;

View file

@ -15,7 +15,7 @@ pre-start script
chown $EPUSER $EPLOGS ||true chown $EPUSER $EPLOGS ||true
chmod 0755 $EPLOGS ||true chmod 0755 $EPLOGS ||true
chown -R $EPUSER $EPHOME/var ||true chown -R $EPUSER $EPHOME/var ||true
$EPHOME/src/bin/installDeps.sh >> $EPLOGS/error.log || { stop; exit 1; } $EPHOME/bin/installDeps.sh >> $EPLOGS/error.log || { stop; exit 1; }
end script end script
script script

View file

@ -2,13 +2,13 @@
# Move to the Etherpad base directory. # Move to the Etherpad base directory.
MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1 MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${MY_DIR}/../.." || exit 1 cd "${MY_DIR}/.." || exit 1
# Source constants and useful functions # Source constants and useful functions
. src/bin/functions.sh . bin/functions.sh
# Prepare the environment # Prepare the environment
src/bin/installDeps.sh || exit 1 bin/installDeps.sh || exit 1
echo "If you are new to debugging Node.js with Chrome DevTools, take a look at this page:" echo "If you are new to debugging Node.js with Chrome DevTools, take a look at this page:"
echo "https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27" echo "https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27"

View file

@ -18,11 +18,11 @@ const supertest = require('supertest');
let deleteCount = 0; let deleteCount = 0;
// get the API Key // get the API Key
const filePath = path.join(__dirname, '../../APIKEY.txt'); const filePath = path.join(__dirname, '../APIKEY.txt');
console.log('Deleting all group sessions, please be patient.'); console.log('Deleting all group sessions, please be patient.');
(async () => { (async () => {
const settings = require('../tests/container/loadSettings').loadSettings(); const settings = require('./src/tests/container/loadSettings').loadSettings();
const apikey = fs.readFileSync(filePath, {encoding: 'utf-8'}); const apikey = fs.readFileSync(filePath, {encoding: 'utf-8'});
const api = supertest(`http://${settings.ip}:${settings.port}`); const api = supertest(`http://${settings.ip}:${settings.port}`);

View file

@ -9,7 +9,7 @@
// unhandled rejection into an uncaught exception, which does cause Node.js to exit. // unhandled rejection into an uncaught exception, which does cause Node.js to exit.
process.on('unhandledRejection', (err) => { throw err; }); process.on('unhandledRejection', (err) => { throw err; });
const settings = require('../tests/container/loadSettings').loadSettings(); const settings = require('./src/tests/container/loadSettings').loadSettings();
const path = require('path'); const path = require('path');
const fs = require('fs'); const fs = require('fs');
const supertest = require('supertest'); const supertest = require('supertest');
@ -22,7 +22,7 @@ if (process.argv.length !== 3) throw new Error('Use: node deletePad.js $PADID');
const padId = process.argv[2]; const padId = process.argv[2];
// get the API Key // get the API Key
const filePath = path.join(__dirname, '../../APIKEY.txt'); const filePath = path.join(__dirname, '../APIKEY.txt');
const apikey = fs.readFileSync(filePath, {encoding: 'utf-8'}); const apikey = fs.readFileSync(filePath, {encoding: 'utf-8'});
(async () => { (async () => {

View file

@ -19,13 +19,13 @@ const padId = process.argv[2];
(async () => { (async () => {
// initialize database // initialize database
require('../node/utils/Settings'); require('./src/node/utils/Settings');
const db = require('../node/db/DB'); const db = require('./src/node/db/DB');
await db.init(); await db.init();
// load extra modules // load extra modules
const dirtyDB = require('dirty'); const dirtyDB = require('dirty');
const padManager = require('../node/db/PadManager'); const padManager = require('./src/node/db/PadManager');
// initialize output database // initialize output database
const dirty = dirtyDB(`${padId}.db`); const dirty = dirtyDB(`${padId}.db`);

View file

@ -11,10 +11,10 @@ set -eu
# Move to the Etherpad base directory. # Move to the Etherpad base directory.
MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1 MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${MY_DIR}/../.." || exit 1 cd "${MY_DIR}/.." || exit 1
# Source constants and useful functions # Source constants and useful functions
. src/bin/functions.sh . bin/functions.sh
echo "Running directly, without checking/installing dependencies" echo "Running directly, without checking/installing dependencies"

View file

@ -49,7 +49,7 @@ const unescape = (val) => {
const fs = require('fs'); const fs = require('fs');
const log4js = require('log4js'); const log4js = require('log4js');
const readline = require('readline'); const readline = require('readline');
const settings = require('../node/utils/Settings'); const settings = require('./src/node/utils/Settings');
const ueberDB = require('ueberdb2'); const ueberDB = require('ueberdb2');
const dbWrapperSettings = { const dbWrapperSettings = {

View file

@ -3,10 +3,10 @@
# Move to the Etherpad base directory. # Move to the Etherpad base directory.
MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1 MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${MY_DIR}/../.." || exit 1 cd "${MY_DIR}/.." || exit 1
# Source constants and useful functions # Source constants and useful functions
. src/bin/functions.sh . bin/functions.sh
is_cmd pnpm || npm install pnpm -g is_cmd pnpm || npm install pnpm -g
@ -33,16 +33,13 @@ if [ ! -f "$settings" ]; then
cp settings.json.template "$settings" || exit 1 cp settings.json.template "$settings" || exit 1
fi fi
log "Installing dependencies..." log "Installing dependencies..."
cd src
if [ -z "${ETHERPAD_PRODUCTION}" ]; then if [ -z "${ETHERPAD_PRODUCTION}" ]; then
log "Installing dev dependencies" log "Installing dev dependencies with pnpm"
pnpm i || exit 1 pnpm --recursive i || exit 1
else else
log "Installing production dependencies" log "Installing production dependencies with pnpm"
pnpm i --production || exit 1 pnpm --recursive i --production || exit 1
fi fi
# Remove all minified data to force node creating it new # Remove all minified data to force node creating it new

View file

@ -1,7 +1,7 @@
@echo off @echo off
:: Change directory to etherpad-lite root :: Change directory to etherpad-lite root
cd /D "%~dp0\..\.." cd /D "%~dp0\.."
:: Is node installed? :: Is node installed?
cmd /C node -e "" || ( echo "Please install node.js ( https://nodejs.org )" && exit /B 1 ) cmd /C node -e "" || ( echo "Please install node.js ( https://nodejs.org )" && exit /B 1 )
@ -16,7 +16,7 @@ mklink /D "ep_etherpad-lite" "..\src"
cd /D ..\src cd /D ..\src
cmd /C pnpm i || exit /B 1 cmd /C pnpm i || exit /B 1
cd /D "%~dp0\..\.." cd /D "%~dp0\.."
echo _ echo _
echo Clearing cache... echo Clearing cache...

View file

@ -14,7 +14,7 @@ process.on('unhandledRejection', (err) => { throw err; });
const dirtyDb = require('dirty'); const dirtyDb = require('dirty');
const log4js = require('log4js'); const log4js = require('log4js');
const settings = require('../node/utils/Settings'); const settings = require('./src/node/utils/Settings');
const ueberDB = require('ueberdb2'); const ueberDB = require('ueberdb2');
const util = require('util'); const util = require('util');
@ -30,7 +30,7 @@ process.on('unhandledRejection', (err) => { throw err; });
await db.init(); await db.init();
console.log('Waiting for dirtyDB to parse its file.'); console.log('Waiting for dirtyDB to parse its file.');
const dirty = dirtyDb(`${__dirname}/../../var/dirty.db`); const dirty = dirtyDb(`${__dirname}/../var/dirty.db`);
const length = await new Promise((resolve) => { dirty.once('load', resolve); }); const length = await new Promise((resolve) => { dirty.once('load', resolve); });
console.log(`Found ${length} records, processing now.`); console.log(`Found ${length} records, processing now.`);

View file

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

@ -3,11 +3,11 @@
/* /*
* Usage -- see README.md * Usage -- see README.md
* *
* Normal usage: node src/bin/plugins/checkPlugin.js ep_whatever * Normal usage: node bin/plugins/checkPlugin.js ep_whatever
* Auto fix the things it can: node src/bin/plugins/checkPlugin.js ep_whatever autofix * Auto fix the things it can: node bin/plugins/checkPlugin.js ep_whatever autofix
* Auto fix and commit: node src/bin/plugins/checkPlugin.js ep_whatever autocommit * Auto fix and commit: node bin/plugins/checkPlugin.js ep_whatever autocommit
* Auto fix, commit, push and publish to npm (highly dangerous): * Auto fix, commit, push and publish to npm (highly dangerous):
* node src/bin/plugins/checkPlugin.js ep_whatever autopush * node bin/plugins/checkPlugin.js ep_whatever autopush
*/ */
const process = require('process'); const process = require('process');
@ -32,7 +32,7 @@ const logger = log4js.getLogger('checkPlugin');
if (!pluginName) throw new Error('no plugin name specified'); if (!pluginName) throw new Error('no plugin name specified');
logger.info(`Checking the plugin: ${pluginName}`); logger.info(`Checking the plugin: ${pluginName}`);
const epRootDir = await fsp.realpath(path.join(await fsp.realpath(__dirname), '../../..')); const epRootDir = await fsp.realpath(path.join(await fsp.realpath(__dirname), '../..'));
logger.info(`Etherpad root directory: ${epRootDir}`); logger.info(`Etherpad root directory: ${epRootDir}`);
process.chdir(epRootDir); process.chdir(epRootDir);
const pluginPath = await fsp.realpath(`node_modules/${pluginName}`); const pluginPath = await fsp.realpath(`node_modules/${pluginName}`);
@ -159,9 +159,9 @@ const logger = log4js.getLogger('checkPlugin');
const workflows = ['backend-tests.yml', 'frontend-tests.yml', 'npmpublish.yml']; const workflows = ['backend-tests.yml', 'frontend-tests.yml', 'npmpublish.yml'];
await Promise.all(workflows.map(async (fn) => { await Promise.all(workflows.map(async (fn) => {
await checkFile(`src/bin/plugins/lib/${fn}`, `.github/workflows/${fn}`); await checkFile(`bin/plugins/lib/${fn}`, `.github/workflows/${fn}`);
})); }));
await checkFile('src/bin/plugins/lib/dependabot.yml', '.github/dependabot.yml'); await checkFile('bin/plugins/lib/dependabot.yml', '.github/dependabot.yml');
if (!files.includes('package.json')) { if (!files.includes('package.json')) {
logger.warn('no package.json, please create'); logger.warn('no package.json, please create');
@ -214,7 +214,7 @@ const logger = log4js.getLogger('checkPlugin');
logger.error(`both ${from} and ${to} exist; delete ${from}`); logger.error(`both ${from} and ${to} exist; delete ${from}`);
} }
} else { } else {
checkFile('src/bin/plugins/lib/eslintrc.cjs', '.eslintrc.cjs', false); checkFile('bin/plugins/lib/eslintrc.cjs', '.eslintrc.cjs', false);
} }
if (checkEntries(parsedPackageJSON, { if (checkEntries(parsedPackageJSON, {
@ -251,7 +251,7 @@ const logger = log4js.getLogger('checkPlugin');
if (autoFix) { if (autoFix) {
logger.info('Autofixing missing README.md file'); logger.info('Autofixing missing README.md file');
logger.info('please edit the README.md file further to include plugin specific details.'); logger.info('please edit the README.md file further to include plugin specific details.');
await fillTemplate('src/bin/plugins/lib/README.md', `${pluginPath}/README.md`); await fillTemplate('bin/plugins/lib/README.md', `${pluginPath}/README.md`);
} }
} }
@ -260,7 +260,7 @@ const logger = log4js.getLogger('checkPlugin');
if (autoFix) { if (autoFix) {
logger.info('Autofixing missing CONTRIBUTING.md file, please edit the CONTRIBUTING.md ' + logger.info('Autofixing missing CONTRIBUTING.md file, please edit the CONTRIBUTING.md ' +
'file further to include plugin specific details.'); 'file further to include plugin specific details.');
await fillTemplate('src/bin/plugins/lib/CONTRIBUTING.md', `${pluginPath}/CONTRIBUTING.md`); await fillTemplate('bin/plugins/lib/CONTRIBUTING.md', `${pluginPath}/CONTRIBUTING.md`);
} }
} }
@ -296,7 +296,7 @@ const logger = log4js.getLogger('checkPlugin');
logger.warn('LICENSE file not found, please create'); logger.warn('LICENSE file not found, please create');
if (autoFix) { if (autoFix) {
logger.info('Autofixing missing LICENSE file (Apache 2.0).'); logger.info('Autofixing missing LICENSE file (Apache 2.0).');
await fsp.copyFile('src/bin/plugins/lib/LICENSE', `${pluginPath}/LICENSE`); await fsp.copyFile('bin/plugins/lib/LICENSE', `${pluginPath}/LICENSE`);
} }
} }
@ -306,7 +306,7 @@ const logger = log4js.getLogger('checkPlugin');
if (autoFix) { if (autoFix) {
logger.info('Autofixing missing .gitignore file'); logger.info('Autofixing missing .gitignore file');
const gitignore = const gitignore =
await fsp.readFile('src/bin/plugins/lib/gitignore', {encoding: 'utf8', flag: 'r'}); await fsp.readFile('bin/plugins/lib/gitignore', {encoding: 'utf8', flag: 'r'});
await fsp.writeFile(`${pluginPath}/.gitignore`, gitignore); await fsp.writeFile(`${pluginPath}/.gitignore`, gitignore);
} }
} else { } else {

View file

@ -11,7 +11,7 @@ error () { log "ERROR: $@" >&2; }
fatal () { error "$@"; exit 1; } fatal () { error "$@"; exit 1; }
mydir=$(cd "${0%/*}" && pwd -P) || exit 1 mydir=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${mydir}/../../.." cd "${mydir}/../.."
pdir=$(cd .. && pwd -P) || exit 1 pdir=$(cd .. && pwd -P) || exit 1
plugins=$("${mydir}/listOfficialPlugins") || exit 1 plugins=$("${mydir}/listOfficialPlugins") || exit 1

View file

@ -49,7 +49,7 @@ jobs:
cache: 'npm' cache: 'npm'
cache-dependency-path: | cache-dependency-path: |
src/package-lock.json src/package-lock.json
src/bin/doc/package-lock.json bin/doc/package-lock.json
node_modules/${{ steps.plugin_name.outputs.plugin_name }}/package-lock.json node_modules/${{ steps.plugin_name.outputs.plugin_name }}/package-lock.json
- -
name: Install plugin dependencies name: Install plugin dependencies
@ -69,7 +69,7 @@ jobs:
# rules. # rules.
- -
name: Install Etherpad core dependencies name: Install Etherpad core dependencies
run: src/bin/installDeps.sh run: bin/installDeps.sh
- -
name: Run the backend tests name: Run the backend tests
run: cd src && pnpm test run: cd src && pnpm test

View file

@ -38,7 +38,7 @@ jobs:
cache: 'npm' cache: 'npm'
cache-dependency-path: | cache-dependency-path: |
src/package-lock.json src/package-lock.json
src/bin/doc/package-lock.json bin/doc/package-lock.json
- -
name: Check out the plugin name: Check out the plugin
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -80,7 +80,7 @@ jobs:
# rules. # rules.
- -
name: Install Etherpad core dependencies name: Install Etherpad core dependencies
run: src/bin/installDeps.sh run: bin/installDeps.sh
- -
name: Create settings.json name: Create settings.json
run: cp settings.json.template settings.json run: cp settings.json.template settings.json

View file

@ -3,7 +3,7 @@ set -e
newline=' newline='
' '
mydir=$(cd "${0%/*}" && pwd -P) || exit 1 mydir=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${mydir}/../../.." cd "${mydir}/../.."
pdir=$(cd .. && pwd -P) || exit 1 pdir=$(cd .. && pwd -P) || exit 1
plugins= plugins=
for p in "" "&page=2" "&page=3"; do for p in "" "&page=2" "&page=3"; do

View file

@ -4,7 +4,7 @@ do
echo $dir echo $dir
if [[ $dir == *"ep_"* ]]; then if [[ $dir == *"ep_"* ]]; then
if [[ $dir != "ep_etherpad-lite" ]]; then if [[ $dir != "ep_etherpad-lite" ]]; then
# node src/bin/plugins/checkPlugin.js $dir autopush # node bin/plugins/checkPlugin.js $dir autopush
cd node_modules/$dir cd node_modules/$dir
git commit -m "Automatic update: bump update to re-run latest Etherpad tests" --allow-empty git commit -m "Automatic update: bump update to re-run latest Etherpad tests" --allow-empty
git push origin master git push origin master

View file

@ -10,7 +10,7 @@ do
# echo $0 # echo $0
if [[ $dir == *"ep_"* ]]; then if [[ $dir == *"ep_"* ]]; then
if [[ $dir != "ep_etherpad-lite" ]]; then if [[ $dir != "ep_etherpad-lite" ]]; then
node src/bin/plugins/checkPlugin.js $dir autopush node bin/plugins/checkPlugin.js $dir autopush
fi fi
fi fi
# echo $dir # echo $dir

View file

@ -5,5 +5,5 @@ set -e
for dir in node_modules/ep_*; do for dir in node_modules/ep_*; do
dir=${dir#node_modules/} dir=${dir#node_modules/}
[ "$dir" != ep_etherpad-lite ] || continue [ "$dir" != ep_etherpad-lite ] || continue
node src/bin/plugins/checkPlugin.js "$dir" autopush node bin/plugins/checkPlugin.js "$dir" autopush
done done

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Specify the path to your package.json file # Specify the path to your package.json file
PACKAGE_JSON_PATH="./src//package.json" PACKAGE_JSON_PATH="./src/package.json"
# Check if the file exists # Check if the file exists
if [ ! -f "$PACKAGE_JSON_PATH" ]; then if [ ! -f "$PACKAGE_JSON_PATH" ]; then

View file

@ -10,7 +10,7 @@
process.on('unhandledRejection', (err) => { throw err; }); process.on('unhandledRejection', (err) => { throw err; });
if (process.argv.length !== 4 && process.argv.length !== 5) { if (process.argv.length !== 4 && process.argv.length !== 5) {
throw new Error('Use: node src/bin/repairPad.js $PADID $REV [$NEWPADID]'); throw new Error('Use: node bin/repairPad.js $PADID $REV [$NEWPADID]');
} }
const padId = process.argv[2]; const padId = process.argv[2];
@ -18,11 +18,11 @@ const newRevHead = process.argv[3];
const newPadId = process.argv[4] || `${padId}-rebuilt`; const newPadId = process.argv[4] || `${padId}-rebuilt`;
(async () => { (async () => {
const db = require('../node/db/DB'); const db = require('./src/node/db/DB');
await db.init(); await db.init();
const PadManager = require('../node/db/PadManager'); const PadManager = require('./src/node/db/PadManager');
const Pad = require('../node/db/Pad').Pad; const Pad = require('./src/node/db/Pad').Pad;
// Validate the newPadId if specified and that a pad with that ID does // Validate the newPadId if specified and that a pad with that ID does
// not already exist to avoid overwriting it. // not already exist to avoid overwriting it.
if (!PadManager.isValidPadId(newPadId)) { if (!PadManager.isValidPadId(newPadId)) {
@ -43,8 +43,8 @@ const newPadId = process.argv[4] || `${padId}-rebuilt`;
})); }));
// Rebuild Pad from revisions up to and including the new revision head // Rebuild Pad from revisions up to and including the new revision head
const AuthorManager = require('../node/db/AuthorManager'); const AuthorManager = require('./src/node/db/AuthorManager');
const Changeset = require('../static/js/Changeset'); const Changeset = require('./src/static/js/Changeset');
// Author attributes are derived from changesets, but there can also be // Author attributes are derived from changesets, but there can also be
// non-author attributes with specific mappings that changesets depend on // non-author attributes with specific mappings that changesets depend on
// and, AFAICT, cannot be recreated any other way // and, AFAICT, cannot be recreated any other way

View file

@ -20,11 +20,11 @@ log4js.configure({appenders: {console: {type: 'console'}},
Usage Usage
node src/bin/release.js patch node bin/release.js patch
*/ */
const usage = const usage =
'node src/bin/release.js [patch/minor/major] -- example: "node src/bin/release.js patch"'; 'node bin/release.js [patch/minor/major] -- example: "node bin/release.js patch"';
const release = process.argv[2]; const release = process.argv[2];
@ -33,7 +33,7 @@ if (!release) {
throw new Error('No release type included'); throw new Error('No release type included');
} }
const cwd = path.join(fs.realpathSync(__dirname), '../../'); const cwd = path.join(fs.realpathSync(__dirname), '../');
process.chdir(cwd); process.chdir(cwd);
// Run command capturing stdout. Trailing newlines are stripped (like the shell does). // Run command capturing stdout. Trailing newlines are stripped (like the shell does).

View file

@ -10,7 +10,7 @@ process.on('unhandledRejection', (err) => { throw err; });
console.warn('WARNING: This script must not be used while etherpad is running!'); console.warn('WARNING: This script must not be used while etherpad is running!');
if (process.argv.length !== 3) throw new Error('Use: node src/bin/repairPad.js $PADID'); if (process.argv.length !== 3) throw new Error('Use: node ./src/bin/repairPad.js $PADID');
// get the padID // get the padID
const padId = process.argv[2]; const padId = process.argv[2];
@ -19,12 +19,12 @@ let valueCount = 0;
(async () => { (async () => {
// initialize database // initialize database
require('../node/utils/Settings'); require('./src/node/utils/Settings');
const db = require('../node/db/DB'); const db = require('./src/node/db/DB');
await db.init(); await db.init();
// get the pad // get the pad
const padManager = require('../node/db/PadManager'); const padManager = require('./src/node/db/PadManager');
const pad = await padManager.getPad(padId); const pad = await padManager.getPad(padId);
// accumulate the required keys // accumulate the required keys

View file

@ -2,10 +2,10 @@
# Move to the Etherpad base directory. # Move to the Etherpad base directory.
MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1 MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${MY_DIR}/../.." || exit 1 cd "${MY_DIR}/.." || exit 1
# Source constants and useful functions # Source constants and useful functions
. src/bin/functions.sh . bin/functions.sh
ignoreRoot=0 ignoreRoot=0
for ARG in "$@"; do for ARG in "$@"; do
@ -27,9 +27,10 @@ EOF
fi fi
# Prepare the environment # Prepare the environment
src/bin/installDeps.sh "$@" || exit 1 bin/installDeps.sh "$@" || exit 1
# Move to the node folder and start # Move to the node folder and start
log "Starting Etherpad..." log "Starting Etherpad..."
# cd src
exec pnpm run dev "$@" exec pnpm run dev "$@"

View file

@ -25,7 +25,7 @@ LAST_EMAIL_SEND=0
# Move to the Etherpad base directory. # Move to the Etherpad base directory.
MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1 MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${MY_DIR}/../.." || exit 1 cd "${MY_DIR}/.." || exit 1
# Check if a logfile parameter is set # Check if a logfile parameter is set
LOG="$1" LOG="$1"
@ -40,7 +40,7 @@ while true; do
[ -w "${LOG}" ] || fatal "Logfile '${LOG}' is not writeable" [ -w "${LOG}" ] || fatal "Logfile '${LOG}' is not writeable"
# Start the application # Start the application
src/bin/run.sh "$@" >>${LOG} 2>>${LOG} bin/run.sh "$@" >>${LOG} 2>>${LOG}
TIME_FMT=$(date +%Y-%m-%dT%H:%M:%S%z) TIME_FMT=$(date +%Y-%m-%dT%H:%M:%S%z)

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
set -e set -e
mydir=$(cd "${0%/*}" && pwd -P) || exit 1 mydir=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${mydir}"/../.. cd "${mydir}"/..
OUTDATED=$(npm outdated --depth=0 | awk '{print $1}' | grep '^ep_') || { OUTDATED=$(npm outdated --depth=0 | awk '{print $1}' | grep '^ep_') || {
echo "All plugins are up-to-date" echo "All plugins are up-to-date"
exit 0 exit 0

View file

@ -30,7 +30,7 @@ docker compose up -d # will build and start the docker container on port 9001 wi
Starting dev server: Starting dev server:
``` ```
docker compose exec app bash -c "./src/bin/run.sh" docker compose exec app bash -c "./bin/run.sh"
``` ```
For production, please create your own docker compose file and change the `target` property in the build section to `production`. In addition, change the NODE_ENV in environment to production. For instance: For production, please create your own docker compose file and change the `target` property in the build section to `production`. In addition, change the NODE_ENV in environment to production. For instance:

View file

@ -15,10 +15,10 @@ services:
tty: true tty: true
stdin_open: true stdin_open: true
volumes: volumes:
# no volume mapping of node_modules as otherwise the build-time installed plugins will be overwritten with the mount
# the same applies to package.json and pnpm-lock.yaml in root dir as these would also get overwritten and build time installed plugins will be removed
- ./src:/opt/etherpad-lite/src - ./src:/opt/etherpad-lite/src
- ./package.json:/opt/etherpad-lite/package.json - ./bin:/opt/etherpad-lite/bin
- node_modules:/opt/etherpad-lite/src/node_modules
- pnpm-store:/home/etherpad/.local/share/pnpm/store/v3
depends_on: depends_on:
- postgres - postgres
environment: environment:
@ -60,6 +60,4 @@ services:
- postgres_data:/var/lib/postgresql/data/pgdata - postgres_data:/var/lib/postgresql/data/pgdata
volumes: volumes:
postgres_data: postgres_data:
node_modules:
pnpm-store:

View file

@ -9,8 +9,8 @@
"editor" "editor"
], ],
"bin": { "bin": {
"etherpad-healthcheck": "src/bin/etherpad-healthcheck", "etherpad-healthcheck": "bin/etherpad-healthcheck",
"etherpad-lite": "src/bin/run" "etherpad-lite": "bin/run"
}, },
"scripts": { "scripts": {
"lint": "pnpm --filter ep_etherpad-lite run lint", "lint": "pnpm --filter ep_etherpad-lite run lint",

View file

@ -0,0 +1,2 @@
packages:
- src

View file

@ -75,7 +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" "etherpad-lite": "node/server.ts"
}, },
"devDependencies": { "devDependencies": {

View file

@ -10,7 +10,7 @@ try() { "$@" || fatal "'$@' failed"; }
MY_DIR=$(try cd "${0%/*}" && try pwd -P) || exit 1 MY_DIR=$(try cd "${0%/*}" && try pwd -P) || exit 1
try cd "${MY_DIR}/../../../.." try cd "${MY_DIR}/../../../.."
log "Assuming src/bin/installDeps.sh has already been run" log "Assuming bin/installDeps.sh has already been run"
(cd src && npm run dev --experimental-worker "${@}" & (cd src && npm run dev --experimental-worker "${@}" &
ep_pid=$!) ep_pid=$!)