devzone 7.0.3 → 7.1.1

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.
Files changed (53) hide show
  1. package/.devcontainer/Dockerfile +1 -8
  2. package/.devcontainer/catalog/app.sh +5 -12
  3. package/.devcontainer/cluster.sh +1 -11
  4. package/.devcontainer/devcontainer.json +1 -11
  5. package/.devcontainer/devzone +18 -10
  6. package/.devcontainer/devzone-cluster.sh +1 -1
  7. package/.devcontainer/devzone-modules.sh +7 -2
  8. package/.devcontainer/devzone-repair.sh +10 -19
  9. package/.devcontainer/devzone-services.sh +21 -20
  10. package/.devcontainer/devzone-status.sh +5 -12
  11. package/.devcontainer/help.sh +3 -4
  12. package/.devcontainer/isolation.sh +1 -1
  13. package/.devcontainer/kube-account.sh +12 -173
  14. package/.devcontainer/metrics-server.sh +1 -1
  15. package/.devcontainer/packages.sh +2 -2
  16. package/.devcontainer/ports-json.sh +0 -4
  17. package/.devcontainer/ports.sh +6 -102
  18. package/.devcontainer/state-json.sh +5 -14
  19. package/.devcontainer/versions.env +2 -2
  20. package/.devcontainer/workspace-init.sh +1 -2
  21. package/Makefile +4 -4
  22. package/README.md +13 -20
  23. package/bin/SHA256SUMS +6 -6
  24. package/bin/devzone-darwin-amd64 +0 -0
  25. package/bin/devzone-darwin-arm64 +0 -0
  26. package/bin/devzone-linux-amd64 +0 -0
  27. package/bin/devzone-linux-arm64 +0 -0
  28. package/bin/devzone-windows-amd64.exe +0 -0
  29. package/bin/devzone-windows-arm64.exe +0 -0
  30. package/manage/devzone +4 -4
  31. package/package.json +1 -1
  32. package/.devcontainer/argocd/argocd.sh +0 -222
  33. package/.devcontainer/argocd/catalog-argocd.sh +0 -119
  34. package/.devcontainer/argocd/services-hook.sh +0 -181
  35. package/.devcontainer/catalog/mysql/install.sh +0 -87
  36. package/.devcontainer/catalog/mysql/mysql.sh +0 -262
  37. package/.devcontainer/catalog/mysql/volume.sh +0 -71
  38. package/.devcontainer/git-identity.sh +0 -28
  39. package/.devcontainer/gitlab/argocd.sh +0 -54
  40. package/.devcontainer/gitlab/chart.sh +0 -39
  41. package/.devcontainer/gitlab/gitlab.sh +0 -168
  42. package/.devcontainer/gitlab/installation.sh +0 -193
  43. package/.devcontainer/gitlab/secrets.sh +0 -95
  44. package/.devcontainer/gitlab/seed.sh +0 -204
  45. package/.devcontainer/gitlab/test-gitlab-restes.sh +0 -16
  46. package/.devcontainer/gitlab/test-gitlab.sh +0 -489
  47. package/.devcontainer/kind-wrapper.sh +0 -45
  48. package/.devcontainer/kube-config.sh +0 -78
  49. package/.devcontainer/kube-reachable.sh +0 -64
  50. package/.devcontainer/ports-auto.sh +0 -247
  51. package/.devcontainer/post-create.sh +0 -91
  52. package/.devcontainer/postgres/postgres.sh +0 -309
  53. package/.devcontainer/startup.sh +0 -65
@@ -3,19 +3,15 @@
3
3
  # agents) can only act in the devzone-* namespaces. The account is the
4
4
  # ServiceAccount devzone-agent of the devzone-system namespace, bound to the
5
5
  # edit ClusterRole (no RBAC, no quotas) in each devzone namespace by a
6
- # RoleBinding, with a 24 h TokenRequest token renewed at startup (startup.sh),
7
- # by « devzone repair » and by the summary before expiry. The installers alone
8
- # use the admin context (host context in ~/.kube/hote.config, kind cluster in
9
- # ~/.kube/config); the shells use ~/.kube/config and the agents the limited
10
- # ~/.kube/agent.config (devzone context only, #844).
11
- # Library sourced by cluster.sh; executable for the token:
12
- # kube-account.sh jeton (argument kept: called by startup.sh and devzone repair)
6
+ # RoleBinding. The installers alone use the admin context (host context in
7
+ # ~/.kube/hote.config, kind cluster in ~/.kube/config); the shells use
8
+ # ~/.kube/config and the agents the limited ~/.kube/agent.config (devzone
9
+ # context only, #844).
10
+ # Library sourced by cluster.sh.
13
11
 
14
12
  ACCOUNT_NS=devzone-system
15
13
  ACCOUNT_SA=devzone-agent
16
- ACCOUNT_DURATION=24h
17
14
  ACCOUNT_CONFIG="${DEVZONE_KUBE_CONFIG:-$HOME/.kube/config}"
18
- ACCOUNT_TOKEN_EXPIRY="${DEVZONE_KUBE_TOKEN_EXPIRY:-$HOME/.kube/devzone-token.expiry}"
19
15
 
20
16
  # kubeconfig file that holds the admin context ctx: hote.config if it lists it
21
17
  # (host clusters), otherwise ~/.kube/config (kind clusters of the container).
@@ -76,25 +72,18 @@ account_context() {
76
72
  kubectl config current-context 2>/dev/null || true
77
73
  }
