|
| 1 | +# Customize the Base URL for Online Boutique |
| 2 | + |
| 3 | +This component allows you to change the base URL for the Online Boutique application. By default, the application uses the root path ("/") as its base URL. This customization sets the base URL to "/online-boutique" and updates the health check paths accordingly. |
| 4 | + |
| 5 | +## What it does |
| 6 | + |
| 7 | +1. Sets the `BASE_URL` environment variable to "/online-boutique" for the frontend deployment. |
| 8 | +2. Updates the liveness probe path to "/online-boutique/_healthz". |
| 9 | +3. Updates the readiness probe path to "/online-boutique/_healthz". |
| 10 | + |
| 11 | +## How to use |
| 12 | + |
| 13 | +To apply this customization, you can use Kustomize to include this component in your deployment. |
| 14 | + |
| 15 | +From the `kustomize/` folder at the root level of this repository, execute this command: |
| 16 | + |
| 17 | +```bash |
| 18 | +kustomize edit add component components/custom-base-url |
| 19 | +``` |
| 20 | + |
| 21 | +This will update the `kustomize/kustomization.yaml` file, which could look similar to: |
| 22 | + |
| 23 | +```yaml |
| 24 | +apiVersion: kustomize.config.k8s.io/v1beta1 |
| 25 | +kind: Kustomization |
| 26 | +resources: |
| 27 | +- base |
| 28 | +components: |
| 29 | +- components/custom-base-url |
| 30 | +``` |
| 31 | +
|
| 32 | +## Render and Deploy |
| 33 | +
|
| 34 | +You can locally render these manifests by running: |
| 35 | +
|
| 36 | +```bash |
| 37 | +kubectl kustomize . |
| 38 | +``` |
| 39 | + |
| 40 | +To deploy the customized application, run: |
| 41 | + |
| 42 | +```bash |
| 43 | +kubectl apply -k . |
| 44 | +``` |
| 45 | + |
| 46 | +## Customizing the Base URL |
| 47 | + |
| 48 | +If you want to use a different base URL, you can modify the `value` fields in the kustomization.yaml file. Make sure to update all three occurrences: |
| 49 | + |
| 50 | +1. The `BASE_URL` environment variable |
| 51 | +2. The liveness probe path |
| 52 | +3. The readiness probe path |
| 53 | + |
| 54 | +For example, to change the base URL to "/shop", you would modify the values as follows: |
| 55 | + |
| 56 | +```yaml |
| 57 | +value: /shop |
| 58 | +value: /shop/_healthz |
| 59 | +value: /shop/_healthz |
| 60 | +``` |
| 61 | +
|
| 62 | +Note: After changing the base URL, make sure to update any internal links or references within your application to use the new base URL. |
0 commit comments