Skip to content

Commit

Permalink
配置梳理
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyoo0812 committed Nov 15, 2023
1 parent 3678948 commit cb81258
Show file tree
Hide file tree
Showing 22 changed files with 200 additions and 144 deletions.
25 changes: 0 additions & 25 deletions bin/cache.conf

This file was deleted.

23 changes: 23 additions & 0 deletions bin/config/quanta.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--eufaula配置参数

--服务器集群,对应后台的服务器id
QUANTA_CLUSTER = 2

--主机IP
QUANTA_HOST_IP = "10.98.8.59"

--mongo地址
QUANTA_MONGO_URL = "mongodb://root:MTAE379673#@10.96.8.100:27017"

--redis地址
QUANTA_REDIS_URL = "redis://root:[email protected]:6379"

--扩展说明
--专用的的配置参考上面的配置,添加到顶层目录

ENVIRON_VARIABLES = {
QUANTA_ENVIRON = "develop"
}

--扩展说明
--公用的的配置参考上面的配置,添加到ENVIRON_VARIABLES
24 changes: 24 additions & 0 deletions bin/configure.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@


@echo off
setlocal enabledelayedexpansion

set /p CONF=please input your conf name:

set RootDir=%~dp0

set ConfDir=%RootDir%quanta
rmdir /Q /S %ConfDir%
md %ConfDir%

set TplDir=%RootDir%template
cd %TplDir%

set SCRIPT=../../extend/lmake/ltemplate.lua
set ENVIRON=../config/%CONF%.conf
for %%i in (*.conf) do (
..\lua.exe %SCRIPT% %%i %ConfDir%\%%i %ENVIRON%
)

pause

20 changes: 0 additions & 20 deletions bin/mongo.conf

This file was deleted.

25 changes: 0 additions & 25 deletions bin/monitor.conf

This file was deleted.

20 changes: 0 additions & 20 deletions bin/mysql.conf

This file was deleted.

11 changes: 11 additions & 0 deletions bin/quanta.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
taskkill /f /im quanta.exe

::start "accord" quanta.exe quanta\accord.conf --index=1 --port=1
start "monitor" quanta.exe quanta\monitor.conf --index=1 --port=1
start "router1" quanta.exe quanta\router.conf --index=1 --port=1
start "cache1" quanta.exe quanta\cache.conf --index=1 --port=1
start "mongo" quanta.exe quanta\mongo.conf --index=1 --port=1
start "redis" quanta.exe quanta\redis.conf --index=1 --port=1
start "gate1" quanta.exe quanta\gateway.conf --index=1 --port=1
start "center" quanta.exe quanta\center.conf --index=1 --port=1
start "login" quanta.exe quanta\login.conf --index=1 --port=1
9 changes: 0 additions & 9 deletions bin/start.bat

This file was deleted.

1 change: 0 additions & 1 deletion bin/stop.bat

This file was deleted.

17 changes: 8 additions & 9 deletions bin/accord.conf → bin/template/accord.conf
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
--[[
quanta启动环境配置
启动:
启动第一个参数是本配置文件的路径, 后续跟环境变量
启动第一个参数是本配置文件的路径后续跟环境变量
备注:
环境变量可在此文件配置, 也可以配置在启动参数, 从启动参数配置时, 系统会自动补全QUANTA_前缀
环境变量可在此文件配置也可以配置在启动参数从启动参数配置时系统会自动补全QUANTA_前缀
案例:
./quanta.exe quanta.conf --index=3 --service=test
]]

--包含通用环境变量配置
dofile("share.conf")
dofile("database.conf")

--mongo
set_env("QUANTA_MONGO_URL", "mongodb://root:MTAE379673#@127.0.0.1:27017/tools")
dofile("quanta/base.conf")

--启动参数
---------------------------------------------------------
Expand All @@ -26,7 +22,10 @@ set_env("QUANTA_SERVICE", "tool")
set_env("QUANTA_MODE", "3")

--协议测试
set_env("QUANTA_ACCORD_HTTP", "127.0.0.1:10401")
set_env("QUANTA_ACCORD_HTTP", "0.0.0.0:10401")

--mongo
set_env("QUANTA_MONGO_URL", "{{%= QUANTA_MONGO_URL %}}/tools")

--服务器列表API
set_env("QUANTA_SRVLIST_API", "http://10.98.8.100:18080/server_mgr/query")
set_env("QUANTA_SRVLIST_API", "{{%= QUANTA_SRVLIST_API or 'http://10.96.8.40:18080/server_mgr/query' %}}")
24 changes: 24 additions & 0 deletions bin/template/base.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--[[
quanta启动环境配置
启动:
启动第一个参数是本配置文件的路径,后续跟环境变量
备注:
环境变量可在此文件配置, 也可以配置在启动参数, 从启动参数配置时, 系统会自动补全QUANTA_前缀
案例:
./quanta.exe quanta.conf --index=3 --service=test
]]

--基础配置
dofile("share.conf")

--服务大区
set_env("QUANTA_CLUSTER", "{{%= QUANTA_CLUSTER %}}")

--本机ip
set_env("QUANTA_HOST_IP", "{{%= QUANTA_HOST_IP %}}")

--需要定义的环境变量
{{% for ENV_KEY, ENV_VALUE in pairs(ENVIRON_VARIABLES or {}) do %}}
set_env("{{%= ENV_KEY %}}", "{{%= ENV_VALUE %}}")

{{% end %}}
27 changes: 27 additions & 0 deletions bin/template/cache.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--[[
quanta启动环境配置
启动:
启动第一个参数是本配置文件的路径,后续跟环境变量
备注:
环境变量可在此文件配置,也可以配置在启动参数,从启动参数配置时,系统会自动补全QUANTA_前缀
案例:
./quanta.exe quanta.conf --index=3 --service=test
]]

--包含通用环境变量配置
dofile("quanta/base.conf")
dofile("quanta/database.conf")

--启动参数
---------------------------------------------------------
--定义启动文件路径
set_env("QUANTA_ENTRY", "cachesvr")
--定义服务名称
set_env("QUANTA_SERVICE", "cache")
--服务INCLUDE
set_env("QUANTA_INCLUDE", "cache.init")

--缓存组条目数量
set_env("QUANTA_DB_CACHE_MAX", "{{%= QUANTA_DB_CACHE_MAX or 4096 %}}")
--每帧落地最大数量
set_env("QUANTA_DB_CACHE_FLUSH", "{{%= QUANTA_DB_CACHE_FLUSH or 10 %}}")
8 changes: 5 additions & 3 deletions bin/center.conf → bin/template/center.conf
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
--[[
quanta启动环境配置
启动:
启动第一个参数是本配置文件的路径, 后续跟环境变量
启动第一个参数是本配置文件的路径后续跟环境变量
备注:
环境变量可在此文件配置, 也可以配置在启动参数, 从启动参数配置时, 系统会自动补全QUANTA_前缀
环境变量可在此文件配置也可以配置在启动参数从启动参数配置时系统会自动补全QUANTA_前缀
案例:
./quanta.exe quanta.conf --index=3 --service=test
]]

--包含通用环境变量配置
dofile("share.conf")
dofile("quanta/base.conf")

--启动参数
---------------------------------------------------------
--定义启动文件路径
set_env("QUANTA_ENTRY", "center")
--定义服务名称
set_env("QUANTA_SERVICE", "center")
--服务INCLUDE
set_env("QUANTA_INCLUDE", "center.init")

--IP地址相关
---------------------------------------------------------
Expand Down
23 changes: 14 additions & 9 deletions bin/database.conf → bin/template/database.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,28 @@ quanta启动环境配置

--数据库配置
---------------------------------------------------------
--数据库连接字符串列表, 分割符为";"
--单个连接串格式: driver://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
--options格式: key1=value1&key2=value2

{{% if QUANTA_MONGO_URL then %}}
--mongo
set_env("QUANTA_MONGO_URL", "mongodb://root:MTAE379673#@127.0.0.1:27017/quanta")
--redis
set_env("QUANTA_REDIS_URL", "redis://root:[email protected]:6379")
set_env("QUANTA_MONGO_URL", "{{%= QUANTA_MONGO_URL %}}/quanta_{{%= QUANTA_CLUSTER %}}")
{{% end %}}