78
74
 
79
- # Sets up the limited account with the admin context: devzone-system namespace
80
- # and devzone-agent ServiceAccount (idempotent, resumed at startup and at each
81
- # installation).
82
- account_setup() {
83
- local ctx="$1"
84
- account_admin "$ctx" create namespace "$ACCOUNT_NS" --dry-run=client -o yaml |
85
- account_admin "$ctx" apply -f - >/dev/null || return 1
86
- account_admin "$ctx" -n "$ACCOUNT_NS" create serviceaccount "$ACCOUNT_SA" \
87
- --dry-run=client -o yaml | account_admin "$ctx" apply -f - >/dev/null || return 1
88
- }
89
-
90
75
  # Allows the account in namespace ns: devzone-agent RoleBinding to the edit
91
76
  # ClusterRole (read, write, secrets, NetworkPolicies — no RBAC, no quotas), set
92
77
  # with the admin context after the namespace is created.
93
- # The account is set up first if missing: an installation on a still blank
94
- # cluster makes the account usable at the next token renewal.
78
+ # The account is set up first if missing: devzone-system namespace and
79
+ # devzone-agent ServiceAccount, so an installation on a still blank cluster
80
+ # makes the account usable at the next token renewal.
95
81
  account_allow() {
96
82
  local ctx="$1" ns="$2"
97
- account_setup "$ctx" || return 1
83
+ account_admin "$ctx" create namespace "$ACCOUNT_NS" --dry-run=client -o yaml |
84
+ account_admin "$ctx" apply -f - >/dev/null || return 1
85
+ account_admin "$ctx" -n "$ACCOUNT_NS" create serviceaccount "$ACCOUNT_SA" \
86
+ --dry-run=client -o yaml | account_admin "$ctx" apply -f - >/dev/null || return 1
98
87
  account_admin "$ctx" -n "$ns" create rolebinding "$ACCOUNT_SA" \
99
88
  --clusterrole=edit --serviceaccount="$ACCOUNT_NS:$ACCOUNT_SA" \
100
89
  --dry-run=client -o yaml | account_admin "$ctx" apply -f - >/dev/null || return 1
@@ -116,153 +105,3 @@ account_namespace() {
116
105
  account_admin "$ctx" label namespace "$ns" "$CLUSTER_LABEL" --overwrite >/dev/null || return 1
117
106
  account_allow "$ctx" "$ns" || return 1
118
107
  }
119
-
120
- # Catches up the existing devzone namespaces: RoleBinding set in each namespace
121
- # labelled CLUSTER_LABEL (idempotent), for the installations prior to the
122
- # limited account.
123
- account_catch_up() {
124
- local ctx="$1" ns label="${CLUSTER_LABEL:-app.kubernetes.io/managed-by=devzone}"
125
- while IFS= read -r ns; do
126
- [ -n "$ns" ] || continue
127
- ns="${ns#namespace/}"
128
- account_admin "$ctx" -n "$ns" create rolebinding "$ACCOUNT_SA" \
129
- --clusterrole=edit --serviceaccount="$ACCOUNT_NS:$ACCOUNT_SA" \
130
- --dry-run=client -o yaml | account_admin "$ctx" apply -f - >/dev/null || return 1
131
- done < <(account_admin "$ctx" get namespaces -l "$label" -o name 2>/dev/null || true)
132
- }
133
-
134
- # Epoch seconds of the RFC 3339 expiration timestamp of a TokenRequest
135
- # response; empty when the local date cannot read it, so the caller falls back
136
- # to now + 24 h (Bash 3.2: GNU date -d, then the BSD date form).
137
- account_expiry_epoch() {
138
- local ts="$1" epoch
139
- [ -n "$ts" ] || return 0
140
- epoch="$(date -u -d "$ts" +%s 2>/dev/null || true)"
141
- if [ -n "$epoch" ]; then
142
- echo "$epoch"
143
- return 0
144
- fi
145
- epoch="$(date -j -u -f '%Y-%m-%dT%H:%M:%SZ' "$ts" +%s 2>/dev/null || true)"
146
- [ -n "$epoch" ] && echo "$epoch"
147
- }
148
-
149
- # True when the token has more than one hour left, read from the expiry file
150
- # without any cluster call: absent, unreadable, non-numeric, close or past
151
- # expiry → false.
152
- account_token_fresh() {
153
- local expiry now
154
- [ -f "$ACCOUNT_TOKEN_EXPIRY" ] || return 1
155
- expiry="$(cat "$ACCOUNT_TOKEN_EXPIRY" 2>/dev/null || true)"
156
- case "$expiry" in
157
- '' | *[!0-9]*) return 1 ;;
158
- esac
159
- now="$(date +%s)"
160
- [ "$expiry" -gt $((now + 3600)) ]
161
- }
162
-
163
- # Renews the account's token (24 h TokenRequest) and writes it into the devzone
164
- # context of ~/.kube/config: user devzone-agent, same cluster as the admin
165
- # context (cluster entry copied: server, certificate authority and
166
- # tls-server-name of the host context). The expiry timestamp of the TokenRequest
167
- # response is kept in ACCOUNT_TOKEN_EXPIRY (now + 24 h if it is unreadable), only
168
- # once a real call through the devzone context has succeeded.
169
- account_token() {
170
- local ctx="$1" conf token cluster server tls ca_data ca_file out expires expiry now answer
171
- local entry=()
172
- conf="$(account_admin_config "$ctx")"
173
- out="$(account_admin "$ctx" create token "$ACCOUNT_SA" -n "$ACCOUNT_NS" \
174
- --duration="$ACCOUNT_DURATION" \
175
- -o jsonpath='{.status.token}{"\n"}{.status.expirationTimestamp}')" || return 1
176
- token="$(printf '%s\n' "$out" | sed -n '1p')"
177
- expires="$(printf '%s\n' "$out" | sed -n '2p')"
178
- if [ -z "$token" ]; then
179
- echo "devzone : limited account token is empty" >&2
180
- return 1
181
- fi
182
- cluster="$(KUBECONFIG="$conf" kubectl config view \
183
- -o jsonpath="{.contexts[?(@.name==\"$ctx\")].context.cluster}" 2>/dev/null || true)"
184
- if [ -z "$cluster" ]; then
185
- echo "devzone : cluster of context $ctx not found in $conf" >&2
186
- return 1
187
- fi
188
- server="$(KUBECONFIG="$conf" kubectl config view \
189
- -o jsonpath="{.clusters[?(@.name==\"$cluster\")].cluster.server}" 2>/dev/null || true)"
190
- if [ -z "$server" ]; then
191
- echo "devzone : server of cluster $cluster not found in $conf" >&2
192
- return 1
193
- fi
194
- ca_data="$(KUBECONFIG="$conf" kubectl config view --raw -o jsonpath="{.clusters[?(@.name==\"$cluster\")].cluster.certificate-authority-data}" 2>/dev/null || true)"
195
- ca_file="$(KUBECONFIG="$conf" kubectl config view \
196
- -o jsonpath="{.clusters[?(@.name==\"$cluster\")].cluster.certificate-authority}" 2>/dev/null || true)"
197
- entry=(--server="$server")
198
- if [ -n "$ca_file" ]; then
199
- entry+=(--certificate-authority="$ca_file" --embed-certs=true)
200
- fi
201
- tls="$(KUBECONFIG="$conf" kubectl config view \
202
- -o jsonpath="{.clusters[?(@.name==\"$cluster\")].cluster.tls-server-name}" 2>/dev/null || true)"
203
- if [ -n "$tls" ]; then
204
- entry+=(--tls-server-name="$tls")
205
- fi
206
- KUBECONFIG="$ACCOUNT_CONFIG" kubectl config set-cluster "$cluster" \
207
- ${entry[@]+"${entry[@]}"} >/dev/null || return 1
208
- if [ -n "$ca_data" ]; then
209
- KUBECONFIG="$ACCOUNT_CONFIG" kubectl config set \
210
- "clusters.$cluster.certificate-authority-data" "$ca_data" >/dev/null || return 1
211
- fi
212
- KUBECONFIG="$ACCOUNT_CONFIG" kubectl config set-credentials "$ACCOUNT_SA" \
213
- --token="$token" >/dev/null || return 1
214
- KUBECONFIG="$ACCOUNT_CONFIG" kubectl config set-context devzone \
215
- --cluster="$cluster" --user="$ACCOUNT_SA" >/dev/null || return 1
216
- answer="$(KUBECONFIG="$ACCOUNT_CONFIG" kubectl --context devzone \
217
- auth can-i get pods -n "$ACCOUNT_NS" 2>/dev/null || true)"
218
- case "$answer" in
219
- yes | no) ;;
220
- *)
221
- echo "devzone : limited account context not reachable" >&2
222
- rm -f "$ACCOUNT_TOKEN_EXPIRY"
223
- return 1
224
- ;;
225
- esac
226
- now="$(date +%s)"
227
- expiry="$(account_expiry_epoch "$expires")"
228
- [ -n "$expiry" ] || expiry=$((now + 86400))
229
- mkdir -p "$(dirname "$ACCOUNT_TOKEN_EXPIRY")"
230
- printf '%s\n' "$expiry" >"$ACCOUNT_TOKEN_EXPIRY"
231
- chmod 600 "$ACCOUNT_TOKEN_EXPIRY"
232
- }
233
-
234
- # Writes the limited agent kubeconfig: the devzone context only, current context
235
- # set to it, for the agents that hold the limited account (Claude Code, #844).
236
- # The contexts are read from ACCOUNT_CONFIG, never from the file being written:
237
- # the view goes to a temporary file of the same folder, moved in place (atomic,
238
- # mode 600); a failure empties the target and returns 1.
239
- account_agent_config() {
240
- local conf="${DEVZONE_KUBE_AGENT_CONFIG:-$HOME/.kube/agent.config}" tmp
241
- tmp="$(mktemp "$(dirname "$conf")/.agent.config.XXXXXX")" || return 1
242
- # shellcheck disable=SC2015 # the failure branch must empty the target too
243
- ( umask 077; KUBECONFIG="$ACCOUNT_CONFIG" kubectl config view --minify --flatten \
244
- --context devzone >"$tmp" ) && KUBECONFIG="$tmp" kubectl config use-context devzone >/dev/null 2>&1 \
245
- || { rm -f "$tmp"; : >"$conf"; return 1; }
246
- chmod 600 "$tmp"; mv "$tmp" "$conf"
247
- }
248
-
249
- # Direct execution: account token renewed at startup (startup.sh) and by
250
- # « devzone repair ». Without a chosen services cluster: nothing to do.
251
- # When the file is sourced, $0 differs from BASH_SOURCE: nothing runs.
252
- if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
253
- if [ "${1:-}" != jeton ]; then
254
- echo "devzone : kube-account : jeton" >&2
255
- exit 1
256
- fi
257
- ICI="$(cd "$(dirname "$0")" && pwd)"
258
- RACINE="${DEVZONE_ROOT:-$(dirname "$ICI")}"
259
- ETAT="${DEVZONE_STATE:-$RACINE/.devzone.modules}"
260
- ctx="$(grep -E '^cluster=' "$ETAT" 2>/dev/null | tail -1 | cut -d= -f2- || true)"
261
- if [ -z "$ctx" ]; then
262
- exit 0
263
- fi
264
- account_setup "$ctx" || exit 1
265
- account_catch_up "$ctx" || exit 1
266
- account_token "$ctx" || exit 1
267
- account_agent_config || exit 1
268
- fi
@@ -7,7 +7,7 @@
7
7
  # --kubelet-insecure-tls: the kubelet of Docker Desktop and kind has a
