Migration to DevOps
This commit is contained in:
@@ -8,6 +8,8 @@ using PartSource.Automation.Jobs;
|
||||
using PartSource.Automation.Services;
|
||||
using PartSource.Data;
|
||||
using PartSource.Data.AutoMapper;
|
||||
using PartSource.Data.Contexts;
|
||||
using PartSource.Services;
|
||||
using Ratermania.Automation.DependencyInjection;
|
||||
using Ratermania.Automation.Logging;
|
||||
using Ratermania.Shopify.DependencyInjection;
|
||||
@@ -21,9 +23,18 @@ namespace PartSource.Automation
|
||||
{
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
using IHost host = CreateHostBuilder().Build();
|
||||
try
|
||||
{
|
||||
using IHost host = CreateHostBuilder().Build();
|
||||
|
||||
await host.StartAsync();
|
||||
await host.StartAsync();
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.ToString());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private static IHostBuilder CreateHostBuilder()
|
||||
@@ -43,6 +54,10 @@ namespace PartSource.Automation
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("PartSourceDatabase"), opts => opts.EnableRetryOnFailure())
|
||||
)
|
||||
|
||||
.AddDbContext<FitmentContext>(options =>
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("FitmentDatabase"), opts => opts.EnableRetryOnFailure())
|
||||
)
|
||||
|
||||
.AddShopify(options =>
|
||||
{
|
||||
options.ApiKey = builder.Configuration["Shopify:ApiKey"];
|
||||
@@ -53,21 +68,19 @@ namespace PartSource.Automation
|
||||
|
||||
.AddAutomation(options =>
|
||||
{
|
||||
options.HasBaseInterval(new TimeSpan(0, 15, 0))
|
||||
options.HasBaseInterval(new TimeSpan(0, 1, 0))
|
||||
.HasMaxFailures(5)
|
||||
//.HasJob<ProcessWhiFitment>(options => options.HasInterval(new TimeSpan(24, 0, 0)))
|
||||
//.HasJob<SyncronizeProducts>(options => options.HasInterval(new TimeSpan(24, 0, 0))
|
||||
// .HasJob<ProcessWhiFitment>(options => options.HasInterval(new TimeSpan(24, 0, 0))
|
||||
//.HasJob<UpdateFitment>(options => options.HasInterval(new TimeSpan(24, 0, 0))
|
||||
// .HasDependency<ProcessWhiFitment>()
|
||||
// .StartsAt(DateTime.Today.AddHours(8))
|
||||
//)
|
||||
|
||||
.HasJob<ExecuteSsisPackages>(options =>
|
||||
options.HasInterval(new TimeSpan(24, 0, 0))
|
||||
.StartsAt(DateTime.Today.AddHours(26))
|
||||
)
|
||||
.HasJob<UpdatePricing>(options => options.HasInterval(new TimeSpan(24, 0, 0))
|
||||
.StartsAt(DateTime.Today.AddHours(27))
|
||||
.HasDependency<ExecuteSsisPackages>()
|
||||
.HasJob<ExecuteSsisPackages>(options => options.HasInterval(new TimeSpan(24, 0, 0))
|
||||
// .HasJob<UpdatePricing>(options => options.HasInterval(new TimeSpan(24, 0, 0)))
|
||||
//.HasDependency<ExecuteSsisPackages>()
|
||||
//.StartsAt(DateTime.Now.AddMinutes(15))
|
||||
)
|
||||
.AddApiServer(options => options.HasApiKey(Environment.GetEnvironmentVariable("AUTOMATION_API_KEY")));
|
||||
})
|
||||
@@ -75,13 +88,16 @@ namespace PartSource.Automation
|
||||
.AddSingleton<EmailService>()
|
||||
.AddSingleton<SsisService>()
|
||||
.AddSingleton<WhiSeoService>()
|
||||
.AddSingleton<VehicleService>()
|
||||
|
||||
|
||||
.AddAutoMapper(typeof(PartSourceProfile));
|
||||
})
|
||||
.ConfigureLogging((builder, logging) =>
|
||||
{
|
||||
logging.ClearProviders()
|
||||
.AddProvider(new AutomationLoggerProvider());
|
||||
logging.AddConsole();
|
||||
|
||||
logging.AddProvider(new AutomationLoggerProvider());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user