Diferencia entre revisiones de «Etherpad»
Ir a la navegación
Ir a la búsqueda
mSin resumen de edición |
(Configuración nginx) |
||
Línea 3: | Línea 3: | ||
* nodejs >= 10.13.0 | * nodejs >= 10.13.0 | ||
Se va a instalar en un servidor: | == Ubuntu Server == | ||
Se va a instalar en un servidor: Ubuntu Server 20.04 TLS. | |||
== Usuario root == | === Usuario root === | ||
Todos los comandos se ejecutarán como root, a menos que se especifique lo contrario. | Todos los comandos se ejecutarán como root, a menos que se especifique lo contrario. | ||
< | <syntaxhighlight lang="Bash">sudo -i</syntaxhighlight> | ||
== Instalación de requisitos == | === Instalación de requisitos === | ||
* Instalación NodeJS | * Instalación NodeJS | ||
< | <syntaxhighlight lang="Bash">apt-get install nodejs npm</syntaxhighlight> | ||
== Requisitos en el OS == | === Requisitos en el OS === | ||
Se va a crear el usuario y el grupo ''"etherpad"'' para ejecutar etherpad. | Se va a crear el usuario y el grupo ''"etherpad"'' para ejecutar etherpad. | ||
< | <syntaxhighlight lang="Bash"> | ||
groupadd -r etherpad | |||
useradd -r -d /home/etherpad -m -g etherpad -s /bin/bash etherpad | |||
</syntaxhighlight> | |||
=== Instalación de Etherpad 1.8.7 === | |||
== Instalación de Etherpad 1.8.7 == | |||
* Descarga de Etherpad 1.8.7 | * Descarga de Etherpad 1.8.7 | ||
< | <syntaxhighlight lang="Bash"> | ||
cd /opt | |||
curl -OL "https://github.com/ether/etherpad-lite/archive/1.8.7.tar.gz" | |||
</syntaxhighlight> | |||
* Compresión de Etherpad | * Compresión de Etherpad | ||
< | <syntaxhighlight lang="Bash">tar -xzvf 1.8.7.tar.gz -C /opt</syntaxhighlight> | ||
* Establecimiento de permisos | * Establecimiento de permisos | ||
< | <syntaxhighlight lang="Bash">chown -R etherpad:etherpad /opt/etherpad-lite-1.8.7</syntaxhighlight> | ||
* Instalación de dependencias de Etherpad | * 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 == | === Añadir extensiones para Etherpad === | ||
Se añaden las siguientes extensiones: | Se añaden las siguientes extensiones: | ||
< | <syntaxhighlight lang="Bash">npm install ep_headings2 ep_markdown ep_comments_page ep_align ep_font_color ep_webrtc ep_embedded_hyperlinks2</syntaxhighlight> | ||
== Etherpad con servicio (SystemD) == | === Etherpad con servicio (SystemD) === | ||
Se va a configurar Etherpad para que arranque con es OS. | Se va a configurar Etherpad para que arranque con es OS. | ||
* Crear el fichero ''"/etc/systemd/system/etherpad.service"'' | * Crear el fichero ''"/etc/systemd/system/etherpad.service"'' | ||
< | <syntaxhighlight lang="Bash"> | ||
[Unit] | [Unit] | ||
Description=Etherpad-lite, the collaborative editor. | Description=Etherpad-lite, the collaborative editor. | ||
After=syslog.target network.target | After=syslog.target network.target | ||
[Service] | [Service] | ||
Type=simple | Type=simple | ||
User=etherpad | User=etherpad | ||
Group=etherpad | Group=etherpad | ||
WorkingDirectory=/opt/etherpad-lite-1.8.7 | WorkingDirectory=/opt/etherpad-lite-1.8.7 | ||
Environment=NODE_ENV=production | Environment=NODE_ENV=production | ||
ExecStart=/usr/bin/nodejs --experimental-worker /opt/etherpad-lite-1.8.7/src/node/server.js | 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 | Restart=always | ||
[Install] | [Install] | ||
WantedBy=multi-user.target | WantedBy=multi-user.target | ||
</ | </syntaxhighlight> | ||
* Recargar demonios | * Recargar demonios | ||
< | <syntaxhighlight lang="Bash">systemctl daemon-reload</syntaxhighlight> | ||
* Arrancar Etherpad | * Arrancar Etherpad | ||
< | <syntaxhighlight lang="Bash">systemctl start etherpad.service</syntaxhighlight> | ||
* Habilitar Etherpad durante el arranque | * Habilitar Etherpad durante el arranque | ||
< | <syntaxhighlight lang="Bash">systemctl enable etherpad.service</syntaxhighlight> | ||
* Comprobar que Etherpad ha arrancado | * Comprobar que Etherpad ha arrancado | ||
< | <syntaxhighlight lang="Bash">systemctl status etherpad.service</syntaxhighlight> | ||
== Usar nginx como frontal == | === Usar nginx como frontal === | ||
Etherpad tiene su propio servidor web que, por defecto, escucha en el puerto 9001/tcp. | 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). | 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"'' | * Crear y editar el fichero: ''"/etc/nginx/sites-available/etherpad"'' | ||
<syntaxhighlight lang="Bash"> | |||
## | |||
# 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; | |||
#} | |||
} | |||
</syntaxhighlight> | |||
* Habilitar configuración | |||
<syntaxhighlight lang="Bash">ln -s /etc/nginx/sites-available/etherpad /etc/nginx/sites-enabled/etherpad</syntaxhighlight> | |||
* Recargar configuración de nginx | |||
<syntaxhighlight lang="Bash">systemctl reload nginx</syntaxhighlight> | |||
== Referencias == | == Referencias == |
Revisión del 08:24 8 ene 2021
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