Bye Gafam, les tutos ! - Tag agenda
http://tutos.bye-gafam.org/tag/agenda
frwhile ( ! geek) code_again();Tue, 26 Feb 2019 13:17:00 +0100PluXmlRadicale : Installer un serveur Carddav/Caldav
http://tutos.bye-gafam.org/article3/radicale-synchronisation-contacts-et-calendrier-installation
http://tutos.bye-gafam.org/article3/radicale-synchronisation-contacts-et-calendrier-installation<blockquote>
<p>Installation d'un serveur Radicale pour la synchronisation des contacts et calendriers ( CardDav / Caldav)</p>
<p> </p>
<p>Ci-dessous l'installation manuelle, mais il existe un playbook Ansible prêt à l'emploi :</p>
<p><a href="https://github.com/share-me/init_raspberry">https://github.com/share-me/init_raspberry</a></p>
</blockquote><h2>Pourquoi installer un serveur Radicale ?</h2>
<div align="left" style="float: left;"><!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->
<div align="center"><svg height="300" width="200" xmlns="http://www.w3.org/2000/svg"> <path d="M 186,188 C 184,98 34,105 47,192 C 59,279 130,296 130,296 C 130,296 189,277 186,188 z" fill="#a40000"></path> <path d="M 73,238 C 119,242 140,241 177,222 C 172,270 131,288 131,288 C 131,288 88,276 74,238 z" fill="#ffffff"></path> <g fill="none" stroke="#4e9a06" stroke-width="15"> <path d="M 103,137 C 77,69 13,62 13,62"></path> <path d="M 105,136 C 105,86 37,20 37,20"></path> <path d="M 105,135 C 112,73 83,17 83,17"></path> </g> </svg></div>
<div align="center"> </div>
<div align="center"> </div>
<div align="center"> </div>
<div align="center"> </div>
<div align="center"> </div>
</div>
<div align="left">Radicale est un serveur CalDAV (calendriers, todo-lists) et CardDAV (contacts, groupes de contacts)</div>
<div align="left">Il est libre, open-source et sous GPLv3.</div>
<div align="center"> </div>
<div align="left">Il permet de synchroniser ses contacts, groupes de contacts, et calendriers.</div>
<div align="left"> </div>
<div align="left">Plusieurs autres <a href="https://en.wikipedia.org/wiki/Comparison_of_CalDAV_and_CardDAV_implementations#Server_implementations" title="alternatives">alternatives</a> sont possibles, parmi lesquelles Baïkal</div>
<div>
<p><strong>ATTENTION:</strong> Avant de vous lancer dans l'installation d'un serveur Radicale pour auto-héberger vos propres données de contacts et calendrier, j'espère que vous avez bien conscience qu'il est de votre responsabilité de faire des sauvegardes régulières de ces données.</p>
<h2> </h2>
<h2> </h2>
<h2> </h2>
<h2> </h2>
<h2> </h2>
<h2># Installer python et son module pip</h2>
</div>
<div style="background:#eeeeee;border:1px solid #cccccc;padding:5px 10px;"># avec le user <strong>pi</strong></div>
<pre>
<code>sudo apt -y install python3 python3-pip apache2-utils</code></pre>
<h2> <br />
# Installation de Radicale et ses librairies</h2>
<div>
<p><code>sudo useradd radicale -m -s /bin/bash</code></p>
<p><code>sudo mkdir -p /var/log/radicale/</code></p>
<p><code>sudo chown -R radicale:radicale /var/log/radicale</code></p>
<p><code>sudo passwd radicale</code></p>
<p><code>sudo su - radicale</code></p>
<p> </p>
</div>
<div style="background:#eeeeee;border:1px solid #cccccc;padding:5px 10px;"># avec user radicale</div>
<p><code>mkdir -p ~/.config/radicale/</code></p>
<p><code>mkdir -p ~/.config/systemd/user/</code></p>
<p><code>pip3 install --upgrade radicale radicale[bcrypt] passlib[bcrypt]</code></p>
<div> </div>
<div>
<h2># Création du fichier de mot de passe (chiffrage bcrypt)</h2>
<p><code>htpasswd -B -c ~/.config/radicale/users nom_du_compte1</code></p>
<p><code>htpasswd -B ~/.config/radicale/users nom_du_compte(x)</code></p>
</div>
<div>
<p>En mettant bien évidemment ce que vous voulez comme user à la place de <strong>nom_du_compte1</strong></p>
<h3> </h3>
<p> </p>
<h2># Créer un fichier de configuration</h2>
</div>
<div> </div>
<div><strong>nano ~/.config/radicale/config</strong></div>
<pre>
[auth]
type = htpasswd
htpasswd_filename = ~/.config/radicale/users
# encryption method used in the htpasswd file
htpasswd_encryption = bcrypt
# Average delay after failed login attempts in seconds
delay = 10
[storage]
filesystem_folder = ~/.config/radicale/collections
[server]
# ouvert à toute IP
hosts = 0.0.0.0:5232
max_connections = 2
# 1 Megabyte
max_content_length = 10000000
# 10 seconds
timeout = 10
</pre>
<blockquote>
<p><u>/!</u> Pour plus d'option, voir le site officiel<br />
<a href="https://radicale.org/3.0.html#documentation/configuration" title="https://radicale.org/configuration/">https://radicale.org/3.0.html#documentation/configuration</a></p>
</blockquote>
<div>
<h3> </h3>
<h3> </h3>
<h2># Créer un fichier de logging (format python)</h2>
</div>
<div> </div>
<div><code><strong>nano ~/.config/radicale/logs.conf </strong></code></div>
<pre>
[loggers]
keys = root
[handlers]
keys = file
[formatters]
keys = full
[logger_root]
# Change this to DEBUG or INFO for higher verbosity.
level = INFO
handlers = file
[handler_file]
class = handlers.RotatingFileHandler
# Specify the output file and parameter for rotation here.
# See https://docs.python.org/3/library/logging.handlers.html#logging.handlers.RotatingFileHandler
# Example: rollover at 100000 kB and keep 10 files (means 1 MB)
args = ('/var/log/radicale/log', 'a', 100000, 10)
formatter = full
[formatter_full]
format = %(asctime)s - [%(thread)x] %(levelname)s: %(message)s</pre>
<blockquote>
<p><u>/!</u> Pour plus d'option, voir le site officiel<br />
<a href="https://docs.python.org/3/library/logging.config.html#configuration-file-format" title="https://docs.python.org/3/library/logging.config.html#configuration-file-format">https://docs.python.org/3/library/logging.config.html#configuration-file-format</a></p>
</blockquote>
<div> </div>
<div> </div>
<div>
<h2># Créer un fichier de service systemd</h2>
</div>
<div style="background:#eeeeee;border:1px solid #cccccc;padding:5px 10px;"># revenir au user pi</div>
<div> </div>
<div><code>sudo nano /lib/systemd/system/radicale.service</code></div>
<pre>
[Unit]
Description=A simple CalDAV (calendar) and CardDAV (contact) server
[Service]
ExecStart=/usr/bin/env python3 -m radicale
Restart=on-failure
User=radicale
Group=radicale
[Install]
WantedBy=multi-user.target</pre>
<p> </p>
<h2># Activer le service Radicale</h2>
<p><code>sudo systemctl enable radicale.service</code></p>
<p><code>sudo systemctl start radicale</code></p>
<p><code>systemctl status radicale</code></p>
<h2> </h2>
<h2># Vérifier les logs</h2>
<p><code>journalctl --unit radicale.service</code></p>
<p>Ou bien on jette un oeil dans le log</p>
<p><code>cat /var/log/radicale/log</code></p>
<pre>
2019-02-18 22:07:15,414 - [76f75640] INFO: Starting Radicale
2019-02-18 22:07:15,415 - [76f75640] INFO: Authentication type is 'htpasswd'
2019-02-18 22:07:16,612 - [76f75640] INFO: Storage type is 'multifilesystem'
2019-02-18 22:07:16,623 - [76f75640] INFO: Rights type is 'owner_only'
2019-02-18 22:07:16,623 - [76f75640] INFO: Web type is 'internal'
2019-02-18 22:07:16,633 - [76f75640] INFO: Listening to 'jarvis' on port 5232
2019-02-18 22:07:16,634 - [76f75640] INFO: Radicale server ready</pre>
<h2># Utilisation</h2>
<p>Je vous invite à lire l'article concerné sur <a href="http://tutos.bye-gafam.org/../article21/radicale-synchronisation-contacts-et-calendrier-utilisation">l'utilisation de Radicale</a></p>Tue, 26 Feb 2019 13:17:00 +0100Nerd