提交 1705fbcc 编写于 作者: 麦壳饼's avatar 麦壳饼

调整taods版本等。

上级 2900c677
......@@ -343,3 +343,4 @@ ASALocalRun/
/data
/rabbitmq
/Deployments/zeromq_taos/postgresql
/taos/data
......@@ -59,7 +59,7 @@ services:
- iotsharp-network
taos:
image: registry.uixe.net/tdengine/tdengine:2.0.8.0
image: registry.uixe.net/tdengine/tdengine:2.0.12.0
restart: always
container_name: taos
hostname: taos
......
......@@ -10,7 +10,7 @@ RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib n
apt-get -y -q update && apt-get install -y -q apt-utils libgdiplus libc6-dev lsof net-tools wget sqlite3 python3 bashtop iputils-ping inetutils-tools libssl-dev libssl1.0.0 curl && \
apt-get autoremove -y && apt-get clean && apt-get autoclean && rm /var/cache/apt/* -rf && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN curl -o TDengine-client.tar.gz "https://www.taosdata.com/download/download-gettingStarted.php?pkg=tdengine_linux&pkgName=TDengine-client-2.0.8.0-Linux-x64.tar.gz" && \
RUN curl -o TDengine-client.tar.gz "https://www.taosdata.com/download/download-gettingStarted.php?pkg=tdengine_linux&pkgName=TDengine-client-2.0.12.0-Linux-x64.tar.gz" && \
tar -xzvf TDengine-client.tar.gz && rm TDengine-client.tar.gz -f && cd $(ls TDengine-client* -d) && ./install_client.sh && \
rm $(pwd) -rf
WORKDIR /app
......
......@@ -121,7 +121,7 @@ namespace IoTSharp
.AddDiskStorageHealthCheck(dso =>
{
System.IO.DriveInfo.GetDrives()
.Where(d=>d.DriveType != System.IO.DriveType.CDRom && d.DriveType== System.IO.DriveType.Ram)
.Where(d=>d.DriveType != System.IO.DriveType.CDRom && d.DriveType!= System.IO.DriveType.Ram)
.Select(f => f.Name).Distinct().ToList()
.ForEach(f => dso.AddDrive(f, 1024));
......@@ -150,6 +150,7 @@ namespace IoTSharp
services.AddControllers();
services.AddMemoryCache();
string _hc_Caching = $"{nameof(CachingUseIn)}-{Enum.GetName(settings.CachingUseIn)}";
services.AddEasyCaching(options =>
{
switch (settings.CachingUseIn)
......@@ -163,6 +164,7 @@ namespace IoTSharp
config.DBConfig.Endpoints.Add(new ServerEndPoint(hx[0], int.Parse(hx[1])));
});
}, "iotsharp");
healthChecks.AddRedis(settings.CachingUseRedisHosts,name: _hc_Caching);
break;
case CachingUseIn.LiteDB:
options.UseLiteDB(cfg => cfg.DBConfig = new EasyCaching.LiteDB.LiteDBDBOptions() { });
......@@ -174,6 +176,7 @@ namespace IoTSharp
}
});
string _hc_telemetryStorage = $"{nameof(TelemetryStorage)}-{Enum.GetName(settings.TelemetryStorage)}";
switch (settings.TelemetryStorage)
{
case TelemetryStorage.Sharding:
......@@ -190,7 +193,7 @@ namespace IoTSharp
case TelemetryStorage.Taos:
services.AddSingleton<IStorage, TaosStorage>();
services.AddObjectPool(() => new TaosConnection(settings.ConnectionStrings["TelemetryStorage"]));
healthChecks.AddTDengine(Configuration.GetConnectionString("TelemetryStorage"));
healthChecks.AddTDengine(Configuration.GetConnectionString("TelemetryStorage"),name: _hc_telemetryStorage);
break;
case TelemetryStorage.InfluxDB:
//https://github.com/julian-fh/influxdb-setup
......@@ -198,6 +201,7 @@ namespace IoTSharp
services.AddSingleton<IStorage, InfluxDBStorage>();
//"TelemetryStorage": "http://localhost:8086/?org=iotsharp&bucket=iotsharp-bucket&token=iotsharp-token"
services.AddObjectPool(() => InfluxDBClientFactory.Create(Configuration.GetConnectionString("TelemetryStorage")));
//healthChecks.AddInfluxDB(Configuration.GetConnectionString("TelemetryStorage"),name: _hc_telemetryStorage);
break;
default:
......@@ -211,17 +215,18 @@ namespace IoTSharp
}
services.AddCap(x =>
{
string _hc_EventBusStore = $"{nameof(EventBusStore)}-{Enum.GetName(settings.EventBusStore)}";
x.SucceedMessageExpiredAfter = settings.SucceedMessageExpiredAfter;
x.ConsumerThreadCount = settings.ConsumerThreadCount;
switch (settings.EventBusStore)
{
case EventBusStore.PostgreSql:
x.UsePostgreSql(Configuration.GetConnectionString("EventBusStore"));
healthChecks.AddNpgSql(Configuration.GetConnectionString("EventBusStore"), name: "EventBusStore");
healthChecks.AddNpgSql(Configuration.GetConnectionString("EventBusStore"), name: _hc_EventBusStore);
break;
case EventBusStore.MongoDB:
x.UseMongoDB(Configuration.GetConnectionString("EventBusStore")); //注意,仅支持MongoDB 4.0+集群
healthChecks.AddMongoDb(Configuration.GetConnectionString("EventBusStore"), name: "EventBusStore");
healthChecks.AddMongoDb(Configuration.GetConnectionString("EventBusStore"), name: _hc_EventBusStore);
break;
case EventBusStore.LiteDB:
x.UseLiteDBStorage(Configuration.GetConnectionString("EventBusStore"));
......@@ -231,12 +236,13 @@ namespace IoTSharp
x.UseInMemoryStorage();
break;
}
string _hc_EventBusMQ =$"{nameof(EventBusMQ)}-{Enum.GetName(settings.EventBusMQ)}" ;
switch (settings.EventBusMQ)
{
case EventBusMQ.RabbitMQ:
x.UseRabbitMQ(new Uri(Configuration.GetConnectionString("EventBusMQ")));
//amqp://guest:guest@localhost:5672
healthChecks.AddRabbitMQ(Configuration.GetConnectionString("EventBusMQ"), name: "EventBusMQ");
healthChecks.AddRabbitMQ(Configuration.GetConnectionString("EventBusMQ"), name: _hc_EventBusMQ);
break;
case EventBusMQ.Kafka:
//BootstrapServers
......@@ -244,7 +250,7 @@ namespace IoTSharp
healthChecks.AddKafka(cfg =>
{
cfg.BootstrapServers = Configuration.GetConnectionString("EventBusMQ");
}, name: "EventBusMQ");
}, name: _hc_EventBusMQ);
break;
case EventBusMQ.ZeroMQ:
x.UseZeroMQ(cfg =>
......
......@@ -19,7 +19,7 @@
"JwtAudience": "IoTSharp.Net",
"EventBusStore": "InMemory",
"EventBusMQ": "InMemory",
"TelemetryStorage": "Taos",
"TelemetryStorage": "Taos"
//"Discovery": {
// "DiscoveryServerHostName": "iotsharp",
// "DiscoveryServerPort": 8500,
......
......@@ -9,7 +9,7 @@
"ConnectionStrings": {
"IoTSharp": "Server=pgsql;Database=IoTSharp;Username=postgres;Password=future;",
"EventBusStore": "mongodb://root:kissme@mongodb:27017",
"TelemetryStorage": "DataSource=taos;DataBase=IoTSharp;Username=root;Password=taosdata;Port=6030",
"TelemetryStorage": "http://influx:8086/?org=iotsharp&bucket=iotsharp-bucket&token=iotsharp-token&&latest=-72h",
"EventBusMQ": "amqp://root:kissme@rabbitmq:5672"
},
"JwtKey": "kissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissme",
......@@ -18,5 +18,5 @@
"JwtAudience": "IoTSharp.Net",
"EventBusStore": "MongoDB",
"EventBusMQ": "RabbitMQ",
"TelemetryStorage": "Taos"
"TelemetryStorage": "InfluxDB"
}
\ No newline at end of file
......@@ -86,6 +86,52 @@ services:
networks:
- iotsharp-network
taos:
image: tdengine/tdengine:2.0.12.0
restart: always
container_name: taos
hostname: taos
volumes:
- "./taos/data:/var/lib/taos"
- "./taos/log:/var/log/taos"
networks:
- iotsharp-network
influx:
image: "quay.io/influxdb/influxdb:2.0.0-rc"
restart: always
container_name: influx
ports:
- "8086:8086"
environment:
TZ: "Asia/Shanghai"
volumes:
- ./data/influxdb-data:/var/lib/influxdb2
command: influxd run --bolt-path /var/lib/influxdb2/influxd.bolt --engine-path /var/lib/influxdb2/engine --store bolt
networks:
- iotsharp-network
influx-setup:
image: "julianfh/influxdb-setup:latest"
depends_on:
- influx
links:
- influx
environment:
TZ: "Asia/Shanghai"
TIMEOUT: 20
INFLUXDB_SCHEMA: "http"
INFLUXDB_HOST: "influx"
INFLUXDB_PORT: "8086"
INFLUXDB_TOKEN: "iotsharp-token"
INFLUXDB_BUCKETID: "iotsharp-bucket"
INFLUXDB_ORG: "iotsharp"
INFLUXDB_USER: "root"
INFLUXDB_PW: "1-q2-w3-e4-r5-t"
INFLUXDB_RETENTION: "240h60m"
networks:
- iotsharp-network
networks:
iotsharp-network:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册