This repository has been archived by the owner on Aug 2, 2024. It is now read-only.
forked from argilla-io/argilla-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTiltfile
210 lines (183 loc) · 6.67 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
# version_settings() enforces a minimum Tilt version
# https://docs.tilt.dev/api.html#api.version_settings
version_settings(constraint='>=0.23.4')
# Allow deployment on prod K8s context
allow_k8s_contexts(k8s_context())
print("Using context:", k8s_context())
# Read the ENV environment variable
ENV = str(local('echo $ENV')).strip()
USERS_DB = str(local('echo $USERS_DB')).strip()
DOCKER_REPO = str(local('echo $DOCKER_REPO')).strip()
if not DOCKER_REPO:
DOCKER_REPO = 'localhost:5005'
print('DOCKER_REPO not set, using default: {DOCKER_REPO}'.format(DOCKER_REPO=DOCKER_REPO))
# Set up the same storage policy for kind as in prod
if 'kind' in k8s_context():
# Storage policy
k8s_yaml('./k8s/kind/tilt-local-dev-kind-storage-policy.yaml')
# Installing elastic/elasticsearch Helm
load('ext://helm_resource', 'helm_resource', 'helm_repo')
helm_repo('elastic', 'https://helm.elastic.co', labels=['helm'])
helm_resource(
name='elasticsearch',
chart='elastic/elasticsearch',
flags=[
'--version=8.5.1',
'--values=./k8s/helm/elasticsearch-helm.yaml'],
deps=['./k8s/helm/elasticsearch-helm.yaml', 'elastic'],
port_forwards=['9200'],
labels=['argilla-server']
)
# argilla-server is the web backend (FastAPI + SQL database)
docker_build(
"{DOCKER_REPO}/extralit-argilla-server".format(DOCKER_REPO=DOCKER_REPO),
context='.',
build_args={'ENV': ENV, 'USERS_DB': USERS_DB},
dockerfile='./docker/server/argilla_server.dockerfile',
ignore=['k8s/', 'argilla/', '.venv/', '.*', 'src/extralit', 'docker/server/extralit.dockerfile'],
live_update=[
# Sync the source code to the container
sync('./src/', '/home/argilla/src/'),
sync('./docker/server/scripts/start_argilla_server.sh', '/home/argilla/'),
sync('./pyproject.toml', '/home/argilla/pyproject.toml'),
# Restart the server to pick up code changes
run('/bin/bash start_argilla_server.sh', trigger='./docker/server/scripts/start_argilla_server.sh'),
]
)
argilla_server_k8s_yaml = read_yaml_stream('./k8s/argilla-server-deployment.yaml')
for o in argilla_server_k8s_yaml:
for container in o['spec']['template']['spec']['containers']:
if container['image'] == 'extralit-argilla-server':
container['image'] = "{DOCKER_REPO}/extralit-argilla-server".format(DOCKER_REPO=DOCKER_REPO)
k8s_yaml([
encode_yaml_stream(argilla_server_k8s_yaml),
'./k8s/argilla-server-service.yaml',
'./k8s/argilla-server-ingress.yaml'
])
k8s_resource(
'argilla-server-deployment',
resource_deps=['main-db', 'elasticsearch'],
port_forwards=['6901:6900' if 'kind' in k8s_context() else '6900'],
labels=['argilla-server'],
)
k8s_yaml(['./k8s/argilla-loadbalancer-service.yaml'])
# PostgreSQL is the database for argilla-server
helm_resource(
name='main-db',
chart='bitnami/postgresql',
flags=[
'--version=13.2.0',
'--values=./k8s/helm/postgres-helm.yaml'],
deps=['./k8s/helm/postgres-helm.yaml'],
port_forwards=['5433:5432' if 'kind' in k8s_context() else '5432'],
labels=['argilla-server']
)
# Langfuse Observability server
k8s_yaml('./k8s/langfuse-deployment.yaml')
k8s_resource(
'langfuse-deployment',
port_forwards=['4000'],
labels=['extralit'],
)
# # Vector-Admin
# k8s_yaml('./k8s/vector-admin-deployment.yaml')
# k8s_resource(
# 'vector-admin-deployment',
# port_forwards=['3001:3001'],
# labels=['extralit'],
# )
# Aimstack Observability server
# docker_build(
# "{DOCKER_REPO}/extralit-aim-server".format(DOCKER_REPO=DOCKER_REPO),
# context='.',
# dockerfile='./docker/services/aim.dockerfile',
# only=['./docker/services/'],
# )
# aim_server_k8s_yaml = read_yaml_stream('./k8s/aim-server-deployment.yaml')
# for o in aim_server_k8s_yaml:
# for container in o['spec']['template']['spec']['containers']:
# print(container['name'])
# if container['name'] == 'aim-server':
# container['image'] = "{DOCKER_REPO}/extralit-aim-server".format(DOCKER_REPO=DOCKER_REPO)
# k8s_yaml([
# encode_yaml_stream(aim_server_k8s_yaml),
# './k8s/aim-server-service.yaml',
# ])
# k8s_resource(
# 'aim-deployment',
# port_forwards=['53800:43800'],
# labels=['aim-observability'],
# )
# Add the MinIO Helm repository
# helm_repo('minio', 'https://operator.min.io/', labels=['helm'])
# Deploy the MinIO operator
# k8s_yaml('./k8s/minio-tenant.yaml')
# helm_resource(
# name='extralit-minio-operator',
# chart='minio/minio-operator',
# flags=[
# '--version=4.3.7',
# '--values=./k8s/helm/minio-operator-helm.yaml'],
# deps=['./k8s/helm/minio-operator-helm.yaml'],
# port_forwards=['9090', '9443'],
# labels=['minio']
# )
# Add the MinIO deployment
k8s_yaml(['./k8s/minio-dev.yaml', './k8s/minio-standalone-pvc.yaml'])
k8s_resource(
'minio',
port_forwards=['9000', '9090'],
labels=['storage'],
)
# Weaviate vector database
helm_repo('weaviate-helm', 'https://weaviate.github.io/weaviate-helm', labels=['helm'])
helm_resource(
name='weaviate',
chart='weaviate/weaviate',
flags=[
'--version=16.8.8',
'--values=./k8s/helm/weaviate-helm.yaml'],
deps=['./k8s/helm/weaviate-helm.yaml'],
port_forwards=['8080:8080', '50051:50051'],
labels=['extralit']
)
# Extralit server
docker_build(
"{DOCKER_REPO}/extralit-server".format(DOCKER_REPO=DOCKER_REPO),
context='.',
dockerfile='./docker/server/extralit.dockerfile',
ignore=['k8s/', '.venv/', '.*', 'docker/', 'argilla/frontend/',
'src/argilla_server/', '!src/argilla_server/_version.py'],
live_update=[
sync('./argilla/', '/home/extralit/argilla/'),
sync('./src/', '/home/extralit/src/'),
sync('./pyproject.toml', '/home/extralit/pyproject.toml'),
run('uv pip install --upgrade -e ".[extraction,llm]"', trigger='./pyproject.toml'),
]
)
extralit_k8s_yaml = read_yaml_stream('./k8s/extralit-deployment.yaml')
for o in extralit_k8s_yaml:
for container in o['spec']['template']['spec']['containers']:
if container['name'] == 'extralit-server':
container['image'] = "{DOCKER_REPO}/extralit-server".format(DOCKER_REPO=DOCKER_REPO)
k8s_yaml([
encode_yaml_stream(extralit_k8s_yaml),
'./k8s/extralit-storage-service.yaml'
])
k8s_resource(
'extralit-server',
resource_deps=['minio', 'weaviate'],
port_forwards=['5555'],
labels=['extralit'],
)
# Cert-manager for SSL certificates
# helm_repo('jetstack', 'https://charts.jetstack.io', labels=['helm'])
# helm_resource(
# name='cert-manager',
# chart='jetstack/cert-manager',
# flags=[
# '--version=1.7.1',
# '--set=installCRDs=true'
# ],
# labels=['security']
# )