1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
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
<VirtualHost *:80>
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
<Proxy *>
Require all granted
</Proxy>
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"
</VirtualHost>
# Configuration HTTPS (décommenter après configuration SSL)
# <VirtualHost *:443>
# 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
#
# <Proxy *>
# Require all granted
# </Proxy>
#
# 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"
# </VirtualHost>
```
### É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
```
|