Servicios Públicos - Tareas #5781
Migrar el servidor del Etherpad
08/09/2017 01:44 PM - Daniel Viñar Ulriksen
Status: Cerrada Start date: 08/09/2017
Priority: Normal Due date:
Assignee: Daniel Viñar Ulriksen % Done: 90%
Category: Estimated time: 0.00 hour
Target version: Spent time: 4.50 hours
Description
Para ir vaciando [[servidores:Barran]] que tiene problemas (#5665), migramos el Etherpad en [[servidores:Ritchie]] a un virtual en
[[servidores:Schwartz]] en Rocha.
De paso aprovechamos para actualizarlo.
Related issues:
Related to Servicios Públicos - Tareas # 3037: Instalar y documentar un pad d... Cerrada 06/19/2014
Related to Plataforma de servidores - Tareas # 5915: Migrar Schwartz a Proxmox Nueva 01/22/2018
History
#1 - 08/09/2017 01:46 PM - Daniel Viñar Ulriksen
- Status changed from Nueva to En curso
- % Done changed from 0 to 10
Creamos un servidor [[servidores:Ombu|ombu.interior.edu.uy]] en Schwartz, instalamos una Debian 9, y configuramos todo lo neceario en IPs y firewall
#2 - 08/09/2017 01:47 PM - Daniel Viñar Ulriksen
- Related to Tareas #3037: Instalar y documentar un pad de cero added
#3 - 08/09/2017 01:55 PM - Daniel Viñar Ulriksen
- % Done changed from 10 to 20
Seguimos la documentación que tenemos ([[servicios:Servidor_e_instalación_del_Pad|esta wiki]] y la tarea #3037).
Empezamos por:
apt-get install gzip git curl python libssl-dev pkg-config build-essential
#4 - 08/09/2017 02:30 PM - Daniel Viñar Ulriksen
La versión de nodejs de la debian stretch y de los backports de la jessie es la 4.8.2, cuando la LTS de la distribución es la 6.11.
Tanto la documentación de Etherpad, como la de node.js y otras fuentes recomiendan no instalar la versión distribuida por la debian. Para instalar una
versión recient por el gestor de paquetes apt, node.js recomienda usar los repos de nodesource.
Este artículo resume el procedimiento y las referencias.
#5 - 08/09/2017 02:31 PM - Daniel Viñar Ulriksen
09/29/2018 1/7
Empezamos por:
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
Instala los repos correctos en /etc/apt/sources.list.d/nodesource.list y la clave apt
#6 - 08/09/2017 02:35 PM - Daniel Viñar Ulriksen
Y luego:
apt-get install nodejs
#7 - 08/09/2017 02:46 PM - Daniel Viñar Ulriksen
Creamos un usuario unix etherpad, con su carpeta de trabajo en /srv/etherpad:
mkdir /srv/etherpad
adduser -d /srv/etherpad etherpad
chown etherpad:etherpad /srv/etherpad
y accedemos con:
su - etherpad
#8 - 08/10/2017 05:03 PM - Daniel Viñar Ulriksen
- % Done changed from 20 to 40
Cuando corremos ~/etherpad-lite/bin/run.sh desde el usuario etherpad, podemos verificar con un tunel ssh que etherpad-lite corre correctamente en el
puerto 9001.
Pero el etherpad quedó instalado con dirtyDB, conviene migrarlo a postgresql:
Instalamos postgresql.
Ingresamos a postgres:
su - postgres
psql
Ahí creamos un usuario y una base para el pad:
postgres=# CREATE USER etherpad WITH PASSWORD '**************';
postgres=# CREATE DATABASE pad;
postgres=# GRANT ALL PRIVILEGES ON DATABASE pad TO etherpad;
#9 - 08/11/2017 11:59 AM - Daniel Viñar Ulriksen
09/29/2018 2/7
Procuro configurar en ~/etherpad-lite/settings.json el acceso del etherpad a esa base:
"dbType" : "postgres",
"dbSettings" : {
"user" : "etherpad",
"host" : "localhost",
"password": "*******************",
"database": "pad",
"charset" : "utf8mb4"
},
Pero no funciona:
etherpad@ombu:~$ ./etherpad-lite/bin/run.sh
Ensure that all dependencies are up to date... If this is the first time you have run Etherpad please be patient.
Ensure jQuery is downloaded and up to date...
Clearing minified cache...
Ensure custom css/js files are created...
Started Etherpad...
events.js:160
throw er; // Unhandled 'error' event
^
error: la autentificación password falló para el usuario «etherpad»
at Connection.parseE (/srv/etherpad/etherpad-lite/src/node_modules/pg/lib/connection.js:534:11)
at Connection.parseMessage (/srv/etherpad/etherpad-lite/src/node_modules/pg/lib/connection.js:361:17)
at Socket.<anonymous> (/srv/etherpad/etherpad-lite/src/node_modules/pg/lib/connection.js:105:22)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:547:20)
#10 - 08/14/2017 10:50 AM - Daniel Viñar Ulriksen
Postgres sólo escucha en localhost:
root@ombu:~# netstat -lp | grep postgres
tcp 0 0 localhost:postgresql 0.0.0.0:* LISTEN 13820/postgres
tcp6 0 0 localhost:postgresql [::]:* LISTEN 13820/postgres
unix 2 [ ACC ] STREAM LISTENING 55941 13820/postgres /var/run/postgresql/.s.PGSQL.5432
Dado que además tenemos adelante caracol, el firewall perimetral del CURE, accedemos al postgres con PGAdmin3 con un doble tunel:
ulvida@rambla:~$ ssh -L 5432:localhost:5432 bourdieu.csic.edu.uy
ulvida@bourdieu:~$ ssh -L 5432:localhost:5432 [email protected]
09/29/2018 3/7
#11 - 08/14/2017 11:19 AM - Daniel Viñar Ulriksen
Ahí, PGAdmin3 se conecta, pero advierte que sólo se conecta a servidores postgres 8.4 a 9.5 (y en el servidor Ombu, en Debian 9, tenemos postgresql
9.6).
Adicionalmente, al conectarnos a la base, nos indica que requiere el paquete postgresql-contrib. Una vez instalado este paquete, más o menos
accedemos a la base con pgAdmin3.
#12 - 08/14/2017 11:39 AM - Daniel Viñar Ulriksen
Según este tutorial también nos falta instalar el cliente postgres para node.js. Pero el paquete node-pg que ahí se menciona no existe en debian. En este
otro tutorial se propone instalarlo con npm:
npm install pg
Pero, luego de eso, el etherpad sigue sin arrancar, con el mismo error.
#13 - 08/14/2017 12:10 PM - Daniel Viñar Ulriksen
Aparentemente la configuración node.js es propia del usuario Unix, había que correr la instalación del cliente pg con el usuario etherpad:
etherpad@ombu:~$ npm install pg
Y ahora el etherpad arranca, y podemos verlo por tunel en el puerto 9001,
#15 - 08/15/2017 09:21 AM - Daniel Viñar Ulriksen
El npm parece depender del usuario en el que se corre. Lo corremos bajo el usuario etherpad:
etherpad@ombu:~$ npm install pg
Pero sigue dando el mismo error al arrancar el pad:
la autentificación password falló para el usuario «etherpad»
#16 - 08/15/2017 09:22 AM - Daniel Viñar Ulriksen
Configuro un apache con un reverse proxy y un certificado letsencrypt, por ahora sólo sobre el dominio ombu.interior.edu.uy
#17 - 08/15/2017 09:34 AM - Daniel Viñar Ulriksen
Como propuesto en este post, instalo también el paquete libpq-dev, pero el pad sigue sin arrancar.
#18 - 08/15/2017 10:01 AM - Daniel Viñar Ulriksen
Pruebo borrar el usuario (etherpad) y la base (pad), y recrearlos con la base template1, es decir entrando a postgres con:
postgres@ombu:~$ psql -dtemplate1
Pero seguimos con el mismo error.
09/29/2018 4/7
#19 - 08/15/2017 05:50 PM - Andrés Pías
- % Done changed from 40 to 60
Ahora funcionó. Para resolverlo me basé en esto #2706#note-7".
Había que editar el archivo /etc/postgresql/9.6/main/pg_hba.conf que controla quien puede conectarse a postgres, modificando estas dos líneas finales
(el método de autenticación es trust, no md5):
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
Quedó accesible en: https://ombu.interior.edu.uy/
Los logs son estos:
etherpad@ombu:~/etherpad-lite/bin$ ./run.sh
Ensure that all dependencies are up to date... If this is the first time you have run Etherpad please be patient.
Ensure jQuery is downloaded and up to date...
Clearing minified cache...
Ensure custom css/js files are created...
Started Etherpad...
[2017-08-15 17:43:31.589] [INFO] console - Installed plugins:
[2017-08-15 17:43:31.606] [INFO] console - Report bugs at https://github.com/ether/etherpad-lite/issues
[2017-08-15 17:43:31.607] [INFO] console - Your Etherpad version is 1.6.1 (e93d607)
[2017-08-15 17:43:31.859] [INFO] console - You can access your Etherpad instance at http://0.0.0.0:9001/
[2017-08-15 17:43:31.859] [WARN] console - Admin username and password not set in settings.json. To access admin please uncomment and
edit 'users' in settings.json
[2017-08-15 17:44:12.333] [INFO] ueberDB - Flushed 1 values
[2017-08-15 17:44:13.138] [INFO] ueberDB - Flushed 1 values
[2017-08-15 17:44:13.239] [INFO] ueberDB - Flushed 1 values
[2017-08-15 17:44:13.345] [INFO] ueberDB - Flushed 1 values
[..................] - :
#20 - 08/16/2017 10:38 AM - Daniel Viñar Ulriksen
Como documentado en el github de etherpad, configuramos el etherpad como un servicio. En /etc/systemd/system creamos un archivo
ehterpad-lite.service que contiene:
[Unit]
Description=etherpad-lite (real-time collaborative document editing)
After=syslog.target network.target
[Service]
Type=simple
User=etherpad
Group=etherpad
ExecStart=/srv/etherpad/etherpad-lite/bin/run.sh
09/29/2018 5/7
[Install]
WantedBy=multi-user.target
Para que arranque al iniciar el servidor: systemctl enable etherpad
Y arrancamos el servicio:
systemctl start etherpad
#21 - 08/16/2017 11:19 AM - Daniel Viñar Ulriksen
Detengo el pad en ritchie para realizar la migración de datos.
Con pgadmin3, con varios túneles, hago un respaldo de la base pad en ritchie y la importo en ombu. Al importarla, arroja los siguientes errores:
/usr/bin/pg_restore --host localhost --port 5432 --username "etherpad" --dbname "pad" --no-password --verbose
"/home/ulvida/Documentos/tech/ritchie/pad"
pg_restore: connecting to database for restore
pg_restore: creating SCHEMA "public"
pg_restore: creating COMMENT "SCHEMA public"
pg_restore: creating EXTENSION "plpgsql"
pg_restore: creating COMMENT "EXTENSION plpgsql"
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 1862; 0 0 COMMENT EXTENSION plpgsql
pg_restore: [archiver (db)] could not execute query: ERROR: debe ser dueño de la extensión plpgsql
Command was: COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
pg_restore: creating FUNCTION "public.ueberdb_insert_or_update(character varying, text)"
pg_restore: [archiver (db)] Error from TOC entry 174; 1255 16386 FUNCTION ueberdb_insert_or_update(character varying, text) etherpad
pg_restore: [archiver (db)] could not execute query: ERROR: ya existe una función «ueberdb_insert_or_update» con los mismos argumentos
Command was: CREATE FUNCTION ueberdb_insert_or_update(character varying, text) RETURNS void
LANGUAGE plpgsql
AS $_$ BEGIN IF EX...
pg_restore: creating TABLE "public.store"
pg_restore: [archiver (db)] Error from TOC entry 162; 1259 16473 TABLE store etherpad
pg_restore: [archiver (db)] could not execute query: ERROR: la relación «store» ya existe
Command was: CREATE TABLE store (
key character varying(100) NOT NULL,
value text NOT NULL
);
pg_restore: processing data for table "public.store"
pg_restore: [archiver (db)] Error from TOC entry 1854; 0 16473 TABLE DATA store etherpad
pg_restore: [archiver (db)] COPY failed for table "store": ERROR: llave duplicada viola restricción de unicidad «store_pkey»
DETAIL: Ya existe la llave (key)=(pad:Red_unidades_informaticas:revs:360).
CONTEXT: COPY store, línea 1
pg_restore: creating CONSTRAINT "public.store_pkey"
pg_restore: [archiver (db)] Error from TOC entry 1752; 2606 16543 CONSTRAINT store_pkey etherpad
pg_restore: [archiver (db)] could not execute query: ERROR: no se permiten múltiples llaves primarias para la tabla «store»
Command was: ALTER TABLE ONLY store
ADD CONSTRAINT store_pkey PRIMARY KEY (key);
pg_restore: setting owner and privileges for DATABASE "pad"
09/29/2018 6/7
pg_restore: setting owner and privileges for SCHEMA "public"
pg_restore: setting owner and privileges for COMMENT "SCHEMA public"
pg_restore: setting owner and privileges for ACL "public"
pg_restore: WARNING: ningún privilegio pudo ser revocado para «public»
pg_restore: WARNING: ningún privilegio pudo ser revocado para «public»
pg_restore: WARNING: no se otorgaron privilegios para «public»
pg_restore: WARNING: no se otorgaron privilegios para «public»
pg_restore: setting owner and privileges for EXTENSION "plpgsql"
pg_restore: setting owner and privileges for COMMENT "EXTENSION plpgsql"
pg_restore: setting owner and privileges for FUNCTION "public.ueberdb_insert_or_update(character varying, text)"
pg_restore: setting owner and privileges for TABLE "public.store"
pg_restore: setting owner and privileges for TABLE DATA "public.store"
pg_restore: setting owner and privileges for CONSTRAINT "public.store_pkey"
WARNING: errors ignored on restore: 5
Process returned exit code 1.
Pero los datos de los pad aparentemente están: https://ombu.interior.edu.uy/p/Red_unidades_informaticas
#22 - 08/16/2017 11:28 AM - Daniel Viñar Ulriksen
Para mayor seguridad, hacemos un drop de la base pad, y la volvemos a crear a partir del respaldo. Ahí no da errores.
#23 - 08/16/2017 01:09 PM - Daniel Viñar Ulriksen
- Status changed from En curso to Resuelta
- % Done changed from 60 to 80
El pad quedó funcionando.
#24 - 01/23/2018 12:44 PM - Andrés Pías
Acabo de apagar Ritchie que sigue encendido sin necesidad, ya que fue migrado a Ombú.
#25 - 01/23/2018 12:45 PM - Andrés Pías
- Status changed from Resuelta to Cerrada
#26 - 01/23/2018 12:45 PM - Andrés Pías
- Related to Tareas #5915: Migrar Schwartz a Proxmox added
#27 - 01/23/2018 03:46 PM - Andrés Pías
- % Done changed from 80 to 90
Finalicé esta tarea, después de modificar el firewall de Ritchie para adaptarlo a Ombu y de subirlo a este servidor migrado.
09/29/2018 7/7