{{tag>Brouillon App Nodejs Docker Redis}}
= Notes Etherpad
== Installation
Voir
* http://docs.docker.com/articles/using_supervisord/
* https://help.ubuntu.com/community/Etherpad-liteInstallation
Voir aussi :
* https://linuxfr.org/news/wopix-un-serveur-wopi-libre-independant-simple-et-leger
Notes : Redis a remplacer par Valkey
apt-get install --no-install-recommends supervisor
apt-get install --no-install-recommends npm
apt-get install --no-install-recommends git
apt-get install --no-install-recommends pigz git curl python libssl-dev pkg-config build-essential
mkdir -p /opt/etherpad
useradd -s /usr/sbin/nologin -r -M -d /opt/etherpad etherpad
# useradd is a low level utility for adding users. On Debian, administrators should usually use adduser(8) instead.
cd /opt/etherpad
su -s /bin/bash -l etherpad -c 'git clone https://github.com/ether/etherpad-lite'
ln -s $(which nodejs) /usr/local/bin/node
''settings.json''
/*when you use NginX or another proxy/ load-balancer set this to true*/
"trustProxy" : false,
/* This is the path to the Abiword executable. Setting it to null, disables abiword.
Abiword is needed to advanced import/export features of pads*/
"abiword" : null,
/* Users for basic authentication. is_admin = true gives access to /admin.
If you do not uncomment this, /admin will not be available! */
"users": {
"admin": {
"password": "P@ssw0rd",
"is_admin": true
},
"user": {
"password": "P@ssw0rd",
"is_admin": false
}
},
/* Default Pad behavior, users can override by changing */
"padOptions": {
"noColors": false,
"showControls": true,
"showChat": true,
"showLineNumbers": true,
"useMonospaceFont": false,
"userName": false,
"userColor": false,
"rtl": false,
"alwaysShowChat": false,
"chatAndUsers": false,
"lang": "fr-fr"
},
A changer aussi
$ ~/etherpad-lite/bin/run.sh
[2015-09-12 17:31:58.565] [WARN] console - DirtyDB is used. This is fine for testing but not recommended for production.
apt-get install --no-install-recommends redis-server
service redis-server start
''settings.json''
"dbType" : "redis",
//the database specific settings
"dbSettings" : {
"host" : "localhost",
"port" : 6379,
"database" : 0
},
apt-get install --no-install-recommends abiword
''settings.json''
/* This is the path to the Abiword executable. Setting it to null, disables abiword.
Abiword is needed to advanced import/export features of pads*/
"abiword" : "/usr/bin/abiword",
== Docker
plugin
WORKDIR /src/etherpad
# Install dependencies RUN bin/installDeps.sh
RUN npm install sqlite3
# Add the settings ADD config/ /src/etherpad/
# Install plugins RUN npm install \
ep_headings \
ep_monospace_default \
ep_print
https://github.com/ether/etherpad-docker
''/etc/supervisor/supervisord.conf''
[supervisord]
nodaemon=true
[unix_http_server]
file=/var/run//supervisor.sock
chmod=0700
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run//supervisor.sock
[program:redis]
user=root
command=service redis-server start
autostart=true
autorestart=true
[program:etherpad]
directory=/opt/etherpad/etherpad-lite
command=node node_modules/ep_etherpad-lite/node/server.js
user=etherpad
autostart=true
autorestart=true
docker run -d -p 9001:9001 -v /srv/docker/etherpad/redis:/var/lib/redis etherpad bash -c "service redis-server start ; su -s /bin/bash -l etherpad -c /opt/etherpad/etherpad-lite/bin/run.sh"
docker ps -a
docker commit 6417ee8095da etherpad
docker run -ti -p 9001:9001 etherpad
service redis start
su -s /bin/bash -l etherpad
~/etherpad-lite/bin/run.sh
update-rc.d redis-server defaults
service redis-server start
== Pb conversion en ODT
[2015-09-12 18:19:45.935] [ERROR] console - Abiword File failed to convert [Error: Abiword died with exit code null]
Error: Abiword died with exit code null
at module.exports (/opt/etherpad/etherpad-lite/src/node_modules/async-stacktrace/ERR.js:46:13)
at /opt/etherpad/etherpad-lite/src/node/handler/ExportHandler.js:224:36
at /opt/etherpad/etherpad-lite/src/node_modules/async/lib/async.js:254:17
at /opt/etherpad/etherpad-lite/src/node_modules/async/lib/async.js:151:21
at /opt/etherpad/etherpad-lite/src/node_modules/async/lib/async.js:251:21
at Object.callback (/opt/etherpad/etherpad-lite/src/node_modules/async/lib/async.js:615:34)
at stdoutCallback (/opt/etherpad/etherpad-lite/src/node/utils/Abiword.js:135:14)
at ChildProcess. (/opt/etherpad/etherpad-lite/src/node/utils/Abiword.js:94:7)
at ChildProcess.emit (events.js:98:17)
at Process.ChildProcess._handle.onexit (child_process.js:809:12)
== Démarrage automatique avec systemd
''/etc/systemd/system/etherpad.service''
[Unit]
Description=Etherpad container
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker stop -t 2 etherpad1
ExecStartPre=-/usr/bin/docker rm -f etherpad1
ExecStart=/usr/bin/docker run -d -p 9001:9001 -v /srv/docker/etherpad/ep_fileupload/upload:/opt/etherpad/etherpad-lite/node_modules/ep_fileupload/upload -v /srv/docker/etherpad/redis:/var/lib/redis --name etherpad1 etherpad supervisord -c /etc/supervisor/supervisord.conf -n
RestartSec=20s
Type=notify
NotifyAccess=all
TimeoutStartSec=120
TimeoutStopSec=25
KillMode=process
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable etherpad.service
systemctl start etherpad
== Plugin
# Ajout un menu dans /admin contenant la liste des pads, date dernière modification, nombre d'utilisateur connecté au pad
ep_adminpad
# Affiche le nom de l'auteur au survol du pointeur sur le texte
ep_authornames
# Plus d'avertissement pour effacer les couleurs identifiant les auteurs
ep_clear_authorship_no_prompt
## DEPEND DE ep_page_view
# Permet de laisser des commentaires en marge de la page
ep_comments_page
# Afficher les images (passées en URL)
# MARCHE AVEC ep_fileupload
ep_previewimages
# Copier-coller des images
ep_copy_paste_images
# De pas garder les pads jamais edités
ep_delete_empty_pads
# Ajoute titre 1er niveau, 2em niveau etc...
ep_headings
# Pour faire des lignes horizontales
ep_horizontal_line
# Créer /list contenant la liste des pads
ep_padlist
# Ajoute un mode page
ep_page_view
# Insertion caractère spéciaux
ep_special_characters
# Diff
ep_timesliderdiff
# Ajout option pour désactiver le retour à la ligne automatique
ep_wrap
''settings.json''
// Display comments as icons, not boxes
"ep_comments_page": {
"displayCommentAsIcon": true
},
FIXME /opt/etherpad/etherpad-lite/node_modules/ep_fileupload/upload
== Script déploiement Etherpad via Docker
#! /bin/bash
mkdir -p /srv/docker/etherpad/ep_fileupload/upload
mkdir -p /srv/docker/etherpad/redis
chmod 777 -R /srv/docker
zcat etherpad.tar.gz | docker load
cat </etc/systemd/system/etherpad.service
[Unit]
Description=Etherpad container
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker stop -t 2 etherpad1
ExecStartPre=-/usr/bin/docker rm -f etherpad1
ExecStart=/usr/bin/docker run -d -p 9001:9001 -v /srv/docker/etherpad/ep_fileupload/upload:/opt/etherpad/etherpad-lite/node_modules/ep_fileupload/upload -v /srv/docker/etherpad/redis:/var/lib/redis --name etherpad1 etherpad supervisord -c /etc/supervisor/supervisord.conf -n
RestartSec=20s
Type=notify
NotifyAccess=all
TimeoutStartSec=120
TimeoutStopSec=25
KillMode=process
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable etherpad.service
systemctl start etherpad
----------------
Liste des pad (requette en base Redis)
redis-cli keys 'pad:*' |grep -Eo '^pad:[^:]+' |sed -e 's/pad://' |sort |uniq -c |sort -rn |awk '{if ($1!="2") {print $2 }}'