|
1 | 1 | version: v1beta11
|
| 2 | + |
| 3 | +# `vars` specifies variables which may be used as ${VAR_NAME} in devspace.yaml |
2 | 4 | vars:
|
3 |
| - - name: IMAGE |
4 |
| - value: myusername/devspace |
5 |
| -images: |
6 |
| - default: |
7 |
| - image: ${IMAGE} |
| 5 | +- name: IMAGE |
| 6 | + value: myusername/app |
| 7 | + |
| 8 | +# `deployments` tells DevSpace how to deploy this project |
8 | 9 | deployments:
|
9 |
| - - name: quickstart |
10 |
| - helm: |
11 |
| - componentChart: true |
12 |
| - values: |
13 |
| - containers: |
14 |
| - - image: ${IMAGE} |
15 |
| - service: |
16 |
| - ports: |
17 |
| - - port: 3000 |
| 10 | +- name: quickstart |
| 11 | + # This deployment uses `helm` but you can also define `kubectl` deployments or kustomizations |
| 12 | + helm: |
| 13 | + # We are deploying the so-called Component Chart: https://devspace.sh/component-chart/docs |
| 14 | + componentChart: true |
| 15 | + # Under `values` we can define the values for this Helm chart used during `helm install/upgrade` |
| 16 | + # You may also use `valuesFiles` to load values from files, e.g. valuesFiles: ["values.yaml"] |
| 17 | + values: |
| 18 | + containers: |
| 19 | + - image: ${IMAGE} # Use the value of our `${IMAGE}` variable here (see vars above) |
| 20 | + service: |
| 21 | + ports: |
| 22 | + - port: 3000 |
| 23 | + |
| 24 | +# `dev` only applies when you run `devspace dev` |
18 | 25 | dev:
|
| 26 | + # `dev.ports` specifies all ports that should be forwarded while `devspace dev` is running |
| 27 | + # Port-forwarding lets you access your application via localhost on your local machine |
19 | 28 | ports:
|
20 |
| - - imageSelector: ${IMAGE} |
21 |
| - forward: |
22 |
| - - port: 3000 |
| 29 | + - imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}` |
| 30 | + forward: |
| 31 | + - port: 3000 |
| 32 | + |
| 33 | + # `dev.open` tells DevSpace to open certain URLs as soon as they return HTTP status 200 |
| 34 | + # Since we configured port-forwarding, we can use a localhost address here to access our application |
| 35 | + open: |
| 36 | + - url: http://localhost:3000 |
| 37 | + |
| 38 | + # `dev.sync` configures a file sync between our Pods in k8s and your local project files |
23 | 39 | sync:
|
24 |
| - - imageSelector: ${IMAGE} |
25 |
| - uploadExcludePaths: |
26 |
| - - node_modules |
| 40 | + - imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}` |
| 41 | + excludePaths: |
| 42 | + - .git/ |
| 43 | + uploadExcludeFile: .gitignore |
| 44 | + |
| 45 | + # `dev.terminal` tells DevSpace to open a terminal as a last step during `devspace dev` |
| 46 | + terminal: |
| 47 | + imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}` |
| 48 | + # With this optional `command` we can tell DevSpace to run a script when opening the terminal |
| 49 | + # This is often useful to display help info for new users or perform initial tasks (e.g. installing dependencies) |
| 50 | + # DevSpace has generated an example ./devspace_start.sh file in your local project - Feel free to customize it! |
| 51 | + command: ["./devspace_start.sh"] |
| 52 | + |
| 53 | + # Since our Helm charts and manifests deployments are often optimized for production, |
| 54 | + # DevSpace let's you swap out Pods dynamically to get a better dev environment |
| 55 | + replacePods: |
| 56 | + - imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}` |
| 57 | + # Since the `${IMAGE}` used to start our main application pod may be distroless or not have any dev tooling, let's replace it with a dev-optimized image |
| 58 | + # DevSpace provides a sample image here but you can use any image for your specific needs |
| 59 | + replaceImage: loftsh/javascript:latest |
| 60 | + # Besides replacing the container image, let's also apply some patches to the `spec` of our Pod |
| 61 | + # We are overwriting `command` + `args` for the first container in our selected Pod, so it starts with `sleep 9999999` |
| 62 | + # Using `sleep 9999999` as PID 1 (instead of the regular ENTRYPOINT), allows you to start the application manually |
| 63 | + patches: |
| 64 | + - op: replace |
| 65 | + path: spec.containers[0].command |
| 66 | + value: ["sleep"] |
| 67 | + - op: replace |
| 68 | + path: spec.containers[0].args |
| 69 | + value: ["9999999"] |
| 70 | + |
| 71 | +# `profiles` lets you modify the config above for different environments (e.g. dev vs production) |
| 72 | +profiles: |
| 73 | + # This profile is called `production` and you can use it for example using: devspace deploy -p production |
| 74 | + # We generally recommend to use the base config without any profiles as optimized for development (e.g. image build+push is disabled) |
| 75 | +- name: production |
| 76 | +# This profile adds our image to the config so that DevSpace will build, tag and push our image before the deployment |
| 77 | + merge: |
| 78 | + images: |
| 79 | + app: |
| 80 | + image: ${IMAGE} # Use the value of our `${IMAGE}` variable here (see vars above) |
| 81 | + dockerfile: ./Dockerfile |
0 commit comments