diff --git a/publisher/README.md b/publisher/README.md index 5d93896..b955ecc 100644 --- a/publisher/README.md +++ b/publisher/README.md @@ -1,4 +1,4 @@ -# TiPublisher server +# Publisher server It provide the publisher functions: - Publish TiUP pacakge from OCI artifact or http file url. @@ -23,6 +23,13 @@ goa example github.com/PingCAP-QE/ee-apps/publisher/design ### Start the API server + +```bash +go run ./cmd/publisher -config=config-publisher.yaml --debug --domain 0.0.0.0:8080 +``` + +### Start the worker instance. + ```bash -go run ./cmd/service +go run ./cmd/worker --config=config-worker.yaml --debug ``` diff --git a/publisher/cmd/publisher/main.go b/publisher/cmd/publisher/main.go index 1cbebbb..cd3b8a7 100644 --- a/publisher/cmd/publisher/main.go +++ b/publisher/cmd/publisher/main.go @@ -18,7 +18,7 @@ import ( "goa.design/clue/log" "gopkg.in/yaml.v3" - tipublisher "github.com/PingCAP-QE/ee-apps/publisher" + "github.com/PingCAP-QE/ee-apps/publisher" tiup "github.com/PingCAP-QE/ee-apps/publisher/gen/tiup" "github.com/PingCAP-QE/ee-apps/publisher/pkg/config" ) @@ -159,5 +159,5 @@ func initService(configFile string) (tiup.Service, error) { DB: config.Redis.DB, }) - return tipublisher.NewTiup(&logger, kafkaWriter, redisClient, config.EventSource), nil + return publisher.NewTiup(&logger, kafkaWriter, redisClient, config.EventSource), nil } diff --git a/publisher/design/design.go b/publisher/design/design.go index 2b73874..267e31f 100644 --- a/publisher/design/design.go +++ b/publisher/design/design.go @@ -24,7 +24,7 @@ var _ = API("publisher", func() { }) var _ = Service("tiup", func() { - Description("The TiPublisher service") + Description("TiUP Publisher service") HTTP(func() { Path("/tiup") }) diff --git a/publisher/gen/http/cli/publisher/cli.go b/publisher/gen/http/cli/publisher/cli.go index 1c390ac..4211972 100644 --- a/publisher/gen/http/cli/publisher/cli.go +++ b/publisher/gen/http/cli/publisher/cli.go @@ -142,7 +142,7 @@ func ParseEndpoint( // tiupUsage displays the usage of the tiup command and its subcommands. func tiupUsage() { - fmt.Fprintf(os.Stderr, `The TiPublisher service + fmt.Fprintf(os.Stderr, `TiUP Publisher service Usage: %[1]s [globalflags] tiup COMMAND [flags] diff --git a/publisher/gen/http/openapi3.json b/publisher/gen/http/openapi3.json index 66f7172..ca6437d 100644 --- a/publisher/gen/http/openapi3.json +++ b/publisher/gen/http/openapi3.json @@ -1 +1 @@ -{"openapi":"3.0.3","info":{"title":"Publish API","description":"Publish API","contact":{"name":"WuHui Zuo","url":"https://github.com/wuhuizuo","email":"wuhui.zuo@pingcap.com"},"version":"1.0.0"},"servers":[{"url":"http://0.0.0.0:80"}],"paths":{"/tiup/publish-request":{"post":{"tags":["tiup"],"summary":"request-to-publish tiup","operationId":"tiup#request-to-publish","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestToPublishRequestBody"},"example":{"artifact_url":"A facilis.","request_id":"Sequi placeat blanditiis est iusto quia eum.","tiup-mirror":"Sunt voluptates.","version":"Rerum consectetur deleniti."}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"array","items":{"type":"string","example":"Distinctio voluptates voluptatem accusamus nisi omnis quia."},"description":"request track ids","example":["Voluptates possimus pariatur consequuntur itaque est dignissimos.","Atque amet optio et aliquam ut.","Nulla at error qui dolores et ipsa.","Rem nisi non."]},"example":["Molestiae vitae ut commodi voluptatem consectetur.","Magnam aut et labore."]}}}}}},"/tiup/publish-request/{request_id}":{"get":{"tags":["tiup"],"summary":"query-publishing-status tiup","operationId":"tiup#query-publishing-status","parameters":[{"name":"request_id","in":"path","description":"request track id","required":true,"schema":{"type":"string","description":"request track id","example":"Facere maiores tenetur mollitia consequatur perferendis sint."},"example":"Nisi earum earum pariatur et animi."}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"string","description":"request state","example":"Necessitatibus officia distinctio officia voluptas laudantium iure."},"example":"Aperiam consequatur consequatur."}}}}}}},"components":{"schemas":{"RequestToPublishRequestBody":{"type":"object","properties":{"artifact_url":{"type":"string","description":"The full url of the pushed image, contain the tag part. It will parse the repo from it.","example":"Voluptas ratione hic libero nisi."},"request_id":{"type":"string","description":"The request id","example":"Quibusdam nisi quam."},"tiup-mirror":{"type":"string","description":"Staging is http://tiup.pingcap.net:8988, product is http://tiup.pingcap.net:8987.","default":"http://tiup.pingcap.net:8988","example":"Magni quia adipisci excepturi."},"version":{"type":"string","description":"Force set the version. Default is the artifact version read from `org.opencontainers.image.version` of the manifest config.","example":"Rerum voluptate accusantium optio."}},"example":{"artifact_url":"Atque vero in molestiae odit consequatur.","request_id":"Eos eveniet vero.","tiup-mirror":"Nemo rerum voluptas.","version":"Eum saepe nihil omnis dolorem eveniet."},"required":["artifact_url","tiup-mirror"]}}},"tags":[{"name":"tiup","description":"The TiPublisher service"}]} \ No newline at end of file +{"openapi":"3.0.3","info":{"title":"Publish API","description":"Publish API","contact":{"name":"WuHui Zuo","url":"https://github.com/wuhuizuo","email":"wuhui.zuo@pingcap.com"},"version":"1.0.0"},"servers":[{"url":"http://0.0.0.0:80"}],"paths":{"/tiup/publish-request":{"post":{"tags":["tiup"],"summary":"request-to-publish tiup","operationId":"tiup#request-to-publish","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestToPublishRequestBody"},"example":{"artifact_url":"A facilis.","request_id":"Sequi placeat blanditiis est iusto quia eum.","tiup-mirror":"Sunt voluptates.","version":"Rerum consectetur deleniti."}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"array","items":{"type":"string","example":"Distinctio voluptates voluptatem accusamus nisi omnis quia."},"description":"request track ids","example":["Voluptates possimus pariatur consequuntur itaque est dignissimos.","Atque amet optio et aliquam ut.","Nulla at error qui dolores et ipsa.","Rem nisi non."]},"example":["Molestiae vitae ut commodi voluptatem consectetur.","Magnam aut et labore."]}}}}}},"/tiup/publish-request/{request_id}":{"get":{"tags":["tiup"],"summary":"query-publishing-status tiup","operationId":"tiup#query-publishing-status","parameters":[{"name":"request_id","in":"path","description":"request track id","required":true,"schema":{"type":"string","description":"request track id","example":"Facere maiores tenetur mollitia consequatur perferendis sint."},"example":"Nisi earum earum pariatur et animi."}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"string","description":"request state","example":"Necessitatibus officia distinctio officia voluptas laudantium iure."},"example":"Aperiam consequatur consequatur."}}}}}}},"components":{"schemas":{"RequestToPublishRequestBody":{"type":"object","properties":{"artifact_url":{"type":"string","description":"The full url of the pushed image, contain the tag part. It will parse the repo from it.","example":"Voluptas ratione hic libero nisi."},"request_id":{"type":"string","description":"The request id","example":"Quibusdam nisi quam."},"tiup-mirror":{"type":"string","description":"Staging is http://tiup.pingcap.net:8988, product is http://tiup.pingcap.net:8987.","default":"http://tiup.pingcap.net:8988","example":"Magni quia adipisci excepturi."},"version":{"type":"string","description":"Force set the version. Default is the artifact version read from `org.opencontainers.image.version` of the manifest config.","example":"Rerum voluptate accusantium optio."}},"example":{"artifact_url":"Atque vero in molestiae odit consequatur.","request_id":"Eos eveniet vero.","tiup-mirror":"Nemo rerum voluptas.","version":"Eum saepe nihil omnis dolorem eveniet."},"required":["artifact_url","tiup-mirror"]}}},"tags":[{"name":"tiup","description":"TiUP Publisher service"}]} \ No newline at end of file diff --git a/publisher/gen/http/openapi3.yaml b/publisher/gen/http/openapi3.yaml index 069e0f1..fa4ac9c 100644 --- a/publisher/gen/http/openapi3.yaml +++ b/publisher/gen/http/openapi3.yaml @@ -104,4 +104,4 @@ components: - tiup-mirror tags: - name: tiup - description: The TiPublisher service + description: TiUP Publisher service diff --git a/publisher/gen/tiup/service.go b/publisher/gen/tiup/service.go index 1c39aa1..77b4280 100644 --- a/publisher/gen/tiup/service.go +++ b/publisher/gen/tiup/service.go @@ -11,7 +11,7 @@ import ( "context" ) -// The TiPublisher service +// TiUP Publisher service type Service interface { // RequestToPublish implements request-to-publish. RequestToPublish(context.Context, *RequestToPublishPayload) (res []string, err error) diff --git a/publisher/pkg/config/config.go b/publisher/pkg/config/config.go index 89e9f87..5dc964d 100644 --- a/publisher/pkg/config/config.go +++ b/publisher/pkg/config/config.go @@ -4,7 +4,7 @@ type Worker struct { Kafka struct { KafkaBasic `yaml:",inline" json:",inline"` ConsumerGroup string `yaml:"consumer_group" json:"consumer_group,omitempty"` - } `yaml:"credentials" json:"credentials,omitempty"` + } `yaml:"kafka" json:"kafka,omitempty"` MirrorUrl string `yaml:"mirror_url" json:"mirror_url,omitempty"` LarkWebhookURL string `yaml:"lark_webhook_url" json:"lark_webhook_url,omitempty"` }