-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdevspace.yaml
More file actions
executable file
·149 lines (139 loc) · 5.13 KB
/
devspace.yaml
File metadata and controls
executable file
·149 lines (139 loc) · 5.13 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
version: v1beta10
# `vars` specifies variables which may be used as ${VAR_NAME} in devspace.yaml
vars:
- name: FRONTEND_IMAGE
value: ghcr.io/wavefrontset/workcalendar-frontend
- name: BACKEND_IMAGE
value: ghcr.io/wavefrontset/workcalendar
- name: BACKEND_IMAGE_DEV
value: ${BACKEND_IMAGE}_dev
images:
frontend:
image: ${FRONTEND_IMAGE}
dockerfile: frontend/Dockerfile
context: frontend/
app:
image: ${BACKEND_IMAGE}
dockerfile: backend/Dockerfile
context: backend/
appDev:
image: ${BACKEND_IMAGE_DEV}
dockerfile: backend/Dockerfile
context: backend/
build:
docker:
options:
target: development
# `deployments` tells DevSpace how to deploy this project
deployments:
- name: database
helm:
chart:
name: postgresql
repo: https://charts.bitnami.com/bitnami
version: 10.5.0
wait: true
values:
postgresqlDatabase: "db_workcalendar"
postgresqlUsername: "workcalendar"
postgresqlPassword: ${DB_PASSWORD}
- name: backend
# 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"]
wait: true
values:
containers:
- image: ${BACKEND_IMAGE} # Use the value of our `${BACKEND_IMAGE}` variable here (see vars above)
env:
- name: DB_HOST
value: "database-postgresql"
- name: DB_NAME
value: "db_workcalendar"
- name: DB_USER
value: "workcalendar"
- name: DB_PASSWORD
value: ${DB_PASSWORD}
service:
ports:
- port: 5000
- name: frontend
helm:
componentChart: true
values:
containers:
- image: ${FRONTEND_IMAGE} # Use the value of our `${BACKEND_IMAGE}` variable here (see vars above)
service:
ports:
- port: 8080
# `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: ${BACKEND_IMAGE} # Select the Pod that runs our `${BACKEND_IMAGE}`
forward:
- port: 5000
- imageSelector: ${FRONTEND_IMAGE}
forward:
- port: 8080
# `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:5000/admin
- url: http://localhost:8080/entries
# `dev.sync` configures a file sync between our Pods in k8s and your local project files
sync:
- imageSelector: ${BACKEND_IMAGE} # Select the Pod that runs our `${BACKEND_IMAGE}`
localSubPath: backend/
excludePaths:
- __pycache__/
- .coverage
- .pytest_cache/
- imageSelector: ${FRONTEND_IMAGE} # Select the Pod that runs our `${BACKEND_IMAGE}`
localSubPath: frontend/
excludePaths:
- node_modules/
# 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: ${BACKEND_IMAGE} # Select the Pod that runs our `${BACKEND_IMAGE}`
# Since the `${BACKEND_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: ${BACKEND_IMAGE_DEV}
logs:
showLast: 200
sync: true
disabled: false
selectors:
- labelSelector:
app.kubernetes.io/component: backend
- labelSelector:
app.kubernetes.io/component: frontend
# `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 to use 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: ${BACKEND_IMAGE} # Use the value of our `${IMAGE}` variable here (see vars above)
dockerfile: ./backend/Dockerfile
commands:
- name: backend
command: "devspace enter -l app.kubernetes.io/component=backend"
description: "Entry point for the backend pod"
- name: lint
command: "devspace run backend -- black --check . && flake8"
description: "Run linters in the backend pod"
- name: test
command: "devspace run backend -- pytest"
description: "Run tests in the backend pod"
- name: frontend
command: "devspace enter -l app.kubernetes.io/component=frontend"
description: "Entry point for the frontend pod"