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.
Files changed (44) hide show
  1. package/.devcontainer/.dockerignore +1 -1
  2. package/.devcontainer/argocd/application.sh +69 -0
  3. package/.devcontainer/argocd/apps.sh +262 -0
  4. package/.devcontainer/argocd/argocd.sh +52 -8
  5. package/.devcontainer/argocd/catalogue-argocd.sh +114 -0
  6. package/.devcontainer/argocd/conf.sh +141 -0
  7. package/.devcontainer/argocd/gitops.sh +214 -0
  8. package/.devcontainer/argocd/services.sh +138 -0
  9. package/.devcontainer/catalogue/app.sh +58 -17
  10. package/.devcontainer/catalogue/mysql/installer.sh +31 -0
  11. package/.devcontainer/catalogue/mysql/mysql.sh +12 -0
  12. package/.devcontainer/devzone +2 -1
  13. package/.devcontainer/password.sh +8 -0
  14. package/README.md +2 -2
  15. package/charts/devzone-argocd/Chart.lock +6 -0
  16. package/charts/devzone-argocd/Chart.yaml +13 -0
  17. package/charts/devzone-argocd/values.yaml +28 -0
  18. package/charts/devzone-mysql/Chart.yaml +6 -0
  19. package/charts/devzone-mysql/templates/service.yaml +15 -0
  20. package/charts/devzone-mysql/templates/statefulset.yaml +55 -0
  21. package/charts/devzone-mysql/values.yaml +19 -0
  22. package/charts/devzone-postgres/Chart.yaml +6 -0
  23. package/charts/devzone-postgres/templates/service.yaml +15 -0
  24. package/charts/devzone-postgres/templates/statefulset.yaml +56 -0
  25. package/charts/devzone-postgres/values.yaml +11 -0
  26. package/manage/devzone +4 -1
  27. package/manage/scripts/argocd-services-svc.sh +110 -0
  28. package/manage/scripts/argocd-services.sh +179 -0
  29. package/manage/scripts/argocd-workspace.sh +221 -0
  30. package/manage/scripts/ci-dns.sh +10 -10
  31. package/manage/scripts/desinstaller.sh +137 -135
  32. package/manage/scripts/docker.sh +26 -22
  33. package/manage/scripts/lancer.sh +103 -103
  34. package/manage/scripts/migrer-retour.sh +37 -34
  35. package/manage/scripts/migrer.sh +154 -138
  36. package/manage/scripts/ports-workspace.sh +94 -82
  37. package/manage/scripts/poste.sh +48 -49
  38. package/manage/scripts/services-workspace.sh +22 -5
  39. package/manage/scripts/versions.sh +88 -88
  40. package/manage/scripts/workspace-aliases.sh +47 -0
  41. package/manage/scripts/workspace-wait.sh +27 -24
  42. package/manage/workspace.sh +134 -105
  43. package/package.json +1 -1
  44. package/.devcontainer/argocd/values.yaml +0 -21
@@ -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,41 +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"
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 "$avec_image" ]; then
82
- 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")
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 $(drapeau_helm) upgrade --install devzone-workspace "$(chemin_chart)" "${args[@]}"
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
- # Désinstalle le workspace du cluster.
98
- arreter() {
99
- ports_arreter
100
- # shellcheck disable=SC2046
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
- # Affiche l'état des pods du workspace.
105
- etat() {
116
+ # Shows workspace pod status.
117
+ status_workspace() {
106
118
  # shellcheck disable=SC2046
107
- kubectl $(drapeau_kubectl) get pods --namespace devzone-workspace
119
+ kubectl $(kubectl_flag) get pods --namespace devzone-workspace
108
120
  }
109
121
 
110
- # Ouvre un shell dans le conteneur workspace.
111
- shell() {
122
+ # Opens a shell in the workspace container.
123
+ shell_workspace() {
112
124
  # shellcheck disable=SC2046
113
- kubectl $(drapeau_kubectl) exec -it devzone-workspace-0 \
125
+ kubectl $(kubectl_flag) exec -it devzone-workspace-0 \
114
126
  --namespace devzone-workspace -c workspace -- bash
115
127
  }
116
128
 
117
- # Marche à suivre VS Code (#399) : attachement au pod avec les extensions
118
- # Kubernetes et Dev Containers, sans autre commande que devzone.
119
- 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() {
120
132
  cat <<EOF
121
- Attache VS Code au pod : extensions « Kubernetes » et « Dev Containers »
122
- 1. Contexte kubectl : devzone — namespace $NAMESPACE, pod $POD, conteneur workspace
123
- 2. Vue Kubernetes : clic droit sur le conteneur workspace,
124
- « Attach to Running Kubernetes Container »
125
- (avec l'extension Dev Containers : « Dev Containers: Attach to Running Container »)
126
- 3. Ouvre le dossier $DOSSIER_PROJETS dans la fenêtre attachée
127
- 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
128
140
  EOF
129
141
  }
130
142
 
131
- # Copie un dossier du poste vers $DOSSIER_PROJETS du pod (#399, kubectl cp) :
132
- # le projet reprend son nom de dossier dans le pod.
133
- copier_vers() {
134
- local dossier="${1:-}"
135
- if [ -z "$dossier" ]; then
136
- 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
137
149
  exit 1
138
150
  fi
139
- if [ ! -d "$dossier" ]; then
140
- echo "✖ dossier introuvable : $dossier" >&2
151
+ if [ ! -d "$folder" ]; then
152
+ echo "✖ folder not found: $folder" >&2
141
153
  exit 1
142
154
  fi
143
- dossier="$(cd "$dossier" && pwd)"
155
+ folder="$(cd "$folder" && pwd)"
144
156
  # shellcheck disable=SC2046
145
- kubectl $(drapeau_kubectl) cp "$dossier" "$POD:$DOSSIER_PROJETS/$(basename "$dossier")" \
157
+ kubectl $(kubectl_flag) cp "$folder" "$POD:$PROJECTS_DIR/$(basename "$folder")" \
146
158
  --namespace "$NAMESPACE" -c workspace
147
159
  }
148
160
 
149
- # Copie un projet de $DOSSIER_PROJETS du pod vers le poste (#399, kubectl cp) :
150
- # le dossier du poste porte le nom du projet.
151
- copier_depuis() {
152
- local dossier="${1:-}"
153
- if [ -z "$dossier" ]; then
154
- 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
155
167
  exit 1
156
168
  fi
157
- # Chemin absolu : « copier-depuis . » donne le nom du dossier courant.
158
- 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")"
159
171
  # shellcheck disable=SC2046
160
- kubectl $(drapeau_kubectl) cp "$POD:$DOSSIER_PROJETS/$(basename "$dossier")" "$dossier" \
172
+ kubectl $(kubectl_flag) cp "$POD:$PROJECTS_DIR/$(basename "$folder")" "$folder" \
161
173
  --namespace "$NAMESPACE" -c workspace
162
174
  }
163
175
 
164
- # shellcheck source=scripts/workspace-wait.sh
165
- . "$ICI/scripts/workspace-wait.sh"
166
- # shellcheck source=scripts/migrer.sh
167
- . "$ICI/scripts/migrer.sh"
168
- # shellcheck source=scripts/migrer-retour.sh
169
- . "$ICI/scripts/migrer-retour.sh"
170
- # shellcheck source=scripts/ports-workspace.sh
171
- . "$ICI/scripts/ports-workspace.sh"
172
- # shellcheck source=scripts/services-workspace.sh
173
- . "$ICI/scripts/services-workspace.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"
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 "$RACINE/.devcontainer/command-aliases.sh" ]; then
180
- . "$RACINE/.devcontainer/command-aliases.sh"
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
- demarrer) demarrer "${@:2}" ;;
188
- arreter) arreter ;;
189
- etat) etat ;;
190
- shell) shell ;;
191
- vscode) vscode ;;
192
- copier-vers) copier_vers "${@:2}" ;;
193
- 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}" ;;
194
220
  ports) ports "${@:2}" ;;
195
- migrer) migrer "${@:2}" ;;
196
- revenir) revenir "${@:2}" ;;
197
- nettoyer-docker) nettoyer_docker "${@:2}" ;;
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 demarrer|arreter|etat|shell|vscode|copier-vers|copier-depuis|ports|services|migrer|revenir|nettoyer-docker"
201
- echo " demarrer [--image dépôt:tag] installe le workspace (image de la version de devzone par défaut)"
202
- 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"
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 " migrer [--oui] copie le poste Docker vers le workspace Kubernetes (rien n'est supprimé)"
206
- echo " revenir [--rapatrier] retour au poste Docker ; --rapatrier : projets du pod recopiés d'abord"
207
- 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)"
208
237
  ;;
209
238
  *)
210
- echo "✖ sous-commande inconnue : $1 (devzone workspace demarrer|arreter|etat|shell|vscode|copier-vers|copier-depuis|ports|services|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
211
240
  exit 1
212
241
  ;;
213
242
  esac
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devzone",
3
- "version": "0.36.7",
3
+ "version": "0.38.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,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