Commit 47cc9754 authored by Your Name's avatar Your Name

add docker compose

parent b27a2460
version: "3.9"
services:
prometheus:
image: prom/prometheus:v2.51.0
volumes:
- "./prometheus.yml:/prometheus/prometheus.yml"
# - "./rules.yml:/etc/prometheus/rules.yml"
network_mode: host
ports:
- 9090:9090
node-exporter:
image: prom/node-exporter:v1.7.0
network_mode: host
privileged: true
pid: host
ports:
- 9100:9100
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.rootfs=/rootfs'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
- '--collector.cpu.info.flags-include=^(aes|avx.?|constant_tsc)$$'
restart: unless-stopped
dcgm:
image: nvcr.io/nvidia/k8s/dcgm-exporter:3.3.5-3.4.0-ubuntu22.04
ports:
- 9400:9400
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [ gpu ]
restart: always
environment:
- DCGM_EXPORTER_NO_HOSTNAME=1
cap_add:
- SYS_ADMIN
monitorapi:
image: docker.ai.17xuexi.com/monitorapi/monitorapi:latest
ports:
- 5000:5000
# docker run -d --gpus all --rm -p 9400:9400 nvcr.io/nvidia/k8s/dcgm-exporter:3.3.5-3.4.0-ubuntu22.04
FROM golang:1.21.7-alpine3.18 AS build
# ENV PACKAGES git openssh-client build-base
# Install dependencies
# RUN apk add --update $PACKAGES
WORKDIR /go/src/github.com/monitorapi
COPY ./ ./
RUN go env -w GOPROXY=https://goproxy.cn
RUN export GOPROXY=https://goproxy.cn
RUN go build -o /monitorapi
# RUN cd go-kafka && go mod tidy && make build-docker-ouput
#go build -o /ai-api-mgr
FROM alpine
WORKDIR /root
COPY --from=build /monitorapi /usr/bin/monitorapi
ENTRYPOINT ["/usr/bin/monitorapi"]
# RUN apk add make
# RUN apk add git
# WORKDIR /go/src/github.com/odysseus/
# Authorize SSH Host
# RUN mkdir -p /root/.ssh && \
# chmod 0700 /root/.ssh && \
# ssh-keyscan github.com > /root/.ssh/known_hosts
#ENV https_proxy 'http://192.168.1.180:1080'
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# RUN mkdir -p ./go-kafka/
# COPY ./ ./go-kafka
# COPY ./cache ./cache
# COPY ./odysseus-protocol ./odysseus-protocol
# COPY ./service-registry ./service-registry
# RUN cat ./go-kafka/id_rsa > /root/.ssh/id_rsa && \
# cat ./go-kafka/id_rsa.pub > /root/.ssh/id_rsa.pub && \
# chmod 600 /root/.ssh/id_rsa && \
# chmod 600 /root/.ssh/id_rsa.pub
#RUN pwd && ls && sleep 10
# RUN go mod tidy
#RUN go build -o /go-kafka
# RUN cd go-kafka && go mod tidy && make build-docker-ouput
# #go build -o /ai-api-mgr
# FROM alpine
# WORKDIR /root
# COPY --from=build /ai-api-mgr /usr/bin/ai-api-mgr
#ENTRYPOINT [ "/usr/bin/ai-api-mgr" ]
# FROM alpine
# WORKDIR /root
# COPY --from=base /ai-api-mgr /usr/bin/
# RUN ls /usr/bin/ai-api-mgr && sleep 30
# ENTRYPOINT [ "/usr/bin/ai-api-mgr" ]
# RUN ls /ai-api-mgr && sleep 30
# FROM alpine
# WORKDIR /root
# RUN ls /usr/bin/ && sleep 10
# COPY --from=base /ai-api-mgr /usr/bin/
# RUN ls /usr/bin/ai-api-mgr && sleep 10
#/usr/bin/go-kafka
# Add entrypoint script
#COPY ./scripts/entrypoint.sh /usr/local/bin/entrypoint.sh
#RUN chmod u+x /usr/local/bin/entrypoint.sh
...@@ -99,9 +99,7 @@ func main() { ...@@ -99,9 +99,7 @@ func main() {
}) })
// app.Get("/hw/usage", func(c *fiber.Ctx) error { // app.Get("/hw/usage", func(c *fiber.Ctx) error {
// res := make([]DeviceInfo, 0, 10) // res := make([]DeviceInfo, 0, 10)
// // gpuUtils, err := cli.GpuUtil() // // gpuUtils, err := cli.GpuUtil()
// // if err != nil { // // if err != nil {
// // return c.JSON(Response{ // // return c.JSON(Response{
......
global:
scrape_interval: 10s
evaluation_interval: 10s
scrape_configs:
- job_name: prometheus
static_configs:
- targets:
- prometheus:9090
- job_name: gpuNode
static_configs:
- targets:
- node-exporter:9100
- job_name: gpu
static_configs:
- targets:
- dcgm:9400
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment