diff --git a/build/linux/usr/local/etc/omc/default/omc.yaml b/build/linux/usr/local/etc/omc/default/omc.yaml index c7c70ad6..f282da78 100644 --- a/build/linux/usr/local/etc/omc/default/omc.yaml +++ b/build/linux/usr/local/etc/omc/default/omc.yaml @@ -1,4 +1,5 @@ -mode: standard +# server version: standard/lite/tenant +serverVersion: "standard" # file: log file name # level: /trace/debug/info/warn/error/fatal, default: debug @@ -35,32 +36,6 @@ webServer: certFile: /usr/local/etc/omc/certs/omc-web.crt keyFile: /usr/local/etc/omc/certs/omc-web.key -# data sources -database: - dataSource: - # Default datab887854ase instance - default: - type: "mysql" - host: "127.0.0.1" - port: 33066 - username: "root" - password: "1000omc@kp!" - database: "omc_db" - # used to specify the default data source for multiple data resourece - defaultDataSourceName: "default" - -# Redis data cache -redis: - dataSource: - # OMC system db - default: - port: 6379 # Redis port - host: "127.0.0.1" # Redis host - password: "helloearth" - db: 10 # Redis db_num - # used to specify the default data source for multiple data resourece - defaultDataSourceName: "default" - # sleep: time delay for after write buffer (millisecond) # deadLine: timeout for io read and write (second) mml: diff --git a/build/linux/usr/local/etc/omc/database/omc_db.sqlite b/build/linux/usr/local/etc/omc/default/omc_db.sqlite similarity index 100% rename from build/linux/usr/local/etc/omc/database/omc_db.sqlite rename to build/linux/usr/local/etc/omc/default/omc_db.sqlite diff --git a/build/linux/usr/local/etc/omc/script/setup.sh b/build/linux/usr/local/etc/omc/script/setup.sh index e361da41..36933e57 100644 --- a/build/linux/usr/local/etc/omc/script/setup.sh +++ b/build/linux/usr/local/etc/omc/script/setup.sh @@ -26,16 +26,6 @@ usage() { exit 1 } -# standard env -standardEnv() { - if command -v mysql &> /dev/null || command -v mariadb &> /dev/null; then - echo "MySQL or MariaDB installed" - else - echo "MySQL or MariaDB not installed" - exit 1 - fi -} - # Different processing depending on the value of customize customize() { cp -rf $OMCEtcDir/vendor/$VENDORS/web/* $OMCEtcDir/web/background @@ -45,7 +35,6 @@ customize() { # ========================= -# 参数解析 while [[ $# -gt 0 ]]; do case "$1" in -i|--install) @@ -113,13 +102,26 @@ fi #echo "Customize parameter: $VENDORS" # ========================= - -if [ "$MODE" = "standard" ]; then - standardEnv +if [[ "$T_PARAM" == "install" && "$MODE" == "standard" ]]; then + if command -v mysql &> /dev/null || command -v mariadb &> /dev/null; then + echo "MySQL or MariaDB installed" + else + echo "MySQL or MariaDB not installed" + exit 1 + fi + rm -rf $OMCEtcDir/default/omc_db.sqlite +fi +if [[ "$T_PARAM" == "install" && "$MODE" == "lite" ]]; then + cp -rf $OMCEtcDir/default/omc_db.sqlite $OMCEtcDir/database/omc_db.sqlite fi +# ========================= $OMCBinFile -c $confFile --sqlPath $OMCEtcDir/database/$MODE/$T_PARAM --sqlSource $MODE -customize + +# ========================= Customize +cp -rf $OMCEtcDir/vendor/$VENDORS/web/* $OMCEtcDir/web/background +cp -rf $OMCEtcDir/vendor/$VENDORS/static/* /usr/local/$VENDORS/static +$OMCBinFile -c $confFile --sqlPath $OMCEtcDir/vendor/$VENDORS/database/$MODE/customized.sql --sqlSource $MODE # bash setup.sh -i -m standard -c omc diff --git a/local/omc.yaml b/local/omc.yaml index 616cef8e..d295bf7f 100644 --- a/local/omc.yaml +++ b/local/omc.yaml @@ -38,11 +38,22 @@ webServer: certFile: ./build/linux/usr/local/etc/omc/certs/omc-web.crt keyFile: ./build/linux/usr/local/etc/omc/certs/omc-web.key +# 静态文件配置, 相对项目根路径或填绝对路径 +staticFile: + # 默认资源,dir目录需要预先创建 + default: + prefix: "/static" + dir: "C:/usr/local/omc/static" + # 文件上传资源目录映射,与项目目录同级 + upload: + prefix: "/upload" + dir: "C:/usr/local/omc/upload" + # data sources database: dataSource: # Default database instance - default: + standard: type: "mysql" host: "192.168.9.58" port: 13306 @@ -56,7 +67,7 @@ database: database: "./local/omc_db.sqlite" logging: true # used to specify the default data source for multiple data resourece - defaultDataSourceName: "default" + defaultDataSourceName: "standard" # Redis data cache redis: diff --git a/src/config/config.local.yaml b/src/config/config.local.yaml index efe837a8..e176b6ec 100644 --- a/src/config/config.local.yaml +++ b/src/config/config.local.yaml @@ -1,6 +1,6 @@ # 日志 logger: - fileDir: "C:/var/log" + fileDir: "/var/log" fileName: "omc.log" level: 0 # 日志记录的等级 0:silent<1:info<2:warn<3:error maxDay: 7 # 日志会保留 180 天 @@ -11,31 +11,31 @@ staticFile: # 默认资源,dir目录需要预先创建 default: prefix: "/static" - dir: "C:/usr/local/omc/static" + dir: "/usr/local/omc/static" # 文件上传资源目录映射,与项目目录同级 upload: prefix: "/upload" - dir: "C:/usr/local/omc/upload" + dir: "/usr/local/omc/upload" # DB 数据源 database: dataSource: # 默认数据库实例 - default: + standard: type: "mysql" host: "127.0.0.1" port: 3306 - username: "" - password: "" - database: "" - logging: false + username: "root" + password: "1000omc@kp!" + database: "omc_db" + logging: true # 内置轻量级数据库 lite: type: "sqlite" - database: "" - logging: false + database: "/usr/local/etc/omc/database/omc_db.sqlite" + logging: true # 多个数据源时可以用这个指定默认的数据源 - defaultDataSourceName: "default" + defaultDataSourceName: "standard" # Redis 缓存数据 redis: @@ -43,7 +43,7 @@ redis: default: port: 6379 # Redis port host: "127.0.0.1" # Redis host - password: "" + password: "helloearth" db: 0 # Redis db_num # 多个数据源时可以用这个指定默认的数据源 defaultDataSourceName: "default" diff --git a/src/config/config.prod.yaml b/src/config/config.prod.yaml index de321a4a..40fd08b4 100644 --- a/src/config/config.prod.yaml +++ b/src/config/config.prod.yaml @@ -2,21 +2,21 @@ database: dataSource: # 默认数据库实例 - default: + standard: type: "mysql" host: "127.0.0.1" - port: 3306 - username: "" - password: "" - database: "" + port: 33066 + username: "root" + password: "1000omc@kp!" + database: "omc_db" logging: false # 内置轻量级数据库 lite: type: "sqlite" - database: "" + database: "/usr/local/etc/omc/database/omc_db.sqlite" logging: false # 多个数据源时可以用这个指定默认的数据源 - defaultDataSourceName: "default" + defaultDataSourceName: "standard" # Redis 缓存数据 redis: @@ -24,7 +24,7 @@ redis: default: port: 6379 # Redis port host: "127.0.0.1" # Redis host - password: "" + password: "helloearth" db: 0 # Redis db_num # 多个数据源时可以用这个指定默认的数据源 defaultDataSourceName: "default"