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.
Files changed (38) hide show
  1. package/.devcontainer/.dockerignore +1 -1
  2. package/.devcontainer/argocd/argocd.sh +6 -7
  3. package/.devcontainer/argocd/catalogue-argocd.sh +114 -0
  4. package/.devcontainer/argocd/gitops.sh +18 -0
  5. package/.devcontainer/argocd/services.sh +138 -0
  6. package/.devcontainer/catalogue/app.sh +58 -17
  7. package/.devcontainer/catalogue/mysql/installer.sh +31 -0
  8. package/.devcontainer/catalogue/mysql/mysql.sh +12 -0
  9. package/.devcontainer/devzone +17 -2
  10. package/.devcontainer/etat-json.sh +5 -1
  11. package/.devcontainer/password.sh +8 -0
  12. package/README.md +7 -1
  13. package/charts/devzone-argocd/Chart.lock +6 -0
  14. package/charts/devzone-argocd/Chart.yaml +13 -0
  15. package/charts/devzone-argocd/values.yaml +28 -0
  16. package/charts/devzone-mysql/Chart.yaml +6 -0
  17. package/charts/devzone-mysql/templates/service.yaml +15 -0
  18. package/charts/devzone-mysql/templates/statefulset.yaml +55 -0
  19. package/charts/devzone-mysql/values.yaml +19 -0
  20. package/manage/devzone +83 -4
  21. package/manage/scripts/argocd-services-svc.sh +110 -0
  22. package/manage/scripts/argocd-services.sh +21 -85
  23. package/manage/scripts/argocd-workspace.sh +8 -6
  24. package/manage/scripts/ci-dns.sh +10 -10
  25. package/manage/scripts/desinstaller.sh +150 -136
  26. package/manage/scripts/docker.sh +26 -22
  27. package/manage/scripts/lancer.sh +103 -103
  28. package/manage/scripts/migrer-retour.sh +37 -34
  29. package/manage/scripts/migrer.sh +154 -138
  30. package/manage/scripts/ports-workspace.sh +87 -82
  31. package/manage/scripts/poste.sh +48 -49
  32. package/manage/scripts/services-workspace.sh +15 -10
  33. package/manage/scripts/versions.sh +88 -88
  34. package/manage/scripts/workspace-aliases.sh +47 -0
  35. package/manage/scripts/workspace-wait.sh +26 -23
  36. package/manage/workspace.sh +124 -111
  37. package/package.json +1 -1
  38. package/.devcontainer/argocd/values.yaml +0 -25
@@ -1,43 +1,46 @@
1
1
  #!/usr/bin/env bash
