Skip to content

Commit

Permalink
Upgrade etherpad develop branch (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikStreek authored Mar 19, 2024
1 parent 0d42abe commit 8c98328
Show file tree
Hide file tree
Showing 416 changed files with 18,624 additions and 15,768 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ docker-compose*.yml

settings.json
src/node_modules
admin/node_modules
18 changes: 18 additions & 0 deletions .env.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Please copy and rename this file.
#
# !Attention!
# Always ensure to load the env variables in every terminal session.
# Otherwise the env variables will not be available

DOCKER_COMPOSE_APP_DEV_PORT_PUBLISHED=9001
DOCKER_COMPOSE_APP_DEV_PORT_TARGET=9001

# IMPORTANT: When the env var DEFAULT_PAD_TEXT is unset or empty, then the pad is not established (not the landing page).
# The env var DEFAULT_PAD_TEXT seems to be mandatory in the latest version of etherpad.
DOCKER_COMPOSE_APP_DEV_ENV_DEFAULT_PAD_TEXT="Welcome to etherpad"

DOCKER_COMPOSE_APP_DEV_ADMIN_PASSWORD=

DOCKER_COMPOSE_POSTGRES_DEV_ENV_POSTGRES_DATABASE=db
DOCKER_COMPOSE_POSTGRES_DEV_ENV_POSTGRES_PASSWORD=etherpad-lite-password
DOCKER_COMPOSE_POSTGRES_DEV_ENV_POSTGRES_USER=etherpad-lite-user
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ name: Create and publish a Docker image
on:
release:
types: [published]
push:
branches: ["kits-qr-code-update"]

env:
REGISTRY: ghcr.io
Expand Down
22 changes: 6 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ node_modules
APIKEY.txt
SESSIONKEY.txt
var/dirty.db
.env
*~
*.patch
npm-debug.log
Expand All @@ -21,19 +22,8 @@ out/
/src/bin/convertSettings.json
/src/bin/etherpad-1.deb
/src/bin/node.exe

# Ignoring the dorectory that sortes the local ssl certificates
ca

# Extending gitignore to include also all .env files, e.g. .env.development.local, .env.test, etc.
.env*
!.env.default
!.env.prod.default

# Avoiding accidentally adding local docker-compose*.override file to version control that might contain secrets
docker-compose-prod.override.yml
docker-compose.override.yml
docker-compose*.override.yml

# Ignoring local vscode settings file
.vscode/settings.json
plugin_packages
/src/templates/admin
/src/test-results
playwright-report
state.json
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers=false
32 changes: 16 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,30 @@ jobs:
- *set_loglevel_warn
- *enable_admin_tests
- "src/tests/frontend/travis/sauce_tunnel.sh"
- "src/bin/installDeps.sh"
- "bin/installDeps.sh"
- "export GIT_HASH=$(git rev-parse --verify --short HEAD)"
script:
- "./src/tests/frontend/travis/runner.sh"
- name: "Run the Backend tests without Plugins"
install:
- *install_libreoffice
- *set_loglevel_warn
- "src/bin/installDeps.sh"
- "cd src && npm install && cd -"
- "bin/installDeps.sh"
- "cd src && pnpm install && cd -"
script:
- "cd src && npm test"
- "cd src && pnpm test"
- name: "Test the Dockerfile"
install:
- "cd src && npm install && cd -"
- "cd src && pnpm install && cd -"
script:
- "docker build -t etherpad:test ."
- "docker run -d -p 9001:9001 etherpad:test && sleep 3"
- "cd src && npm run test-container"
- "cd src && pnpm run test-container"
- name: "Load test Etherpad without Plugins"
install:
- *set_loglevel_warn
- "src/bin/installDeps.sh"
- "cd src && npm install && cd -"
- "bin/installDeps.sh"
- "cd src && pnpm install && cd -"
- "npm install -g etherpad-load-test"
script:
- "src/tests/frontend/travis/runnerLoadTest.sh"
Expand All @@ -90,7 +90,7 @@ jobs:
- *set_loglevel_warn
- *enable_admin_tests
- "src/tests/frontend/travis/sauce_tunnel.sh"
- "src/bin/installDeps.sh"
- "bin/installDeps.sh"
- "rm src/tests/frontend/specs/*"
- *install_plugins
- "export GIT_HASH=$(git rev-parse --verify --short HEAD)"
Expand All @@ -105,22 +105,22 @@ jobs:
install:
- *install_libreoffice
- *set_loglevel_warn
- "src/bin/installDeps.sh"
- "bin/installDeps.sh"
- *install_plugins
- "cd src && npm install && cd -"
- "cd src && pnpm install && cd -"
script:
- "cd src && npm test"
- "cd src && pnpm test"
- name: "Test the Dockerfile"
install:
- "cd src && npm install && cd -"
- "cd src && pnpm install && cd -"
script:
- "docker build -t etherpad:test ."
- "docker run -d -p 9001:9001 etherpad:test && sleep 3"
- "cd src && npm run test-container"
- "cd src && pnpm run test-container"
- name: "Load test Etherpad with Plugins"
install:
- *set_loglevel_warn
- "src/bin/installDeps.sh"
- "bin/installDeps.sh"
- *install_plugins
- "cd src && npm install && cd -"
- "npm install -g etherpad-load-test"
Expand All @@ -135,7 +135,7 @@ jobs:
- "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 --rm --network ep_net --ip 172.23.42.3 --name anotherip -dt anotherip"
- "./src/bin/installDeps.sh"
- "./bin/installDeps.sh"
script:
- "cd src/tests/ratelimit && bash testlimits.sh"

Expand Down
44 changes: 42 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
# 2.0.1

### Notable enhancements and fixes

- Fixed a bug where a plugin depending on a scoped dependency would not install successfully.


# 2.0.0


### Compatibility changes

- Socket io has been updated to 4.7.5. This means that the json.send function won't work anymore and needs to be changed to .emit('message', myObj)
- Deprecating npm version 6 in favor of pnpm: We have made the decision to switch to the well established pnpm (https://pnpm.io/). It works by symlinking dependencies into a global directory allowing you to have a cleaner and more reliable environment.
- Introducing Typescript to the Etherpad core: Etherpad core logic has been rewritten in Typescript allowing for compiler checking of errors.
- Rewritten Admin Panel: The Admin panel has been rewritten in React and now features a more pleasant user experience. It now also features an integrated pad searching with sorting functionality.

### Notable enhancements and fixes

* Bugfixes
- Live Plugin Manager: The live plugin manager caused problems when a plugin had depdendencies defined. This issue is now resolved.

* Enhancements
- pnpm Workspaces: In addition to pnpm we introduced workspaces. A clean way to manage multiple bounded contexts like the admin panel or the bin folder.
- Bin folder: The bin folder has been moved from the src folder to the root folder. This change was necessary as the contained scripts do not represent core functionality of the user.
- Starting Etherpad: Etherpad can now be started with a single command: `pnpm run prod` in the root directory.
- Installing Etherpad: Etherpad no longer symlinks itself in the root directory. This is now also taken care by pnpm, and it just creates a node_modules folder with the src directory`s ep_etherpad-lite folder
- Plugins can now be installed simply via the command: `pnpm run install-plugins first-plugin second-plugin` or if you want to install from path you can do:
`pnpm run install-plugins --path ../path-to-plugin`


# 1.9.7

### Notable enhancements and fixes

* Added Live Plugin Manager: Plugins are now installed into a separate folder on the host system. This folder is called `plugin_packages`.
That way the plugins are separated from the normal etherpad installation.
* Make repairPad.js more verbose
* Fixed favicon not being loaded correctly

# 1.9.6

### Notable enhancements and fixes
Expand All @@ -9,7 +49,7 @@

# 1.9.5

### Compability changes
### Compatibility changes

* This version deprecates NodeJS16 as it reached its end of life and won't receive any updates. So to get started with Etherpad v1.9.5 you need NodeJS 18 and above.
* The bundled windows NodeJS version has been bumped to the current LTS version 20.
Expand All @@ -21,7 +61,7 @@

# 1.9.4

### Compability changes
### Compatibility changes

* Log4js has been updated to the latest version. As it involved a bump of 6 major version.
A lot has changed since then. Most notably the console appender has been deprecated. You can find out more about it [here](https://github.com/log4js-node/log4js-node)
Expand Down
67 changes: 37 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,21 @@
#
# Author: muxator

FROM node:lts-alpine as build
FROM node:alpine as adminBuild

WORKDIR /opt/etherpad-lite
COPY ./admin ./admin
RUN cd ./admin && npm install -g pnpm && pnpm install && pnpm run build --outDir ./dist


FROM node:alpine as build
LABEL maintainer="Etherpad team, https://github.com/ether/etherpad-lite"

# Set these arguments when building the image from behind a proxy
ARG http_proxy=
ARG https_proxy=
ARG no_proxy=

ARG TIMEZONE=

RUN \
Expand Down Expand Up @@ -70,10 +82,11 @@ RUN mkdir -p "${EP_DIR}" && chown etherpad:etherpad "${EP_DIR}"
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199
RUN \
mkdir -p /usr/share/man/man1 && \
npm install npm@6 -g && \
npm install pnpm -g && \
apk update && apk upgrade && \
apk add \
ca-certificates \
curl \
git \
${INSTALL_ABIWORD:+abiword abiword-plugin-command} \
${INSTALL_SOFFICE:+libreoffice openjdk8-jre libreoffice-common}
Expand All @@ -82,50 +95,44 @@ USER etherpad

WORKDIR "${EP_DIR}"

# etherpads version feature requires this. Only copy what is really needed
COPY --chown=etherpad:etherpad ./.git/HEAD ./.git/HEAD
COPY --chown=etherpad:etherpad ./.git/refs ./.git/refs
COPY --chown=etherpad:etherpad ${SETTINGS} ./settings.json
COPY --chown=etherpad:etherpad ./var ./var
COPY --chown=etherpad:etherpad ./bin ./bin
COPY --chown=etherpad:etherpad ./pnpm-workspace.yaml ./package.json ./
COPY --chown=etherpad:etherpad ./src ./src

FROM build as development

COPY --chown=etherpad:etherpad ./src/package.json ./src/package-lock.json ./src/
COPY --chown=etherpad:etherpad ./src/bin ./src/bin
COPY --chown=etherpad:etherpad ${SETTINGS} "${EP_DIR}"/settings.json
COPY --chown=etherpad:etherpad --from=adminBuild /opt/etherpad-lite/admin/dist ./src/templates/admin

RUN { [ -z "${ETHERPAD_PLUGINS}" ] || \
npm install --no-save --legacy-peer-deps ${ETHERPAD_PLUGINS}; } && \
src/bin/installDeps.sh
RUN bin/installDeps.sh && \
{ [ -z "${ETHERPAD_PLUGINS}" ] || pnpm install --workspace-root ${ETHERPAD_PLUGINS}; }

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 ETHERPAD_PRODUCTION=true

COPY --chown=etherpad:etherpad ./ ./

# Plugins must be installed before installing Etherpad'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.
RUN { [ -z "${ETHERPAD_PLUGINS}" ] || \
npm install --no-save --legacy-peer-deps ${ETHERPAD_PLUGINS}; } && \
src/bin/installDeps.sh && \
rm -rf ~/.npm
COPY --chown=etherpad:etherpad --from=adminBuild /opt/etherpad-lite/admin/dist ./src/templates/admin

RUN bin/installDeps.sh && rm -rf ~/.npm && \
{ [ -z "${ETHERPAD_PLUGINS}" ] || pnpm install --workspace-root ${ETHERPAD_PLUGINS}; }


# Copy the configuration file.
COPY --chown=etherpad:etherpad ${SETTINGS} "${EP_DIR}"/settings.json

# Fix group permissions
RUN chmod -R g=u .
# Note: For some reason increases image size from 257 to 334.
# RUN chmod -R g=u .

USER root
RUN cd src && npm link
USER etherpad

HEALTHCHECK --interval=20s --timeout=3s CMD ["etherpad-healthcheck"]
HEALTHCHECK --interval=5s --timeout=3s \
CMD curl --silent http://localhost:9001/health | grep -E "pass|ok|up" > /dev/null || exit 1

EXPOSE 9001
CMD ["etherpad"]
CMD ["pnpm", "run", "prod"]
Loading

0 comments on commit 8c98328

Please sign in to comment.