Item portal
Introduction to the
Baby-fried-rice (baby fried rice fruit, hereinafter referred to as BABY) is a set of distributed micro-service background system developed by Go language, which is mainly composed of three modules: user center, instant communication and user space. Gin is used as the Web framework, Gorm is the ORM framework for connecting to the database, and JWT implements Token verification. Calls between services are made through gRPC, and in order to facilitate horizontal scaling of each microservice, ETCD is introduced as a service registry. NSQ is used as message queue to forward messages, and Redis is introduced to cache hot data. Use qiuniuyun cloud storage service to store photos, documents and other content.
Business content
As shown in the figure below, the overall service consists of six parts, and the functions of each part are described as follows:
- Root-account: super user interface management, mainly to query the overall number of users, the list of files uploaded to Qiuniuyun and other information. Pv and UV statistics may be implemented in the later stage.
- User-account: The implementation of user-centered module, including user login, registration, information query and modification, private message management, etc., and user level and integral management will be introduced later;
- Space: the implementation of user space module, including user dynamic release, query and delete, user like, user comment, etc.
- Im: the implementation of chat module, including session management and session message management, the late introduction of friend management;
- Connect: Message notification module management, including user private message notification, space dynamic notification, session message notification;
- File: File module management, including file upload, query and delete;
Microservices Architecture
run
- Run etCD, NSQ, Redis, mysql services
#Run basic services
./bin/baby-docker-base-run.sh up
Copy the code
- Microservices compile and run
## compiler
make build
## run
make run
#Clear the compile file
make clean
Copy the code
- Docker container runs
#Build the business service image
./bin/baby-docker-build.sh
## Business service startup
./bin/baby-docker-run.sh up
#Shut down all services
./bin/baby-docker-run.sh down
Copy the code
List of Open Source technologies
- Golang
- Gin
- Gorm
- Redis
- NSQ
- ETCD
- Docker