8
8
  # self-signed certificate, without this option the pod never becomes Ready.
9
9
  # Exits in error if a requested context is unknown or unreachable, or if an
10
- # installation fails (kube-config.sh calls it with || true).
10
+ # installation fails.
11
11
  set -euo pipefail
12
12
 
13
13
  # shellcheck source=SCRIPTDIR/cluster.sh
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env bash
2
2
  # System packages kept after a rebuild (#351): a list in the devzone folder
3
3
  # (<root>/.devzone.packages, a comment header + one package name per line, sorted,
4
- # without duplicates), reinstalled at each container creation (post-create.sh).
4
+ # without duplicates), reinstalled at each container creation.
5
5
  # A package installed by hand is lost by a rebuild, unless it is in this list.
6
6
  # packages.sh or packages.sh list list with the state of each package
7
7
  # packages.sh add <name>… validates, installs, adds to the list
8
8
  # packages.sh remove <name>… removes from the list and uninstalls (except image packages)
9
- # packages.sh apply installs everything missing (post-create.sh)
9
+ # packages.sh apply installs everything missing
10
10
  # The state of a package comes from dpkg-query -W -f='${Status}'; the system
11
11
  # commands go through overridable variables for the tests (sudo, apt-get,
12
12
  # apt-cache, dpkg-query, mark, timestamp). Compatible with bash 3.2 (macOS).
