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
package/manage/workspace.sh
CHANGED
|
@@ -1,43 +1,46 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# charts/devzone-workspace
|
|
2
|
+
# Workstation commands for the Kubernetes workspace (#398, #399): drives the
|
|
3
|
+
# charts/devzone-workspace chart with host helm and kubectl.
|
|
4
4
|
set -euo pipefail
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
# Pod, namespace
|
|
6
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
+
ROOT="$(cd "$HERE/.." && pwd)"
|
|
8
|
+
# Pod, namespace and projects folder inside the container (#399).
|
|
9
9
|
POD="devzone-workspace-0"
|
|
10
10
|
NAMESPACE="devzone-workspace"
|
|
11
|
-
|
|
11
|
+
PROJECTS_DIR="/workspaces/projets"
|
|
12
|
+
# compatibility alias, removed with lot 4 (#509)
|
|
13
|
+
# shellcheck disable=SC2034
|
|
14
|
+
DOSSIER_PROJETS="$PROJECTS_DIR"
|
|
12
15
|
|
|
13
|
-
#
|
|
14
|
-
|
|
16
|
+
# Helm flag: devzone context if it exists, otherwise current context (no flag).
|
|
17
|
+
helm_flag() {
|
|
15
18
|
if kubectl config get-contexts -o name 2>/dev/null | grep -qx 'devzone'; then
|
|
16
19
|
printf -- '--kube-context devzone'
|
|
17
20
|
fi
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
#
|
|
21
|
-
|
|
23
|
+
# kubectl flag: devzone context if it exists, otherwise current context (no flag).
|
|
24
|
+
kubectl_flag() {
|
|
22
25
|
if kubectl config get-contexts -o name 2>/dev/null | grep -qx 'devzone'; then
|
|
23
26
|
printf -- '--context devzone'
|
|
24
27
|
fi
|
|
25
28
|
}
|
|
26
29
|
|
|
27
|
-
#
|
|
28
|
-
|
|
29
|
-
printf '%s/charts/devzone-workspace' "$
|
|
30
|
+
# Chart path in the repository (or installed package).
|
|
31
|
+
chart_path() {
|
|
32
|
+
printf '%s/charts/devzone-workspace' "$ROOT"
|
|
30
33
|
}
|
|
31
34
|
|
|
32
|
-
#
|
|
33
|
-
|
|
35
|
+
# Repository of the image published at each devzone release.
|
|
36
|
+
IMAGE_REPO="ghcr.io/simbienvenuehoulboumi/devzone-workspace"
|
|
34
37
|
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
|
|
38
|
+
# Why: without tag, the chart takes its appVersion (0.1.0), an image never
|
|
39
|
+
# published; the package version is published at each release, and a
|
|
40
|
+
# development clone (0.0.0) uses latest.
|
|
41
|
+
default_image_tag() {
|
|
39
42
|
local version
|
|
40
|
-
version="$(sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' "$
|
|
43
|
+
version="$(sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' "$ROOT/package.json" | head -1)"
|
|
41
44
|
if [ -z "$version" ] || [ "$version" = "0.0.0" ]; then
|
|
42
45
|
echo "latest"
|
|
43
46
|
else
|
|
@@ -45,41 +48,53 @@ image_par_defaut() {
|
|
|
45
48
|
fi
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
#
|
|
49
|
-
|
|
50
|
-
local
|
|
51
|
-
|
|
52
|
-
tag="$(
|
|
51
|
+
# Installs or upgrades the workspace in the cluster.
|
|
52
|
+
start_workspace() {
|
|
53
|
+
local repo tag image with_image="" args=()
|
|
54
|
+
repo="$IMAGE_REPO"
|
|
55
|
+
tag="$(default_image_tag)"
|
|
53
56
|
while [ $# -gt 0 ]; do
|
|
54
57
|
case "$1" in
|
|
55
58
|
--image)
|
|
56
59
|
if [ $# -lt 2 ] || [ -z "$2" ]; then
|
|
57
|
-
echo "✖ option --image
|
|
60
|
+
echo "✖ option --image: provide an image <repository:tag> (devzone workspace start --image <repository:tag>)" >&2
|
|
58
61
|
return 1
|
|
59
62
|
fi
|
|
60
63
|
case "$2" in
|
|
61
64
|
*:*)
|
|
62
|
-
|
|
65
|
+
repo="${2%:*}"
|
|
63
66
|
tag="${2##*:}"
|
|
64
|
-
|
|
67
|
+
with_image=yes
|
|
65
68
|
;;
|
|
66
69
|
*)
|
|
67
|
-
echo "✖ option --image
|
|
70
|
+
echo "✖ option --image: image has no tag, expected <repository:tag> (devzone workspace start --image <repository:tag>)" >&2
|
|
68
71
|
return 1
|
|
69
72
|
;;
|
|
70
73
|
esac
|
|
71
74
|
shift 2
|
|
72
75
|
;;
|
|
73
76
|
*)
|
|
74
|
-
echo "✖ option
|
|
77
|
+
echo "✖ unknown option: $1 (devzone workspace start [--image <repository:tag>])" >&2
|
|
75
78
|
return 1
|
|
76
79
|
;;
|
|
77
80
|
esac
|
|
78
81
|
done
|
|
79
|
-
image="$
|
|
82
|
+
image="$repo:$tag"
|
|
83
|
+
# Argo CD first when wanted (#516): the workspace is then an Application
|
|
84
|
+
argocd_ensure
|
|
85
|
+
workspace_deploy "$repo" "$tag" "$with_image"
|
|
86
|
+
# Projects of .argocd.conf held too (#516)
|
|
87
|
+
argocd_reconcile || true
|
|
88
|
+
wait_for_pod "$image" || return 1
|
|
89
|
+
ports_start silence
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
# helm direct: the chart of the package, image set by the options
|
|
93
|
+
workspace_helm_deploy() {
|
|
94
|
+
local repo="$1" tag="$2" with_image="$3" args=()
|
|
80
95
|
args=(--namespace devzone-workspace --create-namespace)
|
|
81
|
-
if [ -n "$
|
|
82
|
-
args+=(--set "image.repository=$
|
|
96
|
+
if [ -n "$with_image" ]; then
|
|
97
|
+
args+=(--set "image.repository=$repo" --set "image.tag=$tag")
|
|
83
98
|
else
|
|
84
99
|
args+=(--set "image.tag=$tag")
|
|
85
100
|
fi
|
|
@@ -89,125 +104,139 @@ demarrer() {
|
|
|
89
104
|
args+=(--set "image.pullPolicy=Always")
|
|
90
105
|
fi
|
|
91
106
|
# shellcheck disable=SC2046
|
|
92
|
-
helm $(
|
|
93
|
-
attendre_pod "$image" || return 1
|
|
94
|
-
ports_demarrer silence
|
|
107
|
+
helm $(helm_flag) upgrade --install devzone-workspace "$(chart_path)" "${args[@]}"
|
|
95
108
|
}
|
|
96
109
|
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
helm $(drapeau_helm) uninstall devzone-workspace --namespace devzone-workspace
|
|
110
|
+
# Uninstalls the workspace from the cluster (Argo CD Application or helm release).
|
|
111
|
+
stop_workspace() {
|
|
112
|
+
ports_stop
|
|
113
|
+
workspace_undeploy
|
|
102
114
|
}
|
|
103
115
|
|
|
104
|
-
#
|
|
105
|
-
|
|
116
|
+
# Shows workspace pod status.
|
|
117
|
+
status_workspace() {
|
|
106
118
|
# shellcheck disable=SC2046
|
|
107
|
-
kubectl $(
|
|
119
|
+
kubectl $(kubectl_flag) get pods --namespace devzone-workspace
|
|
108
120
|
}
|
|
109
121
|
|
|
110
|
-
#
|
|
111
|
-
|
|
122
|
+
# Opens a shell in the workspace container.
|
|
123
|
+
shell_workspace() {
|
|
112
124
|
# shellcheck disable=SC2046
|
|
113
|
-
kubectl $(
|
|
125
|
+
kubectl $(kubectl_flag) exec -it devzone-workspace-0 \
|
|
114
126
|
--namespace devzone-workspace -c workspace -- bash
|
|
115
127
|
}
|
|
116
128
|
|
|
117
|
-
#
|
|
118
|
-
#
|
|
119
|
-
|
|
129
|
+
# VS Code steps (#399): attach to the pod with Kubernetes and Dev Containers
|
|
130
|
+
# extensions, without any command other than devzone.
|
|
131
|
+
vscode_workspace() {
|
|
120
132
|
cat <<EOF
|
|
121
|
-
|
|
122
|
-
1.
|
|
123
|
-
2.
|
|
124
|
-
|
|
125
|
-
(
|
|
126
|
-
3.
|
|
127
|
-
Pod
|
|
133
|
+
Attach VS Code to the pod: "Kubernetes" and "Dev Containers" extensions
|
|
134
|
+
1. kubectl context: devzone — namespace $NAMESPACE, pod $POD, container workspace
|
|
135
|
+
2. Kubernetes view: right-click the workspace container,
|
|
136
|
+
"Attach to Running Kubernetes Container"
|
|
137
|
+
(with Dev Containers extension: "Dev Containers: Attach to Running Container")
|
|
138
|
+
3. Open folder $PROJECTS_DIR in the attached window
|
|
139
|
+
Pod not ready: devzone workspace status
|
|
128
140
|
EOF
|
|
129
141
|
}
|
|
130
142
|
|
|
131
|
-
#
|
|
132
|
-
#
|
|
133
|
-
|
|
134
|
-
local
|
|
135
|
-
if [ -z "$
|
|
136
|
-
echo "✖
|
|
143
|
+
# Copies a workstation folder to $PROJECTS_DIR in the pod (#399, kubectl cp):
|
|
144
|
+
# the project keeps its folder name in the pod.
|
|
145
|
+
copy_to() {
|
|
146
|
+
local folder="${1:-}"
|
|
147
|
+
if [ -z "$folder" ]; then
|
|
148
|
+
echo "✖ provide a workstation folder: devzone workspace copy-to <folder>" >&2
|
|
137
149
|
exit 1
|
|
138
150
|
fi
|
|
139
|
-
if [ ! -d "$
|
|
140
|
-
echo "✖
|
|
151
|
+
if [ ! -d "$folder" ]; then
|
|
152
|
+
echo "✖ folder not found: $folder" >&2
|
|
141
153
|
exit 1
|
|
142
154
|
fi
|
|
143
|
-
|
|
155
|
+
folder="$(cd "$folder" && pwd)"
|
|
144
156
|
# shellcheck disable=SC2046
|
|
145
|
-
kubectl $(
|
|
157
|
+
kubectl $(kubectl_flag) cp "$folder" "$POD:$PROJECTS_DIR/$(basename "$folder")" \
|
|
146
158
|
--namespace "$NAMESPACE" -c workspace
|
|
147
159
|
}
|
|
148
160
|
|
|
149
|
-
#
|
|
150
|
-
#
|
|
151
|
-
|
|
152
|
-
local
|
|
153
|
-
if [ -z "$
|
|
154
|
-
echo "✖
|
|
161
|
+
# Copies a project from $PROJECTS_DIR in the pod to the workstation (#399, kubectl cp):
|
|
162
|
+
# the workstation folder gets the project name.
|
|
163
|
+
copy_from() {
|
|
164
|
+
local folder="${1:-}"
|
|
165
|
+
if [ -z "$folder" ]; then
|
|
166
|
+
echo "✖ provide a workstation folder: devzone workspace copy-from <folder>" >&2
|
|
155
167
|
exit 1
|
|
156
168
|
fi
|
|
157
|
-
#
|
|
158
|
-
|
|
169
|
+
# Absolute path: "copy-from ." gives the current folder name.
|
|
170
|
+
folder="$(cd "$folder" 2>/dev/null && pwd || echo "$folder")"
|
|
159
171
|
# shellcheck disable=SC2046
|
|
160
|
-
kubectl $(
|
|
172
|
+
kubectl $(kubectl_flag) cp "$POD:$PROJECTS_DIR/$(basename "$folder")" "$folder" \
|
|
161
173
|
--namespace "$NAMESPACE" -c workspace
|
|
162
174
|
}
|
|
163
175
|
|
|
164
|
-
#
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
176
|
+
# French names of the command and compatibility aliases (lot 3, #508)
|
|
177
|
+
# shellcheck source=manage/scripts/workspace-aliases.sh
|
|
178
|
+
. "$HERE/scripts/workspace-aliases.sh"
|
|
179
|
+
# shellcheck source=manage/scripts/workspace-wait.sh
|
|
180
|
+
. "$HERE/scripts/workspace-wait.sh"
|
|
181
|
+
# shellcheck source=manage/scripts/migrer.sh
|
|
182
|
+
. "$HERE/scripts/migrer.sh"
|
|
183
|
+
# shellcheck source=manage/scripts/migrer-retour.sh
|
|
184
|
+
. "$HERE/scripts/migrer-retour.sh"
|
|
185
|
+
# shellcheck source=manage/scripts/ports-workspace.sh
|
|
186
|
+
. "$HERE/scripts/ports-workspace.sh"
|
|
187
|
+
# shellcheck source=manage/scripts/services-workspace.sh
|
|
188
|
+
. "$HERE/scripts/services-workspace.sh"
|
|
189
|
+
# shellcheck source=manage/scripts/argocd-workspace.sh
|
|
190
|
+
. "$HERE/scripts/argocd-workspace.sh"
|
|
191
|
+
# shellcheck source=manage/scripts/argocd-services.sh
|
|
192
|
+
. "$HERE/scripts/argocd-services.sh"
|
|
174
193
|
|
|
175
194
|
# English command names are accepted, French ones unchanged (#502).
|
|
176
195
|
# A copied devzone may miss the aliases file: then no normalization.
|
|
177
196
|
# shellcheck source=../.devcontainer/command-aliases.sh
|
|
178
197
|
# shellcheck disable=SC1091
|
|
179
|
-
if [ -f "$
|
|
180
|
-
. "$
|
|
198
|
+
if [ -f "$ROOT/.devcontainer/command-aliases.sh" ]; then
|
|
199
|
+
. "$ROOT/.devcontainer/command-aliases.sh"
|
|
181
200
|
if [ "$#" -gt 0 ]; then
|
|
182
201
|
set -- "$(command_canonical "$1")" "${@:2}"
|
|
183
202
|
fi
|
|
184
203
|
fi
|
|
185
204
|
|
|
205
|
+
if [ "$#" -gt 0 ]; then
|
|
206
|
+
set -- "$(workspace_command "$1")" "${@:2}"
|
|
207
|
+
fi
|
|
208
|
+
if [ "${1:-}" = "ports" ] && [ "$#" -gt 1 ]; then
|
|
209
|
+
set -- "$1" "$(workspace_ports_command "$2")" "${@:3}"
|
|
210
|
+
fi
|
|
211
|
+
|
|
186
212
|
case "${1:-}" in
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
shell)
|
|
191
|
-
vscode)
|
|
192
|
-
|
|
193
|
-
|
|
213
|
+
start) start_workspace "${@:2}" ;;
|
|
214
|
+
stop) stop_workspace ;;
|
|
215
|
+
status) status_workspace ;;
|
|
216
|
+
shell) shell_workspace ;;
|
|
217
|
+
vscode) vscode_workspace ;;
|
|
218
|
+
copy-to) copy_to "${@:2}" ;;
|
|
219
|
+
copy-from) copy_from "${@:2}" ;;
|
|
194
220
|
ports) ports "${@:2}" ;;
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
221
|
+
migrate) migrate_workspace "${@:2}" ;;
|
|
222
|
+
revert) revert_workspace "${@:2}" ;;
|
|
223
|
+
clean-docker) clean_docker "${@:2}" ;;
|
|
198
224
|
services) services "${@:2}" ;;
|
|
225
|
+
argocd) argocd_cmd "${@:2}" ;;
|
|
199
226
|
'' | -h | --help | aide)
|
|
200
|
-
echo "devzone workspace
|
|
201
|
-
echo "
|
|
202
|
-
echo " ports [
|
|
227
|
+
echo "devzone workspace start|stop|status|shell|vscode|copy-to|copy-from|ports|services|argocd|migrate|revert|clean-docker"
|
|
228
|
+
echo " start [--image repository:tag] install workspace (image for devzone version by default)"
|
|
229
|
+
echo " ports [start|stop|status] applications and services from pod on workstation localhost"
|
|
203
230
|
echo " services enable|disable <service> [options] | status"
|
|
204
231
|
echo " devzone services (gitlab, postgres, argocd) of the cluster, installed from the workstation"
|
|
205
|
-
echo "
|
|
206
|
-
echo "
|
|
207
|
-
echo "
|
|
232
|
+
echo " argocd status | init [--repo <url>|--none] | apply | app add <repo url> [path] [--name N] [--revision R] | app list | app remove <N>"
|
|
233
|
+
echo " Argo CD of the workspace: .argocd.conf, GitOps repository, your projects as Applications"
|
|
234
|
+
echo " migrate [--yes] copy Docker workstation to Kubernetes workspace (nothing is deleted)"
|
|
235
|
+
echo " revert [--bring-back] back to Docker workstation; --bring-back: copy pod projects first"
|
|
236
|
+
echo " clean-docker remove devzone-* Docker volumes, after confirmation [y/N] (--yes)"
|
|
208
237
|
;;
|
|
209
238
|
*)
|
|
210
|
-
echo "✖
|
|
239
|
+
echo "✖ unknown subcommand: $1 (devzone workspace start|stop|status|shell|vscode|copy-to|copy-from|ports|services|argocd|migrate|revert|clean-docker)" >&2
|
|
211
240
|
exit 1
|
|
212
241
|
;;
|
|
213
242
|
esac
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Argo CD minimal (#411) : un seul réplica par composant, sans Dex ni
|
|
2
|
-
# notifications, serveur en ClusterIP (aucun Ingress, aucun LoadBalancer).
|
|
3
|
-
# L'accès passe par le relais kubectl port-forward du conteneur (8443:443).
|
|
4
|
-
global:
|
|
5
|
-
domain: ""
|
|
6
|
-
dex:
|
|
7
|
-
enabled: false
|
|
8
|
-
notifications:
|
|
9
|
-
enabled: false
|
|
10
|
-
server:
|
|
11
|
-
replicas: 1
|
|
12
|
-
service:
|
|
13
|
-
type: ClusterIP
|
|
14
|
-
ingress:
|
|
15
|
-
enabled: false
|
|
16
|
-
controller:
|
|
17
|
-
replicas: 1
|
|
18
|
-
repoServer:
|
|
19
|
-
replicas: 1
|
|
20
|
-
applicationSet:
|
|
21
|
-
replicas: 1
|