{{% if QUANTA_MYSQL_URL then %}}
--mysql
set_env("QUANTA_MYSQL_URL", "mysql://root:[email protected]:3306/quanta")
set_env("QUANTA_MYSQL_URL", "{{%= QUANTA_MYSQL_URL %}}/quanta_{{%= QUANTA_CLUSTER %}}")
{{% end %}}

{{% if QUANTA_REDIS_URL then %}}
--redis
set_env("QUANTA_REDIS_URL", "{{%= QUANTA_REDIS_URL %}}")
{{% end %}}

--AUTOINCKEY
set_env("QUANTA_DB_AUTOINCTB", "counters")
set_env("QUANTA_DB_BENCHMARK", "1001014135")
set_env("QUANTA_DB_AUTOINCKEY", "COUNTER:QUANTA:ROLE")

--DB连接池大小
set_env("QUANTA_DB_POOL_COUNT", "3")

--消息队列驱动器 [redis, mongo]
set_env("QUANTA_MQ_DRIVER", "redis")
set_env("QUANTA_DB_POOL_COUNT", "{{%= QUANTA_DB_POOL_COUNT or 11 %}}")
12 changes: 8 additions & 4 deletions bin/gateway.conf → bin/template/gateway.conf
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
--[[
quanta启动环境配置
启动:
启动第一个参数是本配置文件的路径, 后续跟环境变量
启动第一个参数是本配置文件的路径后续跟环境变量
备注:
环境变量可在此文件配置, 也可以配置在启动参数, 从启动参数配置时, 系统会自动补全QUANTA_前缀
环境变量可在此文件配置也可以配置在启动参数从启动参数配置时系统会自动补全QUANTA_前缀
案例:
./quanta.exe quanta.conf --index=3 --service=test
]]

--包含通用环境变量配置
dofile("share.conf")
dofile("quanta/base.conf")

--启动参数
---------------------------------------------------------
Expand All @@ -22,5 +22,9 @@ set_env("QUANTA_SERVICE", "gateway")
---------------------------------------------------------
--GATE监听地址(客户端直连访问,或者nginx等lbs转发)
set_env("QUANTA_GATEWAY_ADDR", "0.0.0.0:30013")

{{% if QUANTA_DOMAIN_ADDR then %}}
--网关域名, 网关需要域名配置
--set_env("QUANTA_DOMAIN_ADDR", "xxx.com")
set_env("QUANTA_DOMAIN_ADDR", "{{%= QUANTA_DOMAIN_ADDR %}}")
{{% end %}}

11 changes: 8 additions & 3 deletions bin/login.conf → bin/template/login.conf
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
--[[
quanta启动环境配置
启动:
启动第一个参数是本配置文件的路径, 后续跟环境变量
启动第一个参数是本配置文件的路径后续跟环境变量
备注:
环境变量可在此文件配置, 也可以配置在启动参数, 从启动参数配置时, 系统会自动补全QUANTA_前缀
环境变量可在此文件配置也可以配置在启动参数从启动参数配置时系统会自动补全QUANTA_前缀
案例:
./quanta.exe quanta.conf --index=3 --service=test
]]

--包含通用环境变量配置
dofile("share.conf")
dofile("quanta/base.conf")

--启动参数
---------------------------------------------------------
--定义启动文件路径
set_env("QUANTA_ENTRY", "login")
--定义服务名称
set_env("QUANTA_SERVICE", "login")
--服务INCLUDE
set_env("QUANTA_INCLUDE", "login.init")

--IP地址相关
---------------------------------------------------------
--Login监听地址(客户端直连访问,或者nginx等lbs转发)
set_env("QUANTA_LOGIN_ADDR", "0.0.0.0:20013")

--登陆验证线程数量
set_env("QUANTA_LOGIN_WORKER", "{{%= QUANTA_LOGIN_WORKER or 2 %}}")
Loading

0 comments on commit cb81258

Please sign in to comment.