Etherpad

De Wiki Castanedo.es
Revisión del 08:24 8 ene 2021 de Guzman (discusión | contribs.) (Configuración nginx)
Ir a la navegación Ir a la búsqueda

Requisitos

Se va a instalar etherpad 1.8.7 cuyos requisitos mínimos son:

  • nodejs >= 10.13.0

Ubuntu Server

Se va a instalar en un servidor: Ubuntu Server 20.04 TLS.

Usuario root

Todos los comandos se ejecutarán como root, a menos que se especifique lo contrario.

sudo -i

Instalación de requisitos

  • Instalación NodeJS
apt-get install nodejs npm

Requisitos en el OS

Se va a crear el usuario y el grupo "etherpad" para ejecutar etherpad.

groupadd -r etherpad
useradd -r -d /home/etherpad -m -g etherpad -s /bin/bash etherpad

Instalación de Etherpad 1.8.7

  • Descarga de Etherpad 1.8.7
cd /opt
curl -OL "https://github.com/ether/etherpad-lite/archive/1.8.7.tar.gz"
  • Compresión de Etherpad
tar -xzvf 1.8.7.tar.gz -C /opt
  • Establecimiento de permisos
chown -R etherpad:etherpad /opt/etherpad-lite-1.8.7
  • Instalación de dependencias de Etherpad

<systaxhighlight lang="Bash">sudo -i -u etherpad /opt/etherpad-lite-1.8.7/bin/installDeps.sh</syntaxhighlight>


Añadir extensiones para Etherpad

Se añaden las siguientes extensiones:

npm install ep_headings2 ep_markdown ep_comments_page ep_align ep_font_color ep_webrtc ep_embedded_hyperlinks2

Etherpad con servicio (SystemD)

Se va a configurar Etherpad para que arranque con es OS.

  • Crear el fichero "/etc/systemd/system/etherpad.service"
[Unit]
Description=Etherpad-lite, the collaborative editor.
After=syslog.target network.target

[Service]
Type=simple
User=etherpad
Group=etherpad
WorkingDirectory=/opt/etherpad-lite-1.8.7
Environment=NODE_ENV=production
ExecStart=/usr/bin/nodejs --experimental-worker /opt/etherpad-lite-1.8.7/src/node/server.js
# use mysql plus a complete settings.json to avoid Service hold-off time over, scheduling restart.
Restart=always

[Install]
WantedBy=multi-user.target
  • Recargar demonios
systemctl daemon-reload
  • Arrancar Etherpad
systemctl start etherpad.service


  • Habilitar Etherpad durante el arranque
systemctl enable etherpad.service
  • Comprobar que Etherpad ha arrancado
systemctl status etherpad.service

Usar nginx como frontal

Etherpad tiene su propio servidor web que, por defecto, escucha en el puerto 9001/tcp. Se va a configurar nginx para que funcione como frontal y redireccione al servidor web de Etherpad (reverse proxy).

  • Crear y editar el fichero: "/etc/nginx/sites-available/etherpad"
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
        listen 80 default_server;
        listen [::]:80 default_server;
        server_name localhost;
        return 301 https://$host$request_uri;
}

server {
        listen 443 ssl http2 default_server;
        listen [::]:443 ssl http2 default_server;
        ssl_certificate /etc/nginx/ssl/etherpad.crt;
        ssl_certificate_key /etc/nginx/ssl/etherpad.key;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.php;

        server_name localhost;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                #try_files $uri $uri/ =404;
                proxy_pass http://127.0.0.1:9001;
        }

        # pass PHP scripts to FastCGI server
        #
        #location ~ \.php$ {
        #       include snippets/fastcgi-php.conf;
        #
        #       # With php-fpm (or other unix sockets):
        #       #fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        #       fastcgi_pass unix:/run/php/php7.3-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       #fastcgi_pass 127.0.0.1:9000;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #       deny all;
        #}
}
  • Habilitar configuración
ln -s /etc/nginx/sites-available/etherpad /etc/nginx/sites-enabled/etherpad
  • Recargar configuración de nginx
systemctl reload nginx

Referencias