Outils pour utilisateurs

Outils du site


admin:services:paste.chapril.org

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
admin:chatons:paste.chapril.org [2019/12/07 18:28] dclermonteadmin:services:paste.chapril.org [2024/04/07 20:13] (Version actuelle) claver
Ligne 4: Ligne 4:
 site principal : [[https://privatebin.info]]\\  site principal : [[https://privatebin.info]]\\ 
 sources : [[https://github.com/PrivateBin/PrivateBin]]\\  sources : [[https://github.com/PrivateBin/PrivateBin]]\\ 
-installation [[https://github.com/PrivateBin/PrivateBin/wiki/Installation]]\\ +Machine virtuelle Chapril pour ce service **lamp.cluster.chapril.org**\\
 Les données peuvent être stockées en SQL ou en fichier plat, ici la solution retenue est fichiers plats Les données peuvent être stockées en SQL ou en fichier plat, ici la solution retenue est fichiers plats
 +
 +
 ====== Préparation ====== ====== Préparation ======
 +
 +Création de la VM avec la procédure [[admin:procedures:creation_machine_virtuelle|Création d'une machine virtuelle « bling »]].
 +
 création d'un utilisateur (non indispensable mais fait pour chapril) création d'un utilisateur (non indispensable mais fait pour chapril)
 <code> <code>
Ligne 21: Ligne 26:
 <code> <code>
 cd /var/www/ cd /var/www/
-wget https://github.com/PrivateBin/PrivateBin/archive/1.1.1.tar.gz +wget https://github.com/PrivateBin/PrivateBin/archive/x.x.x.tar.gz 
-tar xf 1.1.1.tar.gz && rm 1.1.1.tar.gz +tar xf x.x.x.tar.gz && rm x.x.x.tar.gz 
-mv PrivateBin-1.1.paste.chapril.org +mv PrivateBin-x.x.paste.chapril.org 
-chown pastechaprilorg:www-data  -R /var/www/paste.chapril.org+chown www-data:www-data  -R /var/www/paste.chapril.org
 </code> </code>
 ==== Fichiers de logs ==== ==== Fichiers de logs ====
Ligne 74: Ligne 79:
 cd /var/www/paste.chapril.org cd /var/www/paste.chapril.org
 mkdir data   mkdir data  
-chown pastechaprilorg:www-data data +chown www-data:www-data data 
-chmod g+data+chmod -R u+rwX /var/www/paste.chapril.org/data
 </code> </code>
 ====== Rapport d'activité ====== ====== Rapport d'activité ======
-Créer le répertoire tools dans /var/www/paste.chapril.org+Créer le répertoire rapport_activite dans /srv/paste.chapril.org/tools
  
-<code>mkdir /var/www/paste.chapril.org/tools+<code>mkdir /srv/paste.chapril.org/tools 
 +mkdir /srv/paste.chapril.org/tools/rapport_activite
 </code> </code>
 Copier dans ce répertoire le script rapport_activite.sh  Copier dans ce répertoire le script rapport_activite.sh 
-https://agir.april.org/projects/paste-chapril-org/repository/revisions/chapril-1.2.1/show/tools +https://forge.april.org/Chapril/paste.chapril.org-tools/src/branch/master/rapport_activite/rapport_activite.sh 
-et le rendre executable, +et le rendre executable
-puis créer la tache cron.   +(Si nécessaire se mettre sur la dernière branche) 
-Modifier si nécessaire la révision de chapril-1.2.1+ 
 +puis créer la tache cron en ajoutant un fichier pastechaprilorg dans /etc/cron.d avec la ligne suivante
 <code> <code>
-crontab -e +1 0 1 * * root /srv/paste.chapril.org/tools/rapport_activite/rapport_activite.sh -p  >> /srv/paste.chapril.org/Exploitation/rapport_paste.log 2>&1
-ajouter la ligne  +
-1 0 1 * * /var/www/paste.chapril.org/tools/rapport_activite.sh -p  >> /srv/paste.chapril.org/Exploitation/rapport_paste.log+
 </code> </code>
 ====== Création d'un dossier de projet ====== ====== Création d'un dossier de projet ======
Ligne 102: Ligne 107:
 ====== Monitoring ====== ====== Monitoring ======
  
 +Mettre dans le dossier /usr/lib/nagios/plugins un fichier check_pastechaprilorg_update et une copie dans /srv/paste.chapril.org/tools/monitoring
 +
 +<code>
 +function usage() {
 + echo "Usage : $0"
 +}
 +
 +#
 +if [ "$#" -ne 0 ]; then
 +    usage
 +else
 +    lastVersion=$(curl -s https://privatebin.info/|grep Current|cut -d' ' -f3|cut -d'<' -f1)
 +    currentVersion=$(cd /var/www/paste.chapril.org && git branch | grep '*'|cut -c 11-100 )
 +    #echo $lastVersion
 +    #echo $currentVersion
 +    if [ $currentVersion = $lastVersion ]; then
 + echo  "OK"
 + result=0
 +    else
 + echo  "WARNING : new version available, current is $currentVersion, last is $lastVersion."
 + result=1
 +    fi    
 +fi
 +exit $result
 +
 +</code>
 +
 +====== Installation d'un mise à jour ======
 +
 +<note warning>Une nouvelle procédure est en cours d'expérimentation [[admin/services/paste.chapril.org/upgrade|sur une page dédiée]]. La documentation ci-dessous est vouée à être remplacée prochainement.</note>
 +
 +
 +Émettre un avis de maintenance planifiée.
 +
 +Désactiver le site.
 +<code>
 +a2dissite paste.chapril.org.conf
 +systemctl restart apache2
 +</code>
 +
 +Faire une sauvegarde du dossier en production.(Changer la date!)
 +<code>
 +cp -a /var/www/paste.chapril.org  /srv/paste.chapril.org/paste.chapril.org20200412
 +</code>
 +
 +Se mettre sur la dernière branche master,créer une nouvelle branche master et se mettre dessus.
 +<code>
 +git checkout master-x.x.x
 +git branch master-x.x.(x+1)
 +git checkout master-x.x.(x+1)
 +</code>
 +
 +Tout vider sauf .git et .gitignore.
 +
 +Récupérer le fichier tar de la nouvelle version et le décompresser.
 +
 +Si nécessaire déplacer l'ensemble des fichiers dans /var/www/paste.chapril.org.
 +<code>
 +wget https://github.com/PrivateBin/PrivateBin/archive/x.x.(x+1).tar.gz
 +tar xf x.x.(x+1).tar.gz && rm x.x.(x+1).tar.gz
 +</code>
 +Récupérer dans la sauvegarde le répertoire data et le fichier paste.log
 +<code>
 +cp -a /srv/paste.chapril.org/paste.chapril.org20200412/data /var/www/paste.chapril.org/
 +cp  /srv/paste.chapril.org/paste.chapril.org20200412/paste.log /var/www/paste.chapril.org/paste.log
 +</code>
 +Faire le commit
 +<code>
 +git commit -m "version (x.x.x+1) (#1111)"
 +</code>
 +Revenir sur la dernière branche chapril-x.x.x, créer une nouvelle branche chapril-x.x.(x+1) et se mettre dessus et faire le merge de la branche master-x.x.(x+1) dans chapril-x.x.(x+1).
 +<code>
 +git checkout chapril-x.x.x
 +git branch chapril-x.x.(x+1)
 +git checkout chapril-x.x.(x+1)
 +git merge master-x.x.(x+1)
 +</code>
 +Résoudre le problèmes éventuels.
 +Réactiver le site 
 +<code>
 +a2ensite paste.chapril.org.conf
 +systemctl restart apache2
 +</code>
 +mettre l'avis de maintenance à terminé.
 +
 +Faire un push vers la forge et la faire pointer vers la dernière branche
 +<code>
 +git push --all
 +</code>
  
admin/services/paste.chapril.org.1575743335.txt.gz · Dernière modification : 2019/12/07 18:28 de dclermonte