From fb7b2389c33bef903f236f4dd0c0b98dfc0bbbe8 Mon Sep 17 00:00:00 2001 From: ertopogo Date: Wed, 26 Nov 2025 04:02:41 +0100 Subject: Feat: Ajout de la configuration Tridactyl (Native Messenger + .tridactylrc) et scripts de maintenance --- TRIDACTYL-CONFIG.md | 44 +++ ...ATA_Mozilla_NativeMessagingHosts_tridactyl.json | 8 + configs/windows/var_USERPROFILE_.tridactylrc | 39 +++ files-config.txt | 4 +- path-mapping.json | 4 +- scripts/cleanup-tridactyl.ps1 | 34 ++ scripts/install-tridactyl-native.ps1 | 49 +++ scripts/verify-tridactyl-config.ps1 | 108 +++++++ setup-git-web-interface/README.md | 351 +++++++++++++++++++++ setup-git-web-interface/apache-config.conf | 70 ++++ setup-git-web-interface/checklist.md | 163 ++++++++++ setup-git-web-interface/docker-compose-gitlab.yml | 36 +++ setup-git-web-interface/docker-compose.yml | 31 ++ setup-git-web-interface/installation-gitlab.sh | 120 +++++++ setup-git-web-interface/installation-steps.sh | 95 ++++++ setup-git-web-interface/nginx-config.conf | 50 +++ 16 files changed, 1204 insertions(+), 2 deletions(-) create mode 100644 TRIDACTYL-CONFIG.md create mode 100644 configs/windows/var_APPDATA_Mozilla_NativeMessagingHosts_tridactyl.json create mode 100644 configs/windows/var_USERPROFILE_.tridactylrc create mode 100644 scripts/cleanup-tridactyl.ps1 create mode 100644 scripts/install-tridactyl-native.ps1 create mode 100644 scripts/verify-tridactyl-config.ps1 create mode 100644 setup-git-web-interface/README.md create mode 100644 setup-git-web-interface/apache-config.conf create mode 100644 setup-git-web-interface/checklist.md create mode 100644 setup-git-web-interface/docker-compose-gitlab.yml create mode 100644 setup-git-web-interface/docker-compose.yml create mode 100644 setup-git-web-interface/installation-gitlab.sh create mode 100644 setup-git-web-interface/installation-steps.sh create mode 100644 setup-git-web-interface/nginx-config.conf diff --git a/TRIDACTYL-CONFIG.md b/TRIDACTYL-CONFIG.md new file mode 100644 index 0000000..3e3677b --- /dev/null +++ b/TRIDACTYL-CONFIG.md @@ -0,0 +1,44 @@ +# Configuration Tridactyl + +Ce guide explique comment configurer Tridactyl et vérifier que la configuration est bien prise en compte. + +## Structure des fichiers + +Pour une installation propre, tous les fichiers du Native Messenger sont regroupés dans le dossier de configuration de Firefox. + +### 1. Native Messenger (`native_main.exe` et `tridactyl.json`) + +**Emplacement :** `%APPDATA%\Mozilla\NativeMessagingHosts\` + +- `tridactyl.json` : Le manifest qui dit à Firefox où trouver l'exécutable. +- `native_main.exe` : Le programme qui fait le lien avec le système. + +Ces fichiers sont synchronisés dans le projet : +- Source : `%APPDATA%\Mozilla\NativeMessagingHosts\tridactyl.json` +- Projet : `configs\windows\var_APPDATA_Mozilla_NativeMessagingHosts_tridactyl.json` + +*(Note : L'exécutable `native_main.exe` n'est pas synchronisé dans git car c'est un binaire, mais il doit être présent sur la machine)* + +### 2. Configuration Utilisateur (`.tridactylrc`) + +**Emplacement :** `%USERPROFILE%\.tridactylrc` + +Ce fichier contient vos personnalisations (raccourcis, thèmes, etc.). + +Synchronisé dans le projet : +- Source : `%USERPROFILE%\.tridactylrc` +- Projet : `configs\windows\var_USERPROFILE_.tridactylrc` + +## Installation / Restauration + +Si vous installez sur une nouvelle machine : + +1. Copiez `native_main.exe` (à télécharger depuis le dépôt Tridactyl) dans `%APPDATA%\Mozilla\NativeMessagingHosts\`. +2. Exécutez le script de restauration du projet pour placer `tridactyl.json` et `.tridactylrc` : + ```powershell + .\scripts\sync-from-project.ps1 + ``` + +## Vérification + +Dans Firefox, tapez `:native` pour confirmer que le Native Messenger fonctionne. Il devrait afficher la version et le chemin vers l'exécutable. diff --git a/configs/windows/var_APPDATA_Mozilla_NativeMessagingHosts_tridactyl.json b/configs/windows/var_APPDATA_Mozilla_NativeMessagingHosts_tridactyl.json new file mode 100644 index 0000000..9169e9c --- /dev/null +++ b/configs/windows/var_APPDATA_Mozilla_NativeMessagingHosts_tridactyl.json @@ -0,0 +1,8 @@ +{ + "name": "tridactyl", + "description": "Tridactyl native command handler", + "path": "native_main.exe", + "type": "stdio", + "allowed_extensions": [ "tridactyl.vim@cmcaine.co.uk","tridactyl.vim.betas@cmcaine.co.uk", "tridactyl.vim.betas.nonewtab@cmcaine.co.uk" ] +} + diff --git a/configs/windows/var_USERPROFILE_.tridactylrc b/configs/windows/var_USERPROFILE_.tridactylrc new file mode 100644 index 0000000..b25afbb --- /dev/null +++ b/configs/windows/var_USERPROFILE_.tridactylrc @@ -0,0 +1,39 @@ +" Configuration Tridactyl +" Fichier de configuration pour l'extension Firefox Tridactyl +" Place ce fichier dans: %USERPROFILE%\.tridactylrc + +" Moteur de recherche par defaut +set searchengine google + +" Remappage des touches pour naviguer entre les onglets (style Vim) +bind J tabnext +bind K tabprev + +" Theme sombre +colors dark + +" Desactiver les notifications +set newtab none + +" Personnaliser les couleurs +colorscheme dark + +" Activer le mode strict (desactive certaines fonctionnalites pour plus de securite) +set strict true + +" Configuration du hint mode (pour selectionner les liens) +" Utiliser les touches de la home row pour plus de rapidite (au lieu des chiffres) +set hintchars hjklasdfgyuiopqwertnmzxcvb + +" Permettre de filtrer les liens en tapant leur texte +set hintfiltermode simple + +" Afficher les hints en majuscules pour une meilleure lisibilite +set hintuppercase true + +" Delai pour l'apparition des hints (0 = immediat) +set hintdelay 0 + +" Desactiver les sons +set noaudio true + diff --git a/files-config.txt b/files-config.txt index cf8c507..1011005 100644 --- a/files-config.txt +++ b/files-config.txt @@ -4,7 +4,9 @@ # # Exemples: windows|%USERPROFILE%\_vimrc -windows|%APPDATA%\Cursor\User\settings.json +windows|%APPDATA%\Cursor\User\settings.json +windows|%APPDATA%\Mozilla\NativeMessagingHosts\tridactyl.json +windows|%USERPROFILE%\.tridactylrc wsl|~/.bashrc wsl|~/.bash_aliases wsl|~/.screenrc diff --git a/path-mapping.json b/path-mapping.json index 8b77a8f..d34b89d 100644 --- a/path-mapping.json +++ b/path-mapping.json @@ -1,7 +1,9 @@ { "windows": { "%APPDATA%\\Cursor\\User\\settings.json": "configs\\windows\\var_APPDATA_Cursor_User_settings.json", - "%USERPROFILE%\\_vimrc": "configs\\windows\\var_USERPROFILE__vimrc" + "%USERPROFILE%\\_vimrc": "configs\\windows\\var_USERPROFILE__vimrc", + "%APPDATA%\\Mozilla\\NativeMessagingHosts\\tridactyl.json": "configs\\windows\\var_APPDATA_Mozilla_NativeMessagingHosts_tridactyl.json", + "%USERPROFILE%\\.tridactylrc": "configs\\windows\\var_USERPROFILE_.tridactylrc" }, "wsl": { "~/.bashrc": "configs\\wsl\\home_.bashrc", diff --git a/scripts/cleanup-tridactyl.ps1 b/scripts/cleanup-tridactyl.ps1 new file mode 100644 index 0000000..e1c3c7e --- /dev/null +++ b/scripts/cleanup-tridactyl.ps1 @@ -0,0 +1,34 @@ +# Script de nettoyage et consolidation Tridactyl +$ErrorActionPreference = "Stop" + +$sourceDir = "$env:USERPROFILE\.tridactyl" +$targetDir = "$env:APPDATA\Mozilla\NativeMessagingHosts" +$exeName = "native_main.exe" + +Write-Host "=== Consolidation Tridactyl ===" -ForegroundColor Cyan + +# 1. Copier l'exécutable +if (Test-Path "$sourceDir\$exeName") { + Write-Host "Copie de $exeName vers $targetDir..." + Copy-Item -Path "$sourceDir\$exeName" -Destination "$targetDir\$exeName" -Force + Write-Host "OK" -ForegroundColor Green +} else { + Write-Warning "$exeName non trouvé dans $sourceDir" +} + +# 2. Vérifier que tout est bien là-bas +if ((Test-Path "$targetDir\$exeName") -and (Test-Path "$targetDir\tridactyl.json")) { + Write-Host "Les fichiers nécessaires sont bien dans $targetDir" -ForegroundColor Green + + # 3. Supprimer l'ancien dossier + if (Test-Path $sourceDir) { + Write-Host "Suppression du dossier inutile $sourceDir..." + Remove-Item -Path $sourceDir -Recurse -Force + Write-Host "Dossier supprimé." -ForegroundColor Green + } +} else { + Write-Error "La copie semble avoir échoué. Le dossier source n'a pas été supprimé par sécurité." +} + +Write-Host "Opération terminée." -ForegroundColor Cyan + diff --git a/scripts/install-tridactyl-native.ps1 b/scripts/install-tridactyl-native.ps1 new file mode 100644 index 0000000..fed740b --- /dev/null +++ b/scripts/install-tridactyl-native.ps1 @@ -0,0 +1,49 @@ +# Script pour installer le native messenger Tridactyl +# Copie le fichier tridactyl.json vers l'emplacement attendu par Firefox + +$ErrorActionPreference = "Stop" + +Write-Host "=== Installation du Native Messenger Tridactyl ===" -ForegroundColor Cyan +Write-Host "" + +$sourcePath = "$env:USERPROFILE\.tridactyl\tridactyl.json" +$targetPath = "$env:APPDATA\Mozilla\NativeMessagingHosts\tridactyl.json" +$targetDir = Split-Path $targetPath -Parent + +# Verifier que le fichier source existe +if (-not (Test-Path $sourcePath)) { + Write-Host "[ERREUR] Fichier source introuvable: $sourcePath" -ForegroundColor Red + Write-Host "Assurez-vous que le native messenger est installe dans: $sourcePath" -ForegroundColor Yellow + exit 1 +} + +Write-Host "Source: $sourcePath" -ForegroundColor Gray +Write-Host "Destination: $targetPath" -ForegroundColor Gray +Write-Host "" + +# Creer le repertoire de destination si necessaire +if (-not (Test-Path $targetDir)) { + Write-Host "Creation du repertoire: $targetDir" -ForegroundColor Yellow + New-Item -ItemType Directory -Path $targetDir -Force | Out-Null + Write-Host "[OK] Repertoire cree" -ForegroundColor Green +} + +# Copier le fichier +Write-Host "Copie du fichier..." -ForegroundColor Yellow +Copy-Item -Path $sourcePath -Destination $targetPath -Force +Write-Host "[OK] Fichier copie avec succes" -ForegroundColor Green + +# Verifier que le fichier a ete copie correctement +if (Test-Path $targetPath) { + Write-Host "" + Write-Host "[OK] Installation terminee avec succes!" -ForegroundColor Green + Write-Host "" + Write-Host "Prochaines etapes:" -ForegroundColor Yellow + Write-Host "1. Redemarrez Firefox completement" -ForegroundColor Gray + Write-Host "2. Ouvrez Firefox et appuyez sur ':' pour ouvrir Tridactyl" -ForegroundColor Gray + Write-Host "3. Tapez ':native' pour verifier la connexion" -ForegroundColor Gray +} else { + Write-Host "[ERREUR] Le fichier n'a pas ete copie correctement" -ForegroundColor Red + exit 1 +} + diff --git a/scripts/verify-tridactyl-config.ps1 b/scripts/verify-tridactyl-config.ps1 new file mode 100644 index 0000000..afa5ccb --- /dev/null +++ b/scripts/verify-tridactyl-config.ps1 @@ -0,0 +1,108 @@ +# Script pour verifier la configuration Tridactyl +# Verifie que les fichiers de configuration sont au bon endroit et accessibles + +$ErrorActionPreference = "Continue" + +Write-Host "=== Verification de la configuration Tridactyl ===" -ForegroundColor Cyan +Write-Host "" + +# 1. Verifier le fichier tridactyl.json pour le native messenger +Write-Host "1. Verification du Native Messenger (tridactyl.json)..." -ForegroundColor Yellow + +$nativeMessengerPath = "$env:APPDATA\Mozilla\NativeMessagingHosts\tridactyl.json" +$sourcePath = "$env:USERPROFILE\.tridactyl\tridactyl.json" + +if (Test-Path $nativeMessengerPath) { + Write-Host " [OK] Fichier trouve: $nativeMessengerPath" -ForegroundColor Green + + # Verifier le contenu + try { + $content = Get-Content $nativeMessengerPath -Raw | ConvertFrom-Json + Write-Host " [OK] Fichier JSON valide" -ForegroundColor Green + Write-Host " - Nom: $($content.name)" -ForegroundColor Gray + Write-Host " - Type: $($content.type)" -ForegroundColor Gray + + # Verifier que le path pointe vers un executable valide + if ($content.path) { + $exePath = $content.path + # Si c'est un chemin relatif, chercher dans le repertoire .tridactyl + if (-not [System.IO.Path]::IsPathRooted($exePath)) { + $fullExePath = Join-Path (Split-Path $sourcePath -Parent) $exePath + } else { + $fullExePath = $exePath + } + + if (Test-Path $fullExePath) { + Write-Host " [OK] Executable trouve: $fullExePath" -ForegroundColor Green + } else { + Write-Host " [ERREUR] Executable introuvable: $fullExePath" -ForegroundColor Red + } + } + } catch { + Write-Host " [ERREUR] Erreur lors de la lecture du JSON: $_" -ForegroundColor Red + } +} else { + Write-Host " [ERREUR] Fichier introuvable: $nativeMessengerPath" -ForegroundColor Red + Write-Host " -> Le fichier doit etre copie depuis: $sourcePath" -ForegroundColor Yellow + + if (Test-Path $sourcePath) { + Write-Host " -> Voulez-vous creer le lien maintenant? (O/N)" -ForegroundColor Yellow + $response = Read-Host + if ($response -eq 'O' -or $response -eq 'o') { + $nativeDir = Split-Path $nativeMessengerPath -Parent + if (-not (Test-Path $nativeDir)) { + New-Item -ItemType Directory -Path $nativeDir -Force | Out-Null + Write-Host " [OK] Repertoire cree: $nativeDir" -ForegroundColor Green + } + Copy-Item -Path $sourcePath -Destination $nativeMessengerPath -Force + Write-Host " [OK] Fichier copie vers: $nativeMessengerPath" -ForegroundColor Green + } + } else { + Write-Host " [ERREUR] Fichier source introuvable: $sourcePath" -ForegroundColor Red + } +} + +Write-Host "" + +# 2. Verifier le fichier .tridactylrc +Write-Host "2. Verification du fichier de configuration (.tridactylrc)..." -ForegroundColor Yellow + +$tridactylrcPath = "$env:USERPROFILE\.tridactylrc" + +if (Test-Path $tridactylrcPath) { + Write-Host " [OK] Fichier trouve: $tridactylrcPath" -ForegroundColor Green + + $lineCount = (Get-Content $tridactylrcPath | Measure-Object -Line).Lines + Write-Host " - Nombre de lignes: $lineCount" -ForegroundColor Gray + + # Afficher un apercu + $preview = Get-Content $tridactylrcPath -First 5 + if ($preview) { + Write-Host " Apercu (5 premieres lignes):" -ForegroundColor Gray + foreach ($line in $preview) { + Write-Host " $line" -ForegroundColor DarkGray + } + } +} else { + Write-Host " [ATTENTION] Fichier introuvable: $tridactylrcPath" -ForegroundColor Yellow + Write-Host " -> Ce fichier est optionnel mais recommande pour personnaliser Tridactyl" -ForegroundColor Gray + Write-Host " -> Vous pouvez le creer avec des commandes comme:" -ForegroundColor Gray + Write-Host " set searchengine google" -ForegroundColor DarkGray + Write-Host " bind J tabnext" -ForegroundColor DarkGray + Write-Host " bind K tabprev" -ForegroundColor DarkGray +} + +Write-Host "" + +# 3. Instructions pour verifier dans Firefox +Write-Host "3. Instructions pour verifier dans Firefox:" -ForegroundColor Yellow +Write-Host " a) Ouvrez Firefox" -ForegroundColor Gray +Write-Host " b) Appuyez sur ':' pour ouvrir la ligne de commande Tridactyl" -ForegroundColor Gray +Write-Host " c) Tapez ':version' pour voir la version de Tridactyl" -ForegroundColor Gray +Write-Host " d) Tapez ':native' pour verifier la connexion au native messenger" -ForegroundColor Gray +Write-Host " e) Tapez ':source' pour recharger la configuration depuis .tridactylrc" -ForegroundColor Gray +Write-Host " f) Tapez ':get searchengine' pour voir le moteur de recherche configure" -ForegroundColor Gray + +Write-Host "" +Write-Host "=== Verification terminee ===" -ForegroundColor Cyan + diff --git a/setup-git-web-interface/README.md b/setup-git-web-interface/README.md new file mode 100644 index 0000000..9d28f49 --- /dev/null +++ b/setup-git-web-interface/README.md @@ -0,0 +1,351 @@ +# Installation d'une interface web Git sur chillka + +## Objectif + +Installer GitLab pour gérer et visualiser les dépôts Git sur chillka, notamment pour le projet `config-files-keyvault`. + +## Choix : GitLab + +- **Avantages** : Très complet (CI/CD, issues, merge requests, wiki, etc.), interface moderne +- **Inconvénients** : Lourd (2-4GB RAM minimum), installation plus complexe +- **Ressources** : 2-4GB RAM, 4GB+ espace disque + +## Prérequis sur chillka + +- Accès SSH en tant que `toshiro` +- Permissions sudo +- **Minimum 4GB RAM disponible** +- **Minimum 4GB espace disque libre** +- Serveur web (Apache) - optionnel mais recommandé +- Certificat SSL (Let's Encrypt) - pour HTTPS + +## Options d'installation + +### Option A : Installation Omnibus (Recommandé - Plus simple) + +L'installation Omnibus de GitLab est la méthode la plus simple et recommandée. Elle installe tout ce qui est nécessaire (PostgreSQL, Redis, etc.). + +### Option B : Installation via Docker + +Pour une installation plus isolée et facile à maintenir. + +## Installation Omnibus (Recommandé) + +### Étape 1 : Prérequis système + +```bash +# Se connecter à chillka +ssh toshiro@chillka + +# Mettre à jour le système +sudo apt update && sudo apt upgrade -y + +# Installer les dépendances +sudo apt install -y curl openssh-server ca-certificates tzdata perl +``` + +### Étape 2 : Installation de GitLab + +```bash +# Ajouter le dépôt GitLab +curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash + +# Installer GitLab CE (Community Edition) +sudo EXTERNAL_URL="http://chillka" apt install gitlab-ce + +# OU avec un domaine personnalisé +sudo EXTERNAL_URL="https://chillka.example.com" apt install gitlab-ce +``` + +**Note** : L'installation peut prendre 10-15 minutes. + +### Étape 3 : Configuration initiale + +```bash +# Reconfigurer GitLab (si nécessaire) +sudo gitlab-ctl reconfigure + +# Vérifier le statut +sudo gitlab-ctl status +``` + +### Étape 4 : Accès initial + +1. Ouvrir `http://chillka` dans un navigateur +2. Vous serez redirigé pour définir le mot de passe root +3. Se connecter avec : + - **Username** : `root` + - **Password** : (celui que vous venez de définir) + +### Étape 5 : Configuration du dépôt existant + +```bash +# Sur chillka, configurer GitLab pour utiliser le répertoire existant +sudo nano /etc/gitlab/gitlab.rb +``` + +Ajouter/modifier : +```ruby +# Chemin des dépôts Git +git_data_dirs({ + "default" => { + "path" => "/var/data/git/repositories" + } +}) + +# OU si vous voulez que GitLab gère ses propres dépôts +# git_data_dirs({"default" => {"path" => "/var/opt/gitlab/git-data"}}) +``` + +Puis reconfigurer : +```bash +sudo gitlab-ctl reconfigure +sudo gitlab-ctl restart +``` + +### Étape 6 : Importer le dépôt existant + +1. Se connecter à GitLab (http://chillka) +2. Créer un nouveau projet : `config-files-keyvault` +3. **OU** importer le dépôt existant : + - Aller dans "New Project" > "Import project" + - Choisir "Repository by URL" + - URL : `file:///var/data/git/repositories/config-files-keyvault.git` + +## Installation Docker (Alternative) + +### Étape 1 : Prérequis + +```bash +# Installer Docker si pas déjà installé +curl -fsSL https://get.docker.com -o get-docker.sh +sudo sh get-docker.sh + +# Installer Docker Compose +sudo apt install docker-compose -y +``` + +### Étape 2 : Créer docker-compose.yml + +Voir le fichier `docker-compose-gitlab.yml` dans ce dossier. + +### Étape 3 : Démarrer GitLab + +```bash +cd ~/gitlab +docker-compose up -d +``` + +**Note** : Le premier démarrage peut prendre 5-10 minutes. + +### Étape 4 : Accès + +- Ouvrir `http://chillka:8929` (port configuré dans docker-compose) +- Définir le mot de passe root + +## Configuration Apache (Reverse Proxy) + +Pour accéder via un domaine et HTTPS : + +### Étape 1 : Installer Apache et les modules nécessaires + +```bash +sudo apt install -y apache2 +sudo a2enmod proxy +sudo a2enmod proxy_http +sudo a2enmod headers +sudo a2enmod ssl +sudo systemctl restart apache2 +``` + +### Étape 2 : Configuration Apache + +```bash +sudo nano /etc/apache2/sites-available/gitlab.conf +``` + +Contenu : +```apache + + ServerName chillka.example.com # Remplacer par votre domaine + + # Redirection vers HTTPS (décommenter après configuration SSL) + # Redirect permanent / https://chillka.example.com/ + + ProxyPreserveHost On + ProxyRequests off + + + Require all granted + + + ProxyPass / http://127.0.0.1:80/ + ProxyPassReverse / http://127.0.0.1:80/ + + # Headers pour GitLab + RequestHeader set X-Forwarded-Proto "http" + RequestHeader set X-Forwarded-Ssl "off" + + +# Configuration HTTPS (décommenter après configuration SSL) +# +# ServerName chillka.example.com +# +# SSLEngine on +# SSLCertificateFile /etc/letsencrypt/live/chillka.example.com/fullchain.pem +# SSLCertificateKeyFile /etc/letsencrypt/live/chillka.example.com/privkey.pem +# +# ProxyPreserveHost On +# ProxyRequests off +# +# +# Require all granted +# +# +# ProxyPass / http://127.0.0.1:80/ +# ProxyPassReverse / http://127.0.0.1:80/ +# +# RequestHeader set X-Forwarded-Proto "https" +# RequestHeader set X-Forwarded-Ssl "on" +# +``` + +### Étape 3 : Activer le site + +```bash +sudo a2ensite gitlab.conf +sudo a2dissite 000-default.conf # Désactiver le site par défaut si nécessaire +sudo apache2ctl configtest +sudo systemctl reload apache2 +``` + +### Étape 4 : Configurer SSL avec Let's Encrypt + +```bash +sudo apt install certbot python3-certbot-apache +sudo certbot --apache -d chillka.example.com +``` + +Certbot configurera automatiquement Apache pour HTTPS. + +## Intégration avec le dépôt existant + +### Option 1 : Importer le dépôt dans GitLab + +1. Se connecter à GitLab +2. Créer un nouveau projet +3. Importer depuis l'URL locale : `file:///var/data/git/repositories/config-files-keyvault.git` + +### Option 2 : Lier le dépôt existant + +```bash +# Sur chillka, créer un lien symbolique +sudo ln -s /var/data/git/repositories/config-files-keyvault.git \ + /var/opt/gitlab/git-data/repositories/@hashed/.../config-files-keyvault.git +``` + +**Note** : Cette méthode est plus complexe. Il est recommandé d'importer le dépôt. + +## Mise à jour du remote local + +Après avoir créé/importé le dépôt dans GitLab : + +```bash +# Sur votre machine Windows +cd E:\Dev\System\config-files-keyvault + +# Avec HTTPS +git remote set-url origin http://chillka/root/config-files-keyvault.git + +# OU avec SSH (recommandé) +git remote set-url origin git@chillka:root/config-files-keyvault.git +``` + +## Commandes utiles GitLab + +```bash +# Voir le statut de GitLab +sudo gitlab-ctl status + +# Voir les logs +sudo gitlab-ctl tail + +# Redémarrer GitLab +sudo gitlab-ctl restart + +# Reconfigurer GitLab +sudo gitlab-ctl reconfigure + +# Vérifier la configuration +sudo gitlab-rake gitlab:check + +# Sauvegarder GitLab +sudo gitlab-backup create +``` + +## Configuration recommandée + +### Réduire l'utilisation mémoire (si nécessaire) + +Éditer `/etc/gitlab/gitlab.rb` : + +```ruby +# Réduire les workers +puma['worker_processes'] = 2 +sidekiq['max_concurrency'] = 5 + +# Réduire la mémoire PostgreSQL +postgresql['shared_buffers'] = "256MB" +postgresql['max_connections'] = 50 +``` + +Puis : +```bash +sudo gitlab-ctl reconfigure +sudo gitlab-ctl restart +``` + +## Accès + +- **Interface web** : `http://chillka` ou `https://chillka.example.com` +- **SSH** : `git@chillka:root/config-files-keyvault.git` +- **HTTPS** : `http://chillka/root/config-files-keyvault.git` + +## Notes importantes + +- GitLab nécessite **minimum 2GB RAM** (4GB recommandé) +- L'installation Omnibus installe PostgreSQL, Redis, et tous les services nécessaires +- Les sauvegardes sont importantes : `sudo gitlab-backup create` +- La première configuration peut prendre du temps +- GitLab utilise beaucoup de ressources, surveillez l'utilisation + +## Troubleshooting + +### GitLab ne démarre pas + +```bash +# Vérifier les logs +sudo gitlab-ctl tail + +# Vérifier les erreurs spécifiques +sudo gitlab-ctl status +``` + +### Problème de mémoire + +```bash +# Vérifier l'utilisation mémoire +free -h + +# Réduire la configuration (voir section Configuration recommandée) +``` + +### Problème avec les dépôts existants + +```bash +# Vérifier les permissions +sudo chown -R git:git /var/data/git/repositories + +# Vérifier la configuration +sudo gitlab-rake gitlab:check +``` diff --git a/setup-git-web-interface/apache-config.conf b/setup-git-web-interface/apache-config.conf new file mode 100644 index 0000000..859699d --- /dev/null +++ b/setup-git-web-interface/apache-config.conf @@ -0,0 +1,70 @@ +# Configuration Apache pour GitLab +# À placer dans /etc/apache2/sites-available/gitlab.conf +# Puis activer avec: sudo a2ensite gitlab.conf + + + ServerName chillka.example.com # Remplacer par votre domaine ou IP + + # Redirection vers HTTPS (décommenter après configuration SSL) + # Redirect permanent / https://chillka.example.com/ + + ProxyPreserveHost On + ProxyRequests off + + # Autoriser les requêtes proxy + + Require all granted + + + # Proxy vers GitLab + ProxyPass / http://127.0.0.1:80/ + ProxyPassReverse / http://127.0.0.1:80/ + + # Headers pour GitLab + RequestHeader set X-Forwarded-Proto "http" + RequestHeader set X-Forwarded-Ssl "off" + + # Headers supplémentaires pour GitLab + RequestHeader set X-Real-IP %{REMOTE_ADDR}s + RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s + + # Logs + ErrorLog ${APACHE_LOG_DIR}/gitlab_error.log + CustomLog ${APACHE_LOG_DIR}/gitlab_access.log combined + + +# Configuration HTTPS (décommenter après avoir configuré SSL avec certbot) +# +# ServerName chillka.example.com +# +# # SSL Configuration +# SSLEngine on +# SSLCertificateFile /etc/letsencrypt/live/chillka.example.com/fullchain.pem +# SSLCertificateKeyFile /etc/letsencrypt/live/chillka.example.com/privkey.pem +# SSLCertificateChainFile /etc/letsencrypt/live/chillka.example.com/chain.pem +# +# # Protocols et ciphers +# SSLProtocol all -SSLv2 -SSLv3 +# SSLCipherSuite HIGH:!aNULL:!MD5 +# +# ProxyPreserveHost On +# ProxyRequests off +# +# +# Require all granted +# +# +# ProxyPass / http://127.0.0.1:80/ +# ProxyPassReverse / http://127.0.0.1:80/ +# +# # Headers pour GitLab avec HTTPS +# RequestHeader set X-Forwarded-Proto "https" +# RequestHeader set X-Forwarded-Ssl "on" +# RequestHeader set X-Real-IP %{REMOTE_ADDR}s +# RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s +# +# # Logs +# ErrorLog ${APACHE_LOG_DIR}/gitlab_ssl_error.log +# CustomLog ${APACHE_LOG_DIR}/gitlab_ssl_access.log combined +# + diff --git a/setup-git-web-interface/checklist.md b/setup-git-web-interface/checklist.md new file mode 100644 index 0000000..f2853f6 --- /dev/null +++ b/setup-git-web-interface/checklist.md @@ -0,0 +1,163 @@ +# Checklist d'installation GitLab sur chillka + +## Préparation + +- [ ] Accès SSH à chillka en tant que `toshiro` +- [ ] Permissions sudo sur chillka +- [ ] Vérifier que `/var/data/git/repositories` existe +- [ ] **Vérifier la RAM disponible (minimum 2GB, 4GB recommandé)** +- [ ] **Vérifier l'espace disque (minimum 4GB)** +- [ ] Vérifier la connexion internet (pour télécharger GitLab) + +## Installation + +### Option A : Installation Omnibus (Recommandé) + +- [ ] Copier le script `installation-gitlab.sh` sur chillka +- [ ] Rendre le script exécutable : `chmod +x installation-gitlab.sh` +- [ ] Exécuter le script : `./installation-gitlab.sh` +- [ ] Attendre la fin de l'installation (10-15 minutes) +- [ ] Vérifier que GitLab démarre : `sudo gitlab-ctl status` +- [ ] Vérifier les logs si problème : `sudo gitlab-ctl tail` + +### Option B : Installation Docker + +- [ ] Vérifier que Docker est installé : `docker --version` +- [ ] Vérifier que Docker Compose est installé : `docker-compose --version` +- [ ] Copier `docker-compose-gitlab.yml` dans `~/gitlab/docker-compose.yml` +- [ ] Adapter la configuration dans docker-compose.yml si nécessaire +- [ ] Exécuter : `docker-compose up -d` +- [ ] Attendre le démarrage complet (5-10 minutes) +- [ ] Vérifier les logs : `docker-compose logs -f gitlab` + +## Configuration initiale + +- [ ] Ouvrir l'URL GitLab dans un navigateur (http://chillka ou celle configurée) +- [ ] Attendre que la page de définition du mot de passe s'affiche +- [ ] Définir le mot de passe root (minimum 8 caractères) +- [ ] Se connecter avec : + - Username: `root` + - Password: [le mot de passe défini] +- [ ] Vérifier que l'interface GitLab fonctionne + +## Configuration du dépôt existant + +- [ ] Vérifier que GitLab utilise le bon répertoire : + ```bash + sudo grep git_data_dirs /etc/gitlab/gitlab.rb + ``` +- [ ] Si nécessaire, modifier `/etc/gitlab/gitlab.rb` : + ```ruby + git_data_dirs({ + "default" => { + "path" => "/var/data/git/repositories" + } + }) + ``` +- [ ] Reconfigurer : `sudo gitlab-ctl reconfigure` +- [ ] Redémarrer : `sudo gitlab-ctl restart` + +## Import du dépôt existant + +- [ ] Se connecter à GitLab +- [ ] Cliquer sur "New project" ou "+" > "New project" +- [ ] Choisir "Import project" +- [ ] Sélectionner "Repository by URL" +- [ ] Entrer l'URL : `file:///var/data/git/repositories/config-files-keyvault.git` +- [ ] Remplir les informations du projet +- [ ] Cliquer sur "Import project" +- [ ] Vérifier que le dépôt est importé correctement + +## Configuration Apache (Optionnel mais recommandé) + +- [ ] Installer Apache si pas déjà installé : `sudo apt install apache2` +- [ ] Activer les modules nécessaires : + ```bash + sudo a2enmod proxy + sudo a2enmod proxy_http + sudo a2enmod headers + sudo a2enmod ssl + ``` +- [ ] Copier `apache-config.conf` vers `/etc/apache2/sites-available/gitlab.conf` +- [ ] Adapter le `ServerName` dans la config +- [ ] Adapter le `ProxyPass` si GitLab est sur un autre port +- [ ] Activer le site : `sudo a2ensite gitlab.conf` +- [ ] Désactiver le site par défaut si nécessaire : `sudo a2dissite 000-default.conf` +- [ ] Tester la config : `sudo apache2ctl configtest` +- [ ] Recharger Apache : `sudo systemctl reload apache2` + +## Configuration SSL (Optionnel mais recommandé) + +- [ ] Installer certbot : `sudo apt install certbot python3-certbot-apache` +- [ ] Obtenir le certificat : `sudo certbot --apache -d chillka.example.com` +- [ ] Vérifier le renouvellement automatique : `sudo certbot renew --dry-run` +- [ ] Configurer GitLab pour utiliser HTTPS dans `/etc/gitlab/gitlab.rb` : + ```ruby + external_url 'https://chillka.example.com' + ``` +- [ ] Reconfigurer : `sudo gitlab-ctl reconfigure` + +## Mise à jour du remote local + +- [ ] Sur la machine Windows, mettre à jour le remote : + ```bash + # Avec HTTPS + git remote set-url origin http://chillka/root/config-files-keyvault.git + + # OU avec SSH (recommandé) + git remote set-url origin git@chillka:root/config-files-keyvault.git + ``` +- [ ] Tester le push : `git push origin main` +- [ ] Vérifier que le push apparaît dans l'interface GitLab + +## Vérifications finales + +- [ ] Accéder à l'interface web GitLab +- [ ] Voir les commits dans l'interface +- [ ] Voir les fichiers du dépôt +- [ ] Voir l'historique des commits +- [ ] Tester un push depuis la machine locale +- [ ] Vérifier que les logs sont visibles +- [ ] Tester la création d'une issue (optionnel) +- [ ] Tester la création d'un merge request (optionnel) + +## Configuration avancée (Optionnel) + +- [ ] Configurer les notifications par email +- [ ] Configurer les intégrations CI/CD +- [ ] Configurer les webhooks +- [ ] Configurer les runners GitLab CI (si nécessaire) +- [ ] Configurer les sauvegardes automatiques + +## Maintenance + +- [ ] Configurer les sauvegardes régulières : + ```bash + # Ajouter dans crontab + 0 2 * * * /opt/gitlab/bin/gitlab-backup create + ``` +- [ ] Surveiller l'espace disque : `df -h` +- [ ] Surveiller l'utilisation mémoire : `free -h` +- [ ] Mettre à jour GitLab régulièrement : + ```bash + sudo apt update + sudo apt upgrade gitlab-ce + sudo gitlab-ctl reconfigure + ``` +- [ ] Vérifier la santé du système : `sudo gitlab-rake gitlab:check` + +## Réduction de l'utilisation mémoire (si nécessaire) + +Si GitLab utilise trop de mémoire : + +- [ ] Éditer `/etc/gitlab/gitlab.rb` +- [ ] Ajouter/modifier : + ```ruby + puma['worker_processes'] = 2 + sidekiq['max_concurrency'] = 5 + postgresql['shared_buffers'] = "256MB" + postgresql['max_connections'] = 50 + ``` +- [ ] Reconfigurer : `sudo gitlab-ctl reconfigure` +- [ ] Redémarrer : `sudo gitlab-ctl restart` +- [ ] Vérifier l'utilisation mémoire : `free -h` diff --git a/setup-git-web-interface/docker-compose-gitlab.yml b/setup-git-web-interface/docker-compose-gitlab.yml new file mode 100644 index 0000000..c93bd68 --- /dev/null +++ b/setup-git-web-interface/docker-compose-gitlab.yml @@ -0,0 +1,36 @@ +version: '3.8' + +services: + gitlab: + image: gitlab/gitlab-ce:latest + container_name: gitlab + hostname: 'chillka' + environment: + GITLAB_OMNIBUS_CONFIG: | + external_url 'http://chillka:8929' + git_data_dirs({ + "default" => { + "path" => "/var/data/git/repositories" + } + }) + # Réduire l'utilisation mémoire si nécessaire + puma['worker_processes'] = 2 + sidekiq['max_concurrency'] = 5 + postgresql['shared_buffers'] = "256MB" + ports: + - '8929:80' # HTTP + - '2289:22' # SSH + volumes: + - './gitlab/config:/etc/gitlab' + - './gitlab/logs:/var/log/gitlab' + - './gitlab/data:/var/opt/gitlab' + - '/var/data/git/repositories:/var/data/git/repositories' + shm_size: '256m' + restart: always + networks: + - gitlab + +networks: + gitlab: + external: false + diff --git a/setup-git-web-interface/docker-compose.yml b/setup-git-web-interface/docker-compose.yml new file mode 100644 index 0000000..30dcf4b --- /dev/null +++ b/setup-git-web-interface/docker-compose.yml @@ -0,0 +1,31 @@ +version: "3" + +services: + server: + image: gitea/gitea:latest + container_name: gitea + environment: + - USER_UID=1000 + - USER_GID=1000 + - GITEA__database__DB_TYPE=sqlite3 + - GITEA__database__PATH=/data/gitea/gitea.db + - GITEA__server__DOMAIN=chillka + - GITEA__server__SSH_DOMAIN=chillka + - GITEA__server__SSH_PORT=22 + - GITEA__repository__ROOT=/data/git/repositories + restart: always + volumes: + - ./gitea:/data + - /var/data/git/repositories:/data/git/repositories + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "3000:3000" + - "222:22" + networks: + - gitea + +networks: + gitea: + external: false + diff --git a/setup-git-web-interface/installation-gitlab.sh b/setup-git-web-interface/installation-gitlab.sh new file mode 100644 index 0000000..afabb15 --- /dev/null +++ b/setup-git-web-interface/installation-gitlab.sh @@ -0,0 +1,120 @@ +#!/bin/bash +# Script d'installation de GitLab Omnibus sur chillka +# À exécuter sur chillka en tant que toshiro avec sudo + +set -e + +echo "=== Installation de GitLab Omnibus sur chillka ===" + +# Vérifier les prérequis système +echo "Vérification des prérequis..." + +# Vérifier la RAM disponible +RAM_AVAILABLE=$(free -g | awk '/^Mem:/{print $7}') +if [ "$RAM_AVAILABLE" -lt 2 ]; then + echo "⚠️ Attention: Moins de 2GB RAM disponible. GitLab nécessite au moins 2GB." + read -p "Continuer quand même? (y/N) " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + exit 1 + fi +fi + +# Vérifier l'espace disque +DISK_AVAILABLE=$(df -BG / | awk 'NR==2 {print $4}' | sed 's/G//') +if [ "$DISK_AVAILABLE" -lt 4 ]; then + echo "⚠️ Attention: Moins de 4GB d'espace disque disponible." + read -p "Continuer quand même? (y/N) " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + exit 1 + fi +fi + +# Vérifier que nous sommes sur chillka +echo "Vérification de l'environnement..." +if [ ! -d "/var/data/git/repositories" ]; then + echo "Erreur: Le répertoire /var/data/git/repositories n'existe pas" + exit 1 +fi + +# Étape 1: Mettre à jour le système +echo "Étape 1: Mise à jour du système..." +sudo apt update +sudo apt upgrade -y + +# Étape 2: Installer les dépendances +echo "Étape 2: Installation des dépendances..." +sudo apt install -y curl openssh-server ca-certificates tzdata perl + +# Étape 3: Configurer SSH (si nécessaire) +echo "Étape 3: Configuration SSH..." +if ! sudo systemctl is-active --quiet sshd; then + sudo systemctl enable sshd + sudo systemctl start sshd +fi + +# Étape 4: Ajouter le dépôt GitLab +echo "Étape 4: Ajout du dépôt GitLab..." +curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash + +# Étape 5: Demander l'URL externe +echo "" +read -p "URL externe pour GitLab (ex: http://chillka ou https://chillka.example.com): " EXTERNAL_URL +if [ -z "$EXTERNAL_URL" ]; then + EXTERNAL_URL="http://chillka" + echo "Utilisation de l'URL par défaut: $EXTERNAL_URL" +fi + +# Étape 6: Installer GitLab +echo "Étape 6: Installation de GitLab (cela peut prendre 10-15 minutes)..." +sudo EXTERNAL_URL="$EXTERNAL_URL" apt install gitlab-ce -y + +# Étape 7: Configurer GitLab pour utiliser le répertoire existant +echo "Étape 7: Configuration de GitLab..." +sudo tee -a /etc/gitlab/gitlab.rb > /dev/null < { + "path" => "/var/data/git/repositories" + } +}) +EOF + +# Étape 8: Reconfigurer GitLab +echo "Étape 8: Reconfiguration de GitLab (cela peut prendre 5-10 minutes)..." +sudo gitlab-ctl reconfigure + +# Étape 9: Vérifier le statut +echo "Étape 9: Vérification du statut..." +sleep 5 +if sudo gitlab-ctl status | grep -q "run:"; then + echo "✓ GitLab est démarré avec succès" +else + echo "✗ Erreur: GitLab n'a pas démarré correctement" + echo "Vérifiez les logs: sudo gitlab-ctl tail" + exit 1 +fi + +# Afficher les informations importantes +echo "" +echo "=== Installation terminée ===" +echo "" +echo "Informations importantes:" +echo " - URL GitLab: $EXTERNAL_URL" +echo " - Username initial: root" +echo " - Mot de passe: À définir lors de la première connexion" +echo "" +echo "Prochaines étapes:" +echo "1. Ouvrir $EXTERNAL_URL dans un navigateur" +echo "2. Définir le mot de passe root" +echo "3. Se connecter avec root / [votre mot de passe]" +echo "4. Créer ou importer le projet config-files-keyvault" +echo "" +echo "Commandes utiles:" +echo " - Statut: sudo gitlab-ctl status" +echo " - Logs: sudo gitlab-ctl tail" +echo " - Redémarrer: sudo gitlab-ctl restart" +echo " - Vérifier: sudo gitlab-rake gitlab:check" + diff --git a/setup-git-web-interface/installation-steps.sh b/setup-git-web-interface/installation-steps.sh new file mode 100644 index 0000000..e037ac7 --- /dev/null +++ b/setup-git-web-interface/installation-steps.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# Script d'installation de Gitea sur chillka +# À exécuter sur chillka en tant que toshiro avec sudo + +set -e + +echo "=== Installation de Gitea sur chillka ===" + +# Variables +GITEA_VERSION="1.21.0" +GITEA_USER="git" +GITEA_HOME="/home/git" +GITEA_WORK_DIR="/var/lib/gitea" +GITEA_CONFIG="/etc/gitea" + +# Vérifier que nous sommes sur chillka +echo "Vérification de l'environnement..." +if [ ! -d "/var/data/git/repositories" ]; then + echo "Erreur: Le répertoire /var/data/git/repositories n'existe pas" + exit 1 +fi + +# Étape 1: Télécharger Gitea +echo "Étape 1: Téléchargement de Gitea..." +cd /tmp +wget -O gitea "https://dl.gitea.io/gitea/${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-amd64" +chmod +x gitea +sudo mv gitea /usr/local/bin/ +gitea --version + +# Étape 2: Créer l'utilisateur système +echo "Étape 2: Création de l'utilisateur git..." +if ! id "$GITEA_USER" &>/dev/null; then + sudo adduser --system --group --disabled-password --shell /bin/bash \ + --home "$GITEA_HOME" --gecos 'Git Version Control' "$GITEA_USER" + echo "Utilisateur $GITEA_USER créé" +else + echo "Utilisateur $GITEA_USER existe déjà" +fi + +# Étape 3: Créer la structure de répertoires +echo "Étape 3: Création de la structure de répertoires..." +sudo mkdir -p "$GITEA_WORK_DIR"/{custom,data,log} +sudo mkdir -p "$GITEA_CONFIG" +sudo chown -R "$GITEA_USER:$GITEA_USER" "$GITEA_WORK_DIR" +sudo chmod 750 "$GITEA_WORK_DIR" +sudo chmod 770 "$GITEA_CONFIG" + +# Étape 4: Créer le service systemd +echo "Étape 4: Création du service systemd..." +sudo tee /etc/systemd/system/gitea.service > /dev/null <