dotnetcore / agileconfig Goto Github PK
View Code? Open in Web Editor NEW基于.NET Core开发的轻量级分布式配置中心 / .NET Core lightweight configuration server
License: MIT License
基于.NET Core开发的轻量级分布式配置中心 / .NET Core lightweight configuration server
License: MIT License
能否支持Oracle,发布单exe文件。
虽然找了历史记录你说可以 自己加密 , 但这个需求还是一个比较通用的, 建议 增加这么一个配置, 起码不能明文被抓包到吧。。
报错提示只允许字母数字和一些字符串 作者能不能改一下最新版本镜像的环境变量名
报错信息
Deployment.apps "agile-v1" is invalid: [spec.template.spec.containers[0].env[1].name: Invalid value: "db:provide": a valid environment variable name must consist of alphabetic characters, digits, '_', '-', or '.', and must not start with a digit (e.g. 'my.env-name', or 'MY_ENV.NAME', or 'MyEnvName1', regex used for validation is '[-._a-zA-Z][-._a-zA-Z0-9]*'), spec.template.spec.containers[0].env[2].name: Invalid value: "db:conn": a valid environment variable name must consist of alphabetic characters, digits, '_', '-', or '.', and must not start with a digit (e.g. 'my.env-name', or 'MY_ENV.NAME', or 'MyEnvName1', regex used for validation is '[-._a-zA-Z][-._a-zA-Z0-9]*')]
hello ,Thank you for developing this framework,I want to deploy this software on Windows server 2008 r2, but 08R2 only supports net core 2.2. A lot of net core 3.1 is referenced in the software. Can you provide a version that supports net core 2.2 ?
1、从关联应用继承的配置项显示出来
2、配置项按分组显示
对于配置项比较多的项目还是很有用的,方便管理配置项
尝试将AgileConfig部署在docker desktop中连接宿主机上的PostgreSql数据库,在进行一些编辑操作时,会产生异常,容器停止工作。
部署命令:
docker run --restart=always -e adminConsole=true -e db:provider=npgsql -e db:conn="Host=gateway.docker.internal;Port=5432;Username=user;Password=123456;Database=config" -p 5009:5000 -v /etc/localtime:/etc/localtime --name agile_config kklldog/agile_config:latest
大概有两种类型的报错:
以下是其中一种的log输出:
warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key {d63c1e47-8e71-4f4e-8faa-b99b82db5293} may be persisted to storage in unencrypted form.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Overriding address(es) 'http://+:80'. Binding to endpoints defined in UseKestrel() instead.
Hosting environment: Production
Content root path: /app
Now listening on: http://[::]:5000
Application started. Press Ctrl+C to shut down.
info: AgileConfig.Server.Apisite.Websocket.WebsocketHandlerMiddleware[0]
Websocket client 7b7faabb-a438-40d2-be50-991561870bac Added
info: AgileConfig.Server.Apisite.Controllers.RemoteServerProxyController[0]
Request remote node http://gateway.docker.internal:5009 's action OneClientDoAction success .
info: AgileConfig.Server.Apisite.Controllers.RemoteServerProxyController[0]
Request remote node http://gateway.docker.internal:5009 's action AllClientsDoAction success .
info: AgileConfig.Server.Apisite.Controllers.RemoteServerProxyController[0]
Request remote node http://gateway.docker.internal:5009 's action OneClientDoAction success .
fail: AgileConfig.Server.Common.TinyEventBus[0]
fire event OFFLINE_CONFIG_SUCCESS error
Npgsql.NpgsqlOperationInProgressException: The connection is already in state 'Executing'
at FreeSql.UnitOfWork.Rollback()
at FreeSql.UnitOfWork.Dispose()
at FreeSql.DbContext.Dispose()
at AgileConfig.Server.Service.SysLogService.Dispose() in /src/AgileConfig.Server.Service/SysLogService.cs:line 64
at AgileConfig.Server.Service.EventRegister.b__9_11(Object param) in /src/AgileConfig.Server.Service/EventRegister.cs:line 470
at AgileConfig.Server.Common.TinyEventBus.<>c__DisplayClass6_1.b__0() in /src/AgileConfig.Server.Common/TinyEventBus.cs:line 101
fail: AgileConfig.Server.Common.TinyEventBus[0]
fire event PUBLISH_CONFIG_SUCCESS error
Npgsql.NpgsqlOperationInProgressException: A command is already in progress: INSERT INTO "agc_sys_log"("app_id", "log_type", "log_time", "log_text") VALUES(@AppId_0, @LogType_0, @LogTime_0, @LogText_0) RETURNING "id"
at FreeSql.UnitOfWork.Rollback()
at FreeSql.UnitOfWork.Dispose()
at FreeSql.DbContext.Dispose()
at AgileConfig.Server.Service.SysLogService.Dispose() in /src/AgileConfig.Server.Service/SysLogService.cs:line 64
at AgileConfig.Server.Service.EventRegister.b__9_12(Object param) in /src/AgileConfig.Server.Service/EventRegister.cs:line 494
at AgileConfig.Server.Common.TinyEventBus.<>c__DisplayClass6_1.b__0() in /src/AgileConfig.Server.Common/TinyEventBus.cs:line 101
Unhandled exception. System.InvalidOperationException: A transaction is already in progress; nested/concurrent transactions aren't supported.
at FreeSql.UnitOfWork.GetOrBeginTransaction(Boolean isCreate)
at FreeSql.DbSet1.OrmInsert() at FreeSql.DbSet
1.OrmInsert(TEntity data)
at FreeSql.DbSet1.AddPrivAsync(TEntity data, Boolean isCheck) at AgileConfig.Server.Service.SysLogService.AddSysLogAsync(SysLog log) in /src/AgileConfig.Server.Service/SysLogService.cs:line 32 at AgileConfig.Server.Service.RemoteServerNodeProxy.AppClientsDoActionAsync(String address, String appId, WebsocketAction action) in /src/AgileConfig.Server.Service/RemoteServerNodeProxy.cs:line 113 at AgileConfig.Server.Service.EventRegister.<RegisterWebsocketAction>b__8_3(Object param) in /src/AgileConfig.Server.Service/EventRegister.cs:line 176 at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_1(Object state) at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi) at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action
1 callback, TState& state)
at System.Threading.QueueUserWorkItemCallback.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
不能保证配置的一致性,我想大多数人还是考虑使用Docker的Apollo配置中心.
修改方式:
在一些K8S管理工具下,特殊字符不被支持
Validation failed in API: Deployment.apps "agile-config" is invalid: [spec.template.spec.containers[0].env[2].name: Invalid value: "db:conn": a valid environment variable name must consist of alphabetic characters, digits, '_', '-', or '.', and must not start with a digit (e.g. 'my.env-name', or 'MY_ENV.NAME', or 'MyEnvName1', regex used for validation is '[-._a-zA-Z][-.a-zA-Z0-9]*'), spec.template.spec.containers[0].env[3].name: Invalid value: "db:provider": a valid environment variable name must consist of alphabetic characters, digits, '', '-', or '.', and must not start with a digit (e.g. 'my.env-name', or 'MY_ENV.NAME', or 'MyEnvName1', regex used for validation is '[-._a-zA-Z][-._a-zA-Z0-9]*')]
客户端可以正常读取服务端配置数据,但是UI界面一直显示0,没有客户端数据,是哪里需要配置吗?
另外一个问题是:查看了本地缓存,只有其中一个应用的缓存,其他应用未发现缓存文件,不知道这个是否正常?
您好:
版本:1.4.2
IIS部署主程序后,AgileConfig.Server.UI 下 npm run build 后部署到 wwwroot 目录下,重启站点
输入 http://localhost:5000/ 出现404 提示“No webpage was found for the web address: http://localhost:5000/ui”
输入 http://localhost:5000/index.html 出现等待界面,仔细查看后,发现有部分资源无法加载
输入 http://localhost:5000/ 出现404 提示“No webpage was found for the web address: http://localhost:5000/ui”
输入 http://localhost:5000/index.html 正常使用
请问这个是怎么回事呢 ?
把appsettings.json中的配置导入到AgileConfig中,里面的Urls配置项不起作用,相同的配置在Apollo中是ok的,麻烦作者给看看到底是啥原因?
System
Centos7
Docker Cmd
docker run -d \
-e adminConsole=true \
-e db:provider=sqlserver \
-e db:conn="Data Source=****;Initial Catalog=****;User ID=****;Password=!@#$%^789" \
-p 8235:5000 \
-v /etc/localtime:/etc/localtime \
kklldog/agile_config:latest
Error
【主库】恢复检查时间:08/11/2021 10:51:47
Unhandled exception. System.TypeInitializationException: The type initializer for 'AgileConfig.Server.Data.Freesql.FreeSQL' threw an exception.
---> System.Exception: 【主库】状态不可用,等待后台检查程序恢复方可使用。A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)
---> System.Exception: 【主库】状态不可用,等待后台检查程序恢复方可使用。A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)
at FreeSql.Internal.ObjectPool.ObjectPool`1.getFree(Boolean checkAvailable)
at FreeSql.Internal.ObjectPool.ObjectPool`1.Get(Nullable`1 timeout)
at FreeSql.Internal.CommonProvider.AdoProvider.ExecuteScalar(DbConnection connection, DbTransaction transaction, CommandType cmdType, String cmdText, DbParameter[] cmdParms)
--- End of inner exception stack trace ---
at FreeSql.Internal.CommonProvider.AdoProvider.LoggerException(IObjectPool`1 pool, PrepareCommandResult pc, Exception ex, DateTime dt, StringBuilder logtxt, Boolean isThrowException)
at FreeSql.Internal.CommonProvider.AdoProvider.ExecuteScalar(DbConnection connection, DbTransaction transaction, CommandType cmdType, String cmdText, DbParameter[] cmdParms)
at FreeSql.Internal.CommonProvider.AdoProvider.ExecuteScalar(String cmdText, Object parms)
at AgileConfig.Server.Data.Freesql.EnsureTables.ExistTable(IFreeSql instance) in /src/AgileConfig.Server.Data.Freesql/EnsureTables.cs:line 44
at AgileConfig.Server.Data.Freesql.EnsureTables.Ensure(IFreeSql instance) in /src/AgileConfig.Server.Data.Freesql/EnsureTables.cs:line 55
at AgileConfig.Server.Data.Freesql.FreeSQL..cctor() in /src/AgileConfig.Server.Data.Freesql/FreeSQL.cs:line 18
--- End of inner exception stack trace ---
at AgileConfig.Server.Data.Freesql.FreeSQL.get_Instance() in /src/AgileConfig.Server.Data.Freesql/FreeSQL.cs:line 20
at AgileConfig.Server.Service.RemoteServerNodeProxy.GetGerverNodeService() in /src/AgileConfig.Server.Service/RemoteServerNodeProxy.cs:line 38
at AgileConfig.Server.Service.RemoteServerNodeProxy.TestEchoAsync() in /src/AgileConfig.Server.Service/RemoteServerNodeProxy.cs:line 242
at AgileConfig.Server.Apisite.Program.Main(String[] args) in /src/AgileConfig.Server.Apisite/Program.cs:line 36
Even I use double or single quotes to handle password , it also doesn't work.
Please have a check.
LiteDB--原生C# nosql数据库
LiteDB 就在 github
配置项发布以后如果站点不重启 配置项无法生效?
当前没有环境的概念,支持环境的配置后可以很方便地在不同的部署环境下切换配置;
可分开发环境、测试环境和生产环境,类似于 appsettings.json,appsettings.Development.json的关系。
当前只有两个层级,支持多重继承可以提高配置的复用。
子配置可以继承父配置,孙子配置可以继承子配置等,没有继承层级的限制,或者最多能支持到3~5层配置。
1
叶老板开发的ORM FreeSql支持数据库非常多,如果需要支持多数据库可能用这个来实现比较方便。不知道该项目更换ORM的难度,只是提个建议。感谢作者开发这么好用的工具~
版本: 1.4.2
数据库: sqlite
现象: 用新建的账号发布配置变更,提示发布失败,并跳转至登陆界面
复现步骤:
点击【用户】菜单,【添加】用户按钮,输入用户名称与密码,选择角色为“管理员”
点击【应用】菜单,选择【配置】按钮,赋予新建用户为管理员
点击【应用】菜单,选择【授权】按钮,赋予新建用户,修改权,发布权
再次选择【授权】按钮,确认已授权
退出,使用新用户登录
修改配置功能正常
发布配置功能异常,提示发布失败,并跳转至登陆界面
我自己下载了源代码后,修改完appsetting的数据库配置后,使用AgileConfig.Server.Apisite能启动项目,但是想发布到本地使用发现发布的程序无法启动。请问这个项目想本地发布该怎么操作
错误信息:
When ::ffff:221.237.187.12 request /admin/InitPassword error , but not handled .
The type initializer for 'AgileConfig.Server.Data.Freesql.FreeSQL' threw an exception.
at AgileConfig.Server.Data.Freesql.FreeSQL.get_Instance() in /src/AgileConfig.Server.Data.Freesql/FreeSQL.cs:line 20
at AgileConfig.Server.Data.Freesql.ServiceCollectionExt.<>c.<AddFreeSqlDbContext>b__0_0(DbContextOptionsBuilder options) in /src/AgileConfig.Server.Data.Freesql/ServiceCollectionExt.cs:line 12
at Microsoft.Extensions.DependencyInjection.FreeSqlDbContextDependencyInjection.<>c__DisplayClass0_0.<AddFreeDbContext>b__0(IServiceProvider sp)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.GetService(IServiceProvider sp, Type type, Type middleware)
at lambda_method(Closure , Object , HttpContext , IServiceProvider )
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass4_1.<UseMiddleware>b__2(HttpContext context)
at Microsoft.AspNetCore.WebSockets.WebSocketMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.EvaluateAndApplyPolicy(HttpContext context, CorsPolicy corsPolicy)
at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context, ICorsPolicyProvider corsPolicyProvider)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass4_1.<UseMiddleware>b__2(HttpContext context)
at AgileConfig.Server.Apisite.UIExtension.ReactUIMiddleware.Invoke(HttpContext context) in /src/AgileConfig.Server.Apisite/UIExtension/ReactUIMiddleware.cs:line 127
at AgileConfig.Server.Common.ExceptionHandlerMiddleware.Invoke(HttpContext context) in /src/AgileConfig.Server.Common/ExceptionHandlerMiddleware.cs:line 27
url: http://*/admin/InitPassword action:
The type initializer for 'AgileConfig.Server.Data.Freesql.FreeSQL' threw an exception.
这是什么错误,连不上数据库?使用sqlite也不行
我在基于amis写低代码平台,想用这个配置中心,希望能实现在我的平台中能直接操作配置中心
一直提示
【主库】状态不可用,等待后台检查程序恢复方可使用。连接字符串错误
貌似 Data Source=10.2.27.212;Port=5432;User ID=postgre;Password=postgre;Database=AgileConfig;
这种写法不行...
将agileconfig配置到appsettings.Development.json中,提示找不到AgileConfig配置节点
在开发环境中不使用配置中心,在生产环境中才使用
所有节点都挂了,是不是从appconfig里面读取配置,还是有专门的缓存文件,
直接修改appconfig这样不是更加好吗
现有的是导入json文件的方式批量导入配置,建议弹出一个文本框,粘贴想生成配置的json批量生成,这样方便很多
另外建议提供复制项目配置的功能
程序运行后,会在根目录生成“xxx.agileconfig.client.configs.cache”这样的缓存文件,这个文件的路径有办法配置吗?因为一方面生成在根目录,如果缓存文件多的话,看起来就很乱了,这个存储在特定的文件夹,比如根目录的cache文件夹,方便统一管理;还有就是如果是docker部署的,重新启动容器后,.cache文件就全都丢失了。
appsettings.Development.json
"adminConsole": true,
"preview_mode": false,
"db": {
"provider": "sqlite", //sqlite,mysql,sqlserver,npgsql,oracle
"conn": "Data Source=agile_config.db"
数据库表:
user表
1 admin 123456 2021-02-01 2021-02-01 0
super_admin super_admin 123456 2021-02-01 2021-05-01 0
1.关于项目结构希望还是能够描述清楚
2.关于前后端分离,建议两个项目,一个前端一个后端.
3.关于发行版本,可以直接编译出来
4.前后端具体的编译也可以稍微介绍下.
我希望存一段SQL代码进去,目前这样很不方便
下载源码。还原nuget,配置数据库正常,设置AgileConfig.Server.Apisite 为启动项,调试发现跳转
http://localhost:5000/ui#/user/initpassword
页面出不来。
配置如下:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"System": "Warning",
"Microsoft": "Warning"
}
},
"adminConsole": true,
"preview_mode": false,
"db": {
"provider": "sqlserver", //sqlite,mysql,sqlserver,npgsql,oracle
//"conn": ""
"conn": "Data Source=xxxxx;User ID=sa;Password=11223Initial Catalog=ApolloConfig;Pooling=true;Min Pool Size=1"
//"conn": "Persist Security Info = False; User ID =dev; Password =dev@123; Initial Catalog =agile_config; Server =."
},
"JwtSetting": {
"SecurityKey": "dfasf343453fsdfa,./,./sdfasf34r3hfhfdb", // 密钥
"Issuer": "agileconfig.admin", // 颁发者
"Audience": "agileconfig.admin", // 接收者
"ExpireSeconds": 86400 // 过期时间
}
}
现在现状是还没使用 docker,可以下载安装在主机启动吗,文档里面没有看到
引入AgileConfig代码是这样的
host.ConfigureAppConfiguration((context, config) =>
{
//new一个client实例,无参构造会从本地appsettings.json文件读取配置
var configClient = new ConfigClient($"appsettings.{context.HostingEnvironment.EnvironmentName}.json");
//使用AddAgileConfig配置一个新的IConfigurationSource
config.AddAgileConfig(configClient);
//注册配置项修改事件
configClient.ConfigChanged += ConfigClient_ConfigChanged;
});
private static void ConfigClient_ConfigChanged(ConfigChangedArg obj)
{
Console.WriteLine($"配置项更改!更改信息={obj.Serialize2Json()}");
}
经观察修改正在运行的配置项后,ConfigClient_ConfigChanged没有被触发
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.