Compare commits

..

2 Commits

Author SHA1 Message Date
fdf04b789b 03/10/2025 2025-10-03 12:17:39 +02:00
31f4c1bcf8 03/10/2025 2025-10-03 12:10:16 +02:00
8 changed files with 136 additions and 0 deletions

3
.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/misc.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/PFE_Infrastrastruture_Observabilite.iml" filepath="$PROJECT_DIR$/.idea/PFE_Infrastrastruture_Observabilite.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,27 @@
#!/bin/bash
set -e
echo "=== Mise à jour des paquets ==="
sudo apt update
echo "=== Installation de Git ==="
sudo apt install -y git wget
echo "=== Vérification de la version de Git ==="
git --version
echo "=== Téléchargement de Gitea ==="
sudo wget -O gitea https://dl.gitea.io/gitea/1.23.6/gitea-1.23.6-linux-amd64
echo "=== Application des permissions et déplacement ==="
sudo chmod +x gitea
sudo mv gitea /usr/local/bin/
echo "=== Création de lutilisateur système git ==="
sudo adduser --system --group --home /var/lib/gitea --shell /bin/sh git
echo "=== Installation terminée ! ==="
gitea --version

77
Git/Git-local/Restore/etape2.sh Executable file
View File

@ -0,0 +1,77 @@
#!/bin/bash
set -e
# Trouver tous les backups triés par date décroissante (plus récent en premier)
ALL_BACKUPS=( $(ls -t /vagrant/gitea-backup-*.tar.gz 2>/dev/null) )
if [ ${#ALL_BACKUPS[@]} -eq 0 ]; then
echo "❌ Aucun fichier de backup trouvé dans /vagrant !"
exit 1
fi
# Le plus récent
BACKUP_TAR="${ALL_BACKUPS[0]}"
echo "🗂️ Utilisation du backup le plus récent : $BACKUP_TAR"
# Supprimer les autres
for OLD_BACKUP in "${ALL_BACKUPS[@]:1}"; do
echo "🗑️ Suppression de l'ancien backup : $OLD_BACKUP"
rm -f "$OLD_BACKUP"
done
TMP_DIR="/home/vagrant/backup"
# Nettoyer et recréer le répertoire temporaire
sudo rm -rf $TMP_DIR
sudo mkdir -p $TMP_DIR
# Extraire uniquement le dernier backup
sudo tar -xzf "$BACKUP_TAR" -C $TMP_DIR
# Restaurer le binaire, la config et les données
sudo rsync -av --chown=git:git $TMP_DIR/usr/local/bin/gitea /usr/local/bin/
sudo chmod +x /usr/local/bin/gitea
sudo rsync -av --chown=git:git $TMP_DIR/etc/gitea/ /etc/gitea/
sudo rsync -av --chown=git:git $TMP_DIR/var/lib/gitea/ /var/lib/gitea/
# Permissions
sudo chown -R git:git /var/lib/gitea /etc/gitea
sudo chmod -R 750 /var/lib/gitea /etc/gitea
# Vérifier le répertoire home
sudo mkdir -p /home/git
sudo chown -R git:git /home/git
# Créer le service systemd si absent
if [ ! -f /etc/systemd/system/gitea.service ]; then
echo "⚙️ Création du service systemd Gitea..."
sudo tee /etc/systemd/system/gitea.service > /dev/null <<EOF
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
[Service]
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web -c /etc/gitea/conf/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable gitea
fi
# Redémarrer Gitea
sudo systemctl daemon-reload
sudo systemctl restart gitea
sudo systemctl status gitea --no-pager
echo "✅ Restauration terminée avec le backup le plus récent : $BACKUP_TAR"