Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ai-api-mgr
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
ai-api-mgr
Commits
b1fd980e
Commit
b1fd980e
authored
Feb 29, 2024
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
loki param
parent
8bfc1b29
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
4 deletions
+40
-4
dockerfile
dockerfile
+10
-1
main.go
main.go
+8
-3
makefile
makefile
+18
-0
readme.md
readme.md
+4
-0
No files found.
dockerfile
View file @
b1fd980e
...
@@ -3,6 +3,13 @@ FROM golang:1.21.7-alpine3.18 AS build
...
@@ -3,6 +3,13 @@ FROM golang:1.21.7-alpine3.18 AS build
#FROM golang:1.21.3 AS base
#FROM golang:1.21.3 AS base
#FROM golang:1.20.6-alpine3.18 AS build
#FROM golang:1.20.6-alpine3.18 AS build
# Set up dependencies
ENV
PACKAGES git build-base
# Install dependencies
RUN
apk add
--update
$PACKAGES
WORKDIR
/go/src/github.com/odysseus/
WORKDIR
/go/src/github.com/odysseus/
ENV
https_proxy 'http://192.168.1.180:1080'
ENV
https_proxy 'http://192.168.1.180:1080'
...
@@ -19,7 +26,9 @@ COPY ./service-registry ./service-registry
...
@@ -19,7 +26,9 @@ COPY ./service-registry ./service-registry
# RUN go mod tidy
# RUN go mod tidy
#RUN go build -o /go-kafka
#RUN go build -o /go-kafka
RUN
cd
go-kafka
&&
go mod tidy
&&
go build
-o
/ai-api-mgr
RUN
cd
go-kafka
&&
go mod tidy
&&
make build-docker-ouput
#go build -o /ai-api-mgr
FROM
alpine
FROM
alpine
...
...
main.go
View file @
b1fd980e
...
@@ -19,6 +19,7 @@ import (
...
@@ -19,6 +19,7 @@ import (
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2"
gogoPbProto
"github.com/gogo/protobuf/proto"
gogoPbProto
"github.com/gogo/protobuf/proto"
"github.com/odysseus/go-kafka/version"
pbUpstream
"github.com/odysseus/odysseus-protocol/gen/proto/go/base/v1"
pbUpstream
"github.com/odysseus/odysseus-protocol/gen/proto/go/base/v1"
qdb
"github.com/questdb/go-questdb-client/v2"
qdb
"github.com/questdb/go-questdb-client/v2"
...
@@ -496,7 +497,7 @@ func main() {
...
@@ -496,7 +497,7 @@ func main() {
flag
.
StringVar
(
&
mysqlUser
,
"mysqlUser"
,
"liuxuzhong"
,
"connect to mysql user"
)
flag
.
StringVar
(
&
mysqlUser
,
"mysqlUser"
,
"liuxuzhong"
,
"connect to mysql user"
)
flag
.
StringVar
(
&
mysqlPassWd
,
"mysqlPassWd"
,
"12345678"
,
"mysql user password"
)
flag
.
StringVar
(
&
mysqlPassWd
,
"mysqlPassWd"
,
"12345678"
,
"mysql user password"
)
flag
.
StringVar
(
&
logserver
,
"logserver"
,
"http://1
24.193.167.71
:3100"
,
"LOKI log server"
)
flag
.
StringVar
(
&
logserver
,
"logserver"
,
"http://1
72.31.12.187
:3100"
,
"LOKI log server"
)
flag
.
StringVar
(
&
callbackAddrP
,
"callbackIpAddr"
,
"localhost:6001"
,
"ip:port"
)
flag
.
StringVar
(
&
callbackAddrP
,
"callbackIpAddr"
,
"localhost:6001"
,
"ip:port"
)
flag
.
StringVar
(
&
listenIpPort
,
"listenIpPort"
,
"0.0.0.0:6001"
,
"api listen on ip:port"
)
flag
.
StringVar
(
&
listenIpPort
,
"listenIpPort"
,
"0.0.0.0:6001"
,
"api listen on ip:port"
)
...
@@ -524,12 +525,16 @@ func main() {
...
@@ -524,12 +525,16 @@ func main() {
config
.
TenantID
=
"api"
config
.
TenantID
=
"api"
client
,
_
:=
loki
.
New
(
config
)
client
,
_
:=
loki
.
New
(
config
)
slog
.
SetDefault
(
slog
.
New
(
slogloki
.
Option
{
Level
:
levelVar
,
Client
:
client
}
.
NewLokiHandler
()))
//fmt.Println("Version", version.VERSION)
slog
.
SetDefault
(
slog
.
New
(
slogloki
.
Option
{
Level
:
levelVar
,
Client
:
client
}
.
NewLokiHandler
())
.
With
(
"api"
,
version
.
VERSION
))
//slog.SetDefault(slog.New(slogloki.Option{Level: levelVar, Client: client}.NewLokiHandler()).With("api", "v0.0.15"))
//logger := slog.New(slogloki.Option{Level: slog.LevelDebug, Client: client}.NewLokiHandler())
//logger := slog.New(slogloki.Option{Level: slog.LevelDebug, Client: client}.NewLokiHandler())
// logger = logger.With("release", "v1.0.0")
// logger = logger.With("release", "v1.0.0")
// for i := 0; i < 10000; i++ {
// for i := 0; i < 10000; i++ {
// logger.Debug("debug log server", "i", i)
//
//
logger.Debug("debug log server", "i", i)
// slog.Debug("debug log server", "i", i)
// slog.Debug("debug log server", "i", i)
// time.Sleep(time.Second)
// time.Sleep(time.Second)
// }
// }
...
...
makefile
View file @
b1fd980e
...
@@ -2,7 +2,25 @@
...
@@ -2,7 +2,25 @@
VERSION
:=
$(
shell
echo
$(
shell
git describe
--tags
))
VERSION
:=
$(
shell
echo
$(
shell
git describe
--tags
))
COMMIT_HASH
:=
$(
shell
git rev-parse
--short
HEAD
)
COMMIT_SHA1
=
`
git rev-parse HEAD
`
BUILD_FLAGS
=
-tags
netgo
-ldflags
" -X github.com/odysseus/go-kafka/version.VERSION=
${
VERSION
}
-X github.com/odysseus/go-kafka/main.COMMIT_SHA1=
${
COMMIT_SHA1
}
-X 'github.com/odysseus/go-kafka/main.BUILD_TIME=
`
date
`
' -X 'github.com/odysseus/go-kafka/main.GIT_BRANCH=
`
git symbolic-ref
--short
-q
HEAD
`
' "
docker
:
docker
:
docker build
-t
caduceus/ai-api-mgr:
${
VERSION
}
.
docker build
-t
caduceus/ai-api-mgr:
${
VERSION
}
.
build
:
go.sum
go build
-mod
=
readonly
$(BUILD_FLAGS)
-o
ai-api-mgr
build-docker-ouput
:
go.sum
#
build 的目录在docker image 里不能上下复制,不清楚原因;
go build
-mod
=
readonly
$(BUILD_FLAGS)
-o
/ai-api-mgr
readme.md
View file @
b1fd980e
...
@@ -90,6 +90,10 @@ The global counter `counter` is used to keep track of the messages sent to the K
...
@@ -90,6 +90,10 @@ The global counter `counter` is used to keep track of the messages sent to the K
```
`bash
make build
./ai-api-mgr -mysqlUser=root -mysqlAddr=192.168.1.211 -kafkaBroker=192.168.1.10:9092 -withbilldb=false -questAddr=192.168.1.10:9009 -loglevel=-4
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment