devzone 1.0.0 → 2.0.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 +4 -4
- package/.devcontainer/agent-errors.sh +154 -0
- package/.devcontainer/agent-local.sh +2 -2
- package/.devcontainer/{agent-modele.messages → agent-model.messages} +1 -1
- package/.devcontainer/{agent-modele.sh → agent-model.sh} +8 -8
- package/.devcontainer/{agent-droits.sh → agent-rights.sh} +2 -2
- package/.devcontainer/agent-session.sh +122 -125
- package/.devcontainer/agent-state-json.sh +117 -0
- package/.devcontainer/agent-workspace.sh +53 -53
- package/.devcontainer/agent.sh +113 -115
- package/.devcontainer/{ia/docker-garde.sh → ai/docker-guard.sh} +1 -1
- package/.devcontainer/{ia/plugins/devzone-garde-v2.js → ai/plugins/devzone-guard-v2.js} +4 -4
- package/.devcontainer/{ia/plugins/devzone-garde.js → ai/plugins/devzone-guard.js} +3 -3
- package/.devcontainer/argocd/argocd.sh +8 -8
- package/.devcontainer/argocd/{catalogue-argocd.sh → catalog-argocd.sh} +1 -1
- package/.devcontainer/argocd/services-hook.sh +5 -5
- package/.devcontainer/{catalogue → catalog}/app.sh +4 -4
- package/.devcontainer/{catalogue/catalogue-veilleur.sh → catalog/catalog-watcher.sh} +7 -7
- package/.devcontainer/{catalogue → catalog}/mysql/mysql.sh +7 -7
- package/.devcontainer/{catalogue.sh → catalog.sh} +13 -13
- package/.devcontainer/cluster.sh +8 -8
- package/.devcontainer/devcontainer.json +1 -1
- package/.devcontainer/devzone +55 -54
- package/.devcontainer/{docker-relais.sh → docker-relay.sh} +2 -2
- package/.devcontainer/gitlab/argocd.sh +2 -2
- package/.devcontainer/gitlab/gitlab.sh +4 -4
- package/.devcontainer/gitlab/installation.sh +5 -5
- package/.devcontainer/gitlab/secrets.sh +1 -1
- package/.devcontainer/help.sh +1 -0
- package/.devcontainer/{kind-enveloppe.sh → kind-wrapper.sh} +5 -5
- package/.devcontainer/{kube-compte.sh → kube-account.sh} +3 -3
- package/.devcontainer/{kube-joignable.sh → kube-reachable.sh} +1 -1
- package/.devcontainer/memory.sh +113 -0
- package/.devcontainer/metrics-server.sh +52 -51
- package/.devcontainer/{paquets.sh → packages.sh} +4 -4
- package/.devcontainer/password.sh +88 -87
- package/.devcontainer/ports-auto.sh +7 -7
- package/.devcontainer/ports.sh +4 -4
- package/.devcontainer/post-create.sh +2 -2
- package/.devcontainer/postgres/postgres.sh +3 -3
- package/.devcontainer/services-admin.sh +5 -5
- package/.devcontainer/skills/devzone/SKILL.md +1 -1
- package/.devcontainer/{demarrage.sh → startup.sh} +5 -5
- package/.devcontainer/state-json.sh +308 -0
- package/.devcontainer/state-lock.sh +53 -0
- package/.devcontainer/state.sh +219 -0
- package/.devcontainer/workspace-init.sh +1 -1
- package/Makefile +7 -7
- package/README.md +2 -2
- package/charts/devzone-workspace/templates/statefulset.yaml +3 -0
- package/manage/devzone +3 -3
- package/manage/scripts/check-go-layout.sh +40 -0
- package/manage/scripts/check-names.sh +60 -0
- package/manage/scripts/devzone-create.sh +2 -2
- package/manage/scripts/devzone-manifest.sh +2 -2
- package/manage/scripts/docker-workstation.sh +2 -2
- package/manage/scripts/docker.sh +2 -2
- package/manage/scripts/{lancer.sh → launch.sh} +3 -3
- package/manage/scripts/{migrer-retour.sh → migrate-revert.sh} +1 -1
- package/manage/scripts/{migrer.sh → migrate.sh} +1 -1
- package/manage/workspace.sh +4 -4
- package/package.json +1 -1
- package/.devcontainer/agent-erreurs.sh +0 -138
- package/.devcontainer/agent-etat-json.sh +0 -115
- package/.devcontainer/etat-json.sh +0 -308
- package/.devcontainer/etat-verrou.sh +0 -52
- package/.devcontainer/etat.sh +0 -220
- package/.devcontainer/memoire.sh +0 -113
- /package/.devcontainer/{ia/docker-garde.message → ai/docker-guard.message} +0 -0
- /package/.devcontainer/{ia → ai}/host-check.message +0 -0
- /package/.devcontainer/{ia → ai}/host-check.sh +0 -0
- /package/.devcontainer/{ia → ai}/host-models.sh +0 -0
- /package/.devcontainer/{catalogue → catalog}/mysql/app.conf +0 -0
- /package/.devcontainer/{catalogue/mysql/installer.sh → catalog/mysql/install.sh} +0 -0
- /package/.devcontainer/{catalogue → catalog}/mysql/volume.sh +0 -0
- /package/.devcontainer/{docker-sans-hote.sh → docker-without-host.sh} +0 -0
- /package/.devcontainer/{isolement.sh → isolation.sh} +0 -0
- /package/.devcontainer/{etat-gitops.sh → state-gitops.sh} +0 -0
- /package/manage/scripts/{desinstaller.sh → uninstall.sh} +0 -0
|
@@ -1,145 +1,146 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# password.sh regenerer
|
|
4
|
-
# password.sh chemin
|
|
5
|
-
#
|
|
6
|
-
#
|
|
2
|
+
# Grouped credentials of the accounts created by devzone (#332).
|
|
3
|
+
# password.sh regenerer reads the module files, writes $ROOT/.password
|
|
4
|
+
# password.sh chemin prints the path of $ROOT/.password
|
|
5
|
+
# The module files stay the source: .password is a regenerated view.
|
|
6
|
+
# Plain-text secrets: never printed, never committed (.gitignore), mode 600.
|
|
7
|
+
# (regenerer and chemin are public subcommand names, kept as they are.)
|
|
7
8
|
set -euo pipefail
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
PASSWORD_HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
11
|
+
PASSWORD_ROOT="${DEVZONE_RACINE:-$(dirname "$PASSWORD_HERE")}"
|
|
12
|
+
PASSWORD_TARGET="$PASSWORD_ROOT/.password"
|
|
12
13
|
|
|
13
|
-
#
|
|
14
|
-
# workspace/.
|
|
15
|
-
#
|
|
16
|
-
|
|
14
|
+
# Regenerates $ROOT/.password from workspace/.gitlab, workspace/.postgres,
|
|
15
|
+
# workspace/.argocd, workspace/.mysql and the other workspace/.<app>/ folders.
|
|
16
|
+
# Silent on success; without any account, the file is removed.
|
|
17
|
+
password_regenerate() (
|
|
17
18
|
umask 077
|
|
18
|
-
local
|
|
19
|
-
local gl="$
|
|
20
|
-
local ar="$
|
|
21
|
-
local my="$
|
|
22
|
-
local tab
|
|
19
|
+
local target="$PASSWORD_TARGET" root="$PASSWORD_ROOT"
|
|
20
|
+
local gl="$root/workspace/.gitlab" pg="$root/workspace/.postgres"
|
|
21
|
+
local ar="$root/workspace/.argocd"
|
|
22
|
+
local my="$root/workspace/.mysql"
|
|
23
|
+
local tab entries tmp file name service address user secret
|
|
23
24
|
tab="$(printf '\t')"
|
|
24
|
-
|
|
25
|
+
entries="$(mktemp "$root/.password.entries.XXXXXX")" || return 1
|
|
25
26
|
tmp=""
|
|
26
27
|
|
|
27
28
|
if [ -s "$gl/root-password" ]; then
|
|
28
|
-
|
|
29
|
-
if [ -n "$
|
|
30
|
-
printf 'gitlab\t%s\troot\t%s\n' "http://gitlab.localhost:8929" "$
|
|
29
|
+
secret="$(cat "$gl/root-password")"
|
|
30
|
+
if [ -n "$secret" ]; then
|
|
31
|
+
printf 'gitlab\t%s\troot\t%s\n' "http://gitlab.localhost:8929" "$secret" >>"$entries"
|
|
31
32
|
fi
|
|
32
33
|
fi
|
|
33
34
|
if [ -s "$gl/dev-password" ]; then
|
|
34
|
-
|
|
35
|
-
if [ -n "$
|
|
36
|
-
printf 'gitlab\t%s\tdev\t%s\n' "http://gitlab.localhost:8929" "$
|
|
35
|
+
secret="$(cat "$gl/dev-password")"
|
|
36
|
+
if [ -n "$secret" ]; then
|
|
37
|
+
printf 'gitlab\t%s\tdev\t%s\n' "http://gitlab.localhost:8929" "$secret" >>"$entries"
|
|
37
38
|
fi
|
|
38
39
|
fi
|
|
39
40
|
if [ -s "$pg/admin-password" ]; then
|
|
40
|
-
|
|
41
|
-
if [ -n "$
|
|
42
|
-
printf 'postgres\t%s\tpostgres\t%s\n' "127.0.0.1:5432" "$
|
|
41
|
+
secret="$(cat "$pg/admin-password")"
|
|
42
|
+
if [ -n "$secret" ]; then
|
|
43
|
+
printf 'postgres\t%s\tpostgres\t%s\n' "127.0.0.1:5432" "$secret" >>"$entries"
|
|
43
44
|
fi
|
|
44
45
|
fi
|
|
45
|
-
# MySQL root
|
|
46
|
+
# Catalogue MySQL root (direct helm or Argo CD, #538): mirror of the workstation
|
|
46
47
|
if [ -s "$my/admin-password" ]; then
|
|
47
|
-
|
|
48
|
-
if [ -n "$
|
|
49
|
-
printf 'mysql\t%s\troot\t%s\n' "127.0.0.1:3306" "$
|
|
48
|
+
secret="$(cat "$my/admin-password")"
|
|
49
|
+
if [ -n "$secret" ]; then
|
|
50
|
+
printf 'mysql\t%s\troot\t%s\n' "127.0.0.1:3306" "$secret" >>"$entries"
|
|
50
51
|
fi
|
|
51
52
|
fi
|
|
52
53
|
if [ -s "$ar/admin.env" ]; then
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if [ -n "$
|
|
56
|
-
printf 'argocd\t%s\t%s\t%s\n' "https://127.0.0.1:8443" "$
|
|
54
|
+
user="$(sed -n 's/^ARGOCD_USER=//p' "$ar/admin.env" 2>/dev/null | tail -1 || true)"
|
|
55
|
+
secret="$(sed -n 's/^ARGOCD_PASSWORD=//p' "$ar/admin.env" 2>/dev/null | tail -1 || true)"
|
|
56
|
+
if [ -n "$user" ] && [ -n "$secret" ]; then
|
|
57
|
+
printf 'argocd\t%s\t%s\t%s\n' "https://127.0.0.1:8443" "$user" "$secret" >>"$entries"
|
|
57
58
|
fi
|
|
58
59
|
fi
|
|
59
|
-
for
|
|
60
|
-
[ -f "$
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
service="postgres:$
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if [ -z "$
|
|
60
|
+
for file in "$pg"/*.env; do
|
|
61
|
+
[ -f "$file" ] || continue
|
|
62
|
+
name="${file##*/}"
|
|
63
|
+
name="${name%.env}"
|
|
64
|
+
service="postgres:$name"
|
|
65
|
+
user="$(sed -n 's/^DB_USER=//p' "$file" 2>/dev/null | tail -1 || true)"
|
|
66
|
+
secret="$(sed -n 's/^DB_PASSWORD=//p' "$file" 2>/dev/null | tail -1 || true)"
|
|
67
|
+
address="$(sed -n 's/^DB_NAME=//p' "$file" 2>/dev/null | tail -1 || true)"
|
|
68
|
+
if [ -z "$user" ] || [ -z "$secret" ]; then
|
|
68
69
|
continue
|
|
69
70
|
fi
|
|
70
|
-
|
|
71
|
-
printf '%s\t%s\t%s\t%s\n' "$service" "$
|
|
71
|
+
address="127.0.0.1:5432/${address:-$name}"
|
|
72
|
+
printf '%s\t%s\t%s\t%s\n' "$service" "$address" "$user" "$secret" >>"$entries"
|
|
72
73
|
done
|
|
73
|
-
#
|
|
74
|
-
# <APP>
|
|
75
|
-
for
|
|
76
|
-
[ -d "$
|
|
77
|
-
app="${
|
|
74
|
+
# Each other catalogue application: workspace/.<app>/*.env, keys <APP>_HOST,
|
|
75
|
+
# <APP>_PORT, <APP>_USER, <APP>_PASSWORD (or MYSQL_* for mysql)
|
|
76
|
+
for dir in "$root"/workspace/.*/; do
|
|
77
|
+
[ -d "$dir" ] || continue
|
|
78
|
+
app="${dir%/}"
|
|
78
79
|
app="${app##*/}"
|
|
79
80
|
case "$app" in . | .. | .gitlab | .postgres | .argocd) continue ;; esac
|
|
80
81
|
app="${app#.}"
|
|
81
|
-
|
|
82
|
-
for
|
|
83
|
-
[ -f "$
|
|
84
|
-
base="${
|
|
82
|
+
app_upper="$(printf '%s' "$app" | tr '[:lower:]' '[:upper:]')"
|
|
83
|
+
for file in "$dir"*.env; do
|
|
84
|
+
[ -f "$file" ] || continue
|
|
85
|
+
base="${file##*/}"
|
|
85
86
|
base="${base%.env}"
|
|
86
|
-
|
|
87
|
-
[ -z "$
|
|
88
|
-
[ -z "$
|
|
89
|
-
|
|
90
|
-
[ -z "$
|
|
91
|
-
[ -z "$
|
|
92
|
-
[ -z "$
|
|
93
|
-
|
|
94
|
-
[ -z "$
|
|
95
|
-
[ -z "$
|
|
96
|
-
[ -z "$
|
|
97
|
-
port="$(sed -n "s/^${
|
|
98
|
-
[ -z "$port" ] && port="$(sed -n 's/^DB_PORT=//p' "$
|
|
99
|
-
[ -z "$port" ] && port="$(sed -n 's/^MYSQL_PORT=//p' "$
|
|
87
|
+
user="$(sed -n "s/^${app_upper}_USER=//p" "$file" 2>/dev/null | tail -1 || true)"
|
|
88
|
+
[ -z "$user" ] && user="$(sed -n 's/^DB_USER=//p' "$file" 2>/dev/null | tail -1 || true)"
|
|
89
|
+
[ -z "$user" ] && user="$(sed -n 's/^MYSQL_USER=//p' "$file" 2>/dev/null | tail -1 || true)"
|
|
90
|
+
secret="$(sed -n "s/^${app_upper}_PASSWORD=//p" "$file" 2>/dev/null | tail -1 || true)"
|
|
91
|
+
[ -z "$secret" ] && secret="$(sed -n 's/^DB_PASSWORD=//p' "$file" 2>/dev/null | tail -1 || true)"
|
|
92
|
+
[ -z "$secret" ] && secret="$(sed -n 's/^MYSQL_PASSWORD=//p' "$file" 2>/dev/null | tail -1 || true)"
|
|
93
|
+
[ -z "$user" ] || [ -z "$secret" ] && continue
|
|
94
|
+
host="$(sed -n "s/^${app_upper}_HOST=//p" "$file" 2>/dev/null | tail -1 || true)"
|
|
95
|
+
[ -z "$host" ] && host="$(sed -n 's/^DB_HOST=//p' "$file" 2>/dev/null | tail -1 || true)"
|
|
96
|
+
[ -z "$host" ] && host="$(sed -n 's/^MYSQL_HOST=//p' "$file" 2>/dev/null | tail -1 || true)"
|
|
97
|
+
[ -z "$host" ] && host=127.0.0.1
|
|
98
|
+
port="$(sed -n "s/^${app_upper}_PORT=//p" "$file" 2>/dev/null | tail -1 || true)"
|
|
99
|
+
[ -z "$port" ] && port="$(sed -n 's/^DB_PORT=//p' "$file" 2>/dev/null | tail -1 || true)"
|
|
100
|
+
[ -z "$port" ] && port="$(sed -n 's/^MYSQL_PORT=//p' "$file" 2>/dev/null | tail -1 || true)"
|
|
100
101
|
[ -z "$port" ] && port=3306
|
|
101
|
-
printf '%s\t%s\t%s\t%s\n' "$app:$base" "$
|
|
102
|
+
printf '%s\t%s\t%s\t%s\n' "$app:$base" "$host:$port" "$user" "$secret" >>"$entries"
|
|
102
103
|
done
|
|
103
104
|
done
|
|
104
105
|
|
|
105
|
-
if [ ! -s "$
|
|
106
|
-
rm -f "$
|
|
106
|
+
if [ ! -s "$entries" ]; then
|
|
107
|
+
rm -f "$entries" "$target"
|
|
107
108
|
return 0
|
|
108
109
|
fi
|
|
109
110
|
|
|
110
|
-
tmp="$(mktemp "$
|
|
111
|
-
rm -f "$
|
|
111
|
+
tmp="$(mktemp "$root/.password.XXXXXX")" || {
|
|
112
|
+
rm -f "$entries"
|
|
112
113
|
return 1
|
|
113
114
|
}
|
|
114
115
|
{
|
|
115
116
|
printf '%s\n' \
|
|
116
|
-
'# devzone :
|
|
117
|
-
'#
|
|
118
|
-
"# service${tab}
|
|
119
|
-
LC_ALL=C sort -t "$tab" -k1,1 -k3,3 "$
|
|
117
|
+
'# devzone : identifiers of the accounts created by devzone. Plain-text secrets:' \
|
|
118
|
+
'# never commit, copy or paste them into a ticket. Regenerated by devzone.' \
|
|
119
|
+
"# service${tab}address${tab}user${tab}password"
|
|
120
|
+
LC_ALL=C sort -t "$tab" -k1,1 -k3,3 "$entries"
|
|
120
121
|
} >"$tmp" || {
|
|
121
|
-
rm -f "$
|
|
122
|
+
rm -f "$entries" "$tmp"
|
|
122
123
|
return 1
|
|
123
124
|
}
|
|
124
125
|
chmod 600 "$tmp" || {
|
|
125
|
-
rm -f "$
|
|
126
|
+
rm -f "$entries" "$tmp"
|
|
126
127
|
return 1
|
|
127
128
|
}
|
|
128
|
-
mv "$tmp" "$
|
|
129
|
-
rm -f "$
|
|
129
|
+
mv "$tmp" "$target" || {
|
|
130
|
+
rm -f "$entries" "$tmp"
|
|
130
131
|
return 1
|
|
131
132
|
}
|
|
132
|
-
chmod 600 "$
|
|
133
|
-
rm -f "$
|
|
133
|
+
chmod 600 "$target" || {
|
|
134
|
+
rm -f "$entries"
|
|
134
135
|
return 1
|
|
135
136
|
}
|
|
136
|
-
rm -f "$
|
|
137
|
+
rm -f "$entries"
|
|
137
138
|
)
|
|
138
139
|
|
|
139
140
|
if [ "${BASH_SOURCE[0]}" = "$0" ]; then
|
|
140
141
|
case "${1:-}" in
|
|
141
|
-
regenerer)
|
|
142
|
-
chemin) printf '%s\n' "$
|
|
142
|
+
regenerer) password_regenerate ;;
|
|
143
|
+
chemin) printf '%s\n' "$PASSWORD_TARGET" ;;
|
|
143
144
|
*)
|
|
144
145
|
echo "devzone : password.sh : regenerer | chemin" >&2
|
|
145
146
|
exit 1
|
|
@@ -18,7 +18,7 @@ ports_auto_actif() { local v; v="$(grep -E '^ports_auto=' "$ETAT" 2>/dev/null |
|
|
|
18
18
|
# Liste des ports exclus par l'utilisateur (ports_exclus=, virgules).
|
|
19
19
|
ports_exclus_lus() { grep -E '^ports_exclus=' "$ETAT" 2>/dev/null | tail -1 | cut -d= -f2- || true; }
|
|
20
20
|
# Ecrit une ligne cle=valeur dans l'etat, comme ecrire_ports pour ports=
|
|
21
|
-
ecrire() {
|
|
21
|
+
ecrire() { state_write "$1" "${2:-}" || { echo "devzone : port : etat non enregistre : $ETAT" >&2; return 1; }; }
|
|
22
22
|
# Un port est exclu quand il figure dans la liste ports_exclus=.
|
|
23
23
|
port_exclu() { case ",$(ports_exclus_lus)," in *",$1,"*) return 0 ;; esac; return 1; }
|
|
24
24
|
# Nom du relais automatique d'un port : devzone-<instance>-auto-<port>.
|
|
@@ -28,7 +28,7 @@ relais_auto_actif() { local nom; nom="$(nom_relais_auto "$1")"; command -v docke
|
|
|
28
28
|
# Délai après disparition d'un port avant de retirer le pont et le relais.
|
|
29
29
|
delai_disparition() { local v; for v in DEVZONE_PORTS_AUTO_DELAI_DISPARITION DEVZONE_PORTS_AUTO_DELAI DEVZONE_PORTS_AUTO_RETARD PORTS_AUTO_DELAI PORTS_AUTO_RETARD; do [ -n "${!v:-}" ] && { echo "${!v}"; return 0; }; done; echo 10; }
|
|
30
30
|
|
|
31
|
-
# Garde-fou (règle docker-
|
|
31
|
+
# Garde-fou (règle docker-relay.sh #293) : la boucle et demarrer ne tournent
|
|
32
32
|
# jamais sous bats, et hors du conteneur que si le contexte réel est posé.
|
|
33
33
|
garde_veilleur() {
|
|
34
34
|
if [ -n "${BATS_TEST_TMPDIR:-}" ]; then
|
|
@@ -87,10 +87,10 @@ verrou_rafraichir() { touch "$VERROU" 2>/dev/null || true; echo "$$" >"$VERROU/p
|
|
|
87
87
|
ports_auto_tour() {
|
|
88
88
|
local port now delay sortie
|
|
89
89
|
# État restauré ou reconstruit : rien pendant 60 s (#417, étape 4)
|
|
90
|
-
|
|
90
|
+
state_recovery_wait && return 0
|
|
91
91
|
if [ "$(ports_auto_actif)" = off ]; then
|
|
92
92
|
# Jamais de désinstallation sur un état non confirmé (#417, étape 4)
|
|
93
|
-
|
|
93
|
+
state_recovery_pending || nettoyer_auto_tout
|
|
94
94
|
return 0
|
|
95
95
|
fi
|
|
96
96
|
if ! reseau_ip; then echo "devzone : ports-auto : conteneur devzone introuvable" >&2; return 1; fi
|
|
@@ -141,7 +141,7 @@ ports_auto_tour() {
|
|
|
141
141
|
if grep -q "^$port " "$PENDING" 2>/dev/null; then
|
|
142
142
|
ancien="$(grep "^$port " "$PENDING" | head -1 | cut -d' ' -f2)"
|
|
143
143
|
# Rien ne se retire sur un état restauré non confirmé (#417)
|
|
144
|
-
if
|
|
144
|
+
if state_recovery_pending; then continue; fi
|
|
145
145
|
if [ -n "$ancien" ] && [ "$(( now - ancien ))" -ge "$delay" ]; then
|
|
146
146
|
fermer_auto "$port"
|
|
147
147
|
grep -v "^$port " "$PENDING" >"$PENDING.tmp" 2>/dev/null || true; mv "$PENDING.tmp" "$PENDING" 2>/dev/null || true
|
|
@@ -168,7 +168,7 @@ ports_auto_boucle() {
|
|
|
168
168
|
trap 'nettoyer_auto_tout; rm -rf "$VERROU"' EXIT INT TERM
|
|
169
169
|
while true; do
|
|
170
170
|
# État restauré ou reconstruit : rien pendant 60 s (#417, étape 4)
|
|
171
|
-
if
|
|
171
|
+
if state_recovery_wait; then
|
|
172
172
|
verrou_rafraichir
|
|
173
173
|
sleep "${DEVZONE_PORTS_AUTO_PAS:-2}"
|
|
174
174
|
continue
|
|
@@ -178,7 +178,7 @@ ports_auto_boucle() {
|
|
|
178
178
|
verrou_rafraichir
|
|
179
179
|
if [ "$(ports_auto_actif)" = off ]; then
|
|
180
180
|
# Jamais de désinstallation sur un état non confirmé (#417)
|
|
181
|
-
|
|
181
|
+
state_recovery_pending || nettoyer_auto_tout
|
|
182
182
|
break
|
|
183
183
|
fi
|
|
184
184
|
ports_auto_tour || true
|
package/.devcontainer/ports.sh
CHANGED
|
@@ -18,9 +18,9 @@ ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
|
|
|
18
18
|
INSTANCE="${DEVZONE_INSTANCE:-devzone}"
|
|
19
19
|
|
|
20
20
|
# Écriture sûre de l'état (#417) : verrou, temporaire dans l'état, .prec
|
|
21
|
-
# shellcheck source=SCRIPTDIR/
|
|
21
|
+
# shellcheck source=SCRIPTDIR/state.sh
|
|
22
22
|
# shellcheck disable=SC1091
|
|
23
|
-
. "$ICI/
|
|
23
|
+
. "$ICI/state.sh"
|
|
24
24
|
|
|
25
25
|
refuse() { echo "devzone : port : $*" >&2; exit 1; }
|
|
26
26
|
|
|
@@ -41,9 +41,9 @@ trier_ports() {
|
|
|
41
41
|
printf '%s\n' "${1:-}" | tr ',' '\n' | awk 'NF && $0 ~ /^[0-9]+$/ { print }' | sort -n -u | paste -sd, -
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
# Écrit la ligne ports= de l'état (#417 : jamais de mv hors de
|
|
44
|
+
# Écrit la ligne ports= de l'état (#417 : jamais de mv hors de state.sh)
|
|
45
45
|
ecrire_ports() {
|
|
46
|
-
|
|
46
|
+
state_write ports "${1:-}" || { echo "devzone : port : état non enregistré : $ETAT" >&2; exit 1; }
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
ajouter_port() {
|
|
@@ -63,7 +63,7 @@ bash /workspaces/devzone/.devcontainer/kube-config.sh || echo "devzone : configu
|
|
|
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
|
-
sudo install -m 0755 /workspaces/devzone/.devcontainer/docker-
|
|
66
|
+
sudo install -m 0755 /workspaces/devzone/.devcontainer/docker-without-host.sh /usr/local/bin/docker
|
|
67
67
|
fi
|
|
68
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
|
|
@@ -81,7 +81,7 @@ INVITE
|
|
|
81
81
|
fi
|
|
82
82
|
|
|
83
83
|
# Ce qui reste à faire (identité git, GitHub, modules) : récapitulatif de
|
|
84
|
-
# devzone, affiché à chaque démarrage (
|
|
84
|
+
# devzone, affiché à chaque démarrage (startup.sh)
|
|
85
85
|
|
|
86
86
|
recap="java $(java -version 2>&1 | head -1 | cut -d'"' -f2), node $(node -v), python $(python3 --version | cut -d' ' -f2), repowarden $(repowarden --version)"
|
|
87
87
|
! command -v claude >/dev/null || recap+=", claude $(claude --version | cut -d' ' -f1)"
|
|
@@ -22,9 +22,9 @@ ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
|
|
|
22
22
|
# shellcheck disable=SC1091
|
|
23
23
|
. "$ICI/../chart-direct.sh"
|
|
24
24
|
# Isolation réseau : namespace_isoler, d'où viennent les NetworkPolicies
|
|
25
|
-
# shellcheck source=SCRIPTDIR/../
|
|
25
|
+
# shellcheck source=SCRIPTDIR/../isolation.sh
|
|
26
26
|
# shellcheck disable=SC1091
|
|
27
|
-
. "$ICI/../
|
|
27
|
+
. "$ICI/../isolation.sh"
|
|
28
28
|
|
|
29
29
|
NS=devzone-postgres
|
|
30
30
|
SECRETS="$RACINE/workspace/.postgres"
|
|
@@ -37,7 +37,7 @@ refuse() { echo "devzone : postgres : $*" >&2; exit 2; }
|
|
|
37
37
|
|
|
38
38
|
# Vue regroupée des identifiants : un échec n'empêche jamais l'opération
|
|
39
39
|
regenerer_identifiants() {
|
|
40
|
-
|
|
40
|
+
password_regenerate ||
|
|
41
41
|
echo "devzone : postgres : identifiants regroupés non mis à jour (devzone passwords)" >&2
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -34,9 +34,9 @@ refuse() {
|
|
|
34
34
|
exit 2
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
# shellcheck source=SCRIPTDIR/
|
|
37
|
+
# shellcheck source=SCRIPTDIR/state.sh
|
|
38
38
|
# shellcheck disable=SC1091
|
|
39
|
-
. "$HERE/
|
|
39
|
+
. "$HERE/state.sh"
|
|
40
40
|
|
|
41
41
|
action="${1:-}"
|
|
42
42
|
service="${2:-}"
|
|
@@ -73,9 +73,9 @@ cleanup() {
|
|
|
73
73
|
rm -f "$kubeconfig"
|
|
74
74
|
"$DEVZONE_CMD" "$service" relay-stop >/dev/null 2>&1 || true
|
|
75
75
|
if [ -n "$cluster_before" ]; then
|
|
76
|
-
|
|
76
|
+
state_write cluster "$cluster_before" || true
|
|
77
77
|
else
|
|
78
|
-
|
|
78
|
+
state_remove cluster || true
|
|
79
79
|
fi
|
|
80
80
|
}
|
|
81
81
|
trap cleanup EXIT
|
|
@@ -109,7 +109,7 @@ unset token ca_data
|
|
|
109
109
|
export KUBECONFIG="$kubeconfig"
|
|
110
110
|
export DEVZONE_KUBE_CONFIG="$kubeconfig"
|
|
111
111
|
export DEVZONE_SERVICES_ADMIN=1
|
|
112
|
-
|
|
112
|
+
state_write cluster "$ADMIN_CONTEXT" || refuse "cannot write the state: $ETAT"
|
|
113
113
|
echo "devzone services: $action $service in the cluster of the pod (temporary administrator)"
|
|
114
114
|
case "$action" in
|
|
115
115
|
# The seed is a module command: devzone gitlab seed (#538)
|
|
@@ -52,7 +52,7 @@ Le journal est `workspace/.agents/<dossier>.log`. `--auto` évite l'attente d'un
|
|
|
52
52
|
|
|
53
53
|
Avec `ia` actif, le garde-fou repowarden est branché pour Claude Code et opencode : l'agent est arrêté avant de modifier `main`/`develop`, de commiter sans `repowarden cc` ou de contourner les hooks. `repowarden cc -m "…"` pour commiter.
|
|
54
54
|
|
|
55
|
-
Fichiers de droits protégés (jamais écrits par un agent, listés fixes, qu'aucune variable ne change) : `.devcontainer/opencode/agent.json`, `.devcontainer/opencode.jsonc`, `.repowarden.conf`, `.devcontainer/agent-
|
|
55
|
+
Fichiers de droits protégés (jamais écrits par un agent, listés fixes, qu'aucune variable ne change) : `.devcontainer/opencode/agent.json`, `.devcontainer/opencode.jsonc`, `.repowarden.conf`, `.devcontainer/agent-rights.sh`. Un agent qui les touche est refusé et le changement est annulé dans l'arbre.
|
|
56
56
|
|
|
57
57
|
## Kubernetes seulement
|
|
58
58
|
|
|
@@ -13,13 +13,13 @@ exec </dev/null
|
|
|
13
13
|
ICI="$(dirname "$0")"
|
|
14
14
|
# Relais du socket Docker d'abord (#293) : sans lui, les docker exec longs
|
|
15
15
|
# (kind, modules) sont coupés au bout de 0,5 s sous Docker Desktop
|
|
16
|
-
DEVZONE_RELAIS_REEL=oui bash "$ICI/docker-
|
|
16
|
+
DEVZONE_RELAIS_REEL=oui bash "$ICI/docker-relay.sh" || echo "démarrage : relais Docker non corrigé (devzone repair)"
|
|
17
17
|
bash "$ICI/git-identite.sh" || echo "démarrage : identité git non traitée (devzone start)"
|
|
18
18
|
bash "$ICI/kube-config.sh" || echo "démarrage : clusters non traités (devzone start)"
|
|
19
19
|
# Jeton du compte Kubernetes limité (#430) : 24 h, renouvelé à chaque
|
|
20
20
|
# démarrage ; compte posé au passage s'il manque. Sans cluster des services
|
|
21
21
|
# choisi, rien à faire
|
|
22
|
-
bash "$ICI/kube-
|
|
22
|
+
bash "$ICI/kube-account.sh" jeton || echo "démarrage : jeton du compte kubernetes non renouvelé (devzone repair)"
|
|
23
23
|
# Module gitlab actif : /etc/hosts est un montage Docker régénéré à chaque
|
|
24
24
|
# démarrage, gitlab.localhost doit être re-pose (ssh, glab et getent passent
|
|
25
25
|
# par le résolveur système) ; hote-poser n'échoue jamais (avertissement seul)
|
|
@@ -42,7 +42,7 @@ fi
|
|
|
42
42
|
# Module mysql actif : le relais 127.0.0.1:3306, relancé comme celui de
|
|
43
43
|
# postgres après chaque démarrage
|
|
44
44
|
if bash "$ICI/devzone" is-enabled mysql; then
|
|
45
|
-
bash "$ICI/
|
|
45
|
+
bash "$ICI/catalog/mysql/mysql.sh" relay-start || echo "démarrage : relais mysql non lancé (devzone repair)"
|
|
46
46
|
fi
|
|
47
47
|
# Relais de ports vers le poste (#290) : l'IP du conteneur change à chaque
|
|
48
48
|
# démarrage, chaque relais de l'état est recréé ; un échec n'empêche rien
|
|
@@ -55,9 +55,9 @@ if [ "${DEVZONE_WORKSPACE:-}" != kubernetes ]; then
|
|
|
55
55
|
fi
|
|
56
56
|
# Catalogue d'applications : une ligne <app>=off par application absente,
|
|
57
57
|
# écrite une fois, jamais une ligne existante modifiée (#414)
|
|
58
|
-
bash "$ICI/
|
|
58
|
+
bash "$ICI/catalog.sh" sync || echo "démarrage : catalogue non synchronisé (devzone repair)"
|
|
59
59
|
# Veilleur du catalogue : réapplique à chaud dès que .devzone.modules change
|
|
60
|
-
DEVZONE_CATALOGUE_REEL=oui bash "$ICI/
|
|
60
|
+
DEVZONE_CATALOGUE_REEL=oui bash "$ICI/catalog/catalog-watcher.sh" demarrer >/dev/null 2>&1 || echo "démarrage : veilleur catalogue non lancé (devzone repair)"
|
|
61
61
|
|
|
62
62
|
# Vue regroupée des identifiants (#332), regénérée à chaque démarrage ; un
|
|
63
63
|
# échec n'empêche rien et le contenu n'est jamais affiché
|