Skip to content

Commit

Permalink
Merge pull request #112 from MxEmerson/master
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO authored Mar 23, 2024
2 parents 6f0796e + 76ac680 commit dc5c69e
Show file tree
Hide file tree
Showing 14 changed files with 1,106 additions and 10 deletions.
8 changes: 8 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@ COMMAND_START=["","/"]
# 默认牛牛轮盘模式,0为踢人,1为禁言
#DEFAULT_ROULETTE_MODE=0

# 是否使用RPC连接数据库
# 请提前安装依赖:pip install grpcio grpcio-tools grpcio-reflection
#USE_RPC=false

# gRPC token
#RPC_TOKEN=your_rpc_token

# mongodb 相关配置,如无特殊需求,保持注释即可
# 使用 docker-compose 部署时,请将MONGO_HOST设置为 mongodb 容器 的 service 名称,如:MONGO_HOST=mongodb
# 使用RPC连接数据库时,请将mongodb的主机和端口替换为rpc服务的主机和端口

#MONGO_HOST=127.0.0.1
#MONGO_PORT=27017
Expand Down
6 changes: 3 additions & 3 deletions GPU.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ RUN apt-get update && \
apt-get install -y --no-install-recommends ffmpeg portaudio19-dev python3-all-dev && \
rm -rf /var/lib/apt/lists/*

RUN wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb && \
dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb && \
rm libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
RUN curl -s http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/ | grep 'libssl1.1_1.1.1f-1ubuntu.*_amd64\.deb' | sort | head -n 1 | sed 's/.*\(libssl1\.1_1\.1\.1f-1ubuntu.*_amd64\.deb\).*/\1/' | xargs -I {} wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/{} -O libssl_latest.deb && \
dpkg -i libssl_latest.deb && \
rm libssl_latest.deb

ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.9.0/wait /app/wait

Expand Down
81 changes: 81 additions & 0 deletions rpc_server/pymongo_rpc.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
syntax = "proto3";

package pymongoRPC;

service MongoDBService {
rpc Find(FindRequest) returns (FindResponse);
rpc FindOne(FindOneRequest) returns (FindOneResponse);
rpc InsertOne(InsertOneRequest) returns (InsertOneResponse);
rpc InsertMany(InsertManyRequest) returns (InsertManyResponse);
rpc UpdateOne(UpdateOneRequest) returns (UpdateOneResponse);
rpc DeleteMany(DeleteManyRequest) returns (DeleteManyResponse);
rpc CreateIndex(CreateIndexRequest) returns (CreateIndexResponse);
}

message FindRequest {
string collection = 1;
string filter = 2; // JSON
}

message FindResponse {
string documents = 1; // JSON
}

message FindOneRequest {
string collection = 1;
string filter = 2; // JSON
}

message FindOneResponse {
string document = 1; // JSON
}

message InsertOneRequest {
string collection = 1;
string document = 2; // JSON
}

message InsertOneResponse {
string insertedId = 1;
}

message InsertManyRequest {
string collection = 1;
string documents = 2; //JSON
}

message InsertManyResponse {
string insertedIds = 1;
}

message UpdateOneRequest {
string collection = 1;
string filter = 2; // JSON
string update = 3; // JSON
bool upsert = 4;
}

message UpdateOneResponse {
int32 matchedCount = 1;
int32 modifiedCount = 2;
}

message DeleteManyRequest {
string collection = 1;
string filter = 2; // JSON
}

message DeleteManyResponse {
int32 deletedCount = 1;
}

message CreateIndexRequest {
string collection = 1;
string keys = 2; // JSON
string name = 3;
string default_language = 4;
}

message CreateIndexResponse {
string indexName = 1;
}
54 changes: 54 additions & 0 deletions rpc_server/pymongo_rpc_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dc5c69e

Please sign in to comment.