From 6e4efddf688571cabebde0893bf11ede2bde73ba Mon Sep 17 00:00:00 2001 From: kyriediculous Date: Wed, 2 Oct 2024 10:01:12 +0000 Subject: [PATCH] livepeer config --- Dockerfile | 20 ++++++++++---------- docker-compose.yaml | 11 ++++------- lpData/livepeer.conf | 14 ++++++++++++++ lpData/maxPrices.json | 16 ++++++++++++++++ nginx.conf | 11 ++++++++++- 5 files changed, 54 insertions(+), 18 deletions(-) create mode 100644 lpData/livepeer.conf create mode 100644 lpData/maxPrices.json diff --git a/Dockerfile b/Dockerfile index 6918c85..d9cf04b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -# Use a base image with Go 1.21.x for pulling the repository and building the application +# Use a base image with Go 1.21.x for building the application FROM golang:1.21 AS builder # Set the working directory inside the container @@ -6,20 +6,20 @@ WORKDIR /app # Copy from local COPY . . -# Pull the repository -# RUN git clone https://github.com/Livepool-io/livepeer-openai-api-middleware.git . # Download all the dependencies RUN go mod download -# Build the Go application -RUN go build -o app +# Build the Go application with CGO disabled and statically linked +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . # Use a minimal base image for running the application -FROM debian:bullseye-slim +FROM alpine:latest -# Set the working directory inside the container -WORKDIR /app +# Install ca-certificates +RUN apk --no-cache add ca-certificates + +WORKDIR /root/ # Copy the binary from the builder stage COPY --from=builder /app/app . @@ -27,5 +27,5 @@ COPY --from=builder /app/app . # Expose the port the application runs on EXPOSE 8080 -# Set the entry point to run the binary with the gateway flag -ENTRYPOINT ["./app"] +# Set the entry point to run the binary +ENTRYPOINT ["./app"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 8e0c0a9..4be26c1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,17 +1,14 @@ -version: '3' - services: livepeer: - image: livepool/go-livepool:llm + image: livepeer/go-livepeer:v0.7.9-ai.2 networks: - chatlpt-network volumes: - - ./lpData:/root/.lpData/keystore - command: > - livepeer -gateway -mainnet -httpAddr 0.0.0.0:8935 -httpIngest -v 6 -ethPassword /root/.lpData/password.txt + - ./lpData:/root/.lpData/ + command: '-config /root/.lpData/livepeer.conf' api: - image: livepool/openai-api:latest + image: livepool/openai-api:llm networks: - chatlpt-network depends_on: diff --git a/lpData/livepeer.conf b/lpData/livepeer.conf new file mode 100644 index 0000000..9ee374c --- /dev/null +++ b/lpData/livepeer.conf @@ -0,0 +1,14 @@ +ethUrl https://arb-mainnet.g.alchemy.com/v2/vMsgfz6xKYg5MTI-o2dhRjrY1J-DlzoG +ethKeystorePath /root/.lpData/keystore +ethPassword /root/.lpData/password.txt +network arbitrum-one-mainnet +gateway true +monitor true +v 99 +blockPollingInterval 20 +maxPricePerUnit 300 +pixelsPerUnit 1 +rtmpAddr 0.0.0.0:1935 +httpAddr 0.0.0.0:8935 +maxTotalEV 100000000000000 +maxPricePerCapability /root/.lpData/maxPrices.json \ No newline at end of file diff --git a/lpData/maxPrices.json b/lpData/maxPrices.json new file mode 100644 index 0000000..2b540be --- /dev/null +++ b/lpData/maxPrices.json @@ -0,0 +1,16 @@ +{ + "capabilities-prices": [ + { + "pipeline": "llm", + "model_id": "meta-llama/Meta-Llama-3.1-8B-Instruct", + "price_per_unit": 20000000, + "pixels_per_unit": 1000000 + }, + { + "pipeline": "llm", + "model_id": "meta-llama/Meta-Llama-3.1-70B-Instruct", + "price_per_unit": 80000000, + "pixels_per_unit": 1000000 + } + ] +} \ No newline at end of file diff --git a/nginx.conf b/nginx.conf index c48b365..61a7672 100644 --- a/nginx.conf +++ b/nginx.conf @@ -9,7 +9,16 @@ http { server { listen 80; - server_name _; + server_name api.chatlpt.ai; + return 301 https://$server_name$request_uri; + } + + server { + listen 443 ssl; + server_name api.chatlpt.ai; + + ssl_certificate /etc/letsencrypt/live/api.chatlpt.ai/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/api.chatlpt.ai/privkey.pem; location / { proxy_pass http://api;