devzone 0.45.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devcontainer/argocd/argocd.sh +5 -36
- package/.devcontainer/gitlab/installation.sh +7 -51
- package/.devcontainer/llm/llm.sh +14 -1
- package/.devcontainer/memoire.sh +62 -0
- package/.devcontainer/versions.env +1 -1
- package/README.md +18 -0
- package/manage/scripts/services-workspace.sh +19 -2
- package/package.json +1 -1
|
@@ -21,6 +21,11 @@ ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
|
|
|
21
21
|
# shellcheck source=SCRIPTDIR/../isolement.sh
|
|
22
22
|
# shellcheck disable=SC1091
|
|
23
23
|
. "$ICI/../isolement.sh"
|
|
24
|
+
# Shared memory check of the services cluster (#608): quantite_ki and
|
|
25
|
+
# memoire_cluster_ki.
|
|
26
|
+
# shellcheck source=SCRIPTDIR/../memoire.sh
|
|
27
|
+
# shellcheck disable=SC1091
|
|
28
|
+
. "$ICI/../memoire.sh"
|
|
24
29
|
|
|
25
30
|
NS=devzone-argocd
|
|
26
31
|
SECRETS="$RACINE/workspace/.argocd"
|
|
@@ -38,42 +43,6 @@ regenerer_identifiants() {
|
|
|
38
43
|
echo "devzone : argocd : identifiants regroupés non mis à jour (devzone passwords)" >&2
|
|
39
44
|
}
|
|
40
45
|
|
|
41
|
-
# Convertit une quantité de mémoire Kubernetes (Ki, Mi, Gi, K, M, G, octets)
|
|
42
|
-
# en Kio, pour additionner la mémoire allouable des nœuds.
|
|
43
|
-
quantite_ki() {
|
|
44
|
-
local q="${1:-}" nombre
|
|
45
|
-
case "$q" in
|
|
46
|
-
*Ki) nombre="${q%Ki}"; echo $((nombre)) ;;
|
|
47
|
-
*Mi) nombre="${q%Mi}"; echo $((nombre * 1024)) ;;
|
|
48
|
-
*Gi) nombre="${q%Gi}"; echo $((nombre * 1024 * 1024)) ;;
|
|
49
|
-
*Ti) nombre="${q%Ti}"; echo $((nombre * 1024 * 1024 * 1024)) ;;
|
|
50
|
-
*K | *k) nombre="${q%[Kk]}"; echo $((nombre * 1000 / 1024)) ;;
|
|
51
|
-
*M) nombre="${q%M}"; echo $((nombre * 1000 * 1000 / 1024)) ;;
|
|
52
|
-
*G) nombre="${q%G}"; echo $((nombre * 1000 * 1000 * 1000 / 1024)) ;;
|
|
53
|
-
*)
|
|
54
|
-
case "$q" in
|
|
55
|
-
'' | *[!0-9]*) echo 0 ;;
|
|
56
|
-
*) echo $((q / 1024)) ;;
|
|
57
|
-
esac
|
|
58
|
-
;;
|
|
59
|
-
esac
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
# Somme des mémoires allouables des nœuds du cluster des services, en Kio ;
|
|
63
|
-
# échoue si le cluster ne répond pas. Lecture des nœuds réservée à
|
|
64
|
-
# l'administrateur (#430).
|
|
65
|
-
memoire_cluster_ki() {
|
|
66
|
-
local sortie valeur total=0
|
|
67
|
-
sortie="$(compte_admin "$(compte_ctx)" get nodes \
|
|
68
|
-
-o jsonpath='{range .items[*]}{.status.allocatable.memory}{"\n"}{end}' 2>/dev/null)" || return 1
|
|
69
|
-
[ -n "$sortie" ] || return 1
|
|
70
|
-
while IFS= read -r valeur; do
|
|
71
|
-
[ -n "$valeur" ] || continue
|
|
72
|
-
total=$((total + $(quantite_ki "$valeur")))
|
|
73
|
-
done <<<"$sortie"
|
|
74
|
-
echo "$total"
|
|
75
|
-
}
|
|
76
|
-
|
|
77
46
|
# Refuse l'installation sous 1 Go de mémoire allouable dans le cluster ; le
|
|
78
47
|
# message indique où agrandir le cluster et la commande à relancer.
|
|
79
48
|
verifier_memoire() {
|
|
@@ -6,62 +6,18 @@
|
|
|
6
6
|
# Le chart enveloppe charts/devzone-gitlab (#538) porte les dépendances et les
|
|
7
7
|
# valeurs ; chart.sh (helm direct) et argocd.sh (Application) l'installent.
|
|
8
8
|
|
|
9
|
+
# Shared memory check of the services cluster (#608): quantite_ki,
|
|
10
|
+
# memoire_cluster_ki and verifier_memoire_module.
|
|
11
|
+
# shellcheck source=SCRIPTDIR/../memoire.sh
|
|
12
|
+
# shellcheck disable=SC1091
|
|
13
|
+
. "$ICI/../memoire.sh"
|
|
14
|
+
|
|
9
15
|
# Namespace isolé du module : un par instance, comme postgres
|
|
10
16
|
GITLAB_NS="devzone-gitlab${INSTANCE_SUFFIX}"
|
|
11
17
|
# Ancien cluster kind de GitLab, supprimé par « devzone gitlab migrate »
|
|
12
18
|
GITLAB_ANCIEN_CLUSTER="gitlab${INSTANCE_SUFFIX}"
|
|
13
19
|
GITLAB_ANCIEN_CONTEXTE="kind-gitlab${INSTANCE_SUFFIX}"
|
|
14
20
|
|
|
15
|
-
# Convertit une quantité de mémoire Kubernetes (Ki, Mi, Gi, K, M, G, octets)
|
|
16
|
-
# en Kio, pour additionner la mémoire allouable des nœuds.
|
|
17
|
-
quantite_ki() {
|
|
18
|
-
local q="${1:-}" nombre
|
|
19
|
-
case "$q" in
|
|
20
|
-
*Ki) nombre="${q%Ki}"; echo $((nombre)) ;;
|
|
21
|
-
*Mi) nombre="${q%Mi}"; echo $((nombre * 1024)) ;;
|
|
22
|
-
*Gi) nombre="${q%Gi}"; echo $((nombre * 1024 * 1024)) ;;
|
|
23
|
-
*Ti) nombre="${q%Ti}"; echo $((nombre * 1024 * 1024 * 1024)) ;;
|
|
24
|
-
*K | *k) nombre="${q%[Kk]}"; echo $((nombre * 1000 / 1024)) ;;
|
|
25
|
-
*M) nombre="${q%M}"; echo $((nombre * 1000 * 1000 / 1024)) ;;
|
|
26
|
-
*G) nombre="${q%G}"; echo $((nombre * 1000 * 1000 * 1000 / 1024)) ;;
|
|
27
|
-
*)
|
|
28
|
-
case "$q" in
|
|
29
|
-
'' | *[!0-9]*) echo 0 ;;
|
|
30
|
-
*) echo $((q / 1024)) ;;
|
|
31
|
-
esac
|
|
32
|
-
;;
|
|
33
|
-
esac
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
# Somme des mémoires allouables des nœuds du cluster des services, en Kio.
|
|
37
|
-
# Lecture des nœuds réservée à l'administrateur (#430).
|
|
38
|
-
gitlab_memoire_cluster_ki() {
|
|
39
|
-
local sortie valeur total=0
|
|
40
|
-
sortie="$(compte_admin "$(compte_ctx)" get nodes \
|
|
41
|
-
-o jsonpath='{range .items[*]}{.status.allocatable.memory}{"\n"}{end}' 2>/dev/null)" || return 1
|
|
42
|
-
[ -n "$sortie" ] || return 1
|
|
43
|
-
while IFS= read -r valeur; do
|
|
44
|
-
[ -n "$valeur" ] || continue
|
|
45
|
-
total=$((total + $(quantite_ki "$valeur")))
|
|
46
|
-
done <<<"$sortie"
|
|
47
|
-
echo "$total"
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
# Refuse l'installation sous 8 Go de mémoire allouable dans le cluster.
|
|
51
|
-
# Le message indique où agrandir le cluster (Docker Desktop) et la commande.
|
|
52
|
-
gitlab_verifier_memoire_cluster() {
|
|
53
|
-
local memoire
|
|
54
|
-
if ! memoire="$(gitlab_memoire_cluster_ki)"; then
|
|
55
|
-
echo "devzone : gitlab : cluster des services injoignable : devzone cluster" >&2
|
|
56
|
-
return 2
|
|
57
|
-
fi
|
|
58
|
-
if [ "$memoire" -lt 8388608 ]; then
|
|
59
|
-
echo "devzone : gitlab : il faut au moins 8 Go de mémoire allouable dans le cluster (disponible : $((memoire / 1048576)) Go) ; agrandir le cluster (Docker Desktop → Settings → Resources) puis relancer : devzone enable gitlab" >&2
|
|
60
|
-
return 2
|
|
61
|
-
fi
|
|
62
|
-
return 0
|
|
63
|
-
}
|
|
64
|
-
|
|
65
21
|
# Namespace présent dans le cluster des services : GitLab est installé.
|
|
66
22
|
# Lecture des namespaces réservée à l'administrateur (#430).
|
|
67
23
|
gitlab_installe() {
|
|
@@ -80,7 +36,7 @@ gitlab_namespace_preparer() {
|
|
|
80
36
|
# l'accès (relais web/SSH, /etc/hosts) et le seed des données de test.
|
|
81
37
|
gitlab_installer() {
|
|
82
38
|
echo "▶ Vérification de la mémoire allouable du cluster des services…"
|
|
83
|
-
|
|
39
|
+
verifier_memoire_module gitlab 8 || return 2
|
|
84
40
|
|
|
85
41
|
mkdir -p "$GITLAB_SECRETS_DIR"
|
|
86
42
|
gitlab_namespace_preparer
|
package/.devcontainer/llm/llm.sh
CHANGED
|
@@ -31,6 +31,10 @@ ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
|
|
|
31
31
|
# shellcheck source=SCRIPTDIR/bench.sh
|
|
32
32
|
# shellcheck disable=SC1091
|
|
33
33
|
. "$ICI/bench.sh"
|
|
34
|
+
# Memory check of the services cluster, shared with the other modules (#608)
|
|
35
|
+
# shellcheck source=SCRIPTDIR/../memoire.sh
|
|
36
|
+
# shellcheck disable=SC1091
|
|
37
|
+
. "$ICI/../memoire.sh"
|
|
34
38
|
|
|
35
39
|
NS=devzone-llm
|
|
36
40
|
STATE_DIR="$RACINE/workspace/.llm"
|
|
@@ -122,9 +126,18 @@ wait_ready() {
|
|
|
122
126
|
}
|
|
123
127
|
|
|
124
128
|
install() {
|
|
125
|
-
local ctx sets
|
|
129
|
+
local ctx sets minimum_go=12 astuce=""
|
|
126
130
|
local -a args
|
|
131
|
+
|
|
127
132
|
preset_store "$@"
|
|
133
|
+
# The light preset (3B) asks for 8 Gi, the 7B model for 12 Gi
|
|
134
|
+
if [ "$(preset_read)" = light ]; then
|
|
135
|
+
minimum_go=8
|
|
136
|
+
else
|
|
137
|
+
astuce="--preset light (8 Go)"
|
|
138
|
+
fi
|
|
139
|
+
verifier_memoire_module llm "$minimum_go" "$astuce" || return 2
|
|
140
|
+
|
|
128
141
|
ctx="$(cluster_lu)"
|
|
129
142
|
if [ -z "$ctx" ]; then
|
|
130
143
|
ctx="$(cluster_choisir "$WANTED_CTX")" || return 2
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Memory check of the services cluster (#608): a module refuses its
|
|
3
|
+
# installation when the allocatable memory of the nodes is below its minimum.
|
|
4
|
+
# Sourced by the modules (gitlab, llm) and by the tests; bash 3.2 (macOS).
|
|
5
|
+
# quantite_ki <quantite> Kubernetes quantity in Ki
|
|
6
|
+
# memoire_cluster_ki sum of the allocatable memory, in Ki
|
|
7
|
+
# verifier_memoire_module <module> <minimum_go> [astuce]
|
|
8
|
+
# Messages in French. Return 0 when the memory is enough, 2 when it is not or
|
|
9
|
+
# when the cluster is unreachable.
|
|
10
|
+
|
|
11
|
+
# Converts a Kubernetes memory quantity (Ki, Mi, Gi, Ti, K, M, G, bytes)
|
|
12
|
+
# into Ki, to add the allocatable memory of the nodes.
|
|
13
|
+
quantite_ki() {
|
|
14
|
+
local q="${1:-}" nombre
|
|
15
|
+
case "$q" in
|
|
16
|
+
*Ki) nombre="${q%Ki}"; echo $((nombre)) ;;
|
|
17
|
+
*Mi) nombre="${q%Mi}"; echo $((nombre * 1024)) ;;
|
|
18
|
+
*Gi) nombre="${q%Gi}"; echo $((nombre * 1024 * 1024)) ;;
|
|
19
|
+
*Ti) nombre="${q%Ti}"; echo $((nombre * 1024 * 1024 * 1024)) ;;
|
|
20
|
+
*K | *k) nombre="${q%[Kk]}"; echo $((nombre * 1000 / 1024)) ;;
|
|
21
|
+
*M) nombre="${q%M}"; echo $((nombre * 1000 * 1000 / 1024)) ;;
|
|
22
|
+
*G) nombre="${q%G}"; echo $((nombre * 1000 * 1000 * 1000 / 1024)) ;;
|
|
23
|
+
*)
|
|
24
|
+
case "$q" in
|
|
25
|
+
'' | *[!0-9]*) echo 0 ;;
|
|
26
|
+
*) echo $((q / 1024)) ;;
|
|
27
|
+
esac
|
|
28
|
+
;;
|
|
29
|
+
esac
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# Sum of the allocatable memory of the services cluster nodes, in Ki.
|
|
33
|
+
# Reading the nodes is reserved to the administrator (#430).
|
|
34
|
+
memoire_cluster_ki() {
|
|
35
|
+
local sortie valeur total=0
|
|
36
|
+
sortie="$(compte_admin "$(compte_ctx)" get nodes \
|
|
37
|
+
-o jsonpath='{range .items[*]}{.status.allocatable.memory}{"\n"}{end}' 2>/dev/null)" || return 1
|
|
38
|
+
[ -n "$sortie" ] || return 1
|
|
39
|
+
while IFS= read -r valeur; do
|
|
40
|
+
[ -n "$valeur" ] || continue
|
|
41
|
+
total=$((total + $(quantite_ki "$valeur")))
|
|
42
|
+
done <<<"$sortie"
|
|
43
|
+
echo "$total"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Refuses the installation of <module> under <minimum_go> GiB of allocatable
|
|
47
|
+
# memory. The message says the minimum, the available memory and how to enlarge
|
|
48
|
+
# the cluster; [astuce] adds an optional hint (for example --preset light).
|
|
49
|
+
# Return 0 when the memory is enough, 2 when it is not or the cluster is
|
|
50
|
+
# unreachable.
|
|
51
|
+
verifier_memoire_module() {
|
|
52
|
+
local nom_module="$1" minimum_go="$2" astuce="${3:-}" memoire
|
|
53
|
+
if ! memoire="$(memoire_cluster_ki)"; then
|
|
54
|
+
echo "devzone : ${nom_module} : cluster des services injoignable : devzone cluster" >&2
|
|
55
|
+
return 2
|
|
56
|
+
fi
|
|
57
|
+
if [ "$memoire" -lt "$((minimum_go * 1048576))" ]; then
|
|
58
|
+
echo "devzone : ${nom_module} : il faut au moins ${minimum_go} Go de mémoire allouable dans le cluster (disponible : $((memoire / 1048576)) Go) ; agrandir le cluster (Docker Desktop → Settings → Resources) puis relancer : devzone enable ${nom_module}${astuce:+ ; astuce : ${astuce}}" >&2
|
|
59
|
+
return 2
|
|
60
|
+
fi
|
|
61
|
+
return 0
|
|
62
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Single source for the repowarden version used by post-create.sh and workspace-init.sh.
|
|
2
|
-
REPOWARDEN_VERSION=4.17.
|
|
2
|
+
REPOWARDEN_VERSION=4.17.6
|
|
3
3
|
|
|
4
4
|
# BuildKit client version installed in the workspace image (#514). Must match
|
|
5
5
|
# buildkit.image in charts/devzone-workspace/values.yaml.
|
package/README.md
CHANGED
|
@@ -47,6 +47,24 @@ Dans les deux cas, rien n'est hébergé : tout tourne sur ta machine. `workspace
|
|
|
47
47
|
|
|
48
48
|
Sous Windows : il est recommandé de cloner avec Git for Windows (les scripts restent en fins de ligne LF grâce à `.gitattributes`, et la commande npm trouve le `bash` qu'elle exige).
|
|
49
49
|
|
|
50
|
+
#### Mémoire minimale par module
|
|
51
|
+
|
|
52
|
+
Mesures du 16/11/2026. Le chiffre LLM vient des valeurs du chart (non mesuré en service).
|
|
53
|
+
|
|
54
|
+
| Module | Consommation mesurée | Mémoire allouable exigée par devzone |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| Cluster de base | ~4 Go | aucune |
|
|
57
|
+
| GitLab | ~3,6 Go | 8 Go |
|
|
58
|
+
| MySQL | ~0,5 Go | aucune |
|
|
59
|
+
| Argo CD | ~0,6 Go | 1 Go |
|
|
60
|
+
| LLM modèle 7B (7 milliards de paramètres, fichier Q4_K_M) | 6 Gi | 12 Go |
|
|
61
|
+
| LLM --preset light (modèle 3B) | 3 Gi demandés, 4 Gi en limite | 8 Go |
|
|
62
|
+
|
|
63
|
+
- **Réglage de la RAM** :
|
|
64
|
+
- **Mac** (Docker Desktop) : *Settings → Resources > Memory*. Autre méthode : modifier `MemoryMiB` dans le fichier `settings-store.json` de Docker Desktop (Docker totalement quitté sinon il réécrit la valeur).
|
|
65
|
+
- **Windows** : fichier `%UserProfile%\.wslconfig` avec `[wsl2]` et `memory=<N>GB`, puis `wsl --shutdown`. WSL2 prend 50 % de la RAM par défaut.
|
|
66
|
+
- **Linux** : rien à régler : pas de VM, la RAM de l'hôte sert.
|
|
67
|
+
|
|
50
68
|
### Lancer en une commande
|
|
51
69
|
|
|
52
70
|
Deux façons via npm. Sans installation, à chaque usage :
|
|
@@ -30,6 +30,16 @@ services_known() {
|
|
|
30
30
|
return 1
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
# A successful enable/disable is kept in .devzone.modules of the workstation so
|
|
34
|
+
# that a new devcontainer does not reinstall what was removed (#605). state_note
|
|
35
|
+
# (argocd-workspace.sh) updates the line and keeps the other ones intact.
|
|
36
|
+
services_state_note() {
|
|
37
|
+
case "$1" in
|
|
38
|
+
enable) state_note "$2" on ;;
|
|
39
|
+
disable) state_note "$2" off ;;
|
|
40
|
+
esac
|
|
41
|
+
}
|
|
42
|
+
|
|
33
43
|
# Namespace of a service in the cluster (gitlab: default instance)
|
|
34
44
|
services_namespace() {
|
|
35
45
|
case "$1" in
|
|
@@ -98,14 +108,20 @@ services_run() {
|
|
|
98
108
|
# charts: done by the workstation, no installer in the pod (#516, #538)
|
|
99
109
|
if [ "$service" = argocd ]; then
|
|
100
110
|
argocd_toggle "$action" "$@"
|
|
101
|
-
|
|
111
|
+
code=$?
|
|
112
|
+
[ "$code" -eq 0 ] || return "$code"
|
|
113
|
+
services_state_note "$action" "$service"
|
|
114
|
+
return 0
|
|
102
115
|
fi
|
|
103
116
|
# bench is a measure, not a change of state: never taken by Argo CD
|
|
104
117
|
case "$service" in
|
|
105
118
|
postgres | mysql | llm)
|
|
106
119
|
if [ "$action" != bench ] && argocd_holds_charts; then
|
|
107
120
|
services_argocd_toggle "$service" "$action" "$@"
|
|
108
|
-
|
|
121
|
+
code=$?
|
|
122
|
+
[ "$code" -eq 0 ] || return "$code"
|
|
123
|
+
services_state_note "$action" "$service"
|
|
124
|
+
return 0
|
|
109
125
|
fi
|
|
110
126
|
;;
|
|
111
127
|
esac
|
|
@@ -138,6 +154,7 @@ services_run() {
|
|
|
138
154
|
echo "✖ $action $service failed (code $code); in the pod: devzone status" >&2
|
|
139
155
|
return "$code"
|
|
140
156
|
fi
|
|
157
|
+
services_state_note "$action" "$service"
|
|
141
158
|
echo "✔ $action $service done; in the pod: devzone status; local access: devzone workspace ports"
|
|
142
159
|
}
|
|
143
160
|
|