Skip to content

Commit 3f2c485

Browse files
committed
Wrap schema deployment in a session
1 parent fc0eece commit 3f2c485

File tree

4 files changed

+56
-10
lines changed

4 files changed

+56
-10
lines changed

requirements.txt

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,32 @@
11
#
22
# Runtime requirements
33

4-
fastapi==0.115.11 # MIT
5-
sqlalchemy[asyncio]==2.0.40 # MIT
6-
uvicorn==0.34.0 # BSD 3-Clause
7-
pydantic==2.10.6 # MIT
8-
prometheus-fastapi-instrumentator==7.1.0 # ISC
4+
fastapi==0.115.11 # MIT
5+
sqlalchemy[asyncio]==2.0.40 # MIT
6+
uvicorn==0.34.0 # BSD 3-Clause
7+
pydantic==2.10.6 # MIT
8+
psycopg2-binary==2.9.10 # LGPL with exceptions
9+
10+
prometheus-fastapi-instrumentator==7.1.0 # ISC
11+
12+
# For zero-code-instrumentation
13+
# Check the requirements by using opentelemetry-bootstrap -a requirements
14+
opentelemetry-distro # Apache 2.0
15+
opentelemetry-exporter-otlp
16+
opentelemetry-instrumentation-asyncio==0.53b1
17+
opentelemetry-instrumentation-dbapi==0.53b1
18+
opentelemetry-instrumentation-logging==0.53b1
19+
opentelemetry-instrumentation-sqlite3==0.53b1
20+
opentelemetry-instrumentation-threading==0.53b1
21+
opentelemetry-instrumentation-urllib==0.53b1
22+
opentelemetry-instrumentation-wsgi==0.53b1
23+
opentelemetry-instrumentation-asgi==0.53b1
24+
opentelemetry-instrumentation-click==0.53b1
25+
opentelemetry-instrumentation-fastapi==0.53b1
26+
opentelemetry-instrumentation-grpc==0.53b1
27+
opentelemetry-instrumentation-httpx==0.53b1
28+
opentelemetry-instrumentation-requests==0.53b1
29+
opentelemetry-instrumentation-sqlalchemy==0.53b1
30+
opentelemetry-instrumentation-starlette==0.53b1
31+
opentelemetry-instrumentation-tortoiseorm==0.53b1
32+
opentelemetry-instrumentation-urllib3==0.53b1

var/container/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ RUN chown -R 1000:1000 /home/app/.local
1414

1515
USER app:app
1616
EXPOSE 8000
17-
CMD ["/home/app/.local/bin/uvicorn", "--host", "0.0.0.0", "--port", "8000", "mrmat_python_api_fastapi.app:app"]
18-
#CMD ["/home/app/.local/bin/mrmat-python-api-fastapi"]
17+
#CMD ["/home/app/.local/bin/uvicorn", "--host", "0.0.0.0", "--port", "8000", "mrmat_python_api_fastapi.app:app"]
18+
CMD ["/home/app/.local/bin/opentelemetry-instrument", \
19+
"/home/app/.local/bin/uvicorn", "--host", "0.0.0.0", "--port", "8000", "mrmat_python_api_fastapi.app:app"]

var/helm/templates/deployment.yaml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
app.kubernetes.io/name: mrmat-python-api-fastapi
77
app.kubernetes.io/part-of: mrmat-python-api-fastapi
88
spec:
9-
replicas: 2
9+
replicas: {{ .Values.pod.replicas | int }}
1010
selector:
1111
matchLabels:
1212
app: {{ .Values.pod.name }}
@@ -30,6 +30,23 @@ spec:
3030
- name: mrmat-python-api-fastapi
3131
image: {{ .Values.pod.repository }}:{{ .Chart.AppVersion }}
3232
imagePullPolicy: {{ .Values.pod.imagePullPolicy }}
33+
env:
34+
- name: OTEL_SERVICE_NAME
35+
value: "mrmat-python-api-fastapi"
36+
- name: OTEL_TRACES_EXPORTER
37+
value: "otlp"
38+
- name: OTEL_METRICS_EXPORTER
39+
value: "none"
40+
- name: OTEL_LOGS_EXPORTER
41+
value: "none"
42+
- name: OTEL_EXPORTER_OTLP_ENDPOINT
43+
value: "jaeger-collector.stack.svc.cluster.local:4317"
44+
- name: OTEL_EXPORTER_OTLP_INSECURE
45+
value: "true"
46+
- name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
47+
value: "jaeger-collector.stack.svc.cluster.local:4317"
48+
- name: OTEL_EXPORTER_OTLP_TRACES_INSECURE
49+
value: "true"
3350
ports:
3451
- name: http
3552
containerPort: {{ .Values.pod.port }}
@@ -42,13 +59,17 @@ spec:
4259
runAsNonRoot: true
4360
runAsUser: 1000
4461
livenessProbe:
62+
periodSeconds: 10
4563
httpGet:
4664
path: /api/healthz/liveness/
4765
port: {{ .Values.pod.port }}
66+
scheme: HTTP
4867
readinessProbe:
68+
periodSeconds: 10
4969
httpGet:
5070
path: /api/healthz/readiness/
5171
port: {{ .Values.pod.port }}
72+
scheme: HTTP
5273
affinity:
5374
podAntiAffinity:
5475
requiredDuringSchedulingIgnoredDuringExecution:

var/helm/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ serviceAccount:
1010

1111
pod:
1212
name: mrmat-python-api-fastapi
13-
replicas: 2
13+
replicas: 1
1414
repository: registry:5000/mrmat-python-api-fastapi
15-
imagePullPolicy: IfNotPresent
15+
imagePullPolicy: Always
1616
port: 8000
1717

1818
service:

0 commit comments

Comments
 (0)