You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The purpose of the scripts in this directory is to improve and speed up the workflow with the local minikube setup. They are mostly quick and dirty hacks but serve the purpose.
Deletes and tries to re-initiate the local minikube cluster in an unattended fashion (no user input/prompt approval required) by applying our opentofu and helmfile configuration. It can take like ~20 minutes to finish. All data inside the local cluster will be lost. Please report if your cluster is not in a useable state after running this script, so we can improve it.
All of these scripts should start with this failsafe snippet, to make sure they aren't doing anything at all when executed outside of the local minikube cluster context. If `kubectl` will be used in the script, it can be forced to use the local context with each call like this: `kubectl --context ${KUBE_CONTEXT}`.
50
+
51
+
```bash
52
+
#!/bin/bash
53
+
54
+
### failsafe logic to exit in case we are not running in our local minikube context
55
+
KUBE_CONTEXT=$(kubectl config current-context)
56
+
57
+
echo "Current kube context: '${KUBE_CONTEXT}'"
58
+
59
+
if [[ "${KUBE_CONTEXT}" != "minikube-wbaas" ]]; then
60
+
echo "Error: wrong kube context. Use this script only within 'minikube-wbaas'!"
Currently this means each environment gets it's own instance of Argo CD, which in turn always deploys to the cluster it lives in. We may want to change this in the future, if this prevents us from using certain features or workflows.
13
+
14
+
### Application configuration
15
+
There are two more charts we use to configure our project & applications:
16
+
- [argocd-config](../../charts/argocd-config/)
17
+
- gets deployed by helmfile
18
+
- defines the ["app-of-apps"](https://argo-cd.readthedocs.io/en/stable/operator-manual/cluster-bootstrapping/) `Application`
19
+
- [argocd-apps](../../charts/argocd-apps/)
20
+
- gets deployed by Argo CD
21
+
- defines the `Application` resources for our actual helm releases
22
+
23
+
The values of the first chart get passed on to the second one, so we can infer which environment we are running in.
24
+
25
+
### Values files
26
+
After trying out different ways of templating our way through this, we currently settled with a script to generate plain yaml files:
27
+
- the bash script: [/bin/generate/values](../../bin/generate-values)
28
+
- the values files: [/k8s/argocd/](../../k8s/argocd/)
29
+
30
+
These are generated by helmfile, which in turn reads the value files in [/k8s/helmfile/env/](../../k8s/helmfile/env/) like we are used to.
The script can be run like `./bin/generate-values local ui` where `local` could be `staging` or `production` and `ui` any other helmfile release. The third parameter let's you define a different helmfile than `k8s/helmfile/helmfile.yaml`. This is needed for the CI script. Once we moved all components to Argo we could create a Makefile target that generates/updates all values files, for our convenience.
40
+
41
+
#### CI - [check-generated-values.yml](../../.github/workflows/check-generated-values.yml)
42
+
This GitHub workflow runs the script to check if the checked-in values files are actually up to date. It does this by iterating over each generated values file that is present in `k8s/argocd/` and runs `generate-values` to compare it against.
43
+
44
+
### Self-Healing
45
+
[Automatic Self-Healing](https://argo-cd.readthedocs.io/en/stable/user-guide/auto_sync/#automatic-self-healing) is currently disabled for the local environment. This way, we still can use skaffold to replace resources that get deployed by Argo CD. Otherwise Argo CD would immediately replace them again with the image that is configured in the values files.
46
+
47
+
## Admin access
48
+
> Caution! Admin access should only happen in rare circumstances (testing/diagnosing, for example)
49
+
> as we want to maintain the configuration for everything in git.
50
+
51
+
1. Reset the admin password by running `./bin/get-argocd-password`
52
+
1. Enable admin access by flipping `admin.enabled` to `true` in our values file (or manually in the ConfigMap `argocd-cm`)
53
+
- this is enabled for local clusters by default
54
+
2. Access the web interface and log in (username `admin`)
55
+
- a) local - http://argo.wbaas-local-test.de/
56
+
- b) staging/production - https://localhost:8080/
57
+
- Forward port `8080` of the deployment `argo-cd-base-argocd-server`
Copy file name to clipboardExpand all lines: doc/local-dev-env.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -178,15 +178,15 @@ minikube does not provision LoadBalancer service IP addresses as part of normal
178
178
make minikube-tunnel
179
179
```
180
180
181
-
You should now be able to access the ingress via http://www.wbaas.localhost. Most modern browsers will automatically resolve *.localhost to 127.0.0.1. If not, you'll need to edit your hosts file.
181
+
You should now be able to access the ingress via http://www.wbaas-local-test.de. Most modern browsers will automatically resolve *.localhost to 127.0.0.1. If not, you'll need to edit your hosts file.
182
182
183
183
More detailed information on the load balancer can be found in [minikube-load-balancer.md](minikube-load-balancer.md).
184
184
185
185
## Mailhog / Local emails
186
186
187
187
For the local setup, [Mailhog](https://github.com/mailhog/MailHog) is used to capture outbound emails.
188
188
189
-
You can view those emails by going to http://mailhog.wbaas.localhost/
189
+
You can view those emails by going to http://mailhog.wbaas-local-test.de/
190
190
191
191
## Mediawiki debugging
192
192
### logging
@@ -215,10 +215,10 @@ Xdebug can be enabled in your minikube cluster if you use mediawiki image with `
215
215
- You can use Xdebug on your VSCode IDE by following these steps:
216
216
* Follow this tutorial in the section "Debug PHP using Xdebug and VS Code" https://php.tutorials24x7.com/blog/how-to-debug-php-using-xdebug-and-visual-studio-code-on-ubuntu
217
217
218
-
## Create an account on wbaas.localhost
218
+
## Create an account on wbaas-local-test.de
219
219
To use the local wbaas instance you have just setup, you will need to create an invitation code via the api which is needed when creating an account. Follow the [instructions](https://github.com/wbstack/api/blob/main/docs/invitation-codes.md) documented in the wbaas/api repo.
220
220
221
-
After creating the invitation code, you can visit http://wbaas.localhost/create-account (or click the create account link in the login form) and create an account. All outbound email is captured by Mailhog ([see above](#mailhog--local-emails)) so you can use a made up email address (e.g. `test@example.com`). Verify your email address via the "Account Creation Notificaiton" email captured by Mailhog.
221
+
After creating the invitation code, you can visit http://wbaas-local-test.de/create-account (or click the create account link in the login form) and create an account. All outbound email is captured by Mailhog ([see above](#mailhog--local-emails)) so you can use a made up email address (e.g. `test@example.com`). Verify your email address via the "Account Creation Notificaiton" email captured by Mailhog.
222
222
223
223
## [Optional] setup bash completion
224
224
Here is how to get tab completion working for common commands
@@ -275,7 +275,7 @@ Error: plugin "diff" exited with error
275
275
276
276
it is likely because `make diff-local` uses the `--skip-deps` option when executing `helmfile diff` which skips downloading chart dependencies. To force the fetching of dependencies run `make helmfile-deps` before `make diff-local`.
277
277
278
-
### **Why can't I access [wbaas.localhost](http://www.wbaas.localhost)?**
278
+
### **Why can't I access [wbaas-local-test.de](http://www.wbaas-local-test.de)?**
279
279
Here are a few things to try:
280
280
- make sure minikube is running `make minikube-start`
281
281
- make sure the minikube tunnel is running `make minikube-tunnel`
0 commit comments