Skip to content

Commit

Permalink
🐛 fix missing packages and 🔥 removed secrest from deployment files
Browse files Browse the repository at this point in the history
  • Loading branch information
rathijitpapon committed Jun 28, 2024
1 parent d0153ae commit 74918f9
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 30 deletions.
27 changes: 13 additions & 14 deletions agency/app/tracing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from openinference.instrumentation.llama_index import LlamaIndexInstrumentor
from openinference.semconv.resource import ResourceAttributes
from opentelemetry import trace
from opentelemetry import trace as trace_api
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.instrumentation.grpc import GrpcAioInstrumentorServer
from opentelemetry.instrumentation.llamaindex import (
Expand All @@ -25,24 +24,12 @@

def setup_tracing(settings: TracingSettings) -> None:
if settings.environment == "production":
# jaeger opentelemetry tracing
resource = Resource(
attributes={
ResourceAttributes.PROJECT_NAME: settings.project_name,
"service.name": settings.service_name,
},
)
trace.set_tracer_provider(TracerProvider(resource=resource))
trace.get_tracer_provider().add_span_processor(
BatchSpanProcessor(
OTLPSpanExporter(
endpoint=settings.jaeger_endpoint,
)
)
)
set_global_textmap(TraceContextTextMapPropagator())
GrpcAioInstrumentorServer().instrument()
OpentelemetryLlamaIndexInstrumentor().instrument()

# sentry tracing
sentry_sdk.init(
Expand All @@ -60,5 +47,17 @@ def setup_tracing(settings: TracingSettings) -> None:
span_exporter = OTLPSpanExporter(endpoint=settings.phoenix_api)
span_processor = SimpleSpanProcessor(span_exporter=span_exporter)
tracer_provider.add_span_processor(span_processor=span_processor)
trace_api.set_tracer_provider(tracer_provider=tracer_provider)
trace.set_tracer_provider(tracer_provider=tracer_provider)
LlamaIndexInstrumentor().instrument()

# jaeger opentelemetry tracing
trace.get_tracer_provider().add_span_processor(
BatchSpanProcessor(
OTLPSpanExporter(
endpoint=settings.jaeger_endpoint,
)
)
)
set_global_textmap(TraceContextTextMapPropagator())
GrpcAioInstrumentorServer().instrument()
OpentelemetryLlamaIndexInstrumentor().instrument()
62 changes: 61 additions & 1 deletion agency/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions agency/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ qdrant-client = "^1.9.1"

llmlingua = "^0.2.2"
llama-index-llms-huggingface = "^0.2.2"
opentelemetry-instrumentation-llamaindex = "^0.23.0"
opentelemetry-sdk = "^1.25.0"
opentelemetry-instrumentation = "^0.46b0"
opentelemetry-instrumentation-grpc = "^0.46b0"
[tool.poetry.group.dev.dependencies]
pytest = "^8.1.1"
mypy = "^1.9.0"
Expand Down
5 changes: 5 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ COPY next.config.mjs .
COPY postcss.config.mjs .
COPY tailwind.config.ts .
COPY tsconfig.json .
COPY sentry.* .

ARG POSTHOG_KEY
ARG POSTHOG_API_HOST
ARG POSTHOG_UI_HOST
ARG API_URL
ARG AUTH_URL
ARG AUTH_SECRET
ARG SENTRY_DSN
ARG SENTRY_AUTH_TOKEN

ENV NEXT_TELEMETRY_DISABLED 1
ENV NEXT_PUBLIC_POSTHOG_KEY $POSTHOG_KEY
Expand All @@ -28,6 +31,8 @@ ENV NEXT_PUBLIC_POSTHOG_UI_HOST $POSTHOG_UI_HOST
ENV NEXT_PUBLIC_API_URL $API_URL
ENV AUTH_URL $AUTH_URL
ENV AUTH_SECRET $AUTH_SECRET
ENV NEXT_PUBLIC_SENTRY_DSN $SENTRY_DSN
ENV SENTRY_AUTH_TOKEN $SENTRY_AUTH_TOKEN

RUN npm run build

Expand Down
4 changes: 3 additions & 1 deletion frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ POSTHOG_UI_HOST = https://app.posthog.com
API_URL = <BACKEND_URL>
AUTH_URL = <FRONTEND_URL>
AUTH_SECRET = <base64 32 bit secret string>
SENTRY_DSN = <SENTRY_DSN>
SENTRY_AUTH_TOKEN = <SENTRY_AUTH_TOKEN>

ecr_deploy: login
docker buildx build --platform linux/amd64 --build-arg POSTHOG_KEY=$(POSTHOG_KEY) --build-arg POSTHOG_API_HOST=$(POSTHOG_API_HOST) --build-arg POSTHOG_UI_HOST=$(POSTHOG_UI_HOST) --build-arg API_URL=$(API_URL) --build-arg AUTH_URL=${AUTH_URL} --build-arg AUTH_SECRET=${AUTH_SECRET} -t $(Image) .
docker buildx build --platform linux/amd64 --build-arg POSTHOG_KEY=$(POSTHOG_KEY) --build-arg POSTHOG_API_HOST=$(POSTHOG_API_HOST) --build-arg POSTHOG_UI_HOST=$(POSTHOG_UI_HOST) --build-arg API_URL=$(API_URL) --build-arg AUTH_URL=$(AUTH_URL) --build-arg AUTH_SECRET=$(AUTH_SECRET) --build-arg SENTRY_DSN=$(SENTRY_DSN) --build-arg SENTRY_AUTH_TOKEN=$(SENTRY_AUTH_TOKEN) -t $(Image) .
docker tag $(Image) $(ECR):$(TAG)
docker push $(ECR):$(TAG)

Expand Down
18 changes: 4 additions & 14 deletions frontend/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,11 @@ spec:
app: search-{{ .Release.Name }}
spec:
containers:
- image: {{ .Values.service.image }}
- envFrom:
- configMapRef:
name: {{ .Release.Name }}-configmap
image: {{ .Values.service.image }}
imagePullPolicy: Always
env:
- name: NEXT_PUBLIC_POSTHOG_UI_HOST
value: https://app.posthog.com
- name: NEXT_PUBLIC_POSTHOG_KEY
value: phc_Qau6pGkA8BXUr7JuDxgALufZqhxMKAk9UVGY4UFQyXu
- name: NEXT_PUBLIC_POSTHOG_API_HOST
value: https://search.curieo.ai/ingest
- name: NEXT_PUBLIC_API_URL
value: http://search-server.search.svc.cluster.local:3030
- name: AUTH_URL
value: https://search.curieo.ai
- name: AUTH_SECRET
value: 05mk7ukF/GSG1dHLYVp04Mxa49slQb2W3N9v1aMcRTM=
name: search-{{ .Release.Name }}
ports:
- containerPort: {{ .Values.service.port }}
Expand Down

0 comments on commit 74918f9

Please sign in to comment.