devzone 0.36.7 → 0.38.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/.dockerignore +1 -1
- package/.devcontainer/argocd/application.sh +69 -0
- package/.devcontainer/argocd/apps.sh +262 -0
- package/.devcontainer/argocd/argocd.sh +52 -8
- package/.devcontainer/argocd/catalogue-argocd.sh +114 -0
- package/.devcontainer/argocd/conf.sh +141 -0
- package/.devcontainer/argocd/gitops.sh +214 -0
- package/.devcontainer/argocd/services.sh +138 -0
- package/.devcontainer/catalogue/app.sh +58 -17
- package/.devcontainer/catalogue/mysql/installer.sh +31 -0
- package/.devcontainer/catalogue/mysql/mysql.sh +12 -0
- package/.devcontainer/devzone +2 -1
- package/.devcontainer/password.sh +8 -0
- package/README.md +2 -2
- package/charts/devzone-argocd/Chart.lock +6 -0
- package/charts/devzone-argocd/Chart.yaml +13 -0
- package/charts/devzone-argocd/values.yaml +28 -0
- package/charts/devzone-mysql/Chart.yaml +6 -0
- package/charts/devzone-mysql/templates/service.yaml +15 -0
- package/charts/devzone-mysql/templates/statefulset.yaml +55 -0
- package/charts/devzone-mysql/values.yaml +19 -0
- package/charts/devzone-postgres/Chart.yaml +6 -0
- package/charts/devzone-postgres/templates/service.yaml +15 -0
- package/charts/devzone-postgres/templates/statefulset.yaml +56 -0
- package/charts/devzone-postgres/values.yaml +11 -0
- package/manage/devzone +4 -1
- package/manage/scripts/argocd-services-svc.sh +110 -0
- package/manage/scripts/argocd-services.sh +179 -0
- package/manage/scripts/argocd-workspace.sh +221 -0
- package/manage/scripts/ci-dns.sh +10 -10
- package/manage/scripts/desinstaller.sh +137 -135
- package/manage/scripts/docker.sh +26 -22
- package/manage/scripts/lancer.sh +103 -103
- package/manage/scripts/migrer-retour.sh +37 -34
- package/manage/scripts/migrer.sh +154 -138
- package/manage/scripts/ports-workspace.sh +94 -82
- package/manage/scripts/poste.sh +48 -49
- package/manage/scripts/services-workspace.sh +22 -5
- package/manage/scripts/versions.sh +88 -88
- package/manage/scripts/workspace-aliases.sh +47 -0
- package/manage/scripts/workspace-wait.sh +27 -24
- package/manage/workspace.sh +134 -105
- package/package.json +1 -1
- package/.devcontainer/argocd/values.yaml +0 -21
|
@@ -1,133 +1,131 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# make desinstaller
|
|
4
|
-
# make desinstaller
|
|
2
|
+
# Full devzone uninstall, run on the host:
|
|
3
|
+
# make desinstaller everything, after confirmation
|
|
4
|
+
# make desinstaller KEEP=logins everything except logins (gh, git,
|
|
5
5
|
# Claude Code, opencode, modules)
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
# Sans terminal : CONFIRMER=oui.
|
|
6
|
+
# Removes: container, image, kind clusters of the instance and containers
|
|
7
|
+
# labeled devzone.instance on the host Docker (#291), former internal Docker
|
|
8
|
+
# volume (installs before #291), devzone-* volumes, metrics-server installed by
|
|
9
|
+
# devzone on host local clusters, namespace of devzone services (postgres
|
|
10
|
+
# module) on the chosen host cluster. Never touches: workspace/ (your projects),
|
|
11
|
+
# the base image, a metrics-server not installed by devzone.
|
|
12
|
+
# Without a terminal: CONFIRM=yes.
|
|
14
13
|
set -euo pipefail
|
|
15
14
|
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
# devzone folder: two levels above the script (manage/scripts/), so the command
|
|
16
|
+
# works when run from any folder
|
|
17
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
18
|
+
STATE="$HERE/.devzone.etat"
|
|
19
|
+
KEEP="${KEEP:-${GARDER:-}}"
|
|
20
|
+
LOGINS=(gh git claude opencode-config opencode-data config)
|
|
21
|
+
LOCAL_CTX='^(kind-.*|docker-desktop|rancher-desktop|orbstack|minikube)$'
|
|
23
22
|
|
|
24
|
-
case "$
|
|
25
|
-
echo "
|
|
23
|
+
case "$KEEP" in "" | logins | connexions) ;; *)
|
|
24
|
+
echo "KEEP: unknown value: $KEEP (only value: logins)" >&2
|
|
26
25
|
exit 1
|
|
27
26
|
;;
|
|
28
27
|
esac
|
|
29
28
|
|
|
30
|
-
# Docker
|
|
29
|
+
# Docker first: without it every docker call would show its raw error
|
|
31
30
|
# shellcheck source=SCRIPTDIR/docker.sh
|
|
32
31
|
. "$(dirname "${BASH_SOURCE[0]}")/docker.sh"
|
|
33
|
-
|
|
32
|
+
docker_ready "${DEVZONE_COMMANDE:-make desinstaller}" || exit 1
|
|
34
33
|
|
|
35
|
-
#
|
|
36
|
-
#
|
|
34
|
+
# Instance name: an instance name may contain a dash (my-devzone),
|
|
35
|
+
# so DEVZONE_VOLUMES is never split
|
|
37
36
|
DEVZONE_INSTANCE="${DEVZONE_VOLUMES:-devzone}"
|
|
38
37
|
INSTANCE_SUFFIX=""
|
|
39
38
|
if [ "$DEVZONE_INSTANCE" != "devzone" ]; then
|
|
40
39
|
INSTANCE_SUFFIX="-${DEVZONE_INSTANCE}"
|
|
41
40
|
fi
|
|
42
41
|
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
# DEVZONE_DANS_CONTENEUR=
|
|
49
|
-
# dans un conteneur)
|
|
42
|
+
# Run INSIDE the container, docker talks to host Docker (#291): volumes, images
|
|
43
|
+
# and containers seen are those of the workstation, and the host instance name
|
|
44
|
+
# (DEVZONE_VOLUMES) is unknown here. Touching Docker from the container could
|
|
45
|
+
# remove another instance's resources (or the default instance): only the
|
|
46
|
+
# Kubernetes part is handled.
|
|
47
|
+
# DEVZONE_DANS_CONTENEUR=yes|no forces the mode (tests, which run inside a container)
|
|
50
48
|
case "${DEVZONE_DANS_CONTENEUR:-}" in
|
|
51
|
-
oui)
|
|
52
|
-
non)
|
|
53
|
-
*)
|
|
49
|
+
oui | yes) INSIDE_CONTAINER=true ;;
|
|
50
|
+
non | no) INSIDE_CONTAINER=false ;;
|
|
51
|
+
*) INSIDE_CONTAINER=false; [ ! -f /.dockerenv ] || INSIDE_CONTAINER=true ;;
|
|
54
52
|
esac
|
|
55
53
|
|
|
56
|
-
# ---
|
|
57
|
-
echo "▶
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if [ "$
|
|
61
|
-
echo "ℹ
|
|
62
|
-
echo "
|
|
54
|
+
# --- Inventory ---------------------------------------------------------------
|
|
55
|
+
echo "▶ Inventory (folder $HERE)"
|
|
56
|
+
containers=() images=() dind=() volumes=() kept=()
|
|
57
|
+
kind_containers="" labeled_containers=""
|
|
58
|
+
if [ "$INSIDE_CONTAINER" = true ]; then
|
|
59
|
+
echo "ℹ Inside the container: only metrics-server and devzone services are handled."
|
|
60
|
+
echo " Container, image, volumes and kind clusters: make desinstaller on your machine."
|
|
63
61
|
else
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
ids="$(for
|
|
62
|
+
# Label set with the path as opened (VS Code, make): logical or physical path
|
|
63
|
+
# depending on symlinks; both are searched
|
|
64
|
+
ids="$(for path in "$HERE" "$(cd "$HERE" && pwd -P)"; do docker ps -aq --filter "label=devcontainer.local_folder=$path" 2>/dev/null || true; done | sort -u)"
|
|
67
65
|
for id in ${ids}; do
|
|
68
|
-
|
|
66
|
+
containers+=("$id")
|
|
69
67
|
images+=("$(docker inspect "$id" --format '{{.Config.Image}}')")
|
|
70
68
|
v="$(docker inspect "$id" --format '{{range .Mounts}}{{if eq .Destination "/var/lib/docker"}}{{.Name}}{{end}}{{end}}')"
|
|
71
69
|
[ -z "$v" ] || dind+=("$v")
|
|
72
70
|
done
|
|
73
|
-
#
|
|
74
|
-
if [ "${#
|
|
75
|
-
#
|
|
76
|
-
IMAGE="$(sed -n 's/^IMAGE=//p' "$
|
|
77
|
-
DIND="$(sed -n 's/^DIND=//p' "$
|
|
71
|
+
# Container already removed by make down: image and internal Docker noted then
|
|
72
|
+
if [ "${#containers[@]}" -eq 0 ] && [ -f "$STATE" ]; then
|
|
73
|
+
# Read only, never executed
|
|
74
|
+
IMAGE="$(sed -n 's/^IMAGE=//p' "$STATE")"
|
|
75
|
+
DIND="$(sed -n 's/^DIND=//p' "$STATE")"
|
|
78
76
|
[ -z "${IMAGE:-}" ] || ! docker image inspect "$IMAGE" >/dev/null 2>&1 || images+=("$IMAGE")
|
|
79
77
|
[ -z "${DIND:-}" ] || ! docker volume inspect "$DIND" >/dev/null 2>&1 || dind+=("$DIND")
|
|
80
78
|
fi
|
|
81
79
|
|
|
82
|
-
#
|
|
83
|
-
#
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
# Containers of the instance kind clusters on host Docker: a kind cluster is
|
|
81
|
+
# nothing more than containers carrying this label
|
|
82
|
+
kind_containers_devzone="$(docker ps -aq --filter "label=io.x-k8s.kind.cluster=devzone${INSTANCE_SUFFIX}" 2>/dev/null | sort -u)"
|
|
83
|
+
kind_containers_gitlab="$(docker ps -aq --filter "label=io.x-k8s.kind.cluster=gitlab${INSTANCE_SUFFIX}" 2>/dev/null | sort -u)"
|
|
84
|
+
kind_containers="${kind_containers_devzone} ${kind_containers_gitlab}"
|
|
85
|
+
kind_containers="${kind_containers# }"
|
|
86
|
+
kind_containers="${kind_containers% }"
|
|
89
87
|
|
|
90
|
-
#
|
|
91
|
-
|
|
88
|
+
# Containers carrying label devzone.instance=<instance>
|
|
89
|
+
labeled_containers="$(docker ps -aq --filter "label=devzone.instance=$DEVZONE_INSTANCE" 2>/dev/null | sort -u)"
|
|
92
90
|
|
|
93
|
-
# Volumes
|
|
94
|
-
config="$(npx -y @devcontainers/cli read-configuration --workspace-folder "$
|
|
95
|
-
echo "✖
|
|
91
|
+
# Volumes: exact names from devcontainer.json (including DEVZONE_VOLUMES prefix)
|
|
92
|
+
config="$(npx -y @devcontainers/cli read-configuration --workspace-folder "$HERE" 2>/dev/null)" || {
|
|
93
|
+
echo "✖ cannot read .devcontainer/devcontainer.json (npx @devcontainers/cli)" >&2
|
|
96
94
|
exit 1
|
|
97
95
|
}
|
|
98
|
-
# shellcheck disable=SC2016 # ${m.source}
|
|
99
|
-
for
|
|
96
|
+
# shellcheck disable=SC2016 # ${m.source}: JavaScript template, not shell
|
|
97
|
+
for name in $(node -e '
|
|
100
98
|
const c = JSON.parse(require("fs").readFileSync(0, "utf8")).configuration;
|
|
101
99
|
for (const m of c.mounts || []) {
|
|
102
100
|
const s = typeof m === "string" ? m : `source=${m.source},type=${m.type}`;
|
|
103
101
|
if (/type=volume/.test(s)) { const r = /source=([^,]+)/.exec(s); if (r) console.log(r[1]); }
|
|
104
102
|
}' <<<"$config"); do
|
|
105
|
-
docker volume inspect "$
|
|
106
|
-
|
|
107
|
-
if [ "$
|
|
108
|
-
for c in "${
|
|
103
|
+
docker volume inspect "$name" >/dev/null 2>&1 || continue
|
|
104
|
+
keep=false
|
|
105
|
+
if [ "$KEEP" = logins ] || [ "$KEEP" = connexions ]; then
|
|
106
|
+
for c in "${LOGINS[@]}"; do [[ "$name" == *-"$c" ]] && keep=true; done
|
|
109
107
|
fi
|
|
110
|
-
if [ "$
|
|
108
|
+
if [ "$keep" = true ]; then kept+=("$name"); else volumes+=("$name"); fi
|
|
111
109
|
done
|
|
112
110
|
fi
|
|
113
111
|
|
|
114
|
-
# metrics-server
|
|
115
|
-
#
|
|
116
|
-
metrics=()
|
|
112
|
+
# metrics-server installed by devzone (label devzone=installed), on reachable
|
|
113
|
+
# host local clusters; never another one
|
|
114
|
+
metrics=() foreign=()
|
|
117
115
|
if command -v kubectl >/dev/null 2>&1; then
|
|
118
|
-
for ctx in $(kubectl config get-contexts -o name 2>/dev/null | grep -E "$
|
|
116
|
+
for ctx in $(kubectl config get-contexts -o name 2>/dev/null | grep -E "$LOCAL_CTX" || true); do
|
|
119
117
|
k=(kubectl --context "$ctx" --request-timeout=5s)
|
|
120
118
|
"${k[@]}" get --raw /readyz >/dev/null 2>&1 || continue
|
|
121
|
-
|
|
122
|
-
if [ "$
|
|
119
|
+
mark="$("${k[@]}" -n kube-system get deployment metrics-server -o jsonpath='{.metadata.labels.devzone}' 2>/dev/null)" || continue
|
|
120
|
+
if [ "$mark" = installe ] || [ "$mark" = installed ]; then metrics+=("$ctx"); else foreign+=("$ctx"); fi
|
|
123
121
|
done
|
|
124
122
|
fi
|
|
125
123
|
|
|
126
|
-
#
|
|
127
|
-
#
|
|
128
|
-
#
|
|
124
|
+
# devzone services (postgres module, #280) on a host cluster: the namespace it
|
|
125
|
+
# created (label managed-by=devzone). On the dedicated kind, they go with that
|
|
126
|
+
# cluster (removed below). Read only, never executed.
|
|
129
127
|
services=()
|
|
130
|
-
CLUSTER="$(sed -n 's/^cluster=//p' "$
|
|
128
|
+
CLUSTER="$(sed -n 's/^cluster=//p' "$HERE/.devzone.modules" 2>/dev/null | tail -1 || true)"
|
|
131
129
|
if [ -n "$CLUSTER" ] && [[ "$CLUSTER" != kind-* ]] && command -v kubectl >/dev/null 2>&1; then
|
|
132
130
|
for ns in $(kubectl --context "$CLUSTER" --request-timeout=5s get namespaces -l app.kubernetes.io/managed-by=devzone -o name 2>/dev/null || true); do
|
|
133
131
|
services+=("${ns#namespace/}")
|
|
@@ -135,87 +133,91 @@ if [ -n "$CLUSTER" ] && [[ "$CLUSTER" != kind-* ]] && command -v kubectl >/dev/n
|
|
|
135
133
|
fi
|
|
136
134
|
|
|
137
135
|
# --- Confirmation ------------------------------------------------------------
|
|
138
|
-
|
|
139
|
-
echo "
|
|
140
|
-
echo "
|
|
141
|
-
echo " image(s)
|
|
142
|
-
echo "
|
|
143
|
-
echo " volumes
|
|
144
|
-
echo " metrics-server
|
|
145
|
-
echo " services
|
|
146
|
-
echo " clusters
|
|
136
|
+
show_list() { if [ "$#" -eq 0 ]; then echo " (none)"; else printf ' %s\n' "$@"; fi; }
|
|
137
|
+
echo "To remove:"
|
|
138
|
+
echo " container(s):"; show_list ${containers[@]+"${containers[@]}"}
|
|
139
|
+
echo " image(s):"; show_list ${images[@]+"${images[@]}"}
|
|
140
|
+
echo " former internal Docker (installs before #291):"; show_list ${dind[@]+"${dind[@]}"}
|
|
141
|
+
echo " volumes:"; show_list ${volumes[@]+"${volumes[@]}"}
|
|
142
|
+
echo " metrics-server installed by devzone on:"; show_list ${metrics[@]+"${metrics[@]}"}
|
|
143
|
+
echo " devzone services (including postgres databases) on ${CLUSTER:-no cluster}:"; show_list ${services[@]+"${services[@]}"}
|
|
144
|
+
echo " kind clusters of the instance on host Docker:"
|
|
147
145
|
# shellcheck disable=SC2086
|
|
148
|
-
|
|
149
|
-
echo "
|
|
146
|
+
show_list ${kind_containers}
|
|
147
|
+
echo " containers labeled devzone.instance=$DEVZONE_INSTANCE:"
|
|
150
148
|
# shellcheck disable=SC2086
|
|
151
|
-
|
|
152
|
-
[ "${#
|
|
153
|
-
if [ "$
|
|
154
|
-
echo "ℹ
|
|
155
|
-
echo "
|
|
149
|
+
show_list ${labeled_containers}
|
|
150
|
+
[ "${#kept[@]}" -eq 0 ] || { echo "Kept (KEEP=logins):"; printf ' %s\n' "${kept[@]}"; }
|
|
151
|
+
if [ "$INSIDE_CONTAINER" = false ] && [ "${#containers[@]}" -eq 0 ] && [ ! -f "$STATE" ] && [ "${#images[@]}" -eq 0 ]; then
|
|
152
|
+
echo "ℹ No container and no image trace: if a make down from an older version left them,"
|
|
153
|
+
echo " find them with: docker images 'vsc-$(basename "$HERE")-*' ; docker volume ls -q -f name=dind-var-lib-docker"
|
|
156
154
|
fi
|
|
157
155
|
|
|
158
|
-
nb_ck=0; for _ in ${
|
|
159
|
-
nb_ce=0; for _ in ${
|
|
160
|
-
total=$((${#
|
|
156
|
+
nb_ck=0; for _ in ${kind_containers}; do nb_ck=$((nb_ck + 1)); done
|
|
157
|
+
nb_ce=0; for _ in ${labeled_containers}; do nb_ce=$((nb_ce + 1)); done
|
|
158
|
+
total=$((${#containers[@]} + ${#images[@]} + ${#dind[@]} + ${#volumes[@]} + ${#metrics[@]} + ${#services[@]} + nb_ck + nb_ce))
|
|
161
159
|
if [ "$total" -eq 0 ]; then
|
|
162
|
-
echo "✔
|
|
160
|
+
echo "✔ Nothing to remove."
|
|
163
161
|
else
|
|
164
|
-
|
|
162
|
+
CONFIRM_VALUE="${CONFIRM:-${CONFIRMER:-}}"
|
|
163
|
+
if [ "$CONFIRM_VALUE" != yes ] && [ "$CONFIRM_VALUE" != oui ]; then
|
|
165
164
|
if [ ! -t 0 ]; then
|
|
166
|
-
echo "✖
|
|
165
|
+
echo "✖ Cannot confirm without a terminal: CONFIRM=yes make desinstaller" >&2
|
|
167
166
|
exit 1
|
|
168
167
|
fi
|
|
169
|
-
read -r -p "
|
|
170
|
-
|
|
168
|
+
read -r -p "Permanently remove? Type yes: " answer
|
|
169
|
+
case "$answer" in
|
|
170
|
+
yes | oui) ;;
|
|
171
|
+
*) echo "Canceled: nothing was removed."; exit 0 ;;
|
|
172
|
+
esac
|
|
171
173
|
fi
|
|
172
174
|
|
|
173
|
-
# ---
|
|
174
|
-
for id in ${
|
|
175
|
-
for i in ${images[@]+"${images[@]}"}; do docker rmi "$i" >/dev/null && echo "✔ image
|
|
176
|
-
for v in ${dind[@]+"${dind[@]}"} ${volumes[@]+"${volumes[@]}"}; do docker volume rm "$v" >/dev/null && echo "✔ volume
|
|
175
|
+
# --- Removal -------------------------------------------------------------
|
|
176
|
+
for id in ${containers[@]+"${containers[@]}"}; do docker rm -f "$id" >/dev/null && echo "✔ container removed: $id"; done
|
|
177
|
+
for i in ${images[@]+"${images[@]}"}; do docker rmi "$i" >/dev/null && echo "✔ image removed: $i"; done
|
|
178
|
+
for v in ${dind[@]+"${dind[@]}"} ${volumes[@]+"${volumes[@]}"}; do docker volume rm "$v" >/dev/null && echo "✔ volume removed: $v"; done
|
|
177
179
|
if [ "${#metrics[@]}" -gt 0 ]; then
|
|
178
|
-
version="$(sed -n 's/^VERSION=//p' "$
|
|
179
|
-
|
|
180
|
+
version="$(sed -n 's/^VERSION=//p' "$HERE/.devcontainer/metrics-server.sh")"
|
|
181
|
+
manifest="https://github.com/kubernetes-sigs/metrics-server/releases/download/${version}/components.yaml"
|
|
180
182
|
for ctx in "${metrics[@]}"; do
|
|
181
|
-
kubectl --context "$ctx" delete -f "$
|
|
182
|
-
echo "✔ metrics-server
|
|
183
|
+
kubectl --context "$ctx" delete -f "$manifest" --ignore-not-found >/dev/null &&
|
|
184
|
+
echo "✔ metrics-server removed: $ctx"
|
|
183
185
|
done
|
|
184
186
|
fi
|
|
185
187
|
for ns in ${services[@]+"${services[@]}"}; do
|
|
186
188
|
kubectl --context "$CLUSTER" delete namespace "$ns" --wait=true >/dev/null &&
|
|
187
|
-
echo "✔ namespace
|
|
189
|
+
echo "✔ namespace removed: $ns ($CLUSTER)"
|
|
188
190
|
done
|
|
189
|
-
for id in ${
|
|
190
|
-
docker rm -f "$id" >/dev/null 2>&1 && echo "✔
|
|
191
|
+
for id in ${kind_containers}; do
|
|
192
|
+
docker rm -f "$id" >/dev/null 2>&1 && echo "✔ kind cluster container removed: $id"
|
|
191
193
|
done
|
|
192
|
-
#
|
|
193
|
-
|
|
194
|
-
[ "$
|
|
195
|
-
if [ -n "$
|
|
194
|
+
# kind Docker network: removed only if no container uses it anymore
|
|
195
|
+
kind_network=""
|
|
196
|
+
[ "$INSIDE_CONTAINER" = true ] || kind_network="$(docker network inspect kind 2>/dev/null || true)"
|
|
197
|
+
if [ -n "$kind_network" ] && printf '%s\n' "$kind_network" | grep -q '"Containers": {}'; then
|
|
196
198
|
if docker network rm kind >/dev/null 2>&1; then
|
|
197
|
-
echo "✔
|
|
199
|
+
echo "✔ kind Docker network removed"
|
|
198
200
|
fi
|
|
199
201
|
fi
|
|
200
|
-
for id in ${
|
|
201
|
-
docker rm -f "$id" >/dev/null 2>&1 && echo "✔
|
|
202
|
+
for id in ${labeled_containers}; do
|
|
203
|
+
docker rm -f "$id" >/dev/null 2>&1 && echo "✔ labeled container removed: $id"
|
|
202
204
|
done
|
|
203
205
|
fi
|
|
204
|
-
rm -f "$
|
|
206
|
+
rm -f "$HERE/.devzone.log" "$STATE"
|
|
205
207
|
|
|
206
|
-
#
|
|
207
|
-
#
|
|
208
|
-
rm -f "$
|
|
208
|
+
# Instance module state (one "module=on|off" line): removed, modules return to
|
|
209
|
+
# their default values on next start
|
|
210
|
+
rm -f "$HERE/.devzone.modules"
|
|
209
211
|
|
|
210
|
-
# ---
|
|
212
|
+
# --- What remains ------------------------------------------------------------
|
|
211
213
|
echo
|
|
212
|
-
echo "
|
|
213
|
-
echo " workspace
|
|
214
|
-
for ctx in ${
|
|
215
|
-
echo " metrics-server
|
|
214
|
+
echo "Not touched (remove yourself if you want):"
|
|
215
|
+
echo " workspace/: your projects"
|
|
216
|
+
for ctx in ${foreign[@]+"${foreign[@]}"}; do
|
|
217
|
+
echo " metrics-server on $ctx: not installed by devzone (kubectl --context $ctx -n kube-system delete deployment metrics-server)"
|
|
216
218
|
done
|
|
217
|
-
command -v kubectl >/dev/null 2>&1 || echo " metrics-server
|
|
218
|
-
echo " image
|
|
219
|
-
echo "
|
|
220
|
-
echo "
|
|
221
|
-
echo "
|
|
219
|
+
command -v kubectl >/dev/null 2>&1 || echo " metrics-server: kubectl not on host, host clusters not checked"
|
|
220
|
+
echo " base image mcr.microsoft.com/devcontainers/base (shared): docker rmi mcr.microsoft.com/devcontainers/base:ubuntu-24.04"
|
|
221
|
+
echo " devcontainer CLI npx cache: ~/.npm/_npx"
|
|
222
|
+
echo " \"GitHub CLI\" authorization on your account: GitHub → Settings → Applications"
|
|
223
|
+
echo " this folder: $HERE"
|
package/manage/scripts/docker.sh
CHANGED
|
@@ -1,39 +1,43 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# desinstaller.sh
|
|
4
|
-
#
|
|
5
|
-
# DEVZONE_DOCKER
|
|
6
|
-
# Compatible bash 3.2 (macOS).
|
|
2
|
+
# Checks Docker on the host before any call (sourced by lancer.sh,
|
|
3
|
+
# desinstaller.sh and the npm command manage/devzone): without it the user
|
|
4
|
+
# would only see the raw devcontainers CLI or docker error.
|
|
5
|
+
# DEVZONE_DOCKER: docker command name (tests: simulate its absence).
|
|
6
|
+
# Compatible with bash 3.2 (macOS).
|
|
7
7
|
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
# Returns 0 if Docker responds; otherwise prints the cause (missing, no
|
|
9
|
+
# permission, stopped) and what to do on stderr, then asks to run $1 again;
|
|
10
|
+
# returns 1. Nothing raw on screen.
|
|
11
|
+
docker_ready() {
|
|
12
|
+
local command_name="$1" docker_cmd="${DEVZONE_DOCKER:-docker}" err
|
|
13
|
+
if ! command -v "$docker_cmd" >/dev/null 2>&1; then
|
|
13
14
|
{
|
|
14
|
-
echo "✖ Docker
|
|
15
|
-
echo "
|
|
16
|
-
echo "
|
|
17
|
-
echo "
|
|
15
|
+
echo "✖ Docker not found: devzone needs it to run its container."
|
|
16
|
+
echo " Install Docker Desktop (macOS, Windows, Linux): https://docs.docker.com/desktop/"
|
|
17
|
+
echo " or, on Linux, Docker Engine: https://docs.docker.com/engine/install/"
|
|
18
|
+
echo " then run $command_name again"
|
|
18
19
|
} >&2
|
|
19
20
|
return 1
|
|
20
21
|
fi
|
|
21
|
-
|
|
22
|
-
case "$
|
|
22
|
+
err="$("$docker_cmd" info 2>&1 >/dev/null)" && return 0
|
|
23
|
+
case "$err" in
|
|
23
24
|
*"permission denied"* | *"Permission denied"*)
|
|
24
25
|
{
|
|
25
|
-
echo "✖ Docker
|
|
26
|
-
echo " sudo usermod -aG docker \$USER,
|
|
27
|
-
echo "
|
|
26
|
+
echo "✖ Docker denied access: your account is not in the docker group."
|
|
27
|
+
echo " sudo usermod -aG docker \$USER, then open a new session (or newgrp docker),"
|
|
28
|
+
echo " then run $command_name again"
|
|
28
29
|
} >&2
|
|
29
30
|
;;
|
|
30
31
|
*)
|
|
31
32
|
{
|
|
32
|
-
echo "✖ Docker
|
|
33
|
-
echo "
|
|
34
|
-
echo "
|
|
33
|
+
echo "✖ Docker is installed but does not respond (stopped?)."
|
|
34
|
+
echo " Start Docker Desktop (on Linux without Docker Desktop: sudo systemctl start docker),"
|
|
35
|
+
echo " then run $command_name again"
|
|
35
36
|
} >&2
|
|
36
37
|
;;
|
|
37
38
|
esac
|
|
38
39
|
return 1
|
|
39
40
|
}
|
|
41
|
+
|
|
42
|
+
# compatibility alias, removed with lot 4 (#509)
|
|
43
|
+
docker_pret() { docker_ready "$@"; }
|