Move monitoring TG API to Go
This commit is contained in:
@@ -5,7 +5,8 @@ WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
COPY cmd ./cmd
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o /out/monitoring-tg-classifier ./cmd/classifier
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o /out/monitoring-tg-classifier ./cmd/classifier \
|
||||
&& CGO_ENABLED=0 GOOS=linux go build -o /out/monitoring-tg-server ./cmd/server
|
||||
|
||||
FROM python:3.11-slim
|
||||
|
||||
@@ -29,6 +30,7 @@ RUN pip install --upgrade pip && pip install -e .
|
||||
RUN mkdir -p /data/session /data/media
|
||||
|
||||
COPY --from=go-builder /out/monitoring-tg-classifier /usr/local/bin/monitoring-tg-classifier
|
||||
COPY --from=go-builder /out/monitoring-tg-server /usr/local/bin/monitoring-tg-server
|
||||
|
||||
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
@@ -36,4 +38,4 @@ RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
EXPOSE 8000
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
CMD ["python", "-m", "parser_bot.main"]
|
||||
CMD ["/usr/local/bin/monitoring-tg-server"]
|
||||
|
||||
1637
cmd/server/main.go
Normal file
1637
cmd/server/main.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,7 @@ data:
|
||||
API_HOST: "0.0.0.0"
|
||||
API_PORT: "8000"
|
||||
PUBLIC_BASE_PATH: "/api/monitoring-tg"
|
||||
PYTHON_BASE_URL: "http://127.0.0.1:8001"
|
||||
POSTGRES_HOST: "postgres.monitoring-tg.svc.cluster.local"
|
||||
POSTGRES_PORT: "5432"
|
||||
POSTGRES_USER: "parser"
|
||||
|
||||
@@ -31,6 +31,7 @@ spec:
|
||||
containers:
|
||||
- name: monitoring-tg-server
|
||||
image: localhost:30300/admin/monitoring-tg-server:latest
|
||||
command: ["/usr/local/bin/monitoring-tg-server"]
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
envFrom:
|
||||
@@ -64,6 +65,43 @@ spec:
|
||||
limits:
|
||||
cpu: 800m
|
||||
memory: 1Gi
|
||||
- name: monitoring-tg-telegram
|
||||
image: localhost:30300/admin/monitoring-tg-server:latest
|
||||
command: ["python", "-m", "parser_bot.main"]
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: monitoring-tg-config
|
||||
- secretRef:
|
||||
name: monitoring-tg-secrets
|
||||
env:
|
||||
- name: API_PORT
|
||||
value: "8001"
|
||||
volumeMounts:
|
||||
- name: app-data
|
||||
mountPath: /data
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 8001
|
||||
periodSeconds: 5
|
||||
failureThreshold: 30
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 8001
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 8001
|
||||
periodSeconds: 5
|
||||
resources:
|
||||
requests:
|
||||
cpu: 80m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
cpu: 800m
|
||||
memory: 1Gi
|
||||
- name: monitoring-tg-classifier
|
||||
image: localhost:30300/admin/monitoring-tg-server:latest
|
||||
command: ["/usr/local/bin/monitoring-tg-classifier"]
|
||||
|
||||
Reference in New Issue
Block a user