devzone 0.42.0 → 0.43.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/Dockerfile +1 -1
- package/.devcontainer/agent.sh +1 -1
- package/.devcontainer/argocd/apps.sh +2 -2
- package/.devcontainer/argocd/argocd.sh +22 -10
- package/.devcontainer/argocd/catalogue-argocd.sh +4 -0
- package/.devcontainer/argocd/gitops-gitlab.sh +127 -0
- package/.devcontainer/argocd/gitops.sh +12 -2
- package/.devcontainer/argocd/services-hook.sh +181 -0
- package/.devcontainer/catalogue/app.sh +29 -12
- package/.devcontainer/catalogue/catalogue-veilleur.sh +2 -2
- package/.devcontainer/catalogue/mysql/installer.sh +9 -8
- package/.devcontainer/catalogue/mysql/mysql.sh +42 -29
- package/.devcontainer/catalogue/mysql/volume.sh +5 -5
- package/.devcontainer/catalogue.sh +30 -36
- package/.devcontainer/chart-direct.sh +49 -0
- package/.devcontainer/cluster.sh +11 -11
- package/.devcontainer/clusters.sh +1 -1
- package/.devcontainer/command-aliases.sh +152 -2
- package/.devcontainer/demarrage.sh +18 -15
- package/.devcontainer/devcontainer.json +1 -1
- package/.devcontainer/devzone +114 -122
- package/.devcontainer/docker-relais.sh +2 -2
- package/.devcontainer/docker-sans-hote.sh +1 -1
- package/.devcontainer/etat-json.sh +16 -16
- package/.devcontainer/etat.sh +4 -4
- package/.devcontainer/gitlab/argocd.sh +54 -0
- package/.devcontainer/gitlab/chart.sh +39 -0
- package/.devcontainer/gitlab/gitlab.sh +35 -180
- package/.devcontainer/gitlab/installation.sh +34 -47
- package/.devcontainer/gitlab/secrets.sh +2 -2
- package/.devcontainer/gitlab/seed.sh +204 -0
- package/.devcontainer/gitlab/test-gitlab-restes.sh +16 -0
- package/.devcontainer/gitlab/test-gitlab.sh +14 -13
- package/.devcontainer/help.sh +40 -0
- package/.devcontainer/kube-compte.sh +2 -2
- package/.devcontainer/kube-config.sh +1 -1
- package/.devcontainer/kube-joignable.sh +2 -0
- package/.devcontainer/opencode.jsonc +1 -1
- package/.devcontainer/paquets.sh +31 -18
- package/.devcontainer/ports-auto.sh +6 -6
- package/.devcontainer/ports-json.sh +34 -0
- package/.devcontainer/ports.sh +34 -43
- package/.devcontainer/post-create.sh +3 -3
- package/.devcontainer/postgres/postgres.sh +46 -32
- package/.devcontainer/services-admin.sh +13 -3
- package/.devcontainer/skills/devzone/SKILL.md +16 -16
- package/.devcontainer/versions.env +1 -1
- package/README.md +72 -40
- package/charts/devzone-gitlab/Chart.lock +9 -0
- package/charts/devzone-gitlab/Chart.yaml +15 -0
- package/charts/devzone-gitlab/values.yaml +94 -0
- package/charts/devzone-mysql/values.yaml +3 -3
- package/charts/devzone-postgres/values.yaml +2 -2
- package/manage/scripts/check-charts.sh +67 -19
- package/manage/scripts/docker-workstation.sh +73 -0
- package/manage/scripts/lancer.sh +1 -1
- package/manage/scripts/migrer-retour.sh +1 -0
- package/manage/scripts/migrer.sh +6 -0
- package/manage/scripts/services-workspace.sh +11 -3
- package/package.json +1 -1
- package/.devcontainer/catalogue/mysql/manifeste.yaml +0 -81
- package/.devcontainer/gitlab/runner-values.yaml +0 -27
- package/.devcontainer/gitlab/values.yaml +0 -83
- package/.devcontainer/postgres/postgres.yaml +0 -84
package/.devcontainer/paquets.sh
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
# par ligne, triés, sans doublon), réinstallée à chaque création du conteneur
|
|
5
5
|
# (post-create.sh). Un paquet installé à la main est perdu par un rebuild, sauf
|
|
6
6
|
# s'il est dans cette liste.
|
|
7
|
-
# paquets.sh ou paquets.sh
|
|
8
|
-
# paquets.sh
|
|
9
|
-
# paquets.sh
|
|
10
|
-
# paquets.sh
|
|
7
|
+
# paquets.sh ou paquets.sh list liste avec l'état de chaque paquet
|
|
8
|
+
# paquets.sh add <nom>… valide, installe, ajoute à la liste
|
|
9
|
+
# paquets.sh remove <nom>… retire de la liste et désinstalle (sauf paquet de l'image)
|
|
10
|
+
# paquets.sh apply installe tout ce qui manque (post-create.sh)
|
|
11
11
|
# L'état d'un paquet vient de dpkg-query -W -f='${Status}' ; les commandes
|
|
12
12
|
# système passent par des variables surchargeables pour les tests (sudo, apt-get,
|
|
13
13
|
# apt-cache, dpkg-query, marque, horodatage). Compatible bash 3.2 (macOS).
|
|
@@ -23,9 +23,22 @@ APT="${DEVZONE_PAQUETS_APT:-apt-get}"
|
|
|
23
23
|
APTCACHE="${DEVZONE_PAQUETS_APTCACHE:-apt-cache}"
|
|
24
24
|
DPKGQUERY="${DEVZONE_PAQUETS_DPKG_QUERY:-dpkg-query}"
|
|
25
25
|
FORMAT="-f=\${Status}"
|
|
26
|
-
ENTETE="# paquets ajoutés par devzone
|
|
26
|
+
ENTETE="# paquets ajoutés par devzone packages add ; réinstallés à chaque création du conteneur"
|
|
27
27
|
PRESENT="# déjà présent"
|
|
28
28
|
|
|
29
|
+
# English command names are accepted (#557) : a copied script may miss the file
|
|
30
|
+
# shellcheck source=SCRIPTDIR/command-aliases.sh
|
|
31
|
+
# shellcheck disable=SC1091
|
|
32
|
+
if [ -f "$ICI/command-aliases.sh" ]; then
|
|
33
|
+
. "$ICI/command-aliases.sh"
|
|
34
|
+
fi
|
|
35
|
+
# Subcommand and options become their canonical English names ; the old
|
|
36
|
+
# French names warn on use (#557)
|
|
37
|
+
if command -v canonical_args >/dev/null 2>&1; then
|
|
38
|
+
canonical_args packages "$@"
|
|
39
|
+
set -- "${ARGS_CANONICAL[@]+"${ARGS_CANONICAL[@]}"}"
|
|
40
|
+
fi
|
|
41
|
+
|
|
29
42
|
refuse() { echo "devzone : paquets : $*" >&2; exit 1; }
|
|
30
43
|
|
|
31
44
|
en_root() {
|
|
@@ -91,7 +104,7 @@ lister() {
|
|
|
91
104
|
local paquets paquet
|
|
92
105
|
paquets="$(noms_liste)"
|
|
93
106
|
if [ -z "$paquets" ]; then
|
|
94
|
-
echo "aucun paquet (devzone
|
|
107
|
+
echo "aucun paquet (devzone packages add <nom>)"
|
|
95
108
|
return 0
|
|
96
109
|
fi
|
|
97
110
|
while IFS= read -r paquet; do
|
|
@@ -110,11 +123,11 @@ ajouter() {
|
|
|
110
123
|
local arg nom ligne deja=""
|
|
111
124
|
for arg in "$@"; do
|
|
112
125
|
case "$arg" in
|
|
113
|
-
-*) refuse "argument inconnu : $arg (devzone
|
|
126
|
+
-*) refuse "argument inconnu : $arg (devzone packages add <nom>…)" ;;
|
|
114
127
|
*) a+=("$arg") ;;
|
|
115
128
|
esac
|
|
116
129
|
done
|
|
117
|
-
[ "${#a[@]}" -gt 0 ] || refuse "ajouter attend au moins un nom : devzone
|
|
130
|
+
[ "${#a[@]}" -gt 0 ] || refuse "ajouter attend au moins un nom : devzone packages add <nom>…"
|
|
118
131
|
maj_index || echo "index apt non mis à jour" >&2
|
|
119
132
|
for nom in "${a[@]}"; do
|
|
120
133
|
if ! "$APTCACHE" show "$nom" >/dev/null 2>&1; then
|
|
@@ -138,7 +151,7 @@ ajouter() {
|
|
|
138
151
|
case " $deja " in
|
|
139
152
|
*" $nom "*)
|
|
140
153
|
entrees+=("$nom $PRESENT")
|
|
141
|
-
echo "$nom : déjà présent avant devzone
|
|
154
|
+
echo "$nom : déjà présent avant devzone packages (marqué ; retirer le laissera installé)"
|
|
142
155
|
;;
|
|
143
156
|
*) entrees+=("$nom") ;;
|
|
144
157
|
esac
|
|
@@ -156,14 +169,14 @@ retirer() {
|
|
|
156
169
|
local arg nom ligne nom_ligne
|
|
157
170
|
for arg in "$@"; do
|
|
158
171
|
case "$arg" in
|
|
159
|
-
-*) refuse "argument inconnu : $arg (devzone
|
|
172
|
+
-*) refuse "argument inconnu : $arg (devzone packages remove <nom>…)" ;;
|
|
160
173
|
*) a+=("$arg") ;;
|
|
161
174
|
esac
|
|
162
175
|
done
|
|
163
|
-
[ "${#a[@]}" -gt 0 ] || refuse "retirer attend au moins un nom : devzone
|
|
176
|
+
[ "${#a[@]}" -gt 0 ] || refuse "retirer attend au moins un nom : devzone packages remove <nom>…"
|
|
164
177
|
for nom in "${a[@]}"; do
|
|
165
178
|
nom_listee "$nom" ||
|
|
166
|
-
refuse "paquet non listé : $nom (fourni par l'image ?) : devzone
|
|
179
|
+
refuse "paquet non listé : $nom (fourni par l'image ?) : devzone packages remove n'ajoute pas les paquets de l'image"
|
|
167
180
|
if ! marque_presente "$nom"; then
|
|
168
181
|
desinstalles+=("$nom")
|
|
169
182
|
fi
|
|
@@ -173,7 +186,7 @@ retirer() {
|
|
|
173
186
|
fi
|
|
174
187
|
for nom in "${a[@]}"; do
|
|
175
188
|
if marque_presente "$nom"; then
|
|
176
|
-
echo "$nom : retiré de la liste, laissé installé (présent avant devzone
|
|
189
|
+
echo "$nom : retiré de la liste, laissé installé (présent avant devzone packages)"
|
|
177
190
|
fi
|
|
178
191
|
done
|
|
179
192
|
while IFS= read -r ligne; do
|
|
@@ -217,10 +230,10 @@ appliquer() {
|
|
|
217
230
|
}
|
|
218
231
|
|
|
219
232
|
case "${1:-}" in
|
|
220
|
-
'' |
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
233
|
+
'' | list) lister ;;
|
|
234
|
+
add) ajouter "${@:2}" ;;
|
|
235
|
+
remove) retirer "${@:2}" ;;
|
|
236
|
+
apply) appliquer ;;
|
|
224
237
|
-h | --help | aide) awk 'NR==1{next} /^#$/{exit} /^#/{sub(/^# ?/,""); print; next} {exit}' "${BASH_SOURCE[0]}" ;;
|
|
225
|
-
*) refuse "commande inconnue : ${1:-(aucune)} (devzone
|
|
238
|
+
*) refuse "commande inconnue : ${1:-(aucune)} (devzone packages --help)" ;;
|
|
226
239
|
esac
|
|
@@ -36,7 +36,7 @@ garde_veilleur() {
|
|
|
36
36
|
return 2
|
|
37
37
|
fi
|
|
38
38
|
[ "${DEVZONE_PORTS_AUTO_REEL:-}" = oui ] && return 0
|
|
39
|
-
echo "devzone : port : veilleur automatique refusé ici : lancer plutôt devzone
|
|
39
|
+
echo "devzone : port : veilleur automatique refusé ici : lancer plutôt devzone repair" >&2
|
|
40
40
|
return 2
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -199,7 +199,7 @@ ports_auto_liste() {
|
|
|
199
199
|
[ -n "$port" ] || continue
|
|
200
200
|
if grep -qxF "$port" "$OCCUPES" 2>/dev/null; then printf ' %-5s %s auto\n' "$port" "occupé sur le poste"; continue; fi
|
|
201
201
|
if relais_auto_actif "$port"; then marque="● actif"; else marque="○ arrêté"; fi
|
|
202
|
-
if application_repond "$port"; then app="
|
|
202
|
+
if application_repond "$port"; then app="$APP_REPOND"; else app="$APP_AUCUNE"; fi
|
|
203
203
|
printf ' %-5s %s auto %s\n' "$port" "$marque" "$app"
|
|
204
204
|
done <"$ACTIFS"
|
|
205
205
|
fi
|
|
@@ -224,7 +224,7 @@ ports_auto_liste_json() {
|
|
|
224
224
|
json="$(jq -c --argjson port "$port" '. + [{port:$port,actif:false,application:"occupé sur le poste",auto:true}]' <<<"$json")"; continue
|
|
225
225
|
fi
|
|
226
226
|
if relais_auto_actif "$port"; then actif=true; else actif=false; fi
|
|
227
|
-
if application_repond "$port"; then app="
|
|
227
|
+
if application_repond "$port"; then app="$APP_REPOND"; else app="$APP_AUCUNE"; fi
|
|
228
228
|
json="$(jq -c --argjson port "$port" --argjson actif "$actif" --arg app "$app" '. + [{port:$port,actif:$actif,application:$app,auto:true}]' <<<"$json")"
|
|
229
229
|
done <<<"$ports"
|
|
230
230
|
printf '%s\n' "$json"
|
|
@@ -234,12 +234,12 @@ if [ "${BASH_SOURCE[0]}" = "$0" ]; then
|
|
|
234
234
|
case "${1:-}" in
|
|
235
235
|
''|boucle|loop) if ! garde_veilleur; then exit 2; fi; ports_auto_boucle ;;
|
|
236
236
|
tour|one|un-tour) ports_auto_tour ;;
|
|
237
|
-
demarrer|start|lancer) if ! garde_veilleur; then exit 2; fi; if kill -0 "$(cat "$VERROU/pid" 2>/dev/null)" 2>/dev/null; then echo "déjà lancé"; else DEVZONE_PORTS_AUTO_REEL=oui bash "$0" boucle >/dev/null 2>&1 & echo "lancé"; fi ;;
|
|
237
|
+
demarrer|start|lancer) if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then echo "ports: Kubernetes workspace, ports go through devzone workspace ports"; exit 0; fi; if ! garde_veilleur; then exit 2; fi; if kill -0 "$(cat "$VERROU/pid" 2>/dev/null)" 2>/dev/null; then echo "déjà lancé"; else DEVZONE_PORTS_AUTO_REEL=oui bash "$0" boucle >/dev/null 2>&1 & echo "lancé"; fi ;;
|
|
238
238
|
arreter|stop) arreter_veilleur; echo "arrêté" ;;
|
|
239
239
|
nettoyer|clean) nettoyer_auto_tout ;;
|
|
240
240
|
auto) case "${2:-}" in on) ecrire ports_auto on; echo "✔ ports auto activés" ;; off) ecrire ports_auto off; arreter_veilleur; echo "✔ ports auto désactivés" ;; *) echo "devzone : port : auto on|off" >&2; exit 2 ;; esac ;;
|
|
241
|
-
exclure) ports_auto_exclure "${2:-}" ;;
|
|
242
|
-
inclure) ports_auto_inclure "${2:-}" ;;
|
|
241
|
+
exclude|exclure) ports_auto_exclure "${2:-}" ;;
|
|
242
|
+
include|inclure) ports_auto_inclure "${2:-}" ;;
|
|
243
243
|
liste_auto) ports_auto_liste ;;
|
|
244
244
|
liste_json_auto) ports_auto_liste_json ;;
|
|
245
245
|
-h|--help|aide) sed -n '2,8p' "$0" | sed 's/^# \{0,1\}//' ;;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# JSON output of the port relays (#557) : the array
|
|
3
|
+
# [{port,actif,application,auto}] read by the tools (devzone status --json).
|
|
4
|
+
# Sourced by ports.sh, which holds the functions used here.
|
|
5
|
+
|
|
6
|
+
# JSON list of the relays of the state : jq only
|
|
7
|
+
liste_json() {
|
|
8
|
+
local ports port actif app json='[]'
|
|
9
|
+
ports="$(trier_ports "$(lire_ports)")"
|
|
10
|
+
if [ -z "$ports" ]; then
|
|
11
|
+
printf '[]\n'
|
|
12
|
+
return 0
|
|
13
|
+
fi
|
|
14
|
+
# shellcheck disable=SC2046 # list of ports separated by commas
|
|
15
|
+
for port in $(printf '%s' "$ports" | tr ',' ' '); do
|
|
16
|
+
if relais_actif "$port"; then
|
|
17
|
+
actif=true
|
|
18
|
+
else
|
|
19
|
+
actif=false
|
|
20
|
+
fi
|
|
21
|
+
if application_repond "$port"; then
|
|
22
|
+
app="$APP_REPOND"
|
|
23
|
+
else
|
|
24
|
+
app="$APP_AUCUNE"
|
|
25
|
+
fi
|
|
26
|
+
json="$(jq -c --argjson port "$port" --argjson actif "$actif" --arg app "$app" \
|
|
27
|
+
'. + [{port:$port,actif:$actif,application:$app,auto:false}]' <<<"$json")"
|
|
28
|
+
done
|
|
29
|
+
auto_json="$(bash "$ICI/ports-auto.sh" liste_json_auto 2>/dev/null || echo '[]')"
|
|
30
|
+
if [ -n "$auto_json" ] && [ "$auto_json" != "[]" ]; then
|
|
31
|
+
json="$(jq -s 'add' <<<"$json"$'\n'"$auto_json")"
|
|
32
|
+
fi
|
|
33
|
+
printf '%s\n' "$json"
|
|
34
|
+
}
|
package/.devcontainer/ports.sh
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# Relais de ports (#290) : applications du conteneur devzone accessibles
|
|
3
3
|
# depuis 127.0.0.1 du poste, un conteneur alpine/socat par port.
|
|
4
|
-
# ports.sh
|
|
5
|
-
# ports.sh
|
|
6
|
-
# ports.sh
|
|
7
|
-
# ports.sh
|
|
8
|
-
# ports.sh resume
|
|
4
|
+
# ports.sh open <n> ouvre le relais du port <n>
|
|
5
|
+
# ports.sh list relais de l'état : port, actif, application
|
|
6
|
+
# ports.sh close <n> retire le relais et le port de l'état
|
|
7
|
+
# ports.sh restart recrée les relais de l'état vers l'IP actuelle
|
|
8
|
+
# ports.sh resume résumé d'une ligne pour le récapitulatif devzone
|
|
9
9
|
# L'état est la ligne « ports=8080,3000 » de DEVZONE_ETAT (triée, sans doublon).
|
|
10
10
|
# RACINE : un seul dirname depuis ICI (.devcontainer) → racine du dépôt devzone.
|
|
11
11
|
if [ "${BASH_SOURCE[0]}" = "$0" ]; then set -euo pipefail; fi
|
|
@@ -21,9 +21,20 @@ INSTANCE="${DEVZONE_INSTANCE:-devzone}"
|
|
|
21
21
|
# shellcheck source=SCRIPTDIR/etat.sh
|
|
22
22
|
# shellcheck disable=SC1091
|
|
23
23
|
. "$ICI/etat.sh"
|
|
24
|
+
# English command names are accepted (#557) : a copied script may miss the file
|
|
25
|
+
# shellcheck source=SCRIPTDIR/command-aliases.sh
|
|
26
|
+
# shellcheck disable=SC1091
|
|
27
|
+
if [ -f "$ICI/command-aliases.sh" ]; then
|
|
28
|
+
. "$ICI/command-aliases.sh"
|
|
29
|
+
fi
|
|
24
30
|
|
|
25
31
|
refuse() { echo "devzone : port : $*" >&2; exit 1; }
|
|
26
32
|
|
|
33
|
+
# Libellés de l'application derrière un port (liste et JSON) : partagés avec
|
|
34
|
+
# ports-auto.sh et ports-json.sh
|
|
35
|
+
APP_REPOND="application répond"
|
|
36
|
+
APP_AUCUNE="aucune application"
|
|
37
|
+
|
|
27
38
|
nom_relais() { echo "devzone-$INSTANCE-port-$1"; }
|
|
28
39
|
|
|
29
40
|
port_valide() { case "${1:-}" in '' | *[!0-9]*) return 1 ;; esac; [ "$1" -ge 1 ] 2>/dev/null && [ "$1" -le 65535 ] 2>/dev/null; }
|
|
@@ -151,9 +162,9 @@ liste() {
|
|
|
151
162
|
marque="○ arrêté"
|
|
152
163
|
fi
|
|
153
164
|
if application_repond "$port"; then
|
|
154
|
-
app="
|
|
165
|
+
app="$APP_REPOND"
|
|
155
166
|
else
|
|
156
|
-
app="
|
|
167
|
+
app="$APP_AUCUNE"
|
|
157
168
|
fi
|
|
158
169
|
printf ' %-5s %s %s\n' "$port" "$marque" "$app"
|
|
159
170
|
done
|
|
@@ -164,7 +175,7 @@ resume() {
|
|
|
164
175
|
local ports port sortie=""
|
|
165
176
|
ports="$(trier_ports "$(lire_ports)")"
|
|
166
177
|
if [ -z "$ports" ]; then
|
|
167
|
-
echo "
|
|
178
|
+
echo "none (devzone port <n>)"
|
|
168
179
|
return 0
|
|
169
180
|
fi
|
|
170
181
|
# shellcheck disable=SC2046 # liste de ports séparés par des virgules
|
|
@@ -201,47 +212,27 @@ relancer() {
|
|
|
201
212
|
}
|
|
202
213
|
|
|
203
214
|
# Sortie lisible par machine de liste : tableau JSON [{port,actif,application}], via jq seul.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
if [ -z "$ports" ]; then
|
|
208
|
-
printf '[]\n'
|
|
209
|
-
return 0
|
|
210
|
-
fi
|
|
211
|
-
# shellcheck disable=SC2046 # liste de ports séparés par des virgules
|
|
212
|
-
for port in $(printf '%s' "$ports" | tr ',' ' '); do
|
|
213
|
-
if relais_actif "$port"; then
|
|
214
|
-
actif=true
|
|
215
|
-
else
|
|
216
|
-
actif=false
|
|
217
|
-
fi
|
|
218
|
-
if application_repond "$port"; then
|
|
219
|
-
app="application répond"
|
|
220
|
-
else
|
|
221
|
-
app="aucune application"
|
|
222
|
-
fi
|
|
223
|
-
json="$(jq -c --argjson port "$port" --argjson actif "$actif" --arg app "$app" \
|
|
224
|
-
'. + [{port:$port,actif:$actif,application:$app,auto:false}]' <<<"$json")"
|
|
225
|
-
done
|
|
226
|
-
auto_json="$(bash "$ICI/ports-auto.sh" liste_json_auto 2>/dev/null || echo '[]')"
|
|
227
|
-
if [ -n "$auto_json" ] && [ "$auto_json" != "[]" ]; then
|
|
228
|
-
json="$(jq -s 'add' <<<"$json"$'\n'"$auto_json")"
|
|
229
|
-
fi
|
|
230
|
-
printf '%s\n' "$json"
|
|
231
|
-
}
|
|
232
|
-
|
|
215
|
+
# shellcheck source=SCRIPTDIR/ports-json.sh
|
|
216
|
+
# shellcheck disable=SC1091
|
|
217
|
+
. "$ICI/ports-json.sh"
|
|
233
218
|
if [ "${BASH_SOURCE[0]}" = "$0" ]; then
|
|
219
|
+
# Subcommand and options become their canonical English names ; the old
|
|
220
|
+
# French names warn on use (#557)
|
|
221
|
+
if command -v canonical_args >/dev/null 2>&1; then
|
|
222
|
+
canonical_args port "$@"
|
|
223
|
+
set -- "${ARGS_CANONICAL[@]+"${ARGS_CANONICAL[@]}"}"
|
|
224
|
+
fi
|
|
234
225
|
case "${1:-}" in
|
|
235
|
-
'' |
|
|
226
|
+
'' | list)
|
|
236
227
|
if [ "${2:-}" = "--json" ]; then liste_json; else liste; fi
|
|
237
228
|
;;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
229
|
+
open) ouvrir "${2:-}" ;;
|
|
230
|
+
close | --close) fermer "${2:-}" ;;
|
|
231
|
+
restart) relancer ;;
|
|
241
232
|
resume) resume ;;
|
|
242
233
|
auto) bash "$ICI/ports-auto.sh" auto "${2:-}" "${3:-}" ;;
|
|
243
|
-
|
|
244
|
-
|
|
234
|
+
exclude) bash "$ICI/ports-auto.sh" exclude "${2:-}" ;;
|
|
235
|
+
include) bash "$ICI/ports-auto.sh" include "${2:-}" ;;
|
|
245
236
|
-h | --help | aide) sed -n '2,8p' "$0" | sed 's/^# \{0,1\}//' ;;
|
|
246
237
|
*) ouvrir "$1" ;;
|
|
247
238
|
esac
|
|
@@ -59,15 +59,15 @@ repowarden install --global --lang fr
|
|
|
59
59
|
sudo ln -sf /workspaces/devzone/.devcontainer/devzone /usr/local/bin/devzone
|
|
60
60
|
# Accès au cluster du poste (hote.config) avant les modules qui en dépendent
|
|
61
61
|
# (#370) ; un échec n'arrête pas la création, le démarrage la relance
|
|
62
|
-
bash /workspaces/devzone/.devcontainer/kube-config.sh || echo "devzone : configuration kube incomplète, réessayer : devzone
|
|
62
|
+
bash /workspaces/devzone/.devcontainer/kube-config.sh || echo "devzone : configuration kube incomplète, réessayer : devzone start" >&2
|
|
63
63
|
# Sans la feature docker-outside-of-docker (option docker-hote=off, #432),
|
|
64
64
|
# docker n'est pas installé : un message clair renvoie au workspace Kubernetes
|
|
65
65
|
if ! command -v docker >/dev/null 2>&1; then
|
|
66
66
|
sudo install -m 0755 /workspaces/devzone/.devcontainer/docker-sans-hote.sh /usr/local/bin/docker
|
|
67
67
|
fi
|
|
68
|
-
devzone apply || echo "devzone : modules incomplets (détail ci-dessus), réessayer : devzone
|
|
68
|
+
devzone apply || echo "devzone : modules incomplets (détail ci-dessus), réessayer : devzone apply" >&2
|
|
69
69
|
# Paquets systeme gardes (#351) : reinstallees a chaque creation ; un echec n arrete pas la creation
|
|
70
|
-
devzone packages
|
|
70
|
+
devzone packages apply || echo "devzone : paquets en echec, reessayer : devzone packages" >&2
|
|
71
71
|
|
|
72
72
|
# Invite Kubernetes du shell (#337) : prefixe PS1, une seule fois
|
|
73
73
|
if ! grep -qF 'invite-kube.sh' "$HOME/.bashrc" 2>/dev/null; then
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# Module postgres (#280) : PostgreSQL partagé dans le cluster de devzone
|
|
3
3
|
# (cluster.sh), une base et un utilisateur par projet.
|
|
4
|
-
# postgres.sh
|
|
5
|
-
# postgres.sh
|
|
6
|
-
# postgres.sh
|
|
7
|
-
# postgres.sh psql [<projet>]
|
|
8
|
-
# postgres.sh
|
|
4
|
+
# postgres.sh install | uninstall | status | relay-start | relay-stop
|
|
5
|
+
# postgres.sh create <projet> [--new-password] base, rôle, workspace/.postgres/<projet>.env
|
|
6
|
+
# postgres.sh list bases et propriétaires
|
|
7
|
+
# postgres.sh psql [<projet>] console dans le pod
|
|
8
|
+
# postgres.sh delete <projet> [--yes] base, rôle et fichier .env
|
|
9
9
|
# Secrets dans workspace/.postgres/ (600, ignorés par git), jamais affichés.
|
|
10
10
|
set -euo pipefail
|
|
11
11
|
|
|
@@ -18,10 +18,25 @@ ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
|
|
|
18
18
|
# shellcheck source=SCRIPTDIR/../password.sh
|
|
19
19
|
# shellcheck disable=SC1091
|
|
20
20
|
. "$ICI/../password.sh"
|
|
21
|
+
# shellcheck source=SCRIPTDIR/../chart-direct.sh
|
|
22
|
+
# shellcheck disable=SC1091
|
|
23
|
+
. "$ICI/../chart-direct.sh"
|
|
21
24
|
# Isolation réseau : namespace_isoler, d'où viennent les NetworkPolicies
|
|
22
25
|
# shellcheck source=SCRIPTDIR/../isolement.sh
|
|
23
26
|
# shellcheck disable=SC1091
|
|
24
27
|
. "$ICI/../isolement.sh"
|
|
28
|
+
# English command names are accepted (#557) : a copied script may miss the file
|
|
29
|
+
# shellcheck source=SCRIPTDIR/../command-aliases.sh
|
|
30
|
+
# shellcheck disable=SC1091
|
|
31
|
+
if [ -f "$ICI/../command-aliases.sh" ]; then
|
|
32
|
+
. "$ICI/../command-aliases.sh"
|
|
33
|
+
fi
|
|
34
|
+
# Subcommand and options become their canonical English names ; the old
|
|
35
|
+
# French names warn on use (#557)
|
|
36
|
+
if command -v canonical_args >/dev/null 2>&1; then
|
|
37
|
+
canonical_args postgres "$@"
|
|
38
|
+
set -- "${ARGS_CANONICAL[@]+"${ARGS_CANONICAL[@]}"}"
|
|
39
|
+
fi
|
|
25
40
|
|
|
26
41
|
NS=devzone-postgres
|
|
27
42
|
SECRETS="$RACINE/workspace/.postgres"
|
|
@@ -35,15 +50,15 @@ refuse() { echo "devzone : postgres : $*" >&2; exit 2; }
|
|
|
35
50
|
# Vue regroupée des identifiants : un échec n'empêche jamais l'opération
|
|
36
51
|
regenerer_identifiants() {
|
|
37
52
|
password_regenerer ||
|
|
38
|
-
echo "devzone : postgres : identifiants regroupés non mis à jour (devzone
|
|
53
|
+
echo "devzone : postgres : identifiants regroupés non mis à jour (devzone passwords)" >&2
|
|
39
54
|
}
|
|
40
55
|
|
|
41
56
|
# Contexte du module : celui du cluster de devzone ; sans choix, rien n'est
|
|
42
|
-
# installé (devzone
|
|
57
|
+
# installé (devzone enable postgres le fixe)
|
|
43
58
|
contexte() {
|
|
44
59
|
local c
|
|
45
60
|
c="$(cluster_lu)"
|
|
46
|
-
[ -n "$c" ] || refuse "aucun cluster choisi : devzone
|
|
61
|
+
[ -n "$c" ] || refuse "aucun cluster choisi : devzone enable postgres"
|
|
47
62
|
echo "$c"
|
|
48
63
|
}
|
|
49
64
|
|
|
@@ -114,8 +129,7 @@ installer() {
|
|
|
114
129
|
# Compte limité autorisé dans le namespace : RoleBinding vers edit
|
|
115
130
|
compte_autoriser "$CTX" "$NS"
|
|
116
131
|
secret_admin
|
|
117
|
-
|
|
118
|
-
kubectl --context devzone apply -f - >/dev/null
|
|
132
|
+
chart_install postgres "$NS" "size=$POSTGRES_TAILLE" || return 1
|
|
119
133
|
echo "▶ Attente de PostgreSQL (timeout ${POSTGRES_ATTENTE}s)…"
|
|
120
134
|
if ! k rollout status statefulset/postgres --timeout="${POSTGRES_ATTENTE}s" >/dev/null; then
|
|
121
135
|
echo "devzone : postgres : pas prêt après ${POSTGRES_ATTENTE}s : kubectl --context $CTX -n $NS describe pod postgres-0" >&2
|
|
@@ -124,7 +138,7 @@ installer() {
|
|
|
124
138
|
relais_arreter postgres
|
|
125
139
|
relais_lancer postgres "$CTX" "$NS" svc/postgres "$POSTGRES_PORT:5432"
|
|
126
140
|
echo "✔ PostgreSQL prêt : 127.0.0.1:$POSTGRES_PORT dans le conteneur"
|
|
127
|
-
echo " Base d'un projet : devzone postgres
|
|
141
|
+
echo " Base d'un projet : devzone postgres create <projet>"
|
|
128
142
|
regenerer_identifiants
|
|
129
143
|
}
|
|
130
144
|
|
|
@@ -161,9 +175,9 @@ etat() {
|
|
|
161
175
|
return 0
|
|
162
176
|
fi
|
|
163
177
|
if [ "$(k get statefulset postgres -o jsonpath='{.status.readyReplicas}' 2>/dev/null || true)" != 1 ]; then
|
|
164
|
-
echo "en échec sur $CTX : devzone
|
|
178
|
+
echo "en échec sur $CTX : devzone apply"
|
|
165
179
|
elif ! relais_actif postgres; then
|
|
166
|
-
echo "prêt sur $CTX, relais arrêté : devzone
|
|
180
|
+
echo "prêt sur $CTX, relais arrêté : devzone apply"
|
|
167
181
|
else
|
|
168
182
|
echo "prêt sur $CTX : 127.0.0.1:$POSTGRES_PORT, $(nombre_bases) base(s)"
|
|
169
183
|
fi
|
|
@@ -174,12 +188,12 @@ creer() {
|
|
|
174
188
|
valider_projet "$projet"
|
|
175
189
|
for arg in "${@:2}"; do
|
|
176
190
|
case "$arg" in
|
|
177
|
-
--
|
|
191
|
+
--new-password) nouveau=1 ;;
|
|
178
192
|
*) refuse "argument inconnu : $arg" ;;
|
|
179
193
|
esac
|
|
180
194
|
done
|
|
181
195
|
CTX="$(contexte)"
|
|
182
|
-
installe || refuse "module inactif : devzone
|
|
196
|
+
installe || refuse "module inactif : devzone enable postgres"
|
|
183
197
|
fichier="$SECRETS/$projet.env"
|
|
184
198
|
# Mot de passe gardé : une application déjà configurée continue de marcher
|
|
185
199
|
mdp="$(sed -n 's/^DB_PASSWORD=//p' "$fichier" 2>/dev/null || true)"
|
|
@@ -213,15 +227,15 @@ ENV
|
|
|
213
227
|
|
|
214
228
|
liste() {
|
|
215
229
|
CTX="$(contexte)"
|
|
216
|
-
installe || refuse "module inactif : devzone
|
|
230
|
+
installe || refuse "module inactif : devzone enable postgres"
|
|
217
231
|
psql_admin -At -F ' ' -c "SELECT datname, pg_get_userbyid(datdba) FROM pg_database WHERE datname NOT IN ('postgres','template0','template1') ORDER BY 1" |
|
|
218
|
-
awk 'BEGIN { n = 0 } { printf " %-30s propriétaire %s\n", $1, $2; n++ } END { if (n == 0) print " (aucune base : devzone postgres
|
|
232
|
+
awk 'BEGIN { n = 0 } { printf " %-30s propriétaire %s\n", $1, $2; n++ } END { if (n == 0) print " (aucune base : devzone postgres create <projet>)" }'
|
|
219
233
|
}
|
|
220
234
|
|
|
221
235
|
console() {
|
|
222
236
|
local projet="${1:-}" tty=()
|
|
223
237
|
CTX="$(contexte)"
|
|
224
|
-
installe || refuse "module inactif : devzone
|
|
238
|
+
installe || refuse "module inactif : devzone enable postgres"
|
|
225
239
|
[ -t 0 ] && tty=(-t)
|
|
226
240
|
if [ -n "$projet" ]; then
|
|
227
241
|
valider_projet "$projet"
|
|
@@ -236,14 +250,14 @@ supprimer() {
|
|
|
236
250
|
valider_projet "$projet"
|
|
237
251
|
for arg in "${@:2}"; do
|
|
238
252
|
case "$arg" in
|
|
239
|
-
--
|
|
253
|
+
--yes) oui=1 ;;
|
|
240
254
|
*) refuse "argument inconnu : $arg" ;;
|
|
241
255
|
esac
|
|
242
256
|
done
|
|
243
257
|
CTX="$(contexte)"
|
|
244
|
-
installe || refuse "module inactif : devzone
|
|
258
|
+
installe || refuse "module inactif : devzone enable postgres"
|
|
245
259
|
if [ -z "$oui" ]; then
|
|
246
|
-
cluster_interactif || refuse "confirmation impossible sans terminal : devzone postgres
|
|
260
|
+
cluster_interactif || refuse "confirmation impossible sans terminal : devzone postgres delete $projet --yes"
|
|
247
261
|
printf 'Supprimer la base %s et toutes ses données ? [o/N] ' "$projet" >&2
|
|
248
262
|
read -r reponse || reponse=""
|
|
249
263
|
case "$reponse" in
|
|
@@ -289,19 +303,19 @@ interdire() {
|
|
|
289
303
|
}
|
|
290
304
|
|
|
291
305
|
case "${1:-}" in
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
306
|
+
install) installer ;;
|
|
307
|
+
uninstall) desinstaller ;;
|
|
308
|
+
status) etat ;;
|
|
309
|
+
create) creer "${@:2}" ;;
|
|
310
|
+
list) liste ;;
|
|
297
311
|
psql) console "${@:2}" ;;
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
312
|
+
delete) supprimer "${@:2}" ;;
|
|
313
|
+
relay-start) relais ;;
|
|
314
|
+
relay-stop) relais_arreter postgres ;;
|
|
315
|
+
authorize) autoriser "${@:2}" ;;
|
|
316
|
+
forbid) interdire "${@:2}" ;;
|
|
303
317
|
*)
|
|
304
|
-
echo "devzone postgres :
|
|
318
|
+
echo "devzone postgres : create <projet> [--new-password] | list | psql [<projet>] | delete <projet> [--yes]" >&2
|
|
305
319
|
exit 1
|
|
306
320
|
;;
|
|
307
321
|
esac
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# Installs or removes a devzone service (gitlab, postgres, argocd) from inside
|
|
3
3
|
# the Kubernetes workspace pod, with a temporary administrator token (#528).
|
|
4
4
|
# services-admin.sh enable|disable <service> [options of devzone enable]
|
|
5
|
+
# services-admin.sh seed gitlab data of gitlab seeded again, in the pod (#538)
|
|
5
6
|
# Run by the workstation (manage/scripts/services-workspace.sh) through
|
|
6
7
|
# kubectl exec -i: the token comes on stdin, is never printed and lives only
|
|
7
8
|
# in a temporary kubeconfig removed at the end.
|
|
@@ -39,12 +40,17 @@ service="${2:-}"
|
|
|
39
40
|
case "$action" in
|
|
40
41
|
enable | activer) action=enable ;;
|
|
41
42
|
disable | desactiver) action=disable ;;
|
|
42
|
-
|
|
43
|
+
seed) ;;
|
|
44
|
+
*) refuse "usage: services-admin.sh enable|disable|seed gitlab|postgres|argocd [options]" ;;
|
|
43
45
|
esac
|
|
44
46
|
case "$service" in
|
|
45
47
|
gitlab | postgres | argocd) ;;
|
|
46
48
|
*) refuse "unknown service: ${service:-(none)} (gitlab, postgres, argocd)" ;;
|
|
47
49
|
esac
|
|
50
|
+
# The seed of the data (group, demo project, dev user, runner) is gitlab's (#538)
|
|
51
|
+
if [ "$action" = seed ] && [ "$service" != gitlab ]; then
|
|
52
|
+
refuse "seed: only gitlab"
|
|
53
|
+
fi
|
|
48
54
|
[ "${DEVZONE_WORKSPACE:-}" = kubernetes ] || refuse "only in the Kubernetes workspace pod"
|
|
49
55
|
[ -f "$SA_DIR/ca.crt" ] || refuse "cluster CA not found: $SA_DIR/ca.crt"
|
|
50
56
|
if [ -t 0 ]; then
|
|
@@ -62,7 +68,7 @@ cluster_before="$(grep -E '^cluster=' "$ETAT" 2>/dev/null | tail -1 | cut -d= -f
|
|
|
62
68
|
# cluster line of the state as before
|
|
63
69
|
cleanup() {
|
|
64
70
|
rm -f "$kubeconfig"
|
|
65
|
-
devzone "$service"
|
|
71
|
+
devzone "$service" relay-stop >/dev/null 2>&1 || true
|
|
66
72
|
if [ -n "$cluster_before" ]; then
|
|
67
73
|
etat_ecrire cluster "$cluster_before" || true
|
|
68
74
|
else
|
|
@@ -102,4 +108,8 @@ export DEVZONE_KUBE_CONFIG="$kubeconfig"
|
|
|
102
108
|
export DEVZONE_SERVICES_ADMIN=1
|
|
103
109
|
etat_ecrire cluster "$ADMIN_CONTEXT" || refuse "cannot write the state: $ETAT"
|
|
104
110
|
echo "devzone services: $action $service in the cluster of the pod (temporary administrator)"
|
|
105
|
-
|
|
111
|
+
case "$action" in
|
|
112
|
+
# The seed is a module command: devzone gitlab seed (#538)
|
|
113
|
+
seed) devzone gitlab seed "${@:3}" ;;
|
|
114
|
+
*) devzone "$action" "$service" "${@:3}" ;;
|
|
115
|
+
esac
|
|
@@ -3,11 +3,11 @@ name: devzone
|
|
|
3
3
|
description: Utiliser pour travailler dans un conteneur devzone — modules et catalogue, devzone agent, worktrees, garde-fou.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
<!-- devzone : skill posée par devzone
|
|
6
|
+
<!-- devzone : skill posée par devzone enable ia -->
|
|
7
7
|
|
|
8
8
|
# Skill devzone (assistants IA)
|
|
9
9
|
|
|
10
|
-
Cette skill est pour Claude Code (lead) et opencode (développeur) dans un conteneur devzone. Elle est posée par `devzone
|
|
10
|
+
Cette skill est pour Claude Code (lead) et opencode (développeur) dans un conteneur devzone. Elle est posée par `devzone enable ia` dans `~/.claude/skills/devzone/` et `~/.config/opencode/skills/devzone/` (volumes, gardés aux rebuilds). Pour la personnaliser sans qu'elle soit remplacée, retirer la ligne repère ci-dessus.
|
|
11
11
|
|
|
12
12
|
## Règle d'or
|
|
13
13
|
|
|
@@ -23,20 +23,20 @@ Les projets vivent dans `workspace/` ; les worktrees des tickets sous `workspace
|
|
|
23
23
|
|
|
24
24
|
Les modules sont désactivés par défaut, activés à la demande, sans rebuild :
|
|
25
25
|
|
|
26
|
-
- `devzone
|
|
27
|
-
- `devzone
|
|
28
|
-
- `devzone
|
|
29
|
-
- `devzone
|
|
30
|
-
- `devzone
|
|
31
|
-
- `devzone
|
|
32
|
-
- `devzone
|
|
33
|
-
- `devzone
|
|
34
|
-
- `devzone
|
|
35
|
-
- `devzone
|
|
36
|
-
- `devzone
|
|
37
|
-
- `devzone
|
|
38
|
-
|
|
39
|
-
Le catalogue d'applications se consulte avec `devzone
|
|
26
|
+
- `devzone enable ia` : Claude Code et opencode (versions figées), garde-fou repowarden, configuration opencode par défaut. Se connecter ensuite : `claude` (puis `/login`), `opencode auth login`.
|
|
27
|
+
- `devzone disable ia` : désinstalle les assistants ; retire le garde-fou et la configuration opencode par défaut ; garde l'état de `devzone agent`, les journaux `workspace/.agents/` et les connexions.
|
|
28
|
+
- `devzone enable kubernetes` : se connecte au cluster de la machine à chaque démarrage et installe metrics-server sur les clusters locaux.
|
|
29
|
+
- `devzone enable gitlab` : installe GitLab de test dans le cluster des services (namespace `devzone-gitlab*`).
|
|
30
|
+
- `devzone enable postgres` : PostgreSQL partagé, une base par projet (`devzone postgres create <projet>`).
|
|
31
|
+
- `devzone enable mysql` : MySQL partagé du catalogue, une base par projet.
|
|
32
|
+
- `devzone enable argocd` : Argo CD du cluster des services, interface dans le conteneur sur https://127.0.0.1:8443.
|
|
33
|
+
- `devzone disable docker-hote` : retire le socket Docker de l'hôte (puis `make rebuild` sur le poste) ; `devzone enable docker-hote` le remet.
|
|
34
|
+
- `devzone disable <module>` : désactive et applique tout de suite.
|
|
35
|
+
- `devzone apply` : installe ce qui est actif.
|
|
36
|
+
- `devzone repair` : relance relais Docker, gitlab, postgres, mysql, argocd, ports étiquetés et le veilleur du catalogue.
|
|
37
|
+
- `devzone status --json` : récapitulatif complet en JSON, pour les outils (aucun secret, commande à lancer par point à traiter).
|
|
38
|
+
|
|
39
|
+
Le catalogue d'applications se consulte avec `devzone catalog` ; un veilleur applique à chaud les changements de `.devzone.modules`, et `devzone repair` le relance. MySQL se pilote avec `devzone mysql create <projet>`, `devzone mysql list`, `devzone mysql delete <projet>`, `devzone mysql volume [<nom>|--supprimer <nom>]` et `devzone mysql delete-data` (données gardées par défaut).
|
|
40
40
|
|
|
41
41
|
Le choix est propre à chaque devzone, gardé dans `.devzone.modules` du dossier devzone.
|
|
42
42
|
|
|
@@ -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.3
|
|
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.
|