👋 Hi, there's @TremblingV5
tremblingv5 / doutok Goto Github PK
View Code? Open in Web Editor NEWDouTok is a backend server for a simple Douyin/TikTok
License: Apache License 2.0
DouTok is a backend server for a simple Douyin/TikTok
License: Apache License 2.0
上述复现方式中执行步骤4后,对比的结果应该是没有变化的,在执行步骤3时用户1已经关注了用户2,此时对关注数和粉丝数都不应该新增。
所以应该在进行已有的relation action时,不修改相关的计数变量
Add ELK support for DouTok.
ELK(ES Logstash Kibana) is a normal log solution. Now DouTok will write log to files, it not easy to read and analysis logs. In enterprises developments or in large projects development, a log solution is important. We can read logs quickly by using ELK and so some other jobs by using these data.
.yml
file in ./env
to use docker-compose
to start related environment.Now we only can use a .apk
file as client to request DouTok. So we plan to build a frontend app for DouTok. For simple implementation, we may crate a React app as the frontend. Support mobile is not an urgent goal. The directory ./ui
used to store frontend code.
Obviously, there're some directly tasks for achieve this frontend app:
Fix golangci-lint errors.
golangci-lint is a normal linter for Golang
. Now DouTok have many errors which we can found them by using golangci-lint run
. Actually, these errors will not affect running DouTok. But these errors are not elegant enough, also may cause unnecessary bugs.
We suggest that open a new issue to tell everyone what you will do if you want to contribute for this issue. This will avoid different contributor do the same job.
在DouTok/applications/publish/rpc/user.go
文件中的第19行,
func InitUserRpc() {
config := dtviper.ConfigInit("DOUTOK_USER", "user")
c, err := userservice.NewClient(
config.Viper.GetString("Server.Name"),
initHelper.InitRPCClientArgs(*config)...,😊😊这里的config多解引用了一次,
)
if err != nil {
panic(err)
}
userClient = c
}
dtviper.ConfigInit
返回*dtviper.Config
类型,所以不用再解引用了
个人想参与到DouTok的开发中。在看过“DouTok从0到1小帮手”后,想从编写单元测试开始。但我不知道怎么开始,请问能提供些学习材料和建议吗?(基本没有项目相关经验)
The local startup method for DouTok services is very poor, it needs to be optimized using make.
消息队列我可能确实不太熟,学习了一下必要知识就直接来看代码了。
我感觉从代码反推设计目前对我来说太难了
目前直接一点的问题是,我能找到 ConsumerGroup.Consume
在那里初始化,但是没法了解到具体是怎样一个消费流程
换句话说,我想知道这个项目中,消息队列都做了哪些事情
首先,非常欢迎大家能够参与DouTok的项目维护。也非常感谢大家能够花时间在DouTok上,无论是简单浏览,还是提出意见,或是直接贡献参与项目。
很多同学表示难以下手,对此我持反对意见。
开源贡献并不代表只有提交业务代码才叫做开源贡献。开源贡献的途径有很多,例如:
这两样工作是很容易被人轻视的,但是这并不代表他们不重要。DouTok提供了4种Issue模板,包括报Bug、提需求、讨论、和“Anything”。各种各样的Issue和Discussion是开源贡献的基础,DouTok非常欢迎大家能够提Issue或者开启Discussion,请不要害怕发表的观点“太简单”或是“有错误”。请所有人大胆发言。
如果您认为DouTok哪里做的不好,请提Issue。
如果您不明白DouTok为什么这么做,请提Issue。
如果您有任何疑问,请提Issue。
如果您想参与DouTok但不知道该做什么,请提Issue。可以在Issue中简单介绍一下自己,描述一下自己希望能做什么样的工作,DouTok会尽全力帮您寻找一个适合的功能点来提供给您。
在本Issue刚创建的时刻,DouTok的文档站刚刚创建成功,可以通过这个链接访问:https://doutok.zhengfei.xin
项目文档也是一个软件产品重要的一部分。在文档网站中,您可以寻找任何可以添加文档的部分,编写文档,然后提交PR,最终合并。哪怕寥寥几行内容,也会是文档的组成部分,至少可以是开启提交PR之路的一个起点。
DouTok虽然是一个看起来还很稚嫩的项目,但也依赖了一堆环境,也有了一定量的代码。有的同学可能不太能够顺利的把整个项目跑起来,又或是不太能够把相关的环境部署下来,这些都不妨碍去编写一些单元测试。如果一个软件产品想要尽可能的健康,单元测试是整个目标的第一步。只要您能安装一个Golang环境,那么就能直接编写单元测试的代码。编写单元测试,即能够逐渐掌握项目内容的来龙去脉,又能够为整个项目的稳定运行添砖加瓦。DouTok项目的Github Actions中配置了在每次提交PR时都会运行全部的单元测试,也就是说,您提交的所有单元测试在任何人提交PR时都会运行至少一遍,您的单元测试在为DouTok保驾护航。
提交业务代码是最直接的提升DouTok的途径,当您选择提交代码时,我想这里也不需要过多的介绍。想要提交业务代码,请首先确认要做什么。
如果不知道想要做什么,可以在DouTok的Issue列表中浏览一下,那里会有一些明确的需要帮助的Issue可供完成。
如果想要做某些事情,但是Issue中又没有,烦请添加一条对应的Issue用以描述将要做的事情,这么做可以防止其他贡献者在不知情的情况下做了一样的工作。
最近和 @BaiZe1998 商量后,决定把主要的业务代码回退到当时青训营结束时的一个版本,这么做的原因有:
和这段时间有贡献的几位同学说声抱歉。
我尽量保留了大家贡献的代码,例如配置等,后续我会尽可能把大家贡献的代码给用起来。
DouTok最初有这些模块:api, comment, favorite, publish, feed, user, message等,由于接口定义不够清晰,导致在一些情况下会出现循环调用(即使并不会发生无限循环),为了解决这个看起来不够“优雅”的问题,我选择了一条错误的、费事的道路,给微服务像MVC架构那样去分层。这样做虽然基本解决了循环调用,但是服务数量也特别多,在实际业务场景中,随着业务的扩张,服务的数量也将快速增长,显然这样是不合理的。
后续打算沿用原有的模块划分,可能会对一些模块进行合并,例如我个人感觉publish, feed模块可以合并为"video"模块,具体的feed服务可以在未来去搞一个建议的推荐服务。
在原有模块划分的基础上,对除api模块外的每个模块定义2套服务。一套面向网关,一套面向各个微服务。面向网关的服务将返回具体的字段信息,而面向微服务的服务将只返回服务管辖范围内的数据的id,具体的数据内容则调用对应服务去查询。
后续打算基于viper和etcd去做配置中心,通过一个环境变量来确定从文件读配置还是从配置中心读配置。在开发或是部署情况下分别使用对应的方式来读取配置。
这段时间我工作工程中也看到了关于配置的一些封装,我会尝试进行实现。
@BaiZe1998 @AbigailJixiangyuyu @issueMel @newbieking @cilangzzz
希望各位同学能分享下自己的看法,不仅限于上述2个问题,关于DouTok未来架构怎么发展,去做什么样的功能,都欢迎大家能提意见、发表想法
Use hertz-swagger to enhance api documents
To facilitate front-end development, we may need an api documents. As we know, swagger is a good way to do this job. We can read the documents for hertz-swagger
.
https://www.cloudwego.io/zh/docs/hertz/tutorials/basic-feature/middleware/swagger/
We need to add some comments to tell us what the api need and what to response. Also, we may add some commands by using Makefile
to let us to use make ....
to generate the documents of api.
Hello~
我注意到这个 repo 的 REAMDE & 图片与 FreeCar 风格类似。如果有借鉴 FreeCar 的话,请遵循 GPL-3.0 license。
Now DouTok use HBase as a storage to save some data, such as message, video etc. For using row key of HBase to improve data loading, DouTok is using HBase.
Now we hope we can use MongoDB instead of HBase. Because:
MongoDB is more easy so we may select it.
There're some plan for refactor DouTok. If you have some advices, please comment here.
Also, welcome to select one or more entries to do something and that's DouTok's pleasure. If you want to make some contributions to DouTok, we suggest open another issue which used to tell everyone what you want to do and assign it to yourself. In the way, we can avoid different people doing the same job.
The following is something what we want to do. Absolutely, anything that does not appear below is acceptable.
go run ./applications/xxx/
. We may use a better way to do these. See more on: #112go test
when open a PRNow the code of DouTok still not elegant enough. Code layout is a big problem. There many places in this repo is not OOP (although golang is not a 100% OOP language). We suggest that we can improve the code layout of this repo. applications/commentDomain
is an example.
Some package may need refactor:
applications/feed
applications/message
applications/messageDomain
applications/publish
applications/relationDomain
@xwxbUnfortunately, DouTok is poor on unit test. So any contributions for any package are welcome.
我注意到一些接口返回了int64类型的数据,如user_id。
但由于前端js是使用双精度浮点型接收该类数据,会导致数据失真,需要进行处理,将int64转换为string类型再返回。我有一些方案,但不知道哪种方案更好。
handler.SendResponse
内部处理结构体A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.