From 5e929c931cb42028dd988a23c1815acc793e5a1a Mon Sep 17 00:00:00 2001 From: mayunxiang02 Date: Fri, 20 Jun 2025 09:54:52 +0800 Subject: [PATCH] fix: add Swagger and Docker descriptions to the readme file. --- README.md | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9388d83..d0443be 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,43 @@ +

ChainServer

+

+ + semantic-release + + + docker pull casbin/chainserver + + + GitHub Workflow Status (branch) + + + GitHub Release + + + Docker Image Version (latest semver) + +

+ +

+ + Go Report Card + + + license + + + GitHub issues + + + GitHub stars + + + GitHub forks + + + Discord + +

+ # ChainServer A HTTP service wrapper for ChainMaker SDK, designed to work with Casibase without requiring CGO support. @@ -18,7 +58,7 @@ ChainServer is a lightweight HTTP service that provides a bridge between Casibas Currently, ChainServer only supports ChainMaker blockchains with **TLS disabled** and **authtype set to `permissionedWithCert`**. If you encounter errors when invoking transaction or query APIs, please verify that your ChainMaker server configuration meets these requirements. Additionally, ensure that the `provider` configuration in your Casibase setup is consistent with your ChainMaker network settings. -For details on how to check and modify your ChainMaker chain configuration, please refer to the official documentation: +For details on how to check and modify your ChainMaker chain configuration, please refer to the official documentation: - [ChainMaker Configuration Guide](https://docs.chainmaker.org.cn/manage/%E9%95%BF%E5%AE%89%E9%93%BE%E9%85%8D%E7%BD%AE%E7%AE%A1%E7%90%86.html) If your configuration does not meet the above requirements, the service may not function as expected. @@ -37,6 +77,35 @@ The server runs on port 13900 by default. You can modify the port in the configu The service provides HTTP endpoints for ChainMaker operations. Detailed API documentation will be provided separately. +## Docker Deployment Guide + +The recommended way to deploy is to use the official image from Docker Hub: + +```sh +docker run -d --name chainserver -p 13900:13900 casbin/chainserver:latest +``` + +Alternatively, you can use Docker Compose (recommended for production or multi-container setups): + +```sh +docker-compose up -d +``` + +You can also build the image locally if you want to use your own changes: + +```sh +docker build -t chainserver . +docker run -d --name chainserver -p 13900:13900 chainserver +``` + +The default service port is 13900. For troubleshooting or advanced usage, see the Dockerfile and build.sh, or open an issue if you encounter problems. + +## API Documentation (Swagger) + +After starting the service, you can view the API documentation via Swagger UI: + +- Open your browser and visit: [http://localhost:13900/swagger/index.html](http://localhost:13900/swagger/index.html) + ## Building and Running 1. Install Go 1.22 or later