We are using go, gin, gorm, redis, postgreSQL, elastic search, docker and docker compose in backend. To test and view our backend document, you can add rest-client extension in your vscode with the API-docs in api_doc
folder
You can easily run the backend with ./deploy.sh
command.
./deploy.sh
The elastic search may not enable correctly, you may need:
./chore/enableEls.sh http://localhost:8000/
The .http
files are interactive API documents to backend. The @baseUrl
is the base of backend API. You can reach local deployment or remote deployment by comment on different setting. Our public deployment is on whiteboard.house:8000
.
The authentication microservice. This service require a redis deployment. You can create one by docker command:
docker run --name reids -p 6379:6379 -d redis
Then you can run the backend by
go run main.go
Sometimes the elastic search
doesn't configure the premission of the datafolder after restart the container. You can solve the problem by:
sudo chmod -R 777 els_data
Also, this service connect to Uploader
to support avatar for user. And Notification
server to support notification system when user following notification. But these services are not mandatory.
All helper scripts are belong to here. No especial purpose. There are implementations of upload client by python
or curl
, which helps the frontend team understand the uploading procedure.
The main enpoint that redirect all the request to different microservice. Thus this will depends on all the service on backend. This service will gracefully failed if the corresponding serverse is not up and running. Also the gateway
will run a basic file service to let frontent download the picture, which is exporting the img/
folder. You can run it by:
go run main.go
The notification
micro service service. The notification holds the notification to user including like/dislike
, comment
and following
features. This will depends on the auth
service to get the user name and avatar. You can run it by:
go run main.go
This simple uploader
service holds the image manage information and do the neccessary procedure of uploading a picture. The uploaded picture will store on the img/
folder. You can upload both jpg
and png
format and we generate the thumbnail automatically by putting it into img/small/
. While the original image storing at img/big/
.You can run it by:
go run main.go
The first microservice for managing picture post
and like
, comment
. This service only depends on the notification
service. The valid user is checking by JWT token
, so we don't need to check it anymore. This service will depends on elastic search
to enable recommendataion functionality and comment pagination, which is not mandatory. You can run it by:
go run main.go
The search engine we deploy to boost our develop process. Be mind not to export 9200
and 9300
to the public Internet. Our search engine has been hacked for this reason. You can run the search engine by the help of docker
by:
docker run --name es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.9.2
The db/
, els_data/
, img/
folders are auto generated by deploy script. These folders will be mounted to container and holds the information of different container. You can remove the docker-compose
cache and re-run the backend with these commands:
docker-compose down -v
./deploy.sh
./chore/enableEls.sh http://localhost:8000/