@@ -27,9 +27,5 @@ list_json() {
27
27
  json="$(jq -c --argjson port "$port" --argjson active "$active" --arg app "$app" \
28
28
  '. + [{port:$port,active:$active,application:$app,auto:false}]' <<<"$json")"
29
29
  done
30
- auto_json="$(bash "$HERE/ports-auto.sh" list_json_auto 2>/dev/null || echo '[]')"
31
- if [ -n "$auto_json" ] && [ "$auto_json" != "[]" ]; then
32
- json="$(jq -s 'add' <<<"$json"$'\n'"$auto_json")"
33
- fi
34
30
  printf '%s\n' "$json"
35
31
  }
@@ -1,17 +1,13 @@
1
1
  #!/usr/bin/env bash
2
- # Port relays (#290): applications of the devzone container reachable from
3
- # 127.0.0.1 of the workstation, one alpine/socat container per port.
4
- # ports.sh open <n> opens the relay of port <n>
2
+ # Port relays of the workstation (#290): applications reachable from
3
+ # 127.0.0.1 of the workstation, kept in the state of devzone.
5
4
  # ports.sh list relays of the state: port, active, application
6
5
  # ports.sh close <n> removes the relay and the port from the state
7
- # ports.sh restart recreates the relays of the state toward the current IP
8
6
  # ports.sh resume one-line summary for the devzone recap
9
7
  # The state is the line "ports=8080,3000" of DEVZONE_STATE (sorted, no duplicate).
10
8
  # ROOT: a single dirname from HERE (.devcontainer) = root of the devzone repository.
11
9
  if [ "${BASH_SOURCE[0]}" = "$0" ]; then set -euo pipefail; fi
12
10
 
13
- SOCAT_IMAGE=alpine/socat:1.8.0.3
14
-
15
11
  HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
12
  ROOT="${DEVZONE_ROOT:-$(dirname "$HERE")}"
17
13
  ETAT="${DEVZONE_STATE:-$ROOT/.devzone.modules}"
@@ -28,9 +24,9 @@ refuse() { echo "devzone : port : $*" >&2; exit 1; }
28
24
  # French values (read by the tools, #557): a contract, UTF-8 written as byte escapes.
29
25
  APP_RESPONDS="application responds"
30
26
  APP_NONE="no application"
31
- # shellcheck disable=SC2034 # read by ports-json.sh and ports-auto.sh (sourced)
27
+ # shellcheck disable=SC2034 # read by ports-json.sh (sourced)
32
28
  JSON_APP_RESPONDS=$'application r\303\251pond'
33
- # shellcheck disable=SC2034 # read by ports-json.sh and ports-auto.sh (sourced)
29
+ # shellcheck disable=SC2034 # read by ports-json.sh (sourced)
34
30
  JSON_APP_NONE="aucune application"
35
31
 
36
32
  relay_name() { echo "devzone-$INSTANCE-port-$1"; }
@@ -64,28 +60,6 @@ remove_port() {
64
60
  write_ports "$(sort_ports "$rest")"
65
61
  }
66
62
 
67
- # Network and address of the devzone container, read on the host's Docker: the
68
- # relay runs there and must reach the container by its IP.
69
- network_ip() {
70
- local line
71
- command -v docker >/dev/null 2>&1 || return 1
72
- line="$(docker inspect "$(hostname)" \
73
- --format '{{range $nom, $r := .NetworkSettings.Networks}}{{$nom}} {{$r.IPAddress}}{{"\n"}}{{end}}' 2>/dev/null |
74
- awk 'NF >= 2 && $2 != "" { print; exit }')" || return 1
75
- [ -n "$line" ] || return 1
76
- NETWORK="${line%% *}"
77
- IP="${line#* }"
78
- [ -n "$NETWORK" ] && [ -n "$IP" ]
79
- }
80
-
81
- relay_exists() {
82
- local name
83
- name="$(relay_name "$1")"
84
- command -v docker >/dev/null 2>&1 || return 1
85
- [ -n "$(docker ps -a --filter "name=^$name$" --format '{{.Names}}' 2>/dev/null |
86
- grep -Fx "$name" || true)" ]
87
- }
88
-
89
63
  relay_active() {
90
64
  local name
91
65
  name="$(relay_name "$1")"
@@ -94,47 +68,6 @@ relay_active() {
94
68
  grep -Fx "$name" || true)" ]
95
69
  }
96
70
 
97
- # Launches the relay; on failure, a clear message and code 1 (this function does
98
- # not change the state)
99
- launch() {
100
- local port="$1" network="$2" ip="$3" name output
101
- name="$(relay_name "$port")"
102
- if output="$(docker run -d --restart unless-stopped \
103
- --name "$name" \
104
- --label "devzone.instance=$INSTANCE" \
105
- --label "devzone.port=$port" \
106
- --network "$network" \
107
- -p "127.0.0.1:$port:$port" \
108
- "$SOCAT_IMAGE" \
109
- "tcp-listen:$port,fork,reuseaddr" "tcp-connect:$ip:$port" 2>&1)"; then
110
- return 0
111
- fi
112
- case "$output" in
113
- *"port is already allocated"* | *"address already in use"*)
114
- echo "devzone : port : port already in use on the workstation : $port" >&2
115
- ;;
116
- *)
117
- echo "devzone : port : relay on port $port failed : $output" >&2
118
- ;;
119
- esac
120
- return 1
121
- }
122
-
123
- open_port() {
124
- local port="${1:-}"
125
- validate_port "$port"
126
- if relay_active "$port"; then
127
- add_port "$port"
128
- echo "✔ relay already open: 127.0.0.1:$port on the workstation → $port in the container"
129
- return 0
130
- fi
131
- network_ip || refuse "devzone container not found: host Docker unreachable?"
132
- docker rm -f "$(relay_name "$port")" >/dev/null 2>&1 || true
133
- launch "$port" "$NETWORK" "$IP" || exit 1
134
- add_port "$port"
135
- echo "✔ 127.0.0.1:$port on the workstation → $port in the container (relay $(relay_name "$port"))"
136
- }
137
-
138
71
  close_port() {
139
72
  local port="${1:-}"
140
73
  validate_port "$port"
@@ -149,7 +82,7 @@ list_ports() {
149
82
  local ports port mark app
150
83
  ports="$(sort_ports "$(read_ports)")"
151
84
  if [ -z "$ports" ]; then
152
- echo "no relay (devzone port <n>)"
85
+ echo "no relay"
153
86
  return 0
154
87
  fi
155
88
  # shellcheck disable=SC2046 # list of ports separated by commas
@@ -166,14 +99,13 @@ list_ports() {
166
99
  fi
167
100
  printf ' %-5s %s %s\n' "$port" "$mark" "$app"
168
101
  done
169
- bash "$HERE/ports-auto.sh" list_auto 2>/dev/null || true
170
102
  }
171
103
 
172
104
  summary() {
173
105
  local ports port output=""
174
106
  ports="$(sort_ports "$(read_ports)")"
175
107
  if [ -z "$ports" ]; then
176
- echo "none (devzone port <n>)"
108
+ echo "none"
177
109
  return 0
178
110
  fi
179
111
  # shellcheck disable=SC2046 # list of ports separated by commas
@@ -187,28 +119,6 @@ summary() {
187
119
  echo "$output"
188
120
  }
189
121
 
190
- restart_relays() {
191
- local ports port rc=0
192
- ports="$(sort_ports "$(read_ports)")"
193
- [ -n "$ports" ] || return 0
194
- if ! network_ip; then
195
- echo "devzone : port : relays not restarted: devzone container not found (host Docker unreachable?)" >&2
196
- return 1
197
- fi
198
- # shellcheck disable=SC2046 # list of ports separated by commas
199
- for port in $(printf '%s' "$ports" | tr ',' ' '); do
200
- if ! port_valid "$port"; then
201
- echo "devzone : port : invalid port in the state, ignored: $port" >&2
202
- rc=1
203
- continue
204
- fi
205
- # The container IP changes at each start: the relay is recreated
206
- docker rm -f "$(relay_name "$port")" >/dev/null 2>&1 || true
207
- launch "$port" "$NETWORK" "$IP" || rc=1
208
- done
209
- return "$rc"
210
- }
211
-
212
122
  # Machine-readable output of list: a JSON array [{port,active,application,auto}], jq only.
213
123
  # shellcheck source=SCRIPTDIR/ports-json.sh
214
124
  # shellcheck disable=SC1091
@@ -218,14 +128,8 @@ case "${1:-}" in
218
128
  '' | list)
219
129
  if [ "${2:-}" = "--json" ]; then list_json; else list_ports; fi
220
130
  ;;
221
- open) open_port "${2:-}" ;;
222
131
  close | --close) close_port "${2:-}" ;;
223
- restart) restart_relays ;;
224
132
  resume) summary ;;
225
- auto) bash "$HERE/ports-auto.sh" auto "${2:-}" "${3:-}" ;;
226
- exclude) bash "$HERE/ports-auto.sh" exclude "${2:-}" ;;
227
- include) bash "$HERE/ports-auto.sh" include "${2:-}" ;;
228
133
  -h | --help | aide) sed -n '2,8p' "$0" | sed 's/^# \{0,1\}//' ;;
229
- *) open_port "$1" ;;
230
134
  esac
231
135
  fi
@@ -126,11 +126,11 @@ state_json() {
126
126
  state_value="failed"
127
127
  command_value="devzone apply"
128
128
  elif [ "$m" = gitlab ]; then
129
- if out="$(bash "$ICI/gitlab/gitlab.sh" status 2>/dev/null)"; then
129
+ if out="$(devzone gitlab status 2>/dev/null)"; then
130
130
  state_value="$out"
131
131
  else
132
132
  state_value=""
133
- add_error modules "gitlab.sh status unavailable"
133
+ add_error modules "gitlab status unavailable"
134
134
  fi
135
135
  elif [ "$m" = postgres ] || [ "$m" = llm ]; then
136
136
  if out="$(bash "$ICI/$m/$m.sh" status 2>/dev/null)"; then
@@ -140,14 +140,13 @@ state_json() {
140
140
  add_error modules "$m.sh state unavailable"
141
141
  fi
142
142
  elif [ "$m" = argocd ]; then
143
- if out="$(bash "$ICI/argocd/argocd.sh" status 2>/dev/null)"; then
143
+ if out="$("$ICI/devzone" argocd status 2>/dev/null)"; then
144
144
  state_value="$out"
145
145
  else
146
146
  state_value=""
147
- add_error modules "argocd.sh status unavailable"
148
147
  fi
149
148
  elif [ "$m" = mysql ]; then
150
- if out="$(bash "$ICI/catalog/mysql/mysql.sh" status 2>/dev/null)"; then
149
+ if out="$(devzone mysql status 2>/dev/null)"; then
151
150
  state_value="$out"
152
151
  else
153
152
  state_value=""
@@ -190,15 +189,7 @@ state_json() {
190
189
  clusters_command="devzone use $host_ctx"
191
190
  fi
192
191
 
193
- # Limited account token (#845): renewed as soon as it is close to expiry,
194
- # only outside the pod and with a services cluster chosen; a failed renewal
195
- # becomes an alert with the repair command.
196
- if ! in_pod && [ -n "$services_cluster" ] && ! account_token_fresh; then
197
- if ! bash "$ICI/kube-account.sh" jeton >/dev/null 2>&1; then
198
- append_alert limited_account_token "limited account token expired" "devzone repair"
199
- fi
200
- fi
201
-
192
+ devzone cluster clean --quiet >/dev/null 2>&1 || [ $? -ne 3 ] || append_alert cluster_disk "cluster disk almost full" "devzone repair"
202
193
  if ports_out="$(bash "$ICI/ports.sh" list --json 2>/dev/null)"; then
203
194
  if printf '%s' "$ports_out" | jq -e . >/dev/null 2>&1; then
204
195
  ports_json="$ports_out"
@@ -1,5 +1,5 @@
1
- # Single source for the repowarden version used by post-create.sh and workspace-init.sh.
2
- REPOWARDEN_VERSION=4.18.0
1
+ # Single source for the repowarden version used by workspace-init.sh and manage/scripts/ci/versions.sh.
2
+ REPOWARDEN_VERSION=4.18.1
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.
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # Why: post-create.sh and startup.sh never run in the Kubernetes workspace
3
- # pod (#503). This script installs the devzone tools when the container starts.
2
+ # Why: this script installs the devzone tools in the workspace pod (#503).
4
3
  # Each step logs one "devzone init:" line, and a failure never stops the next
5
4
  # step. No Docker socket is used and no kubeconfig is fabricated.
6
5
  set -uo pipefail
package/Makefile CHANGED
@@ -24,8 +24,8 @@ test-fonctionnel: hors-conteneur ## Functional tests: isolated devzone, built th
24
24
  test-cli: hors-conteneur ## CLI tests in a real terminal: isolated devzone, then removed (10 to 15 min)
25
25
  @bash manage/test/cli-terminal.sh
26
26
 
27
- desinstaller: hors-conteneur ## Removes everything devzone created, after confirmation (GARDER=connexions: keeps the connections)
28
- @GARDER="$(GARDER)" bash manage/scripts/uninstall.sh
27
+ desinstaller: hors-conteneur ## Removes Kubernetes objects of this devzone instance, after confirmation
28
+ @bash manage/devzone uninstall
29
29
 
30
- uninstall: hors-conteneur ## Removes everything devzone created, after confirmation (alias of desinstaller)
31
- @GARDER="$(GARDER)" bash manage/scripts/uninstall.sh
30
+ uninstall: hors-conteneur ## Removes Kubernetes objects of this devzone instance, after confirmation (alias of desinstaller)
31
+ @bash manage/devzone uninstall
package/README.md CHANGED
@@ -159,7 +159,7 @@ git clone https://github.com/ton-compte/ton-projet.git
159
159
  mkdir mon-projet && cd mon-projet && git init -b main
160
160
  ```
161
161
 
162
- To learn more: [Starting a project](https://github.com/SimBienvenueHoulBoumi/devzone/blob/main/manage/docs/reference.md#starting-a-project).
162
+ To learn more: [Starting a project](https://github.com/SimBienvenueHoulBoumi/devzone/blob/main/manage/docs/reference.md#starting-a-project). Develop devzone in the pod with `devzone workspace start|shell|vscode`.
163
163
 
164
164
  ## What devzone contains
165
165
 
@@ -172,7 +172,7 @@ To learn more: [Starting a project](https://github.com/SimBienvenueHoulBoumi/dev
172
172
 
173
173
  ## Installing a tool that stays
174
174
 
175
- A tool installed by hand (`sudo apt install tree`) does not survive a rebuild: the image is rebuilt from scratch. For a tool that must stay, `devzone packages` keeps the list of packages to reinstall:
175
+ A tool installed by hand in the workspace pod does not survive a pod recreation: the image is rebuilt from scratch. For a tool that must stay, `devzone packages` keeps the list of packages to reinstall:
176
176
 
177
177
  ```sh
178
178
  devzone packages
@@ -196,7 +196,7 @@ The list lives in `.devzone.packages` at the root of the devzone folder, outside
196
196
  | Open a shell | VS Code terminal | `devzone workspace shell` |
197
197
  | Stop | *Remote: Close Remote Connection* (the container stops with the window) | `devzone workspace stop` |
198
198
  | Status | — | `devzone workspace status` |
199
- | **Uninstall** (everything devzone created, after confirmation) | — | `make uninstall` or `npx devzone uninstall` |
199
+ | **Uninstall** (Kubernetes objects of this devzone instance, after confirmation) | — | `devzone uninstall` (in a devzone folder) |
200
200
 
201
201
  In Kubernetes mode, the same commands apply to the pod `devzone-workspace-0`. The GitLab, PostgreSQL and Argo CD services are installed from the workstation: `devzone workspace services enable postgres` (see [the reference](manage/docs/reference.md#devzone-services-in-the-kubernetes-workspace)). You can also develop there: `devzone workspace clone <url>` makes a working clone in the pod, `devzone ticket <n>` creates the worktree of a ticket there and `devzone agent` launches opencode there without a copy ([developing in the pod](manage/docs/reference.md#developing-devzone-and-repowarden-in-the-pod)). Argo CD is installed by default there and keeps the deployments: interface at https://localhost:8443 (password `admin` in `.password`), GitOps repository `<login>/devzone-argocd` created on your GitHub, projects declared in `.argocd.conf` (`devzone workspace argocd app add <repo>`); see [Argo CD in the Kubernetes workspace](manage/docs/reference.md#argo-cd-in-the-kubernetes-workspace).
202
202
 
@@ -205,7 +205,7 @@ In the container, `devzone --version` shows the version of the workspace image,
205
205
  ```text
206
206
  devzone enable <module> enable and apply at once
207
207
  devzone use CTX [--confirm CTX] switch the kubectl working cluster
208
- devzone port [<n>|--close <n>] relay of a container port to the workstation
208
+ devzone port [--close <n>] list or remove a relay of the workstation
209
209
  ```
210
210
 
211
211
  ### Updating devzone
@@ -232,7 +232,7 @@ The old names of files and folders (`.devzone.paquets`, `.devzone.sauvegarde`, `
232
232
 
233
233
  The Kubernetes workspace is updated separately: `devzone workspace update` moves it to the latest stable release (or `--version X.Y.Z`), image, charts and Argo CD at the same tag. **The pod `devzone-workspace-0` is recreated**: the VS Code windows attached to the pod are disconnected. The image is checked on ghcr.io before any write, and nothing changes if it does not exist yet. Details in the [reference](manage/docs/reference.md#updating-the-workspace).
234
234
 
235
- In the container, the `devzone` summary reports a more recent published version (npm check at most once a day, without blocking offline): `○ devzone X.Y.Z disponible : sur le poste, devzone update`.
235
+ In the workspace pod, the `devzone` summary reports a more recent published version (npm check at most once a day, without blocking offline): `○ devzone X.Y.Z disponible : sur le poste, devzone update`.
236
236
 
237
237
  ## Options
238
238
 
@@ -361,15 +361,14 @@ A project's user owns **its** database (it creates tables, indexes, data in it)
361
361
 
362
362
  On the Kubernetes workstation, `devzone workspace start` starts a port watcher: each TCP port ≥ 1024 that listens in the pod is relayed to `127.0.0.1` of the workstation, at the same number, by `kubectl port-forward`. A server started in the pod (`npm run dev`, port 5173) therefore answers at `http://localhost:5173`, without a command. The enabled services (PostgreSQL, MySQL, Argo CD) are relayed too, on their usual port. The Services of applications deployed in the cluster are relayed the same way, each on a local port (80 → 8080; a port already taken elsewhere becomes another port): `devzone workspace ports status` shows their URL `http://127.0.0.1:<port>`. A Service can be excluded with the annotation `devzone.io/relay: "false"`. The watcher is driven with `devzone workspace ports start|stop|status`; details in the [reference](manage/docs/reference.md#applications-and-services-on-the-workstations-localhost).
363
363
 
364
- On the Docker workstation, an application launched **inside** the container (for example a Spring Boot with `./gradlew bootRun` on port 8080) is not reachable from the workstation: the devzone container publishes no port. As soon as it listens in the container, the **automatic port watcher** (`.devcontainer/ports-auto.sh`) sets up an `alpine/socat` relay (pinned version) on the host's Docker, from `127.0.0.1:<port>` of the workstation to the container's port: `http://localhost:<port>` **without a command**. The relay disappears when the application stops.
364
+ The relays kept in the state of a workstation instance are listed and closed with `devzone port`:
365
365
 
366
366
  ```sh
367
- devzone port # list: manual and automatic relays, ● active or ○ stopped
368
- devzone port auto off # stops the watcher: no more automatic relay
369
- devzone port --close <n> # removes a manual relay and its port from the state
367
+ devzone port # list: relay, ● active or ○ stopped, application behind it
368
+ devzone port --close <n> # removes the relay and its port from the state
370
369
  ```
371
370
 
372
- `devzone port <n>` also opens a manual relay: same mechanism on the workstation side, `alpine/socat` container, name `devzone-<instance>-port-<n>`.
371
+ In the Kubernetes workspace, the applications and services of the pod use `devzone workspace ports` instead: their relays are driven from the workstation by `kubectl port-forward`.
373
372
 
374
373
  From the workstation: `http://localhost:8080`. The manual relay is recreated automatically at container startup, toward the container's current address; it is removed by `make uninstall` (label `devzone.instance`). The automatic relay disappears with the application.
375
374
 
@@ -409,26 +408,20 @@ The shell prompt shows `⎈ ctx/ns` (cyan if local, bold red if remote otherwise
409
408
 
410
409
  ## Uninstalling
411
410
 
412
- ```bash
413
- make uninstall
414
- ```
415
-
416
- This command removes the container, the image `vsc-devzone-…`, the `devzone-*` volumes, the events of the host's Docker and the kind clusters created on the host, the `devzone-postgres` namespaces and the `app.kubernetes.io/managed-by=devzone` labels on the host's clusters, as well as any metrics-server installed by devzone. Resources are filtered by the `devzone.instance` label to target only the current instance. It **never touches** `workspace/` (your projects). To keep your logins (GitHub, git, Claude Code, opencode and modules): `make uninstall KEEP=logins` (old `GARDER=connexions` still accepted).
417
-
418
- With the command installed globally (`npm install -g devzone`), you can also run, in the devzone folder:
411
+ From a devzone folder, remove the Kubernetes objects created by this devzone instance:
419
412
 
420
413
  ```bash
421
414
  devzone uninstall
422
415
  ```
423
416
 
424
- Same effect as `make uninstall`. Then only, to remove the command from your machine:
417
+ The command lists the namespaces, Argo CD Applications, temporary accounts and `.devzone.*` files targeted by this instance, asks for confirmation, then removes them. `workspace/` is kept. Without a terminal, use `devzone uninstall --yes`.
418
+
419
+ To remove the `devzone` command from your machine:
425
420
 
426
421
  ```bash
427
422
  npm uninstall -g devzone
428
423
  ```
429
424
 
430
- This command only removes the `devzone` command from your machine; it deletes neither the container, nor the volumes, nor the folder.
431
-
432
425
  ## Removed names
433
426
 
434
427
  Commands, subcommands and options are written in English. The old French names are removed: devzone refuses them, shows the new name and does nothing.
package/bin/SHA256SUMS CHANGED
@@ -1,6 +1,6 @@
1
- b6dccc1d9f2bd27f1dfc9b2e841ff4b3b82a362826146fb16d2955200235d8d5 devzone-linux-amd64
2
- f3bc328b7f266ec1ce878a3df76d5e14496861e3ec376a62e546653ae41f1a11 devzone-linux-arm64
3
- 17e0d97a2b60a064ddbf3d041ad76ed2357b2aeae1d90e0ecdfb4052b7984df5 devzone-darwin-amd64
4
- 6eb07e8d5d2f168f1432bca3c2acb451df063773e7e14428acb6a61d752919b0 devzone-darwin-arm64
5
- 7b4a96e1ef37cf611b3f1abeff3ef516c370e7504bf1dc2acccad45ad05be205 devzone-windows-amd64.exe
6
- 035aaa2d06954d20288a7146a6967a57759dd90603a40b8e0bc4076f323c86eb devzone-windows-arm64.exe
1
+ bd7fc9fa7a0d1baecb19b7ff3c1afd0def07c87c31fd8e60c7e01c6a03988f3f devzone-linux-amd64
2
+ 8cb046a0356e14fc51ce7668756e17d98ceb149181b6ae5864a4c29e2b5f24d7 devzone-linux-arm64
3
+ d9ec7ea5f2758197674a17cb5677fd54d1d40311debb809ca40c688082d035c3 devzone-darwin-amd64
4
+ 33a9281d7710adf0b50d20a045a0348edc985c042253a6f9b25d9bd2827e2790 devzone-darwin-arm64
5
+ a1fee8e29ccfc866a1097ddecef21c06f58437c02f11ebca790ca06b7743017d devzone-windows-amd64.exe
6
+ 8bd61da3998715280767544a8eb4202b6dfd0756b92b8deddec47a0d16cb5513 devzone-windows-arm64.exe
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file