Etherpad_mypads - 502 Bad Gateway - Migration Yunohost 2.7 > 3.1

Introduction

Avant tout, je tiens à féliciter le travail de développement accompli parce que cette migration s’est passée vraiment bien … c’est presque magique :fireworks:

:heart::heart::heart::heart::heart::heart::heart:

Situation

  • Matériel : VPS CX21 chez Hetzner
  • Debian 8 (jessie) avec Yunohost 2.7.14.5
  • Applications installées : baikal, dokuwiki, dokuwiki__2, etherpad_mypads, htmltool, jappix, jirafeau, mailman, my_webapp, my_webapp__2, nextcloud, noalyss, opensondage, roundcube, searx, wallabag, wordpress, zerobin
  • Domaines (avec LetsEncrypt) : computhings.be, sixiememonde.net, pad.computhings.be, www.computhings.be, drop.computhings.be, mail.computhings.be, wiki.computhings.be, your.computhings.be, lists.computhings.be,

  • Migration effectuée (Yunohost 3.1) : # yunohost tools migrations migrate --accept-disclaimer à la ligne de commande dans screen via ssh

Seul petit soucis: etherpad_mypads

Juste Etherpad_mypads qui affichait une 502 Bad Gateway.

2 Likes

Diagnostique

Pourtant le service etherpad_mypads.service semble démarré

# systemctl status etherpad_mypads.service 
● etherpad_mypads.service - Etherpad-lite, the collaborative editor.
   Loaded: loaded (/etc/systemd/system/etherpad_mypads.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2018-08-19 11:36:38 CEST; 10min ago
 Main PID: 1427 (safeRun.sh)
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/etherpad_mypads.service
           ├─1427 /bin/sh /var/www/etherpad_mypads/bin/safeRun.sh /var/log/etherpad_mypads/etherpad.log
           └─5332 sleep 10

En fait il ne l’est pas vraiment…

# tail -50 /var/log/nginx/pad.computhings.be-error.log
…
2018/08/18 23:12:59 [error] 1351#0: *442 connect() failed (111: Connection refused) while connecting to upstream, client: 91.180.80.248, server: pad.computhings.be, request: "GET /p/article13 HTTP/1.1", upstream: "http://127.0.0.1:9001/p/article13", host: "pad.computhings.be"
…

Et que dit le log de Etherpad-lite?

# tail -20 /var/log/etherpad_mypads/etherpad.log 
Ensure jQuery is downloaded and up to date...
Clearing minified cache...
Ensure custom css/js files are created...
Started Etherpad...
/var/www/etherpad_mypads/src/node_modules/npm/lib/config/defaults.js:392
    nic => interfaces[nic].map(({address}) => address)
                                
SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/var/www/etherpad_mypads/src/node_modules/npm/lib/config/core.js:3:18)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
RESTART!

Et donc en fait, oui le service est démarré, mais non etherpad-lite ne l’est pas puisqu’il redémarre en boucle à cause d’une erreur.

Solution

Sauf si le fichier default.js sera écrasé lors d’une prochaine mise à jours!

Et pour solutionner le problème (heureusement il n’y avait que ça)

vi -c392 /var/www/etherpad_mypads/src/node_modules/npm/lib/config/defaults.js

Pour simplement enlever les accolades { } de la ligne suivante (la 392) dans le fichier defaults.js:

nic => interfaces[nic].map(({address}) => address)

Qui devient donc

nic => interfaces[nic].map((address) => address)

Et voilà, rien d’autre à faire qu’enregistrer le changement puisque que Etherpad-lite est entrain de redémarrer en boucle, il va voir tout seul la correction et lancer correctement l’instance de node.js.

# netstat -anp | grep 9001
tcp        0      0 127.0.0.1:9001          0.0.0.0:*               LISTEN      7468/node 
1 Like

Hi tierce,
sorry to read that you had some issues with etherpad, that’s quite weird because the YunoHost package doesn’t play with the file src/node_modules/npm/lib/config/defaults.js.
Maybe that’s a upstream issue with etherpad, we already have tried an installation of etherpad on stretch without any problem. So I expect that an upgrade should not break again your setup.

Do not hesitate to update this topic if the next upgrade cause the same issue.

A fix is ongoing here

Thanks to have seen that :+1:

2 Likes