ether / etherpad-lite

Etherpad: A modern really-real-time collaborative document editor.
http://docs.etherpad.org/
Apache License 2.0
16.81k stars 2.86k forks source link

Accessing the admin page crashes the docker container #6538

Closed agrimpard closed 4 months ago

agrimpard commented 4 months ago

Describe the bug By accessing /admin page, I get a "time out" error and on the server side the container crashes.

To Reproduce

  1. Simply access /admin page

Expected behavior We should be able to access the admin page and manage Etherpad.

Server (please complete the following information):

Desktop (please complete the following information):

Additional context

I have a docker compose running 3 Etherpads with an apache on the front end. The Etherpad containers are created from a clone of the Etherpad-lite repository (https://github.com/ether/etherpad-lite.git).

Here is the docker compose:

x-proxy-args: &proxy-args
  HTTP_PROXY: http://proxy.mydomaine.com:3333
  HTTPS_PROXY: http://proxy.mydomaine.com:3333
  no_proxy: localhost,127.0.0.1

x-ether-args: &ether-args
  INSTALL_SOFFICE: true
  ETHERPAD_PLUGINS: ep_adminpads2 ep_align ep_author_hover ep_font_color ep_font_family ep_font_size ep_headings2 ep_remove_embed ep_set_title_on_pad ep_special_characters ep_subscript_and_superscript ep_table_of_contents

services:
  etherpad-libre:
    image: etherpad-libre
    build:
      context: ./etherpad-lite
      args:
        HTTP_PROXY: ${HTTP_PROXY}
        HTTPS_PROXY: ${HTTPS_PROXY}
        no_proxy: ${no_proxy}
        INSTALL_SOFFICE: ${INSTALL_SOFFICE}
        ETHERPAD_PLUGINS: ${ETHERPAD_PLUGINS}
    networks:
      - etherpad
    ports:
      - "9001:9001"
    volumes:
      - ./etherpad-config/libre-settings.json:/opt/etherpad-lite/settings.json
      - ./etherpad-config/libre-credentials.json:/opt/etherpad-lite/credentials.json
  etherpad-moodle:
    image: etherpad-moodle
    build:
      context: ./etherpad-lite
      args:
        HTTP_PROXY: ${HTTP_PROXY}
        HTTPS_PROXY: ${HTTPS_PROXY}
        no_proxy: ${no_proxy}
        INSTALL_SOFFICE: ${INSTALL_SOFFICE}
        ETHERPAD_PLUGINS: ${ETHERPAD_PLUGINS}
    networks:
      - etherpad
    ports:
      - "9002:9001"
    volumes:
      - ./etherpad-config/moodle-settings.json:/opt/etherpad-lite/settings.json
      - ./etherpad-config/moodle-credentials.json:/opt/etherpad-lite/credentials.json
  etherpad-redmine:
    image: etherpad-redmine
    build:
      context: ./etherpad-lite
      args:
        HTTP_PROXY: ${HTTP_PROXY}
        HTTPS_PROXY: ${HTTPS_PROXY}
        no_proxy: ${no_proxy}
        INSTALL_SOFFICE: ${INSTALL_SOFFICE}
        ETHERPAD_PLUGINS: ${ETHERPAD_PLUGINS}
    networks:
      - etherpad
    ports:
      - "9003:9001"
    volumes:
      - ./etherpad-config/redmine-settings.json:/opt/etherpad-lite/settings.json
      - ./etherpad-config/redmine-credentials.json:/opt/etherpad-lite/credentials.json
  apache2-frontal:
    image: apache2-frontal
    build:
      context: ./apache2-frontal
      args:
        HTTP_PROXY: ${HTTP_PROXY}
        HTTPS_PROXY: ${HTTPS_PROXY}
        no_proxy: ${no_proxy}
    networks:
      - etherpad
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /etc/certificats/etherpad.mydomaine.com:/etc/certificats/etherpad.mydomaine.com
networks:
  etherpad:
    driver: bridge

Here is .env file :

ETHERPAD_PLUGINS=ep_adminpads2 ep_align ep_author_hover ep_font_color ep_font_family ep_font_size ep_headings2 ep_remove_embed ep_set_title_on_pad ep_special_characters ep_subscript_and_superscript ep_table_of_contents
HTTP_PROXY=http://proxy.mydomain.com:3333
HTTPS_PROXY=http://proxy.mydomain.com:3333
INSTALL_SOFFICE=true
NO_PROXY=localhost,127.0.0.1,mydomain.com

Here is the apache configuration:

# préconisations RSSI
ServerTokens Prod

# global servername
ServerName etherpad.mydomaine.com

<VirtualHost *:80>
    ServerName etherpad.mydomaine.com
    Redirect permanent / https://etherpad.mydomaine.com/libre/
</VirtualHost>

<VirtualHost *:443>

    ServerName etherpad.mydomaine.com

    # logs
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # SSL
    SSLEngine on
    SSLCertificateFile /etc/certificats/etherpad.mydomaine.com/cert.pem
    SSLCertificateKeyFile /etc/certificats/etherpad.mydomaine.com/privkey.pem
    SSLCertificateChainFile /etc/certificats/etherpad.mydomaine.com/fullchain.pem

    # préconisations RSSI
    ServerSignature Off
    FileETag None
    <IfModule mod_headers.c>
        <Directory />
            Header set X-XSS-Protection "1; mode=block"
            Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
            Header always append X-Frame-Options SAMEORIGIN
        </Directory>
    </IfModule>

    # redirection / vers l'Etherpad libre
    Redirect permanent / https://etherpad.mydomaine.com/libre/

    # Etherpad réécritures
    RewriteEngine On
    RewriteCond %{HTTP:Upgrade} websocket [NC]
    RewriteCond %{HTTP:Connection} upgrade [NC]
    RewriteRule ^/libre/socket.io/(.*) ws://etherpad-libre:9001/socket.io/$1 [P,L]
    RewriteRule ^/moodle/socket.io/(.*) ws://etherpad-moodle:9001/socket.io/$1 [P,L]
    RewriteRule ^/redmine/socket.io/(.*) ws://etherpad-redmine:9001/socket.io/$1 [P,L]

    # Etherpad proxypass
    ProxyVia On
    ProxyRequests Off
    ProxyPreserveHost On
    ProxyPass /libre/ http://etherpad-libre:9001/
    ProxyPassReverse /libre/ http://etherpad-libre:9001/
    ProxyPass /moodle/ http://etherpad-moodle:9001/
    ProxyPassReverse /moodle/ http://etherpad-moodle:9001/
    ProxyPass /redmine/ http://etherpad-redmine:9001/
    ProxyPassReverse /redmine/ http://etherpad-redmine:9001/
    <Proxy *>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Proxy>

</VirtualHost>

Log from the crashed container :

etherpad-libre-1  | [2024-07-25T08:58:32.546] [INFO] server - Starting Etherpad...
etherpad-libre-1  | [2024-07-25T08:58:32.625] [INFO] plugins - pnpm --version: 9.0.4
etherpad-libre-1  | [2024-07-25T08:58:32.668] [INFO] plugins - check installed plugins for migration
etherpad-libre-1  | [2024-07-25T08:58:32.787] [INFO] plugins - Loading plugin ep_adminpads2...
etherpad-libre-1  | [2024-07-25T08:58:32.788] [INFO] plugins - Loading plugin ep_align...
etherpad-libre-1  | [2024-07-25T08:58:32.788] [INFO] plugins - Loading plugin ep_author_hover...
etherpad-libre-1  | [2024-07-25T08:58:32.788] [INFO] plugins - Loading plugin ep_font_color...
etherpad-libre-1  | [2024-07-25T08:58:32.788] [INFO] plugins - Loading plugin ep_font_family...
etherpad-libre-1  | [2024-07-25T08:58:32.788] [INFO] plugins - Loading plugin ep_font_size...
etherpad-libre-1  | [2024-07-25T08:58:32.788] [INFO] plugins - Loading plugin ep_headings2...
etherpad-libre-1  | [2024-07-25T08:58:32.788] [INFO] plugins - Loading plugin ep_remove_embed...
etherpad-libre-1  | [2024-07-25T08:58:32.788] [INFO] plugins - Loading plugin ep_set_title_on_pad...
etherpad-libre-1  | [2024-07-25T08:58:32.788] [INFO] plugins - Loading plugin ep_special_characters...
etherpad-libre-1  | [2024-07-25T08:58:32.788] [INFO] plugins - Loading plugin ep_subscript_and_superscript...
etherpad-libre-1  | [2024-07-25T08:58:32.788] [INFO] plugins - Loading plugin ep_table_of_contents...
etherpad-libre-1  | [2024-07-25T08:58:32.788] [INFO] plugins - Loading plugin ep_etherpad-lite...
etherpad-libre-1  | [2024-07-25T08:58:32.790] [INFO] plugins - Loaded 13 plugins
etherpad-libre-1  | [2024-07-25T08:58:33.282] [WARN] settings - oidc-provider WARNING: Unsupported runtime. Use Node.js v18.x LTS, or a later LTS release.
etherpad-libre-1  | [2024-07-25T08:58:33.289] [INFO] APIHandler - Api key file read from: "/opt/etherpad-lite/APIKEY.txt"
etherpad-libre-1  | [2024-07-25T08:58:34.079] [INFO] server - Installed plugins: ep_adminpads2@2.1.106, ep_align@0.3.96, ep_author_hover@0.3.55, ep_font_color@0.0.87, ep_font_family@0.5.44, ep_font_size@0.4.61, ep_headings2@0.2.64, ep_remove_embed@0.0.2, ep_set_title_on_pad@0.6.7, ep_special_characters@0.0.22, ep_subscript_and_superscript@0.3.7, ep_table_of_contents@0.3.84
etherpad-libre-1  | [2024-07-25T08:58:34.080] [INFO] settings - Report bugs at https://github.com/ether/etherpad-lite/issues
etherpad-libre-1  | [2024-07-25T08:58:34.094] [INFO] settings - Your Etherpad version is 2.1.1 (32a4068)
etherpad-libre-1  | [2024-07-25T08:58:34.143] [ERROR] settings - (node:41) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
etherpad-libre-1  | (Use `node --trace-deprecation ...` to show where the warning was created)
etherpad-libre-1  | [2024-07-25T08:58:34.236] [ERROR] settings - Can not perform Etherpad update check: AggregateError
etherpad-libre-1  | [2024-07-25T08:58:35.744] [INFO] http - HTTP server listening for connections
etherpad-libre-1  | [2024-07-25T08:58:35.744] [INFO] settings - You can access your Etherpad instance at http://0.0.0.0:9001/
etherpad-libre-1  | [2024-07-25T08:58:35.744] [INFO] settings - The plugin admin page is at http://0.0.0.0:9001/admin/plugins
etherpad-libre-1  | [2024-07-25T08:58:35.744] [INFO] server - Etherpad is running
etherpad-libre-1  | [2024-07-25T08:58:50.631] [INFO] Minify - Compress CSS file skins/colibris/index.css.
etherpad-libre-1  | [2024-07-25T08:58:50.635] [INFO] Minify - Compress JS file skins/colibris/index.js.
etherpad-libre-1  | [2024-07-25T08:58:56.677] [ERROR] server - Metrics at time of fatal error:
etherpad-libre-1  | {
etherpad-libre-1  |   "httpStartTime": 1721897915744,
etherpad-libre-1  |   "memoryUsage": 295563264,
etherpad-libre-1  |   "memoryUsageHeap": 134978912,
etherpad-libre-1  |   "ueberdb_lockAwaits": 0,
etherpad-libre-1  |   "ueberdb_lockAcquires": 2,
etherpad-libre-1  |   "ueberdb_lockReleases": 2,
etherpad-libre-1  |   "ueberdb_reads": 1,
etherpad-libre-1  |   "ueberdb_readsFailed": 0,
etherpad-libre-1  |   "ueberdb_readsFinished": 1,
etherpad-libre-1  |   "ueberdb_readsFromCache": 0,
etherpad-libre-1  |   "ueberdb_readsFromDb": 1,
etherpad-libre-1  |   "ueberdb_readsFromDbFailed": 0,
etherpad-libre-1  |   "ueberdb_readsFromDbFinished": 1,
etherpad-libre-1  |   "ueberdb_writes": 1,
etherpad-libre-1  |   "ueberdb_writesFailed": 0,
etherpad-libre-1  |   "ueberdb_writesFinished": 1,
etherpad-libre-1  |   "ueberdb_writesObsoleted": 0,
etherpad-libre-1  |   "ueberdb_writesToDb": 1,
etherpad-libre-1  |   "ueberdb_writesToDbFailed": 0,
etherpad-libre-1  |   "ueberdb_writesToDbFinished": 1,
etherpad-libre-1  |   "ueberdb_writesToDbRetried": 0,
etherpad-libre-1  |   "totalUsers": 0,
etherpad-libre-1  |   "activePads": 0,
etherpad-libre-1  |   "httpRequests": {
etherpad-libre-1  |     "meter": {
etherpad-libre-1  |       "mean": 0.295911118793796,
etherpad-libre-1  |       "count": 5,
etherpad-libre-1  |       "currentRate": 0.29591039804701164,
etherpad-libre-1  |       "1MinuteRate": 0.06023096045985435,
etherpad-libre-1  |       "5MinuteRate": 0.0130598243355337,
etherpad-libre-1  |       "15MinuteRate": 0.00441373963469717
etherpad-libre-1  |     },
etherpad-libre-1  |     "histogram": {
etherpad-libre-1  |       "min": 0.2201995849609375,
etherpad-libre-1  |       "max": 5.631429672241211,
etherpad-libre-1  |       "sum": 8.167583465576172,
etherpad-libre-1  |       "variance": 5.164438641021479,
etherpad-libre-1  |       "mean": 1.6335166931152343,
etherpad-libre-1  |       "stddev": 2.272540129683408,
etherpad-libre-1  |       "count": 5,
etherpad-libre-1  |       "median": 0.8571529388427734,
etherpad-libre-1  |       "p75": 3.4147729873657227,
etherpad-libre-1  |       "p95": 5.631429672241211,
etherpad-libre-1  |       "p99": 5.631429672241211,
etherpad-libre-1  |       "p999": 5.631429672241211
etherpad-libre-1  |     }
etherpad-libre-1  |   }
etherpad-libre-1  | }
etherpad-libre-1  | [2024-07-25T08:58:56.677] [ERROR] server - Error: ENOENT: no such file or directory, stat '/opt/etherpad-lite/src/templates/admin/index.html'
etherpad-libre-1  |     at Object.statSync (node:fs:1655:25)
etherpad-libre-1  |     at <anonymous> (/opt/etherpad-lite/src/node/hooks/express/admin.ts:57:14)
etherpad-libre-1  |     at suppressedCallback (node:fs:256:5)
etherpad-libre-1  |     at FSReqCallback.oncomplete (node:fs:187:23)
etherpad-libre-1  | [2024-07-25T08:58:56.677] [INFO] server - Exiting...
etherpad-libre-1  | [2024-07-25T08:58:56.677] [INFO] server - Stopping Etherpad...
etherpad-libre-1  | [2024-07-25T08:58:56.677] [INFO] http - Closing HTTP server...
etherpad-libre-1  | [2024-07-25T08:58:56.678] [INFO] socket.io - Closing socket.io engine...
etherpad-libre-1  | [2024-07-25T08:58:56.678] [INFO] socket.io - All socket.io clients have disconnected
etherpad-libre-1  | [2024-07-25T08:58:56.680] [INFO] ueberDB - Database closed
etherpad-libre-1  | [2024-07-25T08:58:56.680] [INFO] http - Waiting for 1 HTTP clients to disconnect...
etherpad-libre-1  | [2024-07-25T08:58:59.682] [ERROR] server - Error occurred while stopping Etherpad
etherpad-libre-1  | [2024-07-25T08:58:59.683] [ERROR] server - Error in process exit TypeError: Cannot read properties of null (reading 'metrics')
etherpad-libre-1  |     at Gauge._readFn (/opt/etherpad-lite/src/node/db/DB.ts:45:57)
etherpad-libre-1  |     at Gauge.toJSON (/opt/etherpad-lite/node_modules/.pnpm/measured-core@2.0.0/node_modules/measured-core/lib/metrics/Gauge.js:24:17)
etherpad-libre-1  |     at /opt/etherpad-lite/node_modules/.pnpm/measured-core@2.0.0/node_modules/measured-core/lib/Collection.js:62:46
etherpad-libre-1  |     at Array.forEach (<anonymous>)
etherpad-libre-1  |     at Collection.toJSON (/opt/etherpad-lite/node_modules/.pnpm/measured-core@2.0.0/node_modules/measured-core/lib/Collection.js:60:32)
etherpad-libre-1  |     at Object.exports.exit (/opt/etherpad-lite/src/node/server.ts:248:75)
etherpad-libre-1  |     at Object.exports.stop (/opt/etherpad-lite/src/node/server.ts:232:26)
etherpad-libre-1  |     at Object.exports.exit (/opt/etherpad-lite/src/node/server.ts:262:7)
etherpad-libre-1  | /opt/etherpad-lite/src:
etherpad-libre-1  |  ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  ep_etherpad-lite@2.1.1 prod: `cross-env NODE_ENV=production node --require tsx/cjs node/server.ts`
etherpad-libre-1  | Exit status 1
etherpad-libre-1  |  ELIFECYCLE  Command failed with exit code 1.
agrimpard commented 4 months ago

Seems related to https://github.com/ether/etherpad-lite/issues/6344

I'm trying to find where to execute pnpm run build inside one Etherpad container but can't find it.

recombinationgroup commented 4 months ago

I can confirm this. It was caused by a typo introduced recently to the development branch in 550a29f3e62712f856899a082000481a24a57e6b . My PR fixes this.

agrimpard commented 4 months ago

I can confirm this. It was caused by a typo introduced recently to the development branch in 550a29f . My PR fixes this.

I confirm the PR works, just tested, thanks :)