-
Notifications
You must be signed in to change notification settings - Fork 1
/
devspace.yaml
executable file
·128 lines (120 loc) · 5.47 KB
/
devspace.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
version: v1beta11
# `vars` specifies variables which may be used as ${VAR_NAME} in devspace.yaml
vars:
- name: IMAGE
value: ghcr.io/narze/streamie/streamie
- name: DEVSPACE_PROFILE
value: ${devspace.profile}
# These vars will only be used in production profile
- name: TWITCH_OAUTH_TOKEN
source: command
command: ./devspace_dotenv.js
args: ["TWITCH_OAUTH_TOKEN", "${DEVSPACE_PROFILE}"]
- name: DISCORD_TOKEN
source: command
command: ./devspace_dotenv.js
args: ["DISCORD_TOKEN", "${DEVSPACE_PROFILE}"]
- name: DEV_GUILD_ID
source: command
command: ./devspace_dotenv.js
args: ["DEV_GUILD_ID", "${DEVSPACE_PROFILE}"]
- name: OAUTH_CLIENT_ID
source: command
command: ./devspace_dotenv.js
args: ["OAUTH_CLIENT_ID", "${DEVSPACE_PROFILE}"]
- name: PORT
source: command
command: ./devspace_dotenv.js
args: ["PORT", "${DEVSPACE_PROFILE}"]
# `deployments` tells DevSpace how to deploy this project
deployments:
- name: streamie
# This deployment uses `helm` but you can also define `kubectl` deployments or kustomizations
helm:
# We are deploying the so-called Component Chart: https://devspace.sh/component-chart/docs
componentChart: true
# Under `values` we can define the values for this Helm chart used during `helm install/upgrade`
# You may also use `valuesFiles` to load values from files, e.g. valuesFiles: ["values.yaml"]
values:
containers:
- image: ${IMAGE} # Use the value of our `${IMAGE}` variable here (see vars above)
service:
ports:
- port: 3000
# `dev` only applies when you run `devspace dev`
dev:
# `dev.ports` specifies all ports that should be forwarded while `devspace dev` is running
# Port-forwarding lets you access your application via localhost on your local machine
ports:
- imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}`
forward:
- port: 3000
# `dev.open` tells DevSpace to open certain URLs as soon as they return HTTP status 200
# Since we configured port-forwarding, we can use a localhost address here to access our application
open:
- url: http://localhost:3000
# `dev.sync` configures a file sync between our Pods in k8s and your local project files
sync:
- imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}`
# `excludePaths` option expects an array of strings with paths that should not be synchronized between the
# local filesystem and the remote container filesystem. It uses the same syntax as `.gitignore`.
excludePaths:
- .git/
uploadExcludePaths:
- Dockerfile
- node_modules/
arch: arm64
# `dev.terminal` tells DevSpace to open a terminal as a last step during `devspace dev`
terminal:
imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}`
# With this optional `command` we can tell DevSpace to run a script when opening the terminal
# This is often useful to display help info for new users or perform initial tasks (e.g. installing dependencies)
# DevSpace has generated an example ./devspace_start.sh file in your local project - Feel free to customize it!
command:
- ./devspace_start.sh
# Since our Helm charts and manifests deployments are often optimized for production,
# DevSpace let's you swap out Pods dynamically to get a better dev environment
replacePods:
- imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}`
# 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
# DevSpace provides a sample image here but you can use any image for your specific needs
replaceImage: loftsh/javascript:latest
# Besides replacing the container image, let's also apply some patches to the `spec` of our Pod
# We are overwriting `command` + `args` for the first container in our selected Pod, so it starts with `sleep 9999999`
# Using `sleep 9999999` as PID 1 (instead of the regular ENTRYPOINT), allows you to start the application manually
patches:
- op: replace
path: spec.containers[0].command
value:
- sleep
- op: replace
path: spec.containers[0].args
value:
- "9999999"
- op: remove
path: spec.containers[0].securityContext
# `profiles` lets you modify the config above for different environments (e.g. dev vs production)
profiles:
# This profile is called `production` and you can use it for example using: devspace deploy -p production
# We generally recommend using the base config without any profiles as optimized for development (e.g. image build+push is disabled)
- name: production
# This profile adds our image to the config so that DevSpace will build, tag and push our image before the deployment
merge:
images:
app:
image: ${IMAGE} # Use the value of our `${IMAGE}` variable here (see vars above)
dockerfile: ./Dockerfile
patches:
- op: add
path: deployments.name=streamie.helm.values.containers.image=${IMAGE}.env
value:
- name: TWITCH_OAUTH_TOKEN
value: "$!{TWITCH_OAUTH_TOKEN}"
- name: DISCORD_TOKEN
value: "$!{DISCORD_TOKEN}"
- name: DEV_GUILD_ID
value: "$!{DEV_GUILD_ID}"
- name: OAUTH_CLIENT_ID
value: "$!{OAUTH_CLIENT_ID}"
- name: PORT
value: "$!{PORT}"