Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ApiToKafkaBill
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
李伟@五瓣科技
ApiToKafkaBill
Commits
3c1479e0
Commit
3c1479e0
authored
Feb 02, 2024
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete swagger
parent
7967213e
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
154 additions
and
61 deletions
+154
-61
dockerfile
dockerfile
+25
-10
go.mod
go.mod
+6
-10
go.sum
go.sum
+80
-20
main.go
main.go
+43
-21
No files found.
dockerfile
View file @
3c1479e0
FROM
golang:1.21.
3 AS base
#FROM golang:1.20.6-alpine3.18 AS b
ase
FROM
golang:1.21.
6-alpine3.18 AS build
#FROM golang:1.20.6-alpine3.18 AS b
uild
#FROM golang:1.21.3 AS base
#FROM golang:1.20.6-alpine3.18 AS build
WORKDIR
/go/src/github.com/odysseus/
ENV
https_proxy 'http://192.168.1.180:1080'
...
...
@@ -16,21 +15,37 @@ COPY ./payment ./payment
COPY
./odysseus-protocol ./odysseus-protocol
#RUN pwd && ls && sleep 10
# RUN go mod tidy
#RUN go build -o /go-kafka
RUN
cd
go-kafka
&&
go mod tidy
&&
go build
-o
/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
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
...
...
go.mod
View file @
3c1479e0
module go-kafka
module g
ithub.com/odysseus/g
o-kafka
go 1.21.3
...
...
@@ -8,15 +8,17 @@ replace github.com/odysseus/payment => ../payment
require (
github.com/IBM/sarama v1.42.1
github.com/gofiber/contrib/swagger v1.1.1
github.com/gofiber/fiber/v2 v2.52.0
github.com/gogo/protobuf v1.3.2
github.com/odysseus/odysseus-protocol v0.0.0-00010101000000-000000000000
github.com/odysseus/payment v0.0.0-00010101000000-000000000000
github.com/questdb/go-questdb-client/v2 v2.0.0
github.com/swaggo/swag v1.16.3
)
require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/astaxie/beego v1.12.3 // indirect
...
...
@@ -37,7 +39,6 @@ require (
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-openapi/validate v0.22.1 // indirect
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/gofiber/contrib/swagger v1.1.1 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gomodule/redigo v2.0.0+incompatible // indirect
github.com/google/uuid v1.5.0 // indirect
...
...
@@ -52,23 +53,19 @@ require (
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/odysseus/payment v0.0.0-00010101000000-000000000000 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/questdb/go-questdb-client/v2 v2.0.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/redis/go-redis/v9 v9.4.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/
shopspring/decimal v1.3.1
// indirect
github.com/
rogpeppe/go-internal v1.12.0
// indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/swaggo/swag v1.16.2 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.51.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
...
...
@@ -76,7 +73,6 @@ require (
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.14.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
...
...
go.sum
View file @
3c1479e0
This diff is collapsed.
Click to expand it.
main.go
View file @
3c1479e0
...
...
@@ -25,8 +25,6 @@ import (
"github.com/odysseus/payment/cachedata"
"github.com/odysseus/payment/model"
"github.com/gofiber/contrib/swagger"
)
var
(
...
...
@@ -303,18 +301,23 @@ type ResponseJson struct {
TaskError
string
}
func
newCache
()
*
cachedata
.
CacheData
{
func
newCache
(
redisAddr
,
redisPass
,
mysqlIP
,
dbName
,
user
,
passwd
string
,
port
int
)
*
cachedata
.
CacheData
{
_cache
:=
cachedata
.
NewCacheData
(
context
.
Background
(),
cachedata
.
RedisConnParam
{
Addr
:
"192.168.1.10:6379"
,
//Addr: "192.168.1.10:6379",
Addr
:
redisAddr
,
Password
:
""
,
DbIndex
:
0
,
},
model
.
DbConfig
{
Host
:
"192.168.1.211"
,
Port
:
3306
,
DbName
:
"liuxuzhong"
,
Passwd
:
"12345678"
,
User
:
"root"
,
//Host: "192.168.1.211",
Host
:
mysqlIP
,
Port
:
port
,
DbName
:
dbName
,
Passwd
:
passwd
,
User
:
user
,
// DbName: "liuxuzhong",
// Passwd: "12345678",
// User: "root",
})
return
_cache
}
...
...
@@ -381,14 +384,23 @@ func main() {
var
questAddr
,
kafkaBroker
,
callbackAddrP
,
listenIpPort
,
aigcProduceTopic
,
aigcConsumerTopic
string
var
redisAddr
,
mysqlAddr
string
var
redisAddr
,
redisPassWd
,
mysqlAddr
string
var
mysqlPort
int
var
mysqlDbName
,
mysqlUser
,
mysqlPassWd
string
//var redisPassWd string
//flag.StringVar(&questAddr, "questAddr", "192.168.1.10:9009", "questDbAddr")
flag
.
StringVar
(
&
questAddr
,
"questAddr"
,
"localhost:9009"
,
"questDbAddr"
)
flag
.
StringVar
(
&
kafkaBroker
,
"kafkaBroker"
,
"localhost:9092"
,
"single kafka broker"
)
flag
.
StringVar
(
&
redisAddr
,
"redisAddr"
,
"localhost:6379"
,
"Redis Addr"
)
flag
.
StringVar
(
&
mysqlAddr
,
"mysqlAddr"
,
"localhost:3306"
,
"Mysql Addr"
)
flag
.
StringVar
(
&
redisPassWd
,
"redisPassWd"
,
""
,
"Redis password"
)
flag
.
StringVar
(
&
mysqlAddr
,
"mysqlAddr"
,
"localhost"
,
"onely ip address"
)
flag
.
IntVar
(
&
mysqlPort
,
"mysqlPort"
,
3306
,
"onely port"
)
flag
.
StringVar
(
&
mysqlDbName
,
"mysqlDbName"
,
"liuxuzhong"
,
"mysql db name"
)
flag
.
StringVar
(
&
mysqlUser
,
"mysqlUser"
,
"liuxuzhong"
,
"connect to mysql user"
)
flag
.
StringVar
(
&
mysqlPassWd
,
"mysqlPassWd"
,
"12345678"
,
"mysql user password"
)
flag
.
StringVar
(
&
callbackAddrP
,
"callbackIpAddr"
,
"localhost:6001"
,
"ip:port"
)
flag
.
StringVar
(
&
listenIpPort
,
"listenIpPort"
,
"0.0.0.0:6001"
,
"api listen on ip:port"
)
...
...
@@ -398,14 +410,20 @@ func main() {
flag
.
Parse
()
fmt
.
Println
(
"questAddr|"
,
questAddr
)
fmt
.
Println
(
"redisAddr|"
,
redisAddr
)
fmt
.
Println
(
"mysqlAddr|"
,
mysqlAddr
)
fmt
.
Println
(
"kafkaBroker|"
,
kafkaBroker
)
fmt
.
Println
(
"callbackIpAddr|"
,
callbackAddrP
)
fmt
.
Println
(
"listenIpPort|"
,
listenIpPort
)
fmt
.
Println
(
"aigcProduceTopic|"
,
aigcProduceTopic
)
fmt
.
Println
(
"aigcConsumerTopic|"
,
aigcConsumerTopic
)
fmt
.
Println
(
"redisAddr|"
,
redisAddr
)
fmt
.
Println
(
"redisPassWd|"
,
redisPassWd
)
fmt
.
Println
(
"mysqlAddr|"
,
mysqlAddr
)
fmt
.
Println
(
"mysqlPort|"
,
mysqlPort
)
fmt
.
Println
(
"mysqlDbName|"
,
mysqlDbName
)
fmt
.
Println
(
"mysqlUser|"
,
mysqlUser
)
fmt
.
Println
(
"mysqlPassWd|"
,
mysqlPassWd
)
kafkaBrokers
=
[]
string
{
kafkaBroker
}
callbackAddr
=
callbackAddrP
...
...
@@ -419,7 +437,11 @@ func main() {
createTable
(
questAddr
[
:
idx
],
createTaskTableSql
)
createTable
(
questAddr
[
:
idx
],
createBillsTableSql
)
cache
=
newCache
()
// DbName: "liuxuzhong",
// Passwd: "12345678",
// User: "root",
cache
=
newCache
(
redisAddr
,
redisPassWd
,
mysqlAddr
,
mysqlDbName
,
mysqlUser
,
mysqlPassWd
,
mysqlPort
)
// Create a WaitGroup to synchronize goroutines.
wg
:=
&
sync
.
WaitGroup
{}
...
...
@@ -442,14 +464,14 @@ func main() {
// Create a new instance of the Fiber web framework.
app
:=
fiber
.
New
()
cfg
:=
swagger
.
Config
{
BasePath
:
"/"
,
FilePath
:
"./docs/swagger.json"
,
Path
:
"swagger"
,
Title
:
"Swagger API Docs"
,
}
//
cfg := swagger.Config{
//
BasePath: "/",
//
FilePath: "./docs/swagger.json",
//
Path: "swagger",
//
Title: "Swagger API Docs",
//
}
app
.
Use
(
swagger
.
New
(
cfg
))
//
app.Use(swagger.New(cfg))
apiGroup
:=
app
.
Group
(
"/api"
)
jwtGroup
:=
app
.
Group
(
"/jwt"
)
...
...
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