2
- # Commandes du poste pour le workspace Kubernetes (#398, #399) : pilote le chart
3
- # charts/devzone-workspace avec helm et kubectl de l'hôte.
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
- ICI="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
- RACINE="$(cd "$ICI/.." && pwd)"
8
- # Pod, namespace et dossier des projets dans le conteneur (#399).
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
- DOSSIER_PROJETS="/workspaces/projets"
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
- # Drapeau helm : contexte devzone s'il existe, sinon le contexte courant (aucun drapeau).
14
- drapeau_helm() {
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
- # Drapeau kubectl : contexte devzone s'il existe, sinon le contexte courant (aucun drapeau).
21
- drapeau_kubectl() {
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
- # Chemin du chart dans le dépôt (ou le paquet installé).
28
- chemin_chart() {
29
- printf '%s/charts/devzone-workspace' "$RACINE"
30
+ # Chart path in the repository (or installed package).
31
+ chart_path() {
32
+ printf '%s/charts/devzone-workspace' "$ROOT"
30
33
  }
31
34
 
32
- # Dépôt de l'image publiée à chaque livraison de devzone.
33
- IMAGE_DEPOT="ghcr.io/simbienvenuehoulboumi/devzone-workspace"
35
+ # Repository of the image published at each devzone release.
36
+ IMAGE_REPO="ghcr.io/simbienvenuehoulboumi/devzone-workspace"
34
37
 
35
- # Pourquoi : sans tag, le chart prend son appVersion (0.1.0), une image jamais
36
- # publiée ; la version du paquet est publiée à chaque livraison, et un clone de
37
- # développement (0.0.0) utilise latest.
38
- image_par_defaut() {
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' "$RACINE/package.json" | head -1)"
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,53 +48,53 @@ image_par_defaut() {
45
48
  fi
46
49
  }
47
50
 
48
- # Installe ou met à jour le workspace dans le cluster.
49
- demarrer() {
50
- local depot tag image avec_image="" args=()
51
- depot="$IMAGE_DEPOT"
52
- tag="$(image_par_defaut)"
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 : indique une image <repository:tag> (devzone workspace demarrer --image <repository:tag>)" >&2
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
- depot="${2%:*}"
65
+ repo="${2%:*}"
63
66
  tag="${2##*:}"
64
- avec_image=oui
67
+ with_image=yes
65
68
  ;;
66
69
  *)
67
- echo "✖ option --image : image sans tag, attendu <repository:tag> (devzone workspace demarrer --image <repository:tag>)" >&2
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 inconnue : $1 (devzone workspace demarrer [--image <repository:tag>])" >&2
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="$depot:$tag"
82
+ image="$repo:$tag"
80
83
  # Argo CD first when wanted (#516): the workspace is then an Application
81
84
  argocd_ensure
82
- workspace_deploy "$depot" "$tag" "$avec_image"
85
+ workspace_deploy "$repo" "$tag" "$with_image"
83
86
  # Projects of .argocd.conf held too (#516)
84
87
  argocd_reconcile || true
85
- attendre_pod "$image" || return 1
86
- ports_demarrer silence
88
+ wait_for_pod "$image" || return 1
89
+ ports_start silence
87
90
  }
88
91
 
89
92
  # helm direct: the chart of the package, image set by the options
90
93
  workspace_helm_deploy() {
91
- local depot="$1" tag="$2" avec_image="$3" args=()
94
+ local repo="$1" tag="$2" with_image="$3" args=()
92
95
  args=(--namespace devzone-workspace --create-namespace)
93
- if [ -n "$avec_image" ]; then
94
- args+=(--set "image.repository=$depot" --set "image.tag=$tag")
96
+ if [ -n "$with_image" ]; then
97
+ args+=(--set "image.repository=$repo" --set "image.tag=$tag")
95
98
  else
96
99
  args+=(--set "image.tag=$tag")
97
100
  fi
@@ -101,129 +104,139 @@ workspace_helm_deploy() {
101
104
  args+=(--set "image.pullPolicy=Always")
102
105
  fi
103
106
  # shellcheck disable=SC2046
104
- helm $(drapeau_helm) upgrade --install devzone-workspace "$(chemin_chart)" "${args[@]}"
107
+ helm $(helm_flag) upgrade --install devzone-workspace "$(chart_path)" "${args[@]}"
105
108
  }
106
109
 
107
- # Désinstalle le workspace du cluster (Application Argo CD ou release helm).
108
- arreter() {
109
- ports_arreter
110
+ # Uninstalls the workspace from the cluster (Argo CD Application or helm release).
111
+ stop_workspace() {
112
+ ports_stop
110
113
  workspace_undeploy
111
114
  }
112
115
 
113
- # Affiche l'état des pods du workspace.
114
- etat() {
116
+ # Shows workspace pod status.
117
+ status_workspace() {
115
118
  # shellcheck disable=SC2046
116
- kubectl $(drapeau_kubectl) get pods --namespace devzone-workspace
119
+ kubectl $(kubectl_flag) get pods --namespace devzone-workspace
117
120
  }
118
121
 
119
- # Ouvre un shell dans le conteneur workspace.
120
- shell() {
122
+ # Opens a shell in the workspace container.
123
+ shell_workspace() {
121
124
  # shellcheck disable=SC2046
122
- kubectl $(drapeau_kubectl) exec -it devzone-workspace-0 \
125
+ kubectl $(kubectl_flag) exec -it devzone-workspace-0 \
123
126
  --namespace devzone-workspace -c workspace -- bash
124
127
  }
125
128
 
126
- # Marche à suivre VS Code (#399) : attachement au pod avec les extensions
127
- # Kubernetes et Dev Containers, sans autre commande que devzone.
128
- vscode() {
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() {
129
132
  cat <<EOF
130
- Attache VS Code au pod : extensions « Kubernetes » et « Dev Containers »
131
- 1. Contexte kubectl : devzone — namespace $NAMESPACE, pod $POD, conteneur workspace
132
- 2. Vue Kubernetes : clic droit sur le conteneur workspace,
133
- « Attach to Running Kubernetes Container »
134
- (avec l'extension Dev Containers : « Dev Containers: Attach to Running Container »)
135
- 3. Ouvre le dossier $DOSSIER_PROJETS dans la fenêtre attachée
136
- Pod non prêt : devzone workspace etat
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
137
140
  EOF
138
141
  }
139
142
 
140
- # Copie un dossier du poste vers $DOSSIER_PROJETS du pod (#399, kubectl cp) :
141
- # le projet reprend son nom de dossier dans le pod.
142
- copier_vers() {
143
- local dossier="${1:-}"
144
- if [ -z "$dossier" ]; then
145
- echo "✖ indique un dossier du poste : devzone workspace copier-vers <dossier>" >&2
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
146
149
  exit 1
147
150
  fi
148
- if [ ! -d "$dossier" ]; then
149
- echo "✖ dossier introuvable : $dossier" >&2
151
+ if [ ! -d "$folder" ]; then
152
+ echo "✖ folder not found: $folder" >&2
150
153
  exit 1
151
154
  fi
152
- dossier="$(cd "$dossier" && pwd)"
155
+ folder="$(cd "$folder" && pwd)"
153
156
  # shellcheck disable=SC2046
154
- kubectl $(drapeau_kubectl) cp "$dossier" "$POD:$DOSSIER_PROJETS/$(basename "$dossier")" \
157
+ kubectl $(kubectl_flag) cp "$folder" "$POD:$PROJECTS_DIR/$(basename "$folder")" \
155
158
  --namespace "$NAMESPACE" -c workspace
156
159
  }
157
160
 
158
- # Copie un projet de $DOSSIER_PROJETS du pod vers le poste (#399, kubectl cp) :
159
- # le dossier du poste porte le nom du projet.
160
- copier_depuis() {
161
- local dossier="${1:-}"
162
- if [ -z "$dossier" ]; then
163
- echo "✖ indique un dossier du poste : devzone workspace copier-depuis <dossier>" >&2
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
164
167
  exit 1
165
168
  fi
166
- # Chemin absolu : « copier-depuis . » donne le nom du dossier courant.
167
- dossier="$(cd "$dossier" 2>/dev/null && pwd || echo "$dossier")"
169
+ # Absolute path: "copy-from ." gives the current folder name.
170
+ folder="$(cd "$folder" 2>/dev/null && pwd || echo "$folder")"
168
171
  # shellcheck disable=SC2046
169
- kubectl $(drapeau_kubectl) cp "$POD:$DOSSIER_PROJETS/$(basename "$dossier")" "$dossier" \
172
+ kubectl $(kubectl_flag) cp "$POD:$PROJECTS_DIR/$(basename "$folder")" "$folder" \
170
173
  --namespace "$NAMESPACE" -c workspace
171
174
  }
172
175
 
173
- # shellcheck source=scripts/workspace-wait.sh
174
- . "$ICI/scripts/workspace-wait.sh"
175
- # shellcheck source=scripts/migrer.sh
176
- . "$ICI/scripts/migrer.sh"
177
- # shellcheck source=scripts/migrer-retour.sh
178
- . "$ICI/scripts/migrer-retour.sh"
179
- # shellcheck source=scripts/ports-workspace.sh
180
- . "$ICI/scripts/ports-workspace.sh"
181
- # shellcheck source=scripts/services-workspace.sh
182
- . "$ICI/scripts/services-workspace.sh"
183
- # shellcheck source=scripts/argocd-workspace.sh
184
- . "$ICI/scripts/argocd-workspace.sh"
185
- # shellcheck source=scripts/argocd-services.sh
186
- . "$ICI/scripts/argocd-services.sh"
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"
187
193
 
188
194
  # English command names are accepted, French ones unchanged (#502).
189
195
  # A copied devzone may miss the aliases file: then no normalization.
190
196
  # shellcheck source=../.devcontainer/command-aliases.sh
191
197
  # shellcheck disable=SC1091
192
- if [ -f "$RACINE/.devcontainer/command-aliases.sh" ]; then
193
- . "$RACINE/.devcontainer/command-aliases.sh"
198
+ if [ -f "$ROOT/.devcontainer/command-aliases.sh" ]; then
199
+ . "$ROOT/.devcontainer/command-aliases.sh"
194
200
  if [ "$#" -gt 0 ]; then
195
201
  set -- "$(command_canonical "$1")" "${@:2}"
196
202
  fi
197
203
  fi
198
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
+
199
212
  case "${1:-}" in
200
- demarrer) demarrer "${@:2}" ;;
201
- arreter) arreter ;;
202
- etat) etat ;;
203
- shell) shell ;;
204
- vscode) vscode ;;
205
- copier-vers) copier_vers "${@:2}" ;;
206
- copier-depuis) copier_depuis "${@:2}" ;;
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}" ;;
207
220
  ports) ports "${@:2}" ;;
208
- migrer) migrer "${@:2}" ;;
209
- revenir) revenir "${@:2}" ;;
210
- nettoyer-docker) nettoyer_docker "${@:2}" ;;
221
+ migrate) migrate_workspace "${@:2}" ;;
222
+ revert) revert_workspace "${@:2}" ;;
223
+ clean-docker) clean_docker "${@:2}" ;;
211
224
  services) services "${@:2}" ;;
212
225
  argocd) argocd_cmd "${@:2}" ;;
213
226
  '' | -h | --help | aide)
214
- echo "devzone workspace demarrer|arreter|etat|shell|vscode|copier-vers|copier-depuis|ports|services|argocd|migrer|revenir|nettoyer-docker"
215
- echo " demarrer [--image dépôt:tag] installe le workspace (image de la version de devzone par défaut)"
216
- echo " ports [demarrer|arreter|etat] applications et services du pod sur localhost du poste"
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"
217
230
  echo " services enable|disable <service> [options] | status"
218
231
  echo " devzone services (gitlab, postgres, argocd) of the cluster, installed from the workstation"
219
- echo " argocd status | app add <repo url> [path] [--name N] [--revision R] | app list | app remove <N>"
220
- echo " Argo CD of the workspace: deployments held in Git, your projects as Applications"
221
- echo " migrer [--oui] copie le poste Docker vers le workspace Kubernetes (rien n'est supprimé)"
222
- echo " revenir [--rapatrier] retour au poste Docker ; --rapatrier : projets du pod recopiés d'abord"
223
- echo " nettoyer-docker supprime les volumes Docker devzone-*, après confirmation [o/N] (--oui)"
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)"
224
237
  ;;
225
238
  *)
226
- echo "✖ sous-commande inconnue : $1 (devzone workspace demarrer|arreter|etat|shell|vscode|copier-vers|copier-depuis|ports|services|argocd|migrer|revenir|nettoyer-docker)" >&2
239
+ echo "✖ unknown subcommand: $1 (devzone workspace start|stop|status|shell|vscode|copy-to|copy-from|ports|services|argocd|migrate|revert|clean-docker)" >&2
227
240
  exit 1
228
241
  ;;
229
242
  esac
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devzone",
3
- "version": "0.37.0",
3
+ "version": "0.39.0",
4
4
  "description": "Ton poste de développement Linux, prêt en une commande, identique sur Mac, Windows et Linux.",
5
5
  "license": "GPL-3.0-only",
6
6
  "repository": {
@@ -1,25 +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
- # Aggregate ClusterRoles (#516): the Application resources join the edit role,
7
- # so the limited devzone account (#430) manages the Applications of the
8
- # projects in devzone-argocd (devzone argocd app …)
9
- createAggregateRoles: true
10
- dex:
11
- enabled: false
12
- notifications:
13
- enabled: false
14
- server:
15
- replicas: 1
16
- service:
17
- type: ClusterIP
18
- ingress:
19
- enabled: false
20
- controller:
21
- replicas: 1
22
- repoServer:
23
- replicas: 1
24
- applicationSet:
25
- replicas: 1