devzone 0.29.2 → 0.30.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/devzone +30 -0
- package/.devcontainer/docker-relais.sh +8 -0
- package/.devcontainer/docker-sans-hote.sh +12 -0
- package/.devcontainer/etat-json.sh +15 -0
- package/.devcontainer/post-create.sh +5 -0
- package/README.md +1 -1
- package/manage/devzone +1 -0
- package/manage/scripts/lancer.sh +41 -0
- package/package.json +1 -1
package/.devcontainer/devzone
CHANGED
|
@@ -122,6 +122,12 @@ valeur() {
|
|
|
122
122
|
initialiser
|
|
123
123
|
local v
|
|
124
124
|
v="$(grep -E "^$1=" "$ETAT" | tail -1 | cut -d= -f2 || true)"
|
|
125
|
+
# Option docker-hote (#432) : ligne absente = on (socket de l'hôte
|
|
126
|
+
# partagé, comportement historique) ; les modules restent off par défaut
|
|
127
|
+
if [ "$1" = docker-hote ] && [ -z "$v" ]; then
|
|
128
|
+
echo on
|
|
129
|
+
return 0
|
|
130
|
+
fi
|
|
125
131
|
[ "$v" = on ] && echo on || echo off
|
|
126
132
|
}
|
|
127
133
|
|
|
@@ -1057,6 +1063,17 @@ etat() {
|
|
|
1057
1063
|
printf ' ○ module %-10s facultatif, %s : devzone activer %s\n' "$m" "$(description "$m")" "$m"
|
|
1058
1064
|
fi
|
|
1059
1065
|
done
|
|
1066
|
+
# Socket Docker de l'hôte (#432) : l'avertissement montre l'état réel,
|
|
1067
|
+
# le socket monté (même variable que docker-relais.sh), pas l'option :
|
|
1068
|
+
# le montage ne change qu'au make rebuild (faux rassurant en attendant)
|
|
1069
|
+
relais_source="${DEVZONE_RELAIS_SOURCE:-/var/run/docker-host.sock}"
|
|
1070
|
+
if [ -e "$relais_source" ] && [ "$(valeur docker-hote)" = on ]; then
|
|
1071
|
+
printf ' ⚠ socket Docker de l hôte partagé (agents compris)\n'
|
|
1072
|
+
elif [ -e "$relais_source" ]; then
|
|
1073
|
+
printf ' ⚠ socket Docker de l hôte encore partagé : make rebuild sur le poste\n'
|
|
1074
|
+
elif [ "$(valeur docker-hote)" = on ]; then
|
|
1075
|
+
printf ' ⚠ socket Docker de l hôte absent : make rebuild sur le poste\n'
|
|
1076
|
+
fi
|
|
1060
1077
|
# Applications du catalogue (#414)
|
|
1061
1078
|
if [ -d "$ICI/catalogue" ]; then
|
|
1062
1079
|
bash "$ICI/catalogue.sh" resume
|
|
@@ -1119,6 +1136,19 @@ changer() {
|
|
|
1119
1136
|
echo "devzone : module inconnu : (aucun) ; modules : ${MODULES[*]}" >&2
|
|
1120
1137
|
exit 1
|
|
1121
1138
|
fi
|
|
1139
|
+
# Option docker-hote (#432) : le socket de l'hôte, partagé par défaut.
|
|
1140
|
+
# Le choix ne s'applique qu'à la création du conteneur ; sans rebuild,
|
|
1141
|
+
# le conteneur courant garde son montage.
|
|
1142
|
+
if [ "$m" = docker-hote ]; then
|
|
1143
|
+
ecrire docker-hote "$1"
|
|
1144
|
+
if [ "$1" = on ]; then
|
|
1145
|
+
echo "devzone : socket Docker de l'hôte partagé après reconstruction"
|
|
1146
|
+
else
|
|
1147
|
+
echo "devzone : socket Docker de l'hôte non partagé après reconstruction"
|
|
1148
|
+
fi
|
|
1149
|
+
echo "devzone : reconstruction nécessaire : sur le poste, make rebuild"
|
|
1150
|
+
return 0
|
|
1151
|
+
fi
|
|
1122
1152
|
if ! connu "$m"; then
|
|
1123
1153
|
# Une application du catalogue : on écrit la ligne, on applique
|
|
1124
1154
|
if [ -f "$ICI/catalogue/$m/app.conf" ]; then
|
|
@@ -53,6 +53,14 @@ if [ "$SOCKET" = /var/run/docker.sock ] && [ "${DEVZONE_RELAIS_REEL:-}" != oui ]
|
|
|
53
53
|
exit 2
|
|
54
54
|
fi
|
|
55
55
|
|
|
56
|
+
# Sans socket (option docker-hote=off, #432) : rien à relayer ni à contrôler.
|
|
57
|
+
# Sortie 0 pour ne pas gêner le démarrage ; docker renvoie au workspace.
|
|
58
|
+
if [ ! -e "$SOCKET" ]; then
|
|
59
|
+
rm -f "$MARQUE" 2>/dev/null || true
|
|
60
|
+
echo "docker-relais : pas de socket Docker de l'hôte (option docker-hote=off)"
|
|
61
|
+
exit 0
|
|
62
|
+
fi
|
|
63
|
+
|
|
56
64
|
# $SUDO vide : commande lancée par env, jamais en commande intégrée (kill est
|
|
57
65
|
# un builtin de bash : env passe par le PATH, comme sudo ; les tests y mettent
|
|
58
66
|
# leurs faux outils)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Docker du poste non partagé (option docker-hote=off, #432). post-create.sh
|
|
3
|
+
# installe ce script comme commande docker quand la feature
|
|
4
|
+
# docker-outside-of-docker est absente : au lieu d'un « command not found »,
|
|
5
|
+
# un message clair renvoie au workspace Kubernetes.
|
|
6
|
+
cat >&2 <<'MESSAGE'
|
|
7
|
+
✖ Docker du poste non partagé (option docker-hote=off) : docker n'est pas disponible ici.
|
|
8
|
+
Pour lancer des conteneurs, utilise le workspace Kubernetes : devzone workspace
|
|
9
|
+
(docker et Testcontainers y parlent à kubedock, les images sont construites par BuildKit).
|
|
10
|
+
Pour partager le socket Docker de l'hôte : devzone activer docker-hote, puis make rebuild sur le poste.
|
|
11
|
+
MESSAGE
|
|
12
|
+
exit 1
|
|
@@ -29,6 +29,7 @@ etat_json() {
|
|
|
29
29
|
local plat_nom plat_url="" github_json="null"
|
|
30
30
|
local outils_retards_json='[]' outils_commande=""
|
|
31
31
|
local modules_json='[]' m actif desc ef content etat_val echec_val commande_val s
|
|
32
|
+
local docker_hote=false docker_hote_actif=false relais_source
|
|
32
33
|
local services_cluster="" services_distant=false
|
|
33
34
|
local travail_ctx="" travail_interne=false ctx_hote=""
|
|
34
35
|
local clusters_services_raw="" clusters_travail_raw="" clusters_commande=""
|
|
@@ -158,6 +159,16 @@ etat_json() {
|
|
|
158
159
|
<<<"$modules_json")"
|
|
159
160
|
done
|
|
160
161
|
|
|
162
|
+
# Option docker-hote (#432) : absente = on ; socket réellement monté
|
|
163
|
+
# (même source que docker-relais.sh), peut différer jusqu'au make rebuild
|
|
164
|
+
if [ "$(valeur docker-hote)" = on ]; then
|
|
165
|
+
docker_hote=true
|
|
166
|
+
fi
|
|
167
|
+
relais_source="${DEVZONE_RELAIS_SOURCE:-/var/run/docker-host.sock}"
|
|
168
|
+
if [ -e "$relais_source" ]; then
|
|
169
|
+
docker_hote_actif=true
|
|
170
|
+
fi
|
|
171
|
+
|
|
161
172
|
services_cluster="$(cluster_lu)"
|
|
162
173
|
if [ -n "$services_cluster" ] && ! cluster_est_local "$services_cluster"; then
|
|
163
174
|
services_distant=true
|
|
@@ -239,6 +250,8 @@ etat_json() {
|
|
|
239
250
|
--argjson retards "$outils_retards_json" \
|
|
240
251
|
--arg outils_commande "$outils_commande" \
|
|
241
252
|
--argjson modules "$modules_json" \
|
|
253
|
+
--argjson docker_hote "$docker_hote" \
|
|
254
|
+
--argjson docker_hote_actif "$docker_hote_actif" \
|
|
242
255
|
--arg clusters_services "$clusters_services_raw" \
|
|
243
256
|
--argjson services_distant "$services_distant" \
|
|
244
257
|
--arg clusters_travail "$clusters_travail_raw" \
|
|
@@ -256,6 +269,8 @@ etat_json() {
|
|
|
256
269
|
plateforme: { nom: $plat_nom, url: (if $plat_url=="" then null else $plat_url end), github: $github },
|
|
257
270
|
outils: { retards: $retards, commande: (if $outils_commande=="" then null else $outils_commande end) },
|
|
258
271
|
modules: $modules,
|
|
272
|
+
docker_hote: $docker_hote,
|
|
273
|
+
docker_hote_actif: $docker_hote_actif,
|
|
259
274
|
clusters: { services: (if $clusters_services=="" then null else $clusters_services end), services_distant: $services_distant, travail: (if $clusters_travail=="" then null else $clusters_travail end), travail_interne: $travail_interne, commande: (if $clusters_commande=="" then null else $clusters_commande end) },
|
|
260
275
|
ports: $ports,
|
|
261
276
|
applications: (if $applications=="" then null else $applications end),
|
|
@@ -58,6 +58,11 @@ sudo ln -sf /workspaces/devzone/.devcontainer/devzone /usr/local/bin/devzone
|
|
|
58
58
|
# Accès au cluster du poste (hote.config) avant les modules qui en dépendent
|
|
59
59
|
# (#370) ; un échec n'arrête pas la création, le démarrage la relance
|
|
60
60
|
bash /workspaces/devzone/.devcontainer/kube-config.sh || echo "devzone : configuration kube incomplète, réessayer : devzone demarrer" >&2
|
|
61
|
+
# Sans la feature docker-outside-of-docker (option docker-hote=off, #432),
|
|
62
|
+
# docker n'est pas installé : un message clair renvoie au workspace Kubernetes
|
|
63
|
+
if ! command -v docker >/dev/null 2>&1; then
|
|
64
|
+
sudo install -m 0755 /workspaces/devzone/.devcontainer/docker-sans-hote.sh /usr/local/bin/docker
|
|
65
|
+
fi
|
|
61
66
|
devzone appliquer || echo "devzone : modules incomplets (détail ci-dessus), réessayer : devzone appliquer" >&2
|
|
62
67
|
# Paquets systeme gardes (#351) : reinstallees a chaque creation ; un echec n arrete pas la creation
|
|
63
68
|
devzone paquets appliquer || echo "devzone : paquets en echec, reessayer : devzone paquets" >&2
|
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ devzone les évite : le même environnement sur chaque poste, sur ta machine.
|
|
|
24
24
|
|
|
25
25
|
- Pas de systemd : les services fournis par devzone démarrent avec devzone, pas avec `systemctl`.
|
|
26
26
|
- Pas de bureau graphique : tout se passe en terminal ou dans VS Code.
|
|
27
|
-
- Le socket Docker de l'hôte est partagé : c'est un compromis de sécurité assumé, qui donne un accès administrateur au Docker de l'hôte, y compris aux agents IA ([#291](https://github.com/SimBienvenueHoulBoumi/devzone/issues/291)).
|
|
27
|
+
- Le socket Docker de l'hôte est partagé par défaut : c'est un compromis de sécurité assumé, qui donne un accès administrateur au Docker de l'hôte, y compris aux agents IA ([#291](https://github.com/SimBienvenueHoulBoumi/devzone/issues/291)). Pour le retirer : `devzone desactiver docker-hote`, puis `make rebuild` sur le poste. Sans ce socket, `docker` renvoie vers le workspace Kubernetes (`devzone workspace`, kubedock et BuildKit) ; les conteneurs et kind lancés sur le Docker du poste ne fonctionnent plus dans le conteneur, alors que la connexion au cluster Kubernetes de l'hôte et les modules restent utilisables. Pour le remettre : `devzone activer docker-hote`, puis `make rebuild`.
|
|
28
28
|
|
|
29
29
|
## Comment ça marche
|
|
30
30
|
|
package/manage/devzone
CHANGED
package/manage/scripts/lancer.sh
CHANGED
|
@@ -21,6 +21,47 @@ case "$mode" in
|
|
|
21
21
|
exit 2
|
|
22
22
|
;;
|
|
23
23
|
esac
|
|
24
|
+
|
|
25
|
+
# Socket Docker de l'hôte (#432) : ligne docker-hote de l'état de l'instance,
|
|
26
|
+
# écrite par devzone dans le conteneur. Absente ou on : comportement historique.
|
|
27
|
+
hote_off() {
|
|
28
|
+
local v
|
|
29
|
+
v="$(grep -E '^docker-hote=' "$DOSSIER/.devzone.modules" 2>/dev/null | tail -1 | cut -d= -f2 || true)"
|
|
30
|
+
[ "$v" = off ]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# Copie de devcontainer.json sans la feature docker-outside-of-docker, pour un
|
|
34
|
+
# conteneur sans le socket de l'hôte. Le fichier vit un niveau plus bas : les
|
|
35
|
+
# chemins de build remontent d'un cran (../). Écrit à chaque lancement, dans un
|
|
36
|
+
# dossier ignoré par git ; les commentaires du JSON d'origine sont gardés.
|
|
37
|
+
generer_config_sans_docker_hote() {
|
|
38
|
+
local dossier="$DOSSIER/.devcontainer/sans-docker-hote" contexte=non
|
|
39
|
+
grep -q '"context"' "$DOSSIER/.devcontainer/devcontainer.json" && contexte=oui
|
|
40
|
+
mkdir -p "$dossier"
|
|
41
|
+
awk -v contexte="$contexte" '
|
|
42
|
+
/ghcr\.io\/devcontainers\/features\/docker-outside-of-docker/ { next }
|
|
43
|
+
/"build"[[:space:]]*:[[:space:]]*\{[[:space:]]*"dockerfile"[[:space:]]*:[[:space:]]*"Dockerfile"[[:space:]]*\}/ {
|
|
44
|
+
sub(/\{[[:space:]]*"dockerfile"[[:space:]]*:[[:space:]]*"Dockerfile"[[:space:]]*\}/,
|
|
45
|
+
"{ \"dockerfile\": \"../Dockerfile\", \"context\": \"..\" }")
|
|
46
|
+
print
|
|
47
|
+
next
|
|
48
|
+
}
|
|
49
|
+
contexte == "non" && /"build"[[:space:]]*:[[:space:]]*\{[[:space:]]*$/ {
|
|
50
|
+
print
|
|
51
|
+
print " \"context\": \"..\","
|
|
52
|
+
next
|
|
53
|
+
}
|
|
54
|
+
/"dockerfile"[[:space:]]*:/ {
|
|
55
|
+
sub(/"dockerfile"[[:space:]]*:[[:space:]]*"[^"]*"/, "\"dockerfile\": \"../Dockerfile\"")
|
|
56
|
+
}
|
|
57
|
+
{ print }
|
|
58
|
+
' "$DOSSIER/.devcontainer/devcontainer.json" >"$dossier/devcontainer.json"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if hote_off; then
|
|
62
|
+
generer_config_sans_docker_hote
|
|
63
|
+
options+=(--config "$DOSSIER/.devcontainer/sans-docker-hote/devcontainer.json")
|
|
64
|
+
fi
|
|
24
65
|
LOG="$DOSSIER/.devzone.log"
|
|
25
66
|
VIE="${DEVZONE_SIGNE_DE_VIE:-30}"
|
|
26
67
|
QUESTION="${DEVZONE_ATTENTE_QUESTION:-20}"
|