devzone 0.37.0 → 0.39.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/argocd.sh +6 -7
- package/.devcontainer/argocd/catalogue-argocd.sh +114 -0
- package/.devcontainer/argocd/gitops.sh +18 -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 +17 -2
- package/.devcontainer/etat-json.sh +5 -1
- package/.devcontainer/password.sh +8 -0
- package/README.md +7 -1
- 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/manage/devzone +83 -4
- package/manage/scripts/argocd-services-svc.sh +110 -0
- package/manage/scripts/argocd-services.sh +21 -85
- package/manage/scripts/argocd-workspace.sh +8 -6
- package/manage/scripts/ci-dns.sh +10 -10
- package/manage/scripts/desinstaller.sh +150 -136
- 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 +87 -82
- package/manage/scripts/poste.sh +48 -49
- package/manage/scripts/services-workspace.sh +15 -10
- package/manage/scripts/versions.sh +88 -88
- package/manage/scripts/workspace-aliases.sh +47 -0
- package/manage/scripts/workspace-wait.sh +26 -23
- package/manage/workspace.sh +124 -111
- package/package.json +1 -1
- package/.devcontainer/argocd/values.yaml +0 -25
|
@@ -1,133 +1,139 @@
|
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
#
|
|
36
|
-
#
|
|
32
|
+
docker_ready "${DEVZONE_COMMANDE:-make desinstaller}" || exit 1
|
|
33
|
+
|
|
34
|
+
# .argocd.conf of the devzone folder: the GitOps repository is never removed
|
|
35
|
+
# with the devzone, only its designation can be changed later
|
|
36
|
+
# shellcheck disable=SC2034 # read by conf.sh
|
|
37
|
+
ARGOCD_CONF="$HERE/.argocd.conf"
|
|
38
|
+
# shellcheck source=SCRIPTDIR/../.devcontainer/argocd/conf.sh
|
|
39
|
+
# shellcheck disable=SC1091
|
|
40
|
+
. "$HERE/.devcontainer/argocd/conf.sh"
|
|
41
|
+
|
|
42
|
+
# Instance name: an instance name may contain a dash (my-devzone),
|
|
43
|
+
# so DEVZONE_VOLUMES is never split
|
|
37
44
|
DEVZONE_INSTANCE="${DEVZONE_VOLUMES:-devzone}"
|
|
38
45
|
INSTANCE_SUFFIX=""
|
|
39
46
|
if [ "$DEVZONE_INSTANCE" != "devzone" ]; then
|
|
40
47
|
INSTANCE_SUFFIX="-${DEVZONE_INSTANCE}"
|
|
41
48
|
fi
|
|
42
49
|
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
# DEVZONE_DANS_CONTENEUR=
|
|
49
|
-
# dans un conteneur)
|
|
50
|
+
# Run INSIDE the container, docker talks to host Docker (#291): volumes, images
|
|
51
|
+
# and containers seen are those of the workstation, and the host instance name
|
|
52
|
+
# (DEVZONE_VOLUMES) is unknown here. Touching Docker from the container could
|
|
53
|
+
# remove another instance's resources (or the default instance): only the
|
|
54
|
+
# Kubernetes part is handled.
|
|
55
|
+
# DEVZONE_DANS_CONTENEUR=yes|no forces the mode (tests, which run inside a container)
|
|
50
56
|
case "${DEVZONE_DANS_CONTENEUR:-}" in
|
|
51
|
-
oui)
|
|
52
|
-
non)
|
|
53
|
-
*)
|
|
57
|
+
oui | yes) INSIDE_CONTAINER=true ;;
|
|
58
|
+
non | no) INSIDE_CONTAINER=false ;;
|
|
59
|
+
*) INSIDE_CONTAINER=false; [ ! -f /.dockerenv ] || INSIDE_CONTAINER=true ;;
|
|
54
60
|
esac
|
|
55
61
|
|
|
56
|
-
# ---
|
|
57
|
-
echo "▶
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if [ "$
|
|
61
|
-
echo "ℹ
|
|
62
|
-
echo "
|
|
62
|
+
# --- Inventory ---------------------------------------------------------------
|
|
63
|
+
echo "▶ Inventory (folder $HERE)"
|
|
64
|
+
containers=() images=() dind=() volumes=() kept=()
|
|
65
|
+
kind_containers="" labeled_containers=""
|
|
66
|
+
if [ "$INSIDE_CONTAINER" = true ]; then
|
|
67
|
+
echo "ℹ Inside the container: only metrics-server and devzone services are handled."
|
|
68
|
+
echo " Container, image, volumes and kind clusters: make desinstaller on your machine."
|
|
63
69
|
else
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
ids="$(for
|
|
70
|
+
# Label set with the path as opened (VS Code, make): logical or physical path
|
|
71
|
+
# depending on symlinks; both are searched
|
|
72
|
+
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
73
|
for id in ${ids}; do
|
|
68
|
-
|
|
74
|
+
containers+=("$id")
|
|
69
75
|
images+=("$(docker inspect "$id" --format '{{.Config.Image}}')")
|
|
70
76
|
v="$(docker inspect "$id" --format '{{range .Mounts}}{{if eq .Destination "/var/lib/docker"}}{{.Name}}{{end}}{{end}}')"
|
|
71
77
|
[ -z "$v" ] || dind+=("$v")
|
|
72
78
|
done
|
|
73
|
-
#
|
|
74
|
-
if [ "${#
|
|
75
|
-
#
|
|
76
|
-
IMAGE="$(sed -n 's/^IMAGE=//p' "$
|
|
77
|
-
DIND="$(sed -n 's/^DIND=//p' "$
|
|
79
|
+
# Container already removed by make down: image and internal Docker noted then
|
|
80
|
+
if [ "${#containers[@]}" -eq 0 ] && [ -f "$STATE" ]; then
|
|
81
|
+
# Read only, never executed
|
|
82
|
+
IMAGE="$(sed -n 's/^IMAGE=//p' "$STATE")"
|
|
83
|
+
DIND="$(sed -n 's/^DIND=//p' "$STATE")"
|
|
78
84
|
[ -z "${IMAGE:-}" ] || ! docker image inspect "$IMAGE" >/dev/null 2>&1 || images+=("$IMAGE")
|
|
79
85
|
[ -z "${DIND:-}" ] || ! docker volume inspect "$DIND" >/dev/null 2>&1 || dind+=("$DIND")
|
|
80
86
|
fi
|
|
81
87
|
|
|
82
|
-
#
|
|
83
|
-
#
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
# Containers of the instance kind clusters on host Docker: a kind cluster is
|
|
89
|
+
# nothing more than containers carrying this label
|
|
90
|
+
kind_containers_devzone="$(docker ps -aq --filter "label=io.x-k8s.kind.cluster=devzone${INSTANCE_SUFFIX}" 2>/dev/null | sort -u)"
|
|
91
|
+
kind_containers_gitlab="$(docker ps -aq --filter "label=io.x-k8s.kind.cluster=gitlab${INSTANCE_SUFFIX}" 2>/dev/null | sort -u)"
|
|
92
|
+
kind_containers="${kind_containers_devzone} ${kind_containers_gitlab}"
|
|
93
|
+
kind_containers="${kind_containers# }"
|
|
94
|
+
kind_containers="${kind_containers% }"
|
|
89
95
|
|
|
90
|
-
#
|
|
91
|
-
|
|
96
|
+
# Containers carrying label devzone.instance=<instance>
|
|
97
|
+
labeled_containers="$(docker ps -aq --filter "label=devzone.instance=$DEVZONE_INSTANCE" 2>/dev/null | sort -u)"
|
|
92
98
|
|
|
93
|
-
# Volumes
|
|
94
|
-
config="$(npx -y @devcontainers/cli read-configuration --workspace-folder "$
|
|
95
|
-
echo "✖
|
|
99
|
+
# Volumes: exact names from devcontainer.json (including DEVZONE_VOLUMES prefix)
|
|
100
|
+
config="$(npx -y @devcontainers/cli read-configuration --workspace-folder "$HERE" 2>/dev/null)" || {
|
|
101
|
+
echo "✖ cannot read .devcontainer/devcontainer.json (npx @devcontainers/cli)" >&2
|
|
96
102
|
exit 1
|
|
97
103
|
}
|
|
98
|
-
# shellcheck disable=SC2016 # ${m.source}
|
|
99
|
-
for
|
|
104
|
+
# shellcheck disable=SC2016 # ${m.source}: JavaScript template, not shell
|
|
105
|
+
for name in $(node -e '
|
|
100
106
|
const c = JSON.parse(require("fs").readFileSync(0, "utf8")).configuration;
|
|
101
107
|
for (const m of c.mounts || []) {
|
|
102
108
|
const s = typeof m === "string" ? m : `source=${m.source},type=${m.type}`;
|
|
103
109
|
if (/type=volume/.test(s)) { const r = /source=([^,]+)/.exec(s); if (r) console.log(r[1]); }
|
|
104
110
|
}' <<<"$config"); do
|
|
105
|
-
docker volume inspect "$
|
|
106
|
-
|
|
107
|
-
if [ "$
|
|
108
|
-
for c in "${
|
|
111
|
+
docker volume inspect "$name" >/dev/null 2>&1 || continue
|
|
112
|
+
keep=false
|
|
113
|
+
if [ "$KEEP" = logins ] || [ "$KEEP" = connexions ]; then
|
|
114
|
+
for c in "${LOGINS[@]}"; do [[ "$name" == *-"$c" ]] && keep=true; done
|
|
109
115
|
fi
|
|
110
|
-
if [ "$
|
|
116
|
+
if [ "$keep" = true ]; then kept+=("$name"); else volumes+=("$name"); fi
|
|
111
117
|
done
|
|
112
118
|
fi
|
|
113
119
|
|
|
114
|
-
# metrics-server
|
|
115
|
-
#
|
|
116
|
-
metrics=()
|
|
120
|
+
# metrics-server installed by devzone (label devzone=installed), on reachable
|
|
121
|
+
# host local clusters; never another one
|
|
122
|
+
metrics=() foreign=()
|
|
117
123
|
if command -v kubectl >/dev/null 2>&1; then
|
|
118
|
-
for ctx in $(kubectl config get-contexts -o name 2>/dev/null | grep -E "$
|
|
124
|
+
for ctx in $(kubectl config get-contexts -o name 2>/dev/null | grep -E "$LOCAL_CTX" || true); do
|
|
119
125
|
k=(kubectl --context "$ctx" --request-timeout=5s)
|
|
120
126
|
"${k[@]}" get --raw /readyz >/dev/null 2>&1 || continue
|
|
121
|
-
|
|
122
|
-
if [ "$
|
|
127
|
+
mark="$("${k[@]}" -n kube-system get deployment metrics-server -o jsonpath='{.metadata.labels.devzone}' 2>/dev/null)" || continue
|
|
128
|
+
if [ "$mark" = installe ] || [ "$mark" = installed ]; then metrics+=("$ctx"); else foreign+=("$ctx"); fi
|
|
123
129
|
done
|
|
124
130
|
fi
|
|
125
131
|
|
|
126
|
-
#
|
|
127
|
-
#
|
|
128
|
-
#
|
|
132
|
+
# devzone services (postgres module, #280) on a host cluster: the namespace it
|
|
133
|
+
# created (label managed-by=devzone). On the dedicated kind, they go with that
|
|
134
|
+
# cluster (removed below). Read only, never executed.
|
|
129
135
|
services=()
|
|
130
|
-
CLUSTER="$(sed -n 's/^cluster=//p' "$
|
|
136
|
+
CLUSTER="$(sed -n 's/^cluster=//p' "$HERE/.devzone.modules" 2>/dev/null | tail -1 || true)"
|
|
131
137
|
if [ -n "$CLUSTER" ] && [[ "$CLUSTER" != kind-* ]] && command -v kubectl >/dev/null 2>&1; then
|
|
132
138
|
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
139
|
services+=("${ns#namespace/}")
|
|
@@ -135,87 +141,95 @@ if [ -n "$CLUSTER" ] && [[ "$CLUSTER" != kind-* ]] && command -v kubectl >/dev/n
|
|
|
135
141
|
fi
|
|
136
142
|
|
|
137
143
|
# --- 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
|
|
144
|
+
show_list() { if [ "$#" -eq 0 ]; then echo " (none)"; else printf ' %s\n' "$@"; fi; }
|
|
145
|
+
echo "To remove:"
|
|
146
|
+
echo " container(s):"; show_list ${containers[@]+"${containers[@]}"}
|
|
147
|
+
echo " image(s):"; show_list ${images[@]+"${images[@]}"}
|
|
148
|
+
echo " former internal Docker (installs before #291):"; show_list ${dind[@]+"${dind[@]}"}
|
|
149
|
+
echo " volumes:"; show_list ${volumes[@]+"${volumes[@]}"}
|
|
150
|
+
echo " metrics-server installed by devzone on:"; show_list ${metrics[@]+"${metrics[@]}"}
|
|
151
|
+
echo " devzone services (including postgres databases) on ${CLUSTER:-no cluster}:"; show_list ${services[@]+"${services[@]}"}
|
|
152
|
+
echo " kind clusters of the instance on host Docker:"
|
|
147
153
|
# shellcheck disable=SC2086
|
|
148
|
-
|
|
149
|
-
echo "
|
|
154
|
+
show_list ${kind_containers}
|
|
155
|
+
echo " containers labeled devzone.instance=$DEVZONE_INSTANCE:"
|
|
150
156
|
# shellcheck disable=SC2086
|
|
151
|
-
|
|
152
|
-
[ "${#
|
|
153
|
-
if [ "$
|
|
154
|
-
echo "ℹ
|
|
155
|
-
echo "
|
|
157
|
+
show_list ${labeled_containers}
|
|
158
|
+
[ "${#kept[@]}" -eq 0 ] || { echo "Kept (KEEP=logins):"; printf ' %s\n' "${kept[@]}"; }
|
|
159
|
+
if [ "$INSIDE_CONTAINER" = false ] && [ "${#containers[@]}" -eq 0 ] && [ ! -f "$STATE" ] && [ "${#images[@]}" -eq 0 ]; then
|
|
160
|
+
echo "ℹ No container and no image trace: if a make down from an older version left them,"
|
|
161
|
+
echo " find them with: docker images 'vsc-$(basename "$HERE")-*' ; docker volume ls -q -f name=dind-var-lib-docker"
|
|
156
162
|
fi
|
|
157
163
|
|
|
158
|
-
nb_ck=0; for _ in ${
|
|
159
|
-
nb_ce=0; for _ in ${
|
|
160
|
-
total=$((${#
|
|
164
|
+
nb_ck=0; for _ in ${kind_containers}; do nb_ck=$((nb_ck + 1)); done
|
|
165
|
+
nb_ce=0; for _ in ${labeled_containers}; do nb_ce=$((nb_ce + 1)); done
|
|
166
|
+
total=$((${#containers[@]} + ${#images[@]} + ${#dind[@]} + ${#volumes[@]} + ${#metrics[@]} + ${#services[@]} + nb_ck + nb_ce))
|
|
161
167
|
if [ "$total" -eq 0 ]; then
|
|
162
|
-
echo "✔
|
|
168
|
+
echo "✔ Nothing to remove."
|
|
163
169
|
else
|
|
164
|
-
|
|
170
|
+
CONFIRM_VALUE="${CONFIRM:-${CONFIRMER:-}}"
|
|
171
|
+
if [ "$CONFIRM_VALUE" != yes ] && [ "$CONFIRM_VALUE" != oui ]; then
|
|
165
172
|
if [ ! -t 0 ]; then
|
|
166
|
-
echo "✖
|
|
173
|
+
echo "✖ Cannot confirm without a terminal: CONFIRM=yes make desinstaller" >&2
|
|
167
174
|
exit 1
|
|
168
175
|
fi
|
|
169
|
-
read -r -p "
|
|
170
|
-
|
|
176
|
+
read -r -p "Permanently remove? Type yes: " answer
|
|
177
|
+
case "$answer" in
|
|
178
|
+
yes | oui) ;;
|
|
179
|
+
*) echo "Canceled: nothing was removed."; exit 0 ;;
|
|
180
|
+
esac
|
|
171
181
|
fi
|
|
172
182
|
|
|
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
|
|
183
|
+
# --- Removal -------------------------------------------------------------
|
|
184
|
+
for id in ${containers[@]+"${containers[@]}"}; do docker rm -f "$id" >/dev/null && echo "✔ container removed: $id"; done
|
|
185
|
+
for i in ${images[@]+"${images[@]}"}; do docker rmi "$i" >/dev/null && echo "✔ image removed: $i"; done
|
|
186
|
+
for v in ${dind[@]+"${dind[@]}"} ${volumes[@]+"${volumes[@]}"}; do docker volume rm "$v" >/dev/null && echo "✔ volume removed: $v"; done
|
|
177
187
|
if [ "${#metrics[@]}" -gt 0 ]; then
|
|
178
|
-
version="$(sed -n 's/^VERSION=//p' "$
|
|
179
|
-
|
|
188
|
+
version="$(sed -n 's/^VERSION=//p' "$HERE/.devcontainer/metrics-server.sh")"
|
|
189
|
+
manifest="https://github.com/kubernetes-sigs/metrics-server/releases/download/${version}/components.yaml"
|
|
180
190
|
for ctx in "${metrics[@]}"; do
|
|
181
|
-
kubectl --context "$ctx" delete -f "$
|
|
182
|
-
echo "✔ metrics-server
|
|
191
|
+
kubectl --context "$ctx" delete -f "$manifest" --ignore-not-found >/dev/null &&
|
|
192
|
+
echo "✔ metrics-server removed: $ctx"
|
|
183
193
|
done
|
|
184
194
|
fi
|
|
185
195
|
for ns in ${services[@]+"${services[@]}"}; do
|
|
186
196
|
kubectl --context "$CLUSTER" delete namespace "$ns" --wait=true >/dev/null &&
|
|
187
|
-
echo "✔ namespace
|
|
197
|
+
echo "✔ namespace removed: $ns ($CLUSTER)"
|
|
188
198
|
done
|
|
189
|
-
for id in ${
|
|
190
|
-
docker rm -f "$id" >/dev/null 2>&1 && echo "✔
|
|
199
|
+
for id in ${kind_containers}; do
|
|
200
|
+
docker rm -f "$id" >/dev/null 2>&1 && echo "✔ kind cluster container removed: $id"
|
|
191
201
|
done
|
|
192
|
-
#
|
|
193
|
-
|
|
194
|
-
[ "$
|
|
195
|
-
if [ -n "$
|
|
202
|
+
# kind Docker network: removed only if no container uses it anymore
|
|
203
|
+
kind_network=""
|
|
204
|
+
[ "$INSIDE_CONTAINER" = true ] || kind_network="$(docker network inspect kind 2>/dev/null || true)"
|
|
205
|
+
if [ -n "$kind_network" ] && printf '%s\n' "$kind_network" | grep -q '"Containers": {}'; then
|
|
196
206
|
if docker network rm kind >/dev/null 2>&1; then
|
|
197
|
-
echo "✔
|
|
207
|
+
echo "✔ kind Docker network removed"
|
|
198
208
|
fi
|
|
199
209
|
fi
|
|
200
|
-
for id in ${
|
|
201
|
-
docker rm -f "$id" >/dev/null 2>&1 && echo "✔
|
|
210
|
+
for id in ${labeled_containers}; do
|
|
211
|
+
docker rm -f "$id" >/dev/null 2>&1 && echo "✔ labeled container removed: $id"
|
|
202
212
|
done
|
|
203
213
|
fi
|
|
204
|
-
rm -f "$
|
|
214
|
+
rm -f "$HERE/.devzone.log" "$STATE"
|
|
205
215
|
|
|
206
|
-
#
|
|
207
|
-
#
|
|
208
|
-
rm -f "$
|
|
216
|
+
# Instance module state (one "module=on|off" line): removed, modules return to
|
|
217
|
+
# their default values on next start
|
|
218
|
+
rm -f "$HERE/.devzone.modules"
|
|
209
219
|
|
|
210
|
-
# ---
|
|
220
|
+
# --- What remains ------------------------------------------------------------
|
|
211
221
|
echo
|
|
212
|
-
echo "
|
|
213
|
-
echo " workspace
|
|
214
|
-
for ctx in ${
|
|
215
|
-
echo " metrics-server
|
|
222
|
+
echo "Not touched (remove yourself if you want):"
|
|
223
|
+
echo " workspace/: your projects"
|
|
224
|
+
for ctx in ${foreign[@]+"${foreign[@]}"}; do
|
|
225
|
+
echo " metrics-server on $ctx: not installed by devzone (kubectl --context $ctx -n kube-system delete deployment metrics-server)"
|
|
216
226
|
done
|
|
217
|
-
command -v kubectl >/dev/null 2>&1 || echo " metrics-server
|
|
218
|
-
echo " image
|
|
219
|
-
echo "
|
|
220
|
-
echo "
|
|
221
|
-
|
|
227
|
+
command -v kubectl >/dev/null 2>&1 || echo " metrics-server: kubectl not on host, host clusters not checked"
|
|
228
|
+
echo " base image mcr.microsoft.com/devcontainers/base (shared): docker rmi mcr.microsoft.com/devcontainers/base:ubuntu-24.04"
|
|
229
|
+
echo " devcontainer CLI npx cache: ~/.npm/_npx"
|
|
230
|
+
echo " \"GitHub CLI\" authorization on your account: GitHub → Settings → Applications"
|
|
231
|
+
ARGOCD_REPO="$(conf_get argocd repo)"
|
|
232
|
+
if [ -n "$ARGOCD_REPO" ] && [ "$ARGOCD_REPO" != none ]; then
|
|
233
|
+
echo " GitOps repository not removed: $ARGOCD_REPO (delete it yourself if you want to)"
|
|
234
|
+
fi
|
|
235
|
+
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 "$@"; }
|