# DuiC **Repository Path**: tomdev/DuiC ## Basic Information - **Project Name**: DuiC - **Description**: DuiC 是采用 kotlin + spring-boot-2.0 + spring-webflux-5.0 开发的分布式统一配置管理系统, 它的目标是管理所有应用的配置(Any - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 9 - **Created**: 2018-01-08 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README :email: kevinz@weghst.com ``` ______ _ ______ |_ _ `. (_) .' ___ | | | `. \ __ _ __ / .' \_| | | | |[ | | | [ || | _| |_.' / | \_/ |, | |\ `.___.'\ |______.' '.__.'_/[___]`.____ .' ``` DuiC 统一配置管理, 可用于管理服务端(server), 终端(web/app)配置, 并且内置用户权限和 `web` 控制台 https://duic.zhudy.io/index.html[在线演示平台] + __登录信息__ + E-Mail: **{email}** + Password: **123456** IMPORTANT: samples 项目用于演示请不要随意修改其中的配置, 若想体验请增加 `app` 配置 + 同时也请大家不要修改**默认帐户**的**密码** === 设计目标 . 统一配置管理 . 标准配置管理规范 . 管理更多的配置 . 更灵活的配置管理 . 为非技术人员使用 === 功能 . 灵活的配置获取方式 . 采用 `yaml` 文件格式管理配置 . 支持数据结构及数据类型 . 支持配置编辑语法高亮及格式校验 . 配置权限管理 . 兼容 `spring-cloud-config-client` 并提供 https://github.com/zhudyos/duic-spring-cloud-config-client[duic-spring-cloud-config-client] . 支持热更新 . 分布式配置管理 === 配置示例 **name:** `samples` + **profile:** `first` [source,yaml,linenums] ---- k1: string: samples first k1 string int: 11 array: - 1 - 2 - 3 multiple_lines: |- sample first multiple lines k2: string: samples first k2 string ---- **name:** `samples` + **profile:** `second` [source,yaml,linenums] ---- k1: string: samples second k1 string int: 22 array: - 3 - 2 - 1 multiple_lines: |- sample second multiple lines k2: string: samples second k2 string ---- TIP: `name` 表示应用的名称 + `profile` 表示应用的环境 + `name` 与 `profile` 组成一个配置坐标, 在配置系统中是**唯一**的, 相同 `name` 的配置可以**合并** === RESTful API https://app.swaggerhub.com/apis/kevinz70/duic/1.0.0[Open API 文档] . `/apps/states/{name}/{profile}` 获取指定配置状态 + ==== 当配置修改后服务器会更新配置状态, 该接口可用于检查配置的状态, 如果状态变化可重新向服务器拉取配置信息 ==== + 请求:: + $ curl https://duic.zhudy.io/api/v1/apps/states/samples/first 响应:: + ```json { "state":"16" } ``` . `/apps/{name}/{profile}` 获取指定应用所有配置 + ==== 返回所有配置, 如果 `profile` 有多个会合并返回结果 ==== .. 一个 profile + 请求:: + $ curl https://duic.zhudy.io/api/v1/apps/samples/first 响应:: + ```json { "k1":{ "string":"samples first k1 string", "int":11, "array":[ 1, 2, 3 ], "multiple_lines":"sample\nfirst\nmultiple\nlines" }, "k2":{ "string":"samples first k2 string" } } ``` .. 多个 profile + 请求:: + $ curl https://duic.zhudy.io/api/v1/apps/samples/first,second 响应:: + ```json { "k1":{ "string":"samples second k1 string", "int":22, "array":[ 3, 2, 1 ], "multiple_lines":"sample\nsecond\nmultiple\nlines" }, "k2":{ "string":"samples second k2 string" } } ``` + IMPORTANT: 多个 `profile` 采用 `,` 分隔, `DuiC` 会按照顺序加载相应的配置, 如果配置键 `key` 相同, 后面的 `profile` 将会覆盖前面 `profile` 的值 . `/apps/{name}/{profile}/{key}` 获取指定应用中某个 `key` 的配置 + ==== 这里的 `profile` 也可以传入多个并按 `,` 分隔 ==== + 请求:: + $ curl https://duic.zhudy.io/api/v1/apps/samples/first,second/k1 响应:: + ```json { "string":"samples second k1 string", "int":22, "array":[ 3, 2, 1 ], "multiple_lines":"sample\nsecond\nmultiple\nlines" } ``` === 部署 .服务配置 application.yml **** ---- server: port: 7777 # <1> spring: jackson: default_property_inclusion: non_default date_format: yyyy-MM-dd'T'HH:mm:ss joda_date_time_format: yyyy-MM-dd'T'HH:mm:ss property_naming_strategy: CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES data: mongodb: uri: mongodb://127.0.0.1:27017/duic # <2> duic: root_email: kevinz@weghst.com # <3> root_password: 123456 # <4> jwt: secret: U2FsdGVkX1/jO0KlWumac4yDM8rOgWPkaV0KrSHDynWOP6n8FMJB9uSc8EW/qM+VagrMBAXGpyw= # <5> expires_in: 180 # <6> ---- <1> 应用服务端口 <2> MongoDB 连接地址 <3> 默认用户登录邮箱 <4> 默认用户登录密码 <5> JWT HMAC256 签名字符串 <6> JWT 过期时间(单位:分钟) **** --- . https://github.com/zhudyos/duic-docker-compose[docker-compose 部署] . docker 部署 .. 安装 MongoDB + https://www.mongodb.com/[https://www.mongodb.com/] + .. 服务配置 + ... 创建 `config` 文件夹 ... 在 `config` 文件夹中创建配置文件 `application.yml` ... `application.yml` 配置文件将 `spring.data.mongodb.uri` 连接地址修改为安装服务的 MongoDB 连接地址 .. 启用容器 + ```shell $ docker run -d -p 7777:7777 -v $(pwd)/config:/app/config zhudyos/duic ``` + TIP: 将 `application.yml` 配置文件放置在 `config` 目录中并挂载到容器的 `/app/config` 目录中, DuiC 则会使用指定的配置 === 相关项目 . https://projects.spring.io/spring-boot/[Spring Boot] . https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html[Spring WebFlux] . https://github.com/iview/iview-admin[iView Admin] === 联系/讨论 QQ 群:: **540315111** (DuiC 统一配置管理)