2022-01-27 17:33:53 +01:00
# Service pad.libre-service.eu
Le service pad.libre-service.eu est un service de traitement de texte collaboratif basé sur le logiciel Etherpad-lite : https://etherpad.org/
2022-01-27 17:36:24 +01:00
# Installation
2022-01-29 05:33:11 +01:00
Basée sur :
- https://github.com/ether/etherpad-lite#manual-install
- https://framacloud.org/fr/cultiver-son-jardin/etherpad
2022-01-27 17:36:24 +01:00
## Prérequis système
2022-01-27 17:33:53 +01:00
Configuration du hostname :
```
hostname pad.libre-service.eu
```
Personnalisation du prompt dans .bashrc :
```
PS1='${debian_chroot:+($debian_chroot)}\u@\H:\w\$ '
```
Ouvrir les ports nécessaires :
```
apt install ufw
ufw allow 'ssh'
ufw enable
```
2022-01-27 17:36:24 +01:00
## Prérequis logiciels
2022-01-27 17:33:53 +01:00
2022-01-29 05:33:11 +01:00
### Git
Installation de Git pour cloner le code :
```
apt install git
```
### Postgresql
Base de données :
```
2022-03-12 18:47:23 +01:00
apt install postgresql postgresql-contrib
2022-01-29 05:33:11 +01:00
```
2022-03-12 18:47:23 +01:00
D'après la documentation d'installation de Gitea :
> PostgreSQL uses md5 challenge-response encryption scheme for password authentication by default.
> Nowadays this scheme is not considered secure anymore. Use SCRAM-SHA-256 scheme instead by editing
> the postgresql.conf configuration file on the database server to:
>
> password_encryption = scram-sha-256
>
> Restart PostgreSQL to apply the setting.
Le conseil semble judicieux donc éditer le fichier `/etc/postgresql/13/main/postgresql.conf` :
```
#password_encryption = md5 # md5 or scram-sha-256
password_encryption = scram-sha-256
```
Et redémarrer le service :
```
systemctl restart postgresql.service
```
2022-01-29 05:33:11 +01:00
### Nodejs
2022-01-27 17:33:53 +01:00
Etherpad nécessite Node.js >= 12.17.0. Vérifier que la version de Debian Stable est compatible :
```
apt-cache show nodejs |grep Version
```
Installer :
```
2022-01-29 05:33:11 +01:00
apt install nodejs
2022-01-27 17:33:53 +01:00
```
2022-01-27 17:36:24 +01:00
## Déploiement
2022-01-27 17:33:53 +01:00
2022-03-12 23:10:26 +01:00
### Préparation de la base de données
2022-03-12 18:47:23 +01:00
Créer un utilisateur (« role » en langage Pgsql) :
```
su -c "psql" - postgres
CREATE ROLE etherpad WITH LOGIN PASSWORD 'xxxxxxxxxxxxx';
```
Créer une base de données :
```
CREATE DATABASE etherpad WITH OWNER etherpad TEMPLATE template0 ENCODING UTF8 LC_COLLATE 'fr_FR.UTF-8' LC_CTYPE 'fr_FR.UTF-8';
```
Donner l'accès en éditant le ficher /etc/postgresql/13/main/pg_hba.conf :
```
local etherpad etherpad scram-sha-256
```
Redémarrer le service :
```
systemctl restart postgresql.service
```
### Création d'un utilisateur système dédié
2022-03-12 19:13:25 +01:00
Créer un compte système dédié :
2022-03-12 18:47:23 +01:00
```
2022-03-12 19:13:25 +01:00
adduser --disabled-password --system --group --home /srv/etherpad/
2022-03-12 18:47:23 +01:00
```
2022-03-12 19:13:25 +01:00
### Déploiement du code
2022-01-29 05:33:11 +01:00
2022-01-27 17:33:53 +01:00
Déployer le code :
```
cd /var/www
git clone --branch master git://github.com/ether/etherpad-lite.git pad.libre-service.eu
2022-01-29 05:33:11 +01:00
chown -R etherpad:etherpad /var/www/pad.libre-service.eu
```
Premier lancement :
```
2022-03-13 01:57:15 +01:00
su etherpad -c "cd /var/www/pad.libre-service.eu/ & & ./bin/installDeps.sh & & ./src/bin/run.sh"
2022-01-29 05:33:11 +01:00
```
Configuration dans le fichier `/var/www/pad.libre-service.eu/settings.json` :
```
- "dbType" : "dirty",
- "dbSettings" : {
- "filename" : "var/dirty.db"
- },
"dbType" : "postgres",
"dbSettings" : {
"user": "etherpad",
"host": "localhost",
"port": 3306,
"password": "password",
"database": "etherpad",
"charset": "utf8mb4"
},
"trustProxy": true,
Define a password for the admin user:Advertisement
"users": {
"admin": {
"password": "adminpassword",
"is_admin": true
},
```
Installer les dépendances nécessaires :
```
2022-03-12 19:13:25 +01:00
su etherpad -c "cd /var/www/pad.libre-service.eu/ & & ./bin/installDeps.sh"
2022-01-29 05:33:11 +01:00
```
## Configuration Systemd
Créer le fichier `/etc/systemd/system/etherpad.service` :
```
[Unit]
Description=Etherpad-lite, the collaborative editor.
After=syslog.target network.target
[Service]
Type=simple
User=etherpad
Group=etherpad
2022-03-12 19:13:25 +01:00
WorkingDirectory=/var/www/pad.libre-service.eu/
2022-01-29 05:33:11 +01:00
Environment=NODE_ENV=production
2022-03-13 01:57:15 +01:00
ExecStart=/usr/bin/node /var/www/pad.libre-service.eu/bin/run.sh
# src???/node/server.js
2022-01-29 05:33:11 +01:00
Restart=always
[Install]
WantedBy=multi-user.target
```
Activer le fichier :
```
systemctl daemon-reload
2022-01-27 17:33:53 +01:00
```
2022-01-27 17:36:24 +01:00
2022-01-29 05:33:11 +01:00
Next, start the Etherpad service and enable it to start at system reboot with the following command:
```
systemctl start etherpad
systemctl status etherpad
```
2022-01-27 17:36:24 +01:00
2022-01-29 05:33:11 +01:00
Activer le démarrage automatique :
```
systemctl enable etherpad
```
2022-03-13 01:57:15 +01:00
## Configuration Apache
Documentation officielle : https://github.com/ether/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy#apache
Activer les modules pour le proxy :
```
a2enmod proxy
a2enmod proxy_http
a2enmod rewrite
apachectl configtest
systemctl restart apache2
```
Configurer le site web :
```
ProxyVia On
ProxyRequests Off
ProxyPreserveHost On
< Location / >
ProxyPass http://localhost:9001/ retry=0 timeout=30
ProxyPassReverse http://localhost:9001/
< / Location >
< Location / socket . io >
# This is needed to handle the websocket transport through the proxy, since
# etherpad does not use a specific sub-folder, such as /ws/ to handle this kind of traffic.
# Taken from https://github.com/ether/etherpad-lite/issues/2318#issuecomment-63548542
# Thanks to beaugunderson for the semantics
RewriteEngine On
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:9001/socket.io/$1 [P,L]
ProxyPass http://localhost:9001/socket.io retry=0 timeout=30
ProxyPassReverse http://localhost:9001/socket.io
< / Location >
< Proxy * >
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
< / Proxy >
```
2022-03-13 00:27:14 +01:00
## Personnalisation
### Installation de modules
Installer des modules élémentaires :
```
su - etherpad
cd /var/www/pad.libre-service.eu/
2022-03-13 01:57:15 +01:00
npm install --no-save --legacy-peer-deps ep_adminpads2 ep_align ep_author_hover ep_delete_empty_pads ep_font_color ep_font_size ep_headings2 ep_spellcheck ep_table_of_contents
```
Sous réserve de mise àjour : ep_delete_after_delay
### Ajout export ODF
La FAQ officielle indique comment faire : https://github.com/ether/etherpad-lite/wiki/How-to-enable-importing-and-exporting-different-file-formats-with-AbiWord
Installer LibreOffice de façon non grahique :
2022-03-13 00:27:14 +01:00
```
2022-03-13 01:57:15 +01:00
apt install libreoffice-nogui
```
Configurer dans /var/www/pad.libre-service.eu/settings.json :
```
"soffice" : "/usr/bin/soffice"
```
2022-03-13 00:27:14 +01:00
2022-01-29 05:33:11 +01:00
# Mise à jour
2022-03-12 19:13:25 +01:00
Documentation:
```
To update to the latest released version, execute git pull origin. The next start with src/bin/run.sh will update the dependencies.
```
2022-01-29 05:33:11 +01:00
2022-03-12 19:13:25 +01:00
So proceed:
2022-01-29 05:33:11 +01:00
```
systemctl stop etherpad
cd /var/www/pad.libre-service.eu/
git pull
./src/bin/run.sh
????????
systemctl start etherpad
```