# core-portal

grpc-gateway based service as a portal of CM(Cluster Management), serve service by HTTP. In other words, it's a gateway for CM which convert 
traffic between HTTP/json and gRPC/protobuf.

In general, we shouldn't directly CRUD metadb or directly operate infra-API to do something. All things done in core-portal
should only be combine operations to multiple gRPC service or assemble data from multiple gRPC service. 
For historical reasons, there are some logic still directly do CURD metadb or operate infra-API.

All API can be classified by management's API and user-side API which provide by [admin](internal/admin) and [central](internal/central). 

# directory structure

- [admin](internal/admin): API for [management-portal](https://ops.tidbcloud.com/), used by administrator user. All API served directly by gin.
- [central](internal/central): API for [DBaaS UI](https://tidbclou.com/), used by customer user. All API served by grpc-gateway, 
  and API definition defined by protobuf + grpc-gateway [annotation](https://grpc-ecosystem.github.io/grpc-gateway/docs/tutorials/adding_annotations/). 
- [deploy](./deploy): pulumi based deploy scripts.
- [doc](./docs)/: **OUTDATED**
- [local build tool](./local): some tools for locally fast build or deploy
- [pkg](internal/central/pkg): **OUTDATED** this code is designed to be shared by different services
- [test](./test): to run a metadb in docker for UT
- [tools](./tools): some tools for build

# About Authentication and Authorize

For now, there still do authentication and authorize for HTTP request. And, will migrate both authentication and authorize to [API-Gateway](https://github.com/tidbcloud/api-gateway) soon or later.

# TODO

- [ ] migrate all code which directly CRUD metadb or infra-API into [core-svc](https://github.com/tidbcloud/core-svc/).
- [ ] migrate all [worker](internal/central/worker) into [core-svc](https://github.com/tidbcloud/core-svc)
- [ ] migrate [proxy](internal/central/mesh) into a independent service.
- [ ] remove all aws/gcp depended logic, then remove all aws/gcp credential from deployment.

# History

All code is migrated from [DBaaS](https://github.com/tidbcloud/dbaas/).  
You can find some historical doc in [here](https://github.com/tidbcloud/dbaas/).
