Bläddra i källkod

first commit

master
杨雷 6 månader sedan
incheckning
fd89f33aec
16 ändrade filer med 852 tillägg och 0 borttagningar
  1. +30
    -0
      .dockerignore
  2. +340
    -0
      .gitignore
  3. +33
    -0
      TelpoPush.Position.Worker/Dockerfile
  4. +98
    -0
      TelpoPush.Position.Worker/Program.cs
  5. +15
    -0
      TelpoPush.Position.Worker/Properties/launchSettings.json
  6. +26
    -0
      TelpoPush.Position.Worker/TelpoPush.Position.Worker.csproj
  7. +24
    -0
      TelpoPush.Position.Worker/Worker.cs
  8. +40
    -0
      TelpoPush.Position.Worker/appsettings.Development.json
  9. +77
    -0
      TelpoPush.Position.Worker/appsettings.json
  10. +36
    -0
      TelpoPush.Position.Worker/appsettings.production.json
  11. +39
    -0
      TelpoPush.Position.Worker/appsettings.test.json
  12. +25
    -0
      TelpoPushPosition.sln
  13. +7
    -0
      nuget.config
  14. +18
    -0
      setup_production.sh
  15. +17
    -0
      setup_test.sh
  16. +27
    -0
      telpo_push_position_run.sh

+ 30
- 0
.dockerignore Visa fil

@@ -0,0 +1,30 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
!**/.gitignore
!.git/HEAD
!.git/config
!.git/packed-refs
!.git/refs/heads/**

+ 340
- 0
.gitignore Visa fil

@@ -0,0 +1,340 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# Visual Studio 2017 auto generated files
Generated\ Files/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# Benchmark Results
BenchmarkDotNet.Artifacts/

# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/

# StyleCop
StyleCopReport.xml

# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap

# Visual Studio Trace Files
*.e2e

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json

# Visual Studio code coverage results
*.coverage
*.coveragexml

# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets

# Microsoft Azure Build Output
csx/
*.build.csdef

# Microsoft Azure Emulator
ecf/
rcf/

# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/

# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs

# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak

# SQL Server files
*.mdf
*.ldf
*.ndf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- Backup*.rdl

# Microsoft Fakes
FakesAssemblies/

# GhostDoc plugin setting file
*.GhostDoc.xml

# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Paket dependency manager
.paket/paket.exe
paket-files/

# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml

# CodeRush personal settings
.cr/personal

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc

# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config

# Tabs Studio
*.tss

# Telerik's JustMock configuration file
*.jmconfig

# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs

# OpenCover UI analysis results
OpenCover/

# Azure Stream Analytics local run output
ASALocalRun/

# MSBuild Binary and Structured Log
*.binlog

# NVidia Nsight GPU debugger configuration file
*.nvuser

# MFractors (Xamarin productivity tool) working folder
.mfractor/

# Local History for Visual Studio
.localhistory/

# BeatPulse healthcheck temp database
healthchecksdb

+ 33
- 0
TelpoPush.Position.Worker/Dockerfile Visa fil

@@ -0,0 +1,33 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
WORKDIR /src
COPY ["TelpoPush.Position.Worker/TelpoPush.Position.Worker.csproj", "TelpoPush.Position.Worker/"]


COPY ["nuget.config","."]
RUN dotnet nuget remove source nuget.org
RUN dotnet nuget add source https://repo.huaweicloud.com/repository/nuget/v3/index.json -n huaweicloud_nuget
RUN dotnet restore "TelpoPush.Position.Worker/TelpoPush.Position.Worker.csproj"
COPY . .
WORKDIR "/src/TelpoPush.Position.Worker"


FROM build AS publish
RUN dotnet publish "TelpoPush.Position.Worker.csproj" -c Release -o /app/publish


FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
#COPY pem /app/pem
ENV environment=Development
RUN apk add --no-cache tzdata
ENV TimeZone=Asia/Shanghai
ENV LANG C.UTF-8
ENV ASPNETCORE_ENVIRONMENT_LOG=Development
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone
ENTRYPOINT dotnet TelpoPush.Position.Worker.dll --environment=$environment

+ 98
- 0
TelpoPush.Position.Worker/Program.cs Visa fil

@@ -0,0 +1,98 @@
using Dapper;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using Serilog;
using TelpoDataService.Util.Clients;
using TelpoPush.Position.Worker;


#region 日志
//using Serilog.Events;
//using Serilog;
//using Microsoft.AspNetCore.Builder;

//Log.Logger = new LoggerConfiguration()
//#if DEBUG
// .MinimumLevel.Debug()
//#else
// .MinimumLevel.Information()
//#endif
// .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
// .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
// .Enrich.FromLogContext()
// //.Filter.ByExcluding(c => c.Properties.Any(p => p.Value.ToString().Contains("Microsoft")))//过滤
// .WriteTo.Async(c => c.File("/var/telpo_pushthird_ssl2/logs/infos/info.log",
// restrictedToMinimumLevel: LogEventLevel.Information,
// rollingInterval: RollingInterval.Day,//滚动策略(天)
// //fileSizeLimitBytes: 20971520, //设置单个文件大小为3M 默认1G
// rollOnFileSizeLimit: true, //超过文件大小后创建新的
// retainedFileCountLimit: 7,//默认31,意思就是只保留最近的31个日志文件"
// outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff}[{Level:u3}] [Thread-{ThreadId}] [{SourceContext:l}] {Message:lj}{NewLine}{Exception}"
// )
// )
// .WriteTo.Async(c => c.File("/var/telpo_pushthird_ssl2/logs/errors/errors.log",
// restrictedToMinimumLevel: LogEventLevel.Error,
// rollingInterval: RollingInterval.Day,
// rollOnFileSizeLimit: true,
// retainedFileCountLimit: 7,
// outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff }[{Level:u3}] [Thread-{ThreadId}] [{SourceContext:l}] {Message:lj}{NewLine}{Exception}"
// )
// )
// .WriteTo.Async(c => c.Console())
// .CreateLogger();

//选择配置文件appsetting.json
var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.Build();

Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.Enrich.WithThreadId()
.CreateLogger();
#endregion
try
{
Log.Information("Starting up");
var builder = Host.CreateApplicationBuilder(args);

var config = builder.Configuration;
//builder.Services.Configure<PositionConfig>(config.GetSection("PositionConfig"));
//builder.Services.Configure<ServiceConfig>(config.GetSection("ServiceConfig"));
//builder.Services.Configure<RedisConfig>(config.GetSection("Redis"));

JsonSerializerSettings setting = new JsonSerializerSettings();
JsonConvert.DefaultSettings = () =>
{
setting.DateFormatString = "yyyy-MM-dd HH:mm:ss";
setting.ContractResolver = new CamelCasePropertyNamesContractResolver();
return setting;
};
builder.Services.AddTelpoDataServices(opt =>
{
opt.TelpoDataUrl = config["ServiceConfig:TelpoDataUrl"];
});

builder.Services.AddSerilog();
builder.Services.AddHttpClient();
//builder.Services.AddTransient<HttpHelperAsync>();
//builder.Services.AddSingleton<SqlMapper>();
//builder.Services.AddSingleton<RedisUtil>();
//builder.Services.AddSingleton<IKafkaService, KafkaService>();
//builder.Services.AddSingleton<KafkaSubscribe>();
//builder.Services.AddSingleton<MessageProducer>();
//builder.Services.AddSingleton<MqProcessMessage>();
//builder.Services.AddSingleton<PositionProcess>();
builder.Services.AddHostedService<Worker>();
var host = builder.Build();
host.Run();
}
catch (Exception ex)
{
Log.Fatal(ex, "Application start-up failed");
}
finally
{
Log.CloseAndFlush();
}

+ 15
- 0
TelpoPush.Position.Worker/Properties/launchSettings.json Visa fil

@@ -0,0 +1,15 @@
{
"profiles": {
"TelpoPush.Position.Worker": {
"commandName": "Project",
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true
},
"Container (Dockerfile)": {
"commandName": "Docker"
}
},
"$schema": "http://json.schemastore.org/launchsettings.json"
}

+ 26
- 0
TelpoPush.Position.Worker/TelpoPush.Position.Worker.csproj Visa fil

@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-TelpoPush.Position.Worker-211b7ba5-b122-4108-a72e-d3ee6ae6a82d</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Confluent.Kafka" Version="2.4.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.Exceptionless" Version="4.0.0" />
<PackageReference Include="CSRedisCore" Version="3.8.803" />
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="MySql.Data" Version="8.4.0" />
<PackageReference Include="TelpoDataService.Util" Version="1.6.9.28-beta1" />
</ItemGroup>
</Project>

+ 24
- 0
TelpoPush.Position.Worker/Worker.cs Visa fil

@@ -0,0 +1,24 @@
namespace TelpoPush.Position.Worker
{
public class Worker : BackgroundService
{
private readonly ILogger<Worker> _logger;

public Worker(ILogger<Worker> logger)
{
_logger = logger;
}

protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
if (_logger.IsEnabled(LogLevel.Information))
{
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
}
await Task.Delay(1000, stoppingToken);
}
}
}
}

+ 40
- 0
TelpoPush.Position.Worker/appsettings.Development.json Visa fil

@@ -0,0 +1,40 @@
{
"ConnectionStrings": {
"DB_Connection_String": "server=139.224.254.18;port=3305;database=gps_card;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none",
"Telpo_common_ConnString": "server=139.224.254.18;port=3305;database=telpo_common;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none",
"Telpo_Healthy_ConnString": "server=139.224.254.18;port=3305;database=telpo_healthy;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none"

//"DB_Connection_String": "server=rm-uf6j529mu0v6g0btpco.mysql.rds.aliyuncs.com;port=3305;database=gps_card;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none",
//"Telpo_common_ConnString": "server=rm-uf6j529mu0v6g0btpco.mysql.rds.aliyuncs.com;port=3305;database=telpo_common;uid=linwl;pwd=linwl#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none"
},

"PositionConfig": {
"CoreServiceApiUrl": "http://localhost:8094/api/v1",
"GpsWebApiUrl": "http://id.ssjlai.com/webapi",
//-------融智联
"RzlManufactorId": "2cae99d6-0475-42fe-9fa7-ca27e03077de",
"RzlPushTemperatureUrl": "http://121.40.140.74:8071/api/CollectData/TemperatureTranspond",
"RzlPushTranspondUrl": "http://121.40.140.74:8071/api/CollectData/ThirdPushTranspond",
"RzlVoiceCallback": "http://121.40.140.74/GspCardStand/api/Voice/VoiceCallback"
},
"ServiceConfig": {
"TelpoDataUrl": "http://id.ssjlai.com/data",
"KafkaBootstrapServers": "47.116.67.214:9092", // "172.19.42.53:9092",
"KafkaTopics": [ "topic.push.position" ],
"KafkaGroupId": "telpo.position",
"CacheDurationSeconds": 1200, //20分钟
"CacheDurationSeconds10": 600 //10分钟
},
"Redis": {
//"Server": "139.224.254.18:8090",
"Server": "47.116.142.20:8090",
"Password": "telpo#1234",
"DefaultDatabase": 7,
"Poolsize": 150,
"Preheat": 50,
"Prefix": "_Third_",
"ConnectTimeout": 5000,
"IdleTimeout": 20000
},
"Environment": "dev"
}

+ 77
- 0
TelpoPush.Position.Worker/appsettings.json Visa fil

@@ -0,0 +1,77 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"System.Net.Http.HttpClient": "Warning"
}
},
"Serilog": {
"Using": [ "Serilog.Sinks.File", "Serilog.Sinks.Async", "Serilog.Sinks.Console", "Serilog.Sinks.Exceptionless" ],
"MinimumLevel": {
"Default": "Verbose",
"Override": {
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"System.Net.Http.HttpClient": "Warning"
}
},
"WriteTo:Information": {
"Name": "Async",
"Args": {
"Configure": [
{
"Name": "File",
"Args": {
"RestrictedToMinimumLevel": "Information",
"RollingInterval": "Day",
"RollOnFileSizeLimit": "true",
"OutputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss }[{Level:u3}] [Thread-{ThreadId}] [{SourceContext:l}] {Message:lj}{NewLine}{Exception}",
"Path": "/var/telpo_pushposition/logs/infos/info.log",
"RetainedFileCountLimit": 7 // "--设置日志文件个数最大值,默认31,意思就是只保留最近的31个日志文件", "等于null时永远保留文件": null
// "FileSizeLimitBytes": 20971520, //设置单个文件大小为3M 默认1G
// "RollOnFileSizeLimit": true //超过文件大小后创建新的

}
}
]
}
},
"WriteTo:Error": {
"Name": "Async",
"Args": {
"Configure": [
{
"Name": "File",
"Args": {
"RestrictedToMinimumLevel": "Error",
"RollingInterval": "Day",
"RollOnFileSizeLimit": "true",
"OutputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss }[{Level:u3}] [Thread-{ThreadId}][{SourceContext:l}] {Message:lj}{NewLine}{Exception}",
"Path": "/var/telpo_pushposition/logs/errors/error.log",
"RetainedFileCountLimit": 7 // "--设置日志文件个数最大值,默认31,意思就是只保留最近的31个日志文件", "等于null时永远保留文件": null
// "FileSizeLimitBytes": 20971520, //设置单个文件大小为3M 默认1G
// "RollOnFileSizeLimit": true //超过文件大小后创建新的
}
}
]
}
},
"WriteTo:Console": {
"Name": "Console",
"Args": {
"restrictedToMinimumLevel": "Verbose",
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss }[{Level:u3}] [Thread-{ThreadId}] [{SourceContext:l}] {Message:lj}{NewLine}{Exception}",
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console"
}
},
"WriteTo:Exceptionless": {
"Name": "Exceptionless",
"Args": {
"serverUrl": "http://8.134.157.154:5000",
"apiKey": "f2I0sng4BBQS9IAsbdBK1W71oOYGPpsC66s7pzJu"
}
}
}
}

+ 36
- 0
TelpoPush.Position.Worker/appsettings.production.json Visa fil

@@ -0,0 +1,36 @@
{
"ConnectionStrings": {
"DB_Connection_String": "server=rm-uf6j529mu0v6g0btp.mysql.rds.aliyuncs.com;port=3305;database=gps_card;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none",
"Telpo_common_ConnString": "server=rm-uf6j529mu0v6g0btp.mysql.rds.aliyuncs.com;port=3305;database=telpo_common;uid=linwl;pwd=linwl#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none",
"Telpo_Healthy_ConnString": "server=rm-uf6j529mu0v6g0btp.mysql.rds.aliyuncs.com;port=3305;database=telpo_healthy;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none"
},

"PositionConfig": {
"CoreServiceApiUrl": "http://ai.ssjlai.com/gateway/core/api/v1",
"GpsWebApiUrl": "https://ai.ssjlai.com/webapi",
//-------融智联
"RzlManufactorId": "2cae99d6-0475-42fe-9fa7-ca27e03077de",
"RzlPushTemperatureUrl": "http://121.40.140.74:8071/api/CollectData/TemperatureTranspond",
"RzlPushTranspondUrl": "http://121.40.140.74:8071/api/CollectData/ThirdPushTranspond",
"RzlVoiceCallback": "http://121.40.140.74/GspCardStand/api/Voice/VoiceCallback"
},
"ServiceConfig": {
"TelpoDataUrl": "https://ai.ssjlai.com/data",
"KafkaBootstrapServers": "172.19.42.40:9092,172.19.42.41:9092,172.19.42.48:9092",
"KafkaTopics": [ "topic.push.position" ],
"KafkaGroupId": "telpo.position",
"CacheDurationSeconds": 1200, //20分钟
"CacheDurationSeconds10": 600 //10分钟
},
"Redis": {
"Server": "172.19.42.40:8090",
"Password": "telpo#1234",
"DefaultDatabase": 7,
"Poolsize": 150,
"Preheat": 50,
"Prefix": "_Third_",
"ConnectTimeout": 5000,
"IdleTimeout": 20000
},
"Environment": "production"
}

+ 39
- 0
TelpoPush.Position.Worker/appsettings.test.json Visa fil

@@ -0,0 +1,39 @@
{
"ConnectionStrings": {
"DB_Connection_String": "server=139.224.254.18;port=3305;database=gps_card;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none",
"Telpo_common_ConnString": "server=139.224.254.18;port=3305;database=telpo_common;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none",
"Telpo_Healthy_ConnString": "server=139.224.254.18;port=3305;database=telpo_healthy;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none"

//"DB_Connection_String": "server=rm-uf6j529mu0v6g0btpco.mysql.rds.aliyuncs.com;port=3305;database=gps_card;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none",
//"Telpo_common_ConnString": "server=rm-uf6j529mu0v6g0btpco.mysql.rds.aliyuncs.com;port=3305;database=telpo_common;uid=linwl;pwd=linwl#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none"
},

"PositionConfig": {
"CoreServiceApiUrl": "http://localhost:8094/api/v1",
"GpsWebApiUrl": "http://id.ssjlai.com/webapi",
//-------融智联
"RzlManufactorId": "2cae99d6-0475-42fe-9fa7-ca27e03077de",
"RzlPushTemperatureUrl": "http://121.40.140.74:8071/api/CollectData/TemperatureTranspond",
"RzlPushTranspondUrl": "http://121.40.140.74:8071/api/CollectData/ThirdPushTranspond",
"RzlVoiceCallback": "http://121.40.140.74/GspCardStand/api/Voice/VoiceCallback"
},
"ServiceConfig": {
"TelpoDataUrl": "http://id.ssjlai.com/data",
"KafkaBootstrapServers": "172.19.42.53:9092", // "172.19.42.53:9092",
"KafkaTopics": [ "topic.push.position" ],
"KafkaGroupId": "telpo.position",
"CacheDurationSeconds": 1200, //20分钟
"CacheDurationSeconds10": 600 //10分钟
},
"Redis": {
"Server": "172.19.42.44:8090",
"Password": "telpo#1234",
"DefaultDatabase": 7,
"Poolsize": 150,
"Preheat": 50,
"Prefix": "_Third_",
"ConnectTimeout": 5000,
"IdleTimeout": 20000
},
"Environment": "dev"
}

+ 25
- 0
TelpoPushPosition.sln Visa fil

@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34723.18
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TelpoPush.Position.Worker", "TelpoPush.Position.Worker\TelpoPush.Position.Worker.csproj", "{7E015BBC-126F-40AA-B261-0C58ED0FE0DE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7E015BBC-126F-40AA-B261-0C58ED0FE0DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E015BBC-126F-40AA-B261-0C58ED0FE0DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E015BBC-126F-40AA-B261-0C58ED0FE0DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E015BBC-126F-40AA-B261-0C58ED0FE0DE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {76B08062-E22A-4D9C-A1BB-6D713A3A5DEE}
EndGlobalSection
EndGlobal

+ 7
- 0
nuget.config Visa fil

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="company" value="http://139.224.254.18:3344" />
</packageSources>
</configuration>

+ 18
- 0
setup_production.sh Visa fil

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
image_version=$version
# 删除镜像
docker rmi -f $(
docker images | grep registry.cn-shanghai.aliyuncs.com/gps_card/telpo_push_position | awk '{print $3}'
)
# 构建telpo/mrp:$image_version镜像
docker build -f ./TelpoPush.Position.Worker/Dockerfile . -t telpo/telpo_push_position:$image_version
#TODO:推送镜像到阿里仓库
echo '=================开始推送镜像======================='
docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com
docker tag telpo/telpo_push_position:$image_version registry.cn-shanghai.aliyuncs.com/gps_card/telpo_push_position:$image_version
docker push registry.cn-shanghai.aliyuncs.com/gps_card/telpo_push_position:$image_version
echo '=================推送镜像完成======================='
#删除产生的None镜像
docker rmi -f $(docker images | grep none | awk '{print $3}')
# 查看镜像列表
docker images

+ 17
- 0
setup_test.sh Visa fil

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
image_version=$version
# 删除镜像
docker rmi -f $(
docker images | grep 139.224.254.18:5000/telpo_push_position | awk '{print $3}'
)
# 构建telpo/mrp:$image_version镜像
docker build -f ./TelpoPush.Position.Worker/Dockerfile . -t telpo/telpo_push_position:$image_version
#TODO:推送镜像到私有仓库
echo '=================开始推送镜像======================='
docker tag telpo/telpo_push_position:$image_version 139.224.254.18:5000/telpo_push_position:$image_version
docker push 139.224.254.18:5000/telpo_push_position:$image_version
echo '=================推送镜像完成======================='
#删除产生的None镜像
docker rmi -f $(docker images | grep none | awk '{print $3}')
# 查看镜像列表
docker images

+ 27
- 0
telpo_push_position_run.sh Visa fil

@@ -0,0 +1,27 @@
#!/bin/bash
environment=$1
version=$2
echo "环境变量为${environment},版本为$version!"
if [[ ${environment} == 'production' ]]; then
echo "开始远程构建容器"
docker stop telpo_push_third_ssl || true
docker rm telpo_push_third_ssl || true
docker rmi -f $(docker images | grep registry.cn-shanghai.aliyuncs.com/gps_card/telpo_push_third_ssl | awk '{print $3}')
docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com
docker pull registry.cn-shanghai.aliyuncs.com/gps_card/telpo_push_third_ssl:$version
docker run -d --network=host -e environment=production -v /home/data/telpo_push_third_ssl/log:/var/telpo_pushthird_ssl/logs --restart=always --name telpo_push_third_ssl registry.cn-shanghai.aliyuncs.com/gps_card/telpo_push_third_ssl:$version;
#删除产生的None镜像
docker rmi -f $(docker images | grep none | awk '{print $3}')
docker ps -a

elif [[ ${environment} == 'test' ]]; then
echo "开始在测试环境远程构建容器"
docker stop telpo_push_third_ssl || true
docker rm telpo_push_third_ssl || true
docker rmi -f $(docker images | grep 139.224.254.18:5000/telpo_push_third_ssl | awk '{print $3}')
docker pull 139.224.254.18:5000/telpo_push_third_ssl:$version
docker run -d --network=host -e environment=${environment} -v /home/data/telpo_push_third_ssl/log:/var/telpo_pushthird_ssl/logs --restart=always --name telpo_push_third_ssl 139.224.254.18:5000/telpo_push_third_ssl:$version;
#删除产生的None镜像
docker rmi -f $(docker images | grep none | awk '{print $3}')
docker ps -a
fi

Laddar…
Avbryt
Spara