-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathTiltfile
232 lines (207 loc) · 7.72 KB
/
Tiltfile
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
update_settings(max_parallel_updates=6)
docker_build(
'chroma-postgres',
context='./k8s/test/postgres',
dockerfile='./k8s/test/postgres/Dockerfile'
)
if config.tilt_subcommand == "ci":
custom_build(
'logservice',
'depot build --project $DEPOT_PROJECT_ID -t $EXPECTED_REF --target logservice -f ./go/Dockerfile . --load',
['./go/', './idl/']
)
else:
docker_build(
'logservice',
'.',
only=['go/', 'idl/'],
dockerfile='./go/Dockerfile',
target='logservice'
)
if config.tilt_subcommand == "ci":
custom_build(
'logservice-migration',
'depot build --project $DEPOT_PROJECT_ID -t $EXPECTED_REF --target logservice-migration -f ./go/Dockerfile.migration . --load',
['./go/']
)
else:
docker_build(
'logservice-migration',
'.',
only=['go/'],
dockerfile='./go/Dockerfile.migration',
target="logservice-migration"
)
if config.tilt_subcommand == "ci":
custom_build(
'rust-log-service',
'depot build --project $DEPOT_PROJECT_ID -t $EXPECTED_REF -f ./rust/log/Dockerfile . --load',
['./rust/', './idl/', './Cargo.toml', './Cargo.lock']
)
else:
docker_build(
'rust-log-service',
'.',
only=["rust/", "idl/", "Cargo.toml", "Cargo.lock"],
dockerfile='./rust/log/Dockerfile',
)
if config.tilt_subcommand == "ci":
custom_build(
'sysdb',
'depot build --project $DEPOT_PROJECT_ID -t $EXPECTED_REF --target sysdb -f ./go/Dockerfile . --load',
['./go/', './idl/']
)
else:
docker_build(
'sysdb',
'.',
only=['go/', 'idl/'],
dockerfile='./go/Dockerfile',
target='sysdb'
)
if config.tilt_subcommand == "ci":
custom_build(
'sysdb-migration',
'depot build --project $DEPOT_PROJECT_ID -t $EXPECTED_REF --target sysdb-migration -f ./go/Dockerfile.migration . --load',
['./go/']
)
else:
docker_build(
'sysdb-migration',
'.',
only=['go/'],
dockerfile='./go/Dockerfile.migration',
target='sysdb-migration'
)
if config.tilt_subcommand == "ci":
custom_build(
'frontend-service',
'depot build --project $DEPOT_PROJECT_ID -t $EXPECTED_REF -f ./Dockerfile . --load',
['chromadb/', 'idl/', 'requirements.txt', 'bin/']
)
else:
docker_build(
'frontend-service',
'.',
only=['chromadb/', 'idl/', 'requirements.txt', 'bin/'],
dockerfile='./Dockerfile',
ignore=['**/*.pyc', 'chromadb/test/'],
)
if config.tilt_subcommand == "ci":
custom_build(
'rust-frontend-service',
'depot build --project $DEPOT_PROJECT_ID -t $EXPECTED_REF -f ./rust/cli/Dockerfile . --load',
['./rust/', './idl/', './Cargo.toml', './Cargo.lock']
)
else:
docker_build(
'rust-frontend-service',
'.',
only=["rust/", "idl/", "Cargo.toml", "Cargo.lock"],
dockerfile='./rust/cli/Dockerfile',
)
if config.tilt_subcommand == "ci":
custom_build(
'query-service',
'depot build --project $DEPOT_PROJECT_ID -t $EXPECTED_REF --target query_service -f ./rust/worker/Dockerfile . --load ',
['./rust/', './idl/', './Cargo.toml', './Cargo.lock']
)
else:
docker_build(
'query-service',
'.',
only=["rust/", "idl/", "Cargo.toml", "Cargo.lock"],
dockerfile='./rust/worker/Dockerfile',
target='query_service'
)
if config.tilt_subcommand == "ci":
custom_build(
'compaction-service',
'depot build --project $DEPOT_PROJECT_ID -t $EXPECTED_REF --target compaction_service -f ./rust/worker/Dockerfile . --load ',
['./rust/', './idl/', './Cargo.toml', './Cargo.lock']
)
else:
docker_build(
'compaction-service',
'.',
only=["rust/", "idl/", "Cargo.toml", "Cargo.lock"],
dockerfile='./rust/worker/Dockerfile',
target='compaction_service'
)
# First install the CRD
k8s_yaml(
['k8s/distributed-chroma/crds/memberlist_crd.yaml'],
)
# We manually call helm template so we can call set-file
k8s_yaml(
local(
'helm template --set-file rustFrontendService.configuration=rust/frontend/sample_configs/distributed.yaml --values k8s/distributed-chroma/values.yaml,k8s/distributed-chroma/values.dev.yaml k8s/distributed-chroma'
),
)
watch_file('rust/frontend/sample_configs/distributed.yaml')
watch_file('k8s/distributed-chroma/values.yaml')
watch_file('k8s/distributed-chroma/values.dev.yaml')
watch_file('k8s/distributed-chroma/*.yaml')
# Extra stuff to make debugging and testing easier
k8s_yaml([
'k8s/test/otel-collector.yaml',
'k8s/test/grafana-service.yaml',
'k8s/test/grafana.yaml',
'k8s/test/jaeger-service.yaml',
'k8s/test/jaeger.yaml',
'k8s/test/minio.yaml',
'k8s/test/prometheus.yaml',
'k8s/test/test-memberlist-cr.yaml',
'k8s/test/postgres.yaml',
])
# Lots of things assume the cluster is in a basic state. Get it into a basic
# state before deploying anything else.
k8s_resource(
objects=[
'pod-watcher:Role',
'memberlists.chroma.cluster:CustomResourceDefinition',
'query-service-memberlist:MemberList',
'compaction-service-memberlist:MemberList',
'sysdb-serviceaccount:serviceaccount',
'sysdb-serviceaccount-rolebinding:RoleBinding',
'sysdb-query-service-memberlist-binding:clusterrolebinding',
'sysdb-compaction-service-memberlist-binding:clusterrolebinding',
'logservice-serviceaccount:serviceaccount',
'query-service-serviceaccount:serviceaccount',
'query-service-serviceaccount-rolebinding:RoleBinding',
'query-service-memberlist-readerwriter:ClusterRole',
'query-service-query-service-memberlist-binding:clusterrolebinding',
'query-service-memberlist-readerwriter-binding:clusterrolebinding',
'compaction-service-memberlist-readerwriter:ClusterRole',
'compaction-service-compaction-service-memberlist-binding:clusterrolebinding',
'compaction-service-memberlist-readerwriter-binding:clusterrolebinding',
'compaction-service-serviceaccount:serviceaccount',
'compaction-service-serviceaccount-rolebinding:RoleBinding',
'test-memberlist:MemberList',
'test-memberlist-reader:ClusterRole',
'test-memberlist-reader-binding:ClusterRoleBinding',
'lease-watcher:role',
'logservice-serviceaccount-rolebinding:rolebinding',
'rust-frontend-service-config:ConfigMap',
],
new_name='k8s_setup',
labels=["infrastructure"],
)
# Production Chroma
k8s_resource('postgres', resource_deps=['k8s_setup'], labels=["infrastructure"], port_forwards='5432:5432')
# Jobs are suffixed with the image tag to ensure they are unique. In this context, the image tag is defined in k8s/distributed-chroma/values.yaml.
k8s_resource('sysdb-migration-latest', resource_deps=['postgres'], labels=["infrastructure"])
k8s_resource('logservice-migration-latest', resource_deps=['postgres'], labels=["infrastructure"])
k8s_resource('logservice', resource_deps=['sysdb-migration-latest'], labels=["chroma"], port_forwards='50052:50051')
k8s_resource('rust-log-service', labels=["chroma"], port_forwards='50054:50051')
k8s_resource('sysdb', resource_deps=['sysdb-migration-latest'], labels=["chroma"], port_forwards='50051:50051')
k8s_resource('frontend-service', resource_deps=['sysdb', 'logservice'],labels=["chroma"], port_forwards='8000:8000')
k8s_resource('rust-frontend-service', resource_deps=['sysdb', 'logservice', 'rust-log-service'], labels=["chroma"], port_forwards='3000:8000')
k8s_resource('query-service', resource_deps=['sysdb'], labels=["chroma"], port_forwards='50053:50051')
k8s_resource('compaction-service', resource_deps=['sysdb'], labels=["chroma"])
k8s_resource('jaeger', resource_deps=['k8s_setup'], labels=["observability"])
k8s_resource('grafana', resource_deps=['k8s_setup'], labels=["observability"])
k8s_resource('prometheus', resource_deps=['k8s_setup'], labels=["observability"])
k8s_resource('otel-collector', resource_deps=['k8s_setup'], labels=["observability"])
# Local S3
k8s_resource('minio-deployment', resource_deps=['k8s_setup'], labels=["debug"], port_forwards=['9000:9000', '9005:9005'])