From 3766a80d1c50e0d5f02bd050bb1ee871d3dfd207 Mon Sep 17 00:00:00 2001 From: strange Date: Tue, 13 Jan 2026 11:22:04 +0800 Subject: [PATCH] deploy docker --- Dockerfile | 2 +- config/exchange.toml | 4 +-- deploy/config/config.toml | 55 +++++++++++++++++++++++++++++++++++++ deploy/config/exchange.toml | 43 +++++++++++++++++++++++++++++ deploy/config/gateway.toml | 5 ++++ deploy/docker-compose.yml | 2 ++ 6 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 deploy/config/config.toml create mode 100644 deploy/config/exchange.toml create mode 100644 deploy/config/gateway.toml diff --git a/Dockerfile b/Dockerfile index a1eef44..9c86f96 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,6 @@ WORKDIR /opt COPY localtime /etc/localtime COPY target/${APP} /opt/app COPY config/*.toml /opt/config/ -COPY config/production/*.toml /opt/config/ +COPY deploy/config/*.toml /opt/config/ RUN chmod +x /opt/app CMD ["./app"] diff --git a/config/exchange.toml b/config/exchange.toml index 355e8c1..de70f8d 100644 --- a/config/exchange.toml +++ b/config/exchange.toml @@ -18,9 +18,9 @@ receiveBuffer = 4096 marketSubscribeLimit = 16 consumeBatch = 1024 consumeLater = 2000 # 时间到达later或者数据累计到batch触发consume -httpProxy = "" +# httpProxy = "" # httpProxy = "http://192.168.1.8:7890" -# httpProxy = "http://10.255.183.209:7890" +httpProxy = "http://10.255.183.209:7890" # 模拟盘API交易地址如下: # REST:https://www.okx.com diff --git a/deploy/config/config.toml b/deploy/config/config.toml new file mode 100644 index 0000000..55048f3 --- /dev/null +++ b/deploy/config/config.toml @@ -0,0 +1,55 @@ + +[grpc] +maxSendMsgSize = "8Mi" +maxRecvMsgSize = "8Mi" +readBufferSize = "8Ki" +writeBufferSize = "8Ki" + +[grpc.keepalive] +idleTimeout = "60s" # 空闲连接超时 +keepAliveInterval = "60s" # 发送 ping 的间隔 +keepAliveTimeout = "20s" # ping 超时 +maxLifeTime = "2h" + +[etcd] +endpoints = ["10.255.172.128:7079"] +username = "" +password = "" + +[consul] +address = "10.255.172.128:8500" + +[nats] +url = "nats://@10.255.172.128:7222" + +[database.mysql] +logMode = "info" +# https://gorm.io/zh_CN/docs/connecting_to_the_database.html +mysql = { DSN = "root:123456@tcp(10.255.172.128:7306)/sig?charset=utf8&parseTime=True&loc=Local" } + +[database.postgres] +logMode = "info" +postgres = { DSN = "host=10.255.172.128 port=5432 user=postgres password=123456 dbname=sig sslmode=disable TimeZone=Asia/Shanghai" } + + +[database.clickhouse] +# dsn = "clickhouse://user:password@192.168.0.137:9000/game?dial_timeout=10s&read_timeout=20s" +addr = "10.255.172.128:9000" +database = "sig" +username = "root" +password = "123456" +dial_timeout = 10 +read_timeout = 20 +logsql = true +logsqlCk = false + +[database.kvrocks] +addr = "10.255.172.128:7666" +password = "" +minIdleConns = 3 + +[tsdb] +active = "victoriametrics" + +[tsdb.victoriametrics] +addr = "http://10.255.172.128:8428" diff --git a/deploy/config/exchange.toml b/deploy/config/exchange.toml new file mode 100644 index 0000000..fedbaf5 --- /dev/null +++ b/deploy/config/exchange.toml @@ -0,0 +1,43 @@ + +grpcReflection = true # 注册grpc反射服务 + +[register] +nodeId = 1 # grpc服务节点id, 多实例唯一 +addr = ":8011" # grpc 服务端口 +attrs = { weight = 10 } # grpc 服务权重 + +# okx exchange +[okx] +apiKey = "48be46ec-30ad-4f6f-a5e2-c9ea712df9cd" +secretKey = "12323BA1B411A2235650BBD784850953" +passphrase = "Tm.123456789" +receiveBuffer = 4096 +marketSubscribeLimit = 16 +consumeBatch = 1024 +consumeLater = 2000 # 时间到达later或者数据累计到batch触发consume +# httpProxy = "" +# httpProxy = "http://192.168.1.8:7890" +httpProxy = "http://10.255.183.209:7890" + +# 模拟盘API交易地址如下: +# REST:https://www.okx.com +# WebSocket公共频道:wss://wspap.okx.com:8443/ws/v5/public +# WebSocket私有频道:wss://wspap.okx.com:8443/ws/v5/private +# WebSocket业务频道:wss://wspap.okx.com:8443/ws/v5/business + +# binance key RYgJrvqP4iGqdRth14r0ChgWo8eg0wPEcFqDttsKzvUJDyhOKvPiz42tXxjYIMiG +# secret GLTzNNYzC0AbcINPAYfuKDjkWnAMQUhsyd1ed7ubcdzIRrFZBGUrOAkubqyjekVp + +[exchanges.okx] +api_key = "your-api-key" +secret_key = "your-secret-key" +passphrase = "your-passphrase" + +[exchanges.binance] +api_key = "your-api-key" +secret_key = "your-secret-key" + +[exchanges.bitget] +api_key = "your-api-key" +secret_key = "your-secret-key" +passphrase = "your-passphrase" diff --git a/deploy/config/gateway.toml b/deploy/config/gateway.toml new file mode 100644 index 0000000..5264f3c --- /dev/null +++ b/deploy/config/gateway.toml @@ -0,0 +1,5 @@ + +httpAddr = ":7001" +wsAddr = ":7101" + +sigServer = "http://sig-admin:7009" # 后台服务 diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index 8a35516..ca86c34 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -24,6 +24,8 @@ services: container_name: sig-exchange hostname: sig-exchange network_mode: host + volumes: + - /etc/ssl/certs:/etc/ssl/certs:ro # 挂载宿主机证书 # networks: # - sig-network sig-trading: