Skip to content
Snippets Groups Projects
Commit 45423962 authored by Dmytro Bogatov's avatar Dmytro Bogatov :two_hearts:
Browse files

Resolve "Upgrade to ASP Core 2.0"

parent fb3be3de
Branches
No related tags found
No related merge requests found
Showing
with 107 additions and 115 deletions
...@@ -56,3 +56,7 @@ debug ...@@ -56,3 +56,7 @@ debug
# Debian build artifacts # Debian build artifacts
debian/build debian/build
test/appsettings.*
*lock.json
...@@ -9,7 +9,7 @@ before_script: ...@@ -9,7 +9,7 @@ before_script:
## BUILD ## BUILD
build-docs: build-docs:
image: dbogatov/docker-containers:mkdocs-latest image: dbogatov/docker-images:mk-docs-latest
stage: build stage: build
script: script:
- ./build.sh -f build-docs - ./build.sh -f build-docs
...@@ -35,7 +35,7 @@ build-ping: ...@@ -35,7 +35,7 @@ build-ping:
- docker - docker
build-app: build-app:
image: dbogatov/docker-containers:dotnet-core-latest image: dbogatov/docker-images:net-core-latest
stage: build stage: build
script: script:
- export ASPNETCORE_ENVIRONMENT="Production" - export ASPNETCORE_ENVIRONMENT="Production"
...@@ -53,24 +53,25 @@ build-app: ...@@ -53,24 +53,25 @@ build-app:
unit-test-app: unit-test-app:
stage: test stage: test
image: microsoft/dotnet:1.1.1-sdk image: microsoft/dotnet:2.0.3-sdk
script: script:
- printf "{\"Version\":{\"GitHash\":\"%s\"}}" $CI_BUILD_REF > src/version.json - printf "{\"Version\":{\"GitHash\":\"%s\"}}" $CI_BUILD_REF > src/version.json
- cd test - cd test
- dotnet restore - dotnet restore
- dotnet build
- ./test.sh | tee tests.out - ./test.sh | tee tests.out
- "cat tests.out | grep 'Failed: 0.'" - "cat tests.out | grep 'Test Run Successful.'"
tags: tags:
- docker - docker
tidy-app: tidy-app:
stage: test stage: test
image: dbogatov/docker-containers:dotnet-core-latest image: dbogatov/docker-images:net-core-latest
dependencies: dependencies:
- build-app - build-app
before_script: before_script:
- export ASPNETCORE_ENVIRONMENT="Staging" - export ASPNETCORE_ENVIRONMENT="Staging"
- cd src/web/bin/release/netcoreapp1.1/publish/ - cd src/web/bin/release/netcoreapp2.0/publish/
- dotnet web.dll > /dev/null & - dotnet web.dll > /dev/null &
- sleep 15 - sleep 15
script: script:
...@@ -81,12 +82,12 @@ tidy-app: ...@@ -81,12 +82,12 @@ tidy-app:
blc-app: blc-app:
stage: test stage: test
image: dbogatov/docker-containers:dotnet-core-latest image: dbogatov/docker-images:net-core-latest
dependencies: dependencies:
- build-app - build-app
before_script: before_script:
- export ASPNETCORE_ENVIRONMENT="Staging" - export ASPNETCORE_ENVIRONMENT="Staging"
- cd src/web/bin/release/netcoreapp1.1/publish/ - cd src/web/bin/release/netcoreapp2.0/publish/
- dotnet web.dll > /dev/null & - dotnet web.dll > /dev/null &
- sleep 15 - sleep 15
script: script:
...@@ -96,7 +97,7 @@ blc-app: ...@@ -96,7 +97,7 @@ blc-app:
blc-docs: blc-docs:
stage: test stage: test
image: dbogatov/docker-containers:jekyll-latest image: dbogatov/docker-images:blc-latest
dependencies: dependencies:
- build-docs - build-docs
before_script: before_script:
...@@ -130,7 +131,7 @@ release-app-docs: ...@@ -130,7 +131,7 @@ release-app-docs:
release-debian: release-debian:
stage: release stage: release
image: dbogatov/docker-containers:debian-latest image: dbogatov/docker-images:debian-latest
script: script:
- ./build.sh -f build-debian-package - ./build.sh -f build-debian-package
artifacts: artifacts:
... ...
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"request": "launch", "request": "launch",
"preLaunchTask": "build-web", "preLaunchTask": "build-web",
"justMyCode": false, "justMyCode": false,
"program": "${workspaceRoot}/src/web/bin/Debug/netcoreapp1.1/web.dll", "program": "${workspaceRoot}/src/web/bin/Debug/netcoreapp2.0/web.dll",
"args": [], "args": [],
"cwd": "${workspaceRoot}/src/web", "cwd": "${workspaceRoot}/src/web",
"externalConsole": false, "externalConsole": false,
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
"request": "launch", "request": "launch",
"preLaunchTask": "build-daemons", "preLaunchTask": "build-daemons",
"justMyCode": false, "justMyCode": false,
"program": "${workspaceRoot}/src/daemons/bin/Debug/netcoreapp1.1/daemons.dll", "program": "${workspaceRoot}/src/daemons/bin/Debug/netcoreapp2.0/daemons.dll",
"args": [], "args": [],
"cwd": "${workspaceRoot}/src/daemons", "cwd": "${workspaceRoot}/src/daemons",
"externalConsole": false, "externalConsole": false,
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
"request": "launch", "request": "launch",
"preLaunchTask": "build-test", "preLaunchTask": "build-test",
"justMyCode": false, "justMyCode": false,
"program": "${workspaceRoot}/test/bin/Debug/netcoreapp1.1/test.dll", "program": "${workspaceRoot}/test/bin/Debug/netcoreapp2.0/test.dll",
"args": [], "args": [],
"cwd": "${workspaceRoot}/test", "cwd": "${workspaceRoot}/test",
"externalConsole": false, "externalConsole": false,
... ...
......
...@@ -9,7 +9,9 @@ strict: true ...@@ -9,7 +9,9 @@ strict: true
copyright: Copyright © 2017 Dmytro Bogatov copyright: Copyright © 2017 Dmytro Bogatov
# Documentation and theme # Documentation and theme
theme_dir: material theme:
name: 'material'
custom_dir: 'material'
# Options # Options
extra: extra:
... ...
......
...@@ -15,11 +15,7 @@ install-node-tools () { ...@@ -15,11 +15,7 @@ install-node-tools () {
echo "Installing node modules... Requires Yarn or MPM" echo "Installing node modules... Requires Yarn or MPM"
if hash yarn 2>/dev/null; then
yarn --ignore-engines > /dev/null yarn --ignore-engines > /dev/null
else
npm install > /dev/null
fi
} }
clean-doc-folder () { clean-doc-folder () {
... ...
......
FROM dbogatov/docker-containers:nginx-latest FROM dbogatov/docker-images:nginx-latest
MAINTAINER Dmytro Bogatov dmytro@dbogatov.org MAINTAINER Dmytro Bogatov dmytro@dbogatov.org
... ...
......
FROM microsoft/dotnet:1.1.1-runtime FROM microsoft/dotnet:2.0.3-runtime
# Create directory for the app source code # Create directory for the app source code
WORKDIR /srv WORKDIR /srv
# Copy the binary # Copy the binary
COPY bin/release/netcoreapp1.1/publish/ /srv COPY bin/release/netcoreapp2.0/publish/ /srv
ENTRYPOINT /bin/bash -c "dotnet daemons.dll" ENTRYPOINT /bin/bash -c "dotnet daemons.dll"
...@@ -55,6 +55,8 @@ namespace StatusMonitor.Daemons.Services ...@@ -55,6 +55,8 @@ namespace StatusMonitor.Daemons.Services
{ {
var metric = await _metricService.GetOrCreateMetricAsync(type, source); var metric = await _metricService.GetOrCreateMetricAsync(type, source);
_context.Attach(metric);
// Using plain new Random() will result in the same number if called multiple times in short time period // Using plain new Random() will result in the same number if called multiple times in short time period
var random = new Random( var random = new Random(
Convert.ToInt32( Convert.ToInt32(
... ...
......
...@@ -287,6 +287,12 @@ namespace StatusMonitor.Daemons.Services ...@@ -287,6 +287,12 @@ namespace StatusMonitor.Daemons.Services
.GetRequiredService<IHealthService>() .GetRequiredService<IHealthService>()
.ProduceHealthReportAsync(); .ProduceHealthReportAsync();
// May happen in test environment
if (report.Metric != null)
{
context.Attach(report.Metric);
}
await context.HealthReports.AddAsync(report); await context.HealthReports.AddAsync(report);
await context.SaveChangesAsync(); await context.SaveChangesAsync();
} }
...@@ -353,6 +359,18 @@ namespace StatusMonitor.Daemons.Services ...@@ -353,6 +359,18 @@ namespace StatusMonitor.Daemons.Services
// Wait completion of all tasks // Wait completion of all tasks
var pingDataPoints = await Task.WhenAll(tasks.ToArray()); var pingDataPoints = await Task.WhenAll(tasks.ToArray());
pingDataPoints
.ToList()
.ForEach(
ping => {
// May happen in test environment
if (ping.Metric != null)
{
context.Attach(ping.Metric);
}
}
);
await context.PingDataPoints.AddRangeAsync(pingDataPoints); await context.PingDataPoints.AddRangeAsync(pingDataPoints);
await context.SaveChangesAsync(); await context.SaveChangesAsync();
... ...
......
<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web"> <Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext> <PreserveCompilationContext>true</PreserveCompilationContext>
</PropertyGroup> <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="../shared/shared.csproj"> <ProjectReference Include="../shared/shared.csproj" Name="shared" />
<Name>shared</Name> <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
</ProjectReference> <PackageReference Include="Npgsql" Version="3.2.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.0" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.0.0-*" />
<PackageReference Include="Npgsql" Version="3.1.9" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="2.0.0-*" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="1.1.0" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Design" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.TagHelpers" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
<PackageReference Include="CommonMark.NET" Version="0.14.0" /> <PackageReference Include="CommonMark.NET" Version="0.14.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Tools" Version="1.1.0-preview4-final" /> <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.0" />
<PackageReference Include="Moq" Version="4.6.38-alpha" /> <PackageReference Include="Moq" Version="4.6.38-alpha" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="1.1.0" /> <PackageReference Include="MailKit" Version="1.16.0" />
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="1.1.0" />
<PackageReference Include="NetEscapades.Configuration.Yaml" Version="1.2.0" /> <PackageReference Include="NetEscapades.Configuration.Yaml" Version="1.2.0" />
<PackageReference Include="System.ComponentModel.TypeConverter" Version="*" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="*" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<AppSettings Include="../appsettings*.*"/> <AppSettings Include="../appsettings*.*"/>
... ...
......
...@@ -38,22 +38,14 @@ namespace StatusMonitor.Shared.Extensions ...@@ -38,22 +38,14 @@ namespace StatusMonitor.Shared.Extensions
services services
.AddEntityFrameworkSqlite() .AddEntityFrameworkSqlite()
.AddDbContext<DataContext>( .AddDbContext<DataContext>(
b => b.UseSqlite("Data Source=../../../../../development.db") b => b.UseSqlite("Data Source=../development.db")
); );
} }
else // Testing and Staging else // Testing and Staging
{ {
services services
.AddEntityFrameworkInMemoryDatabase() .AddEntityFrameworkInMemoryDatabase()
.AddDbContext<DataContext>( .AddDbContext<DataContext>(b => b.UseInMemoryDatabase("main-db"));
b => b
.UseInMemoryDatabase()
.UseInternalServiceProvider(
new ServiceCollection()
.AddEntityFrameworkInMemoryDatabase()
.BuildServiceProvider()
)
);
} }
services.AddTransient<IDataContext, DataContext>(); services.AddTransient<IDataContext, DataContext>();
... ...
......
...@@ -37,6 +37,7 @@ namespace StatusMonitor.Shared.Models ...@@ -37,6 +37,7 @@ namespace StatusMonitor.Shared.Models
void RemoveRange(params object[] entities); void RemoveRange(params object[] entities);
EntityEntry Remove(object entity); EntityEntry Remove(object entity);
EntityEntry Entry(object entity); EntityEntry Entry(object entity);
EntityEntry Attach(object entity);
} }
/// <summary> /// <summary>
... ...
......
<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web"> <Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback> <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.0" /> <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Npgsql" Version="3.1.9" /> <PackageReference Include="Npgsql" Version="3.2.5" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="1.1.0" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.0.0-*" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.0" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="2.0.0-*" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Design" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.TagHelpers" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
<PackageReference Include="CommonMark.NET" Version="0.14.0" /> <PackageReference Include="CommonMark.NET" Version="0.14.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Tools" Version="1.1.0-preview4-final" /> <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.0" />
<PackageReference Include="Moq" Version="4.6.38-alpha" /> <PackageReference Include="Moq" Version="4.6.38-alpha" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="1.1.0" />
<PackageReference Include="MailKit" Version="1.16.0" /> <PackageReference Include="MailKit" Version="1.16.0" />
<PackageReference Include="NetEscapades.Configuration.Yaml" Version="1.2.0" /> <PackageReference Include="NetEscapades.Configuration.Yaml" Version="1.2.0" />
<PackageReference Include="System.ComponentModel.TypeConverter" Version="*" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="*" />
</ItemGroup> </ItemGroup>
</Project> </Project>
...@@ -19,6 +19,8 @@ namespace StatusMonitor.Web.Controllers.Api ...@@ -19,6 +19,8 @@ namespace StatusMonitor.Web.Controllers.Api
// Retrieve requested metric // Retrieve requested metric
var metric = await _metricService.GetOrCreateMetricAsync(Metrics.Compilation, model.Source); var metric = await _metricService.GetOrCreateMetricAsync(Metrics.Compilation, model.Source);
_context.Attach(metric);
// Retrieve requested user action // Retrieve requested user action
var compilationStage = var compilationStage =
await _context await _context
... ...
......
...@@ -16,6 +16,8 @@ namespace StatusMonitor.Web.Controllers.Api ...@@ -16,6 +16,8 @@ namespace StatusMonitor.Web.Controllers.Api
// Retrieve requested metric // Retrieve requested metric
var metric = await _metricService.GetOrCreateMetricAsync(Metrics.CpuLoad, model.Source); var metric = await _metricService.GetOrCreateMetricAsync(Metrics.CpuLoad, model.Source);
_context.Attach(metric);
// Record data // Record data
await _context await _context
.NumericDataPoints .NumericDataPoints
... ...
......
...@@ -18,6 +18,8 @@ namespace StatusMonitor.Web.Controllers.Api ...@@ -18,6 +18,8 @@ namespace StatusMonitor.Web.Controllers.Api
// Retrieve requested metric // Retrieve requested metric
var metric = await _metricService.GetOrCreateMetricAsync(Metrics.Log, model.Source); var metric = await _metricService.GetOrCreateMetricAsync(Metrics.Log, model.Source);
_context.Attach(metric);
// Retrieve requested user action // Retrieve requested user action
var logSeverity = var logSeverity =
await _context await _context
... ...
......
...@@ -18,6 +18,8 @@ namespace StatusMonitor.Web.Controllers.Api ...@@ -18,6 +18,8 @@ namespace StatusMonitor.Web.Controllers.Api
// Retrieve requested metric // Retrieve requested metric
var metric = await _metricService.GetOrCreateMetricAsync(Metrics.UserAction, model.Source); var metric = await _metricService.GetOrCreateMetricAsync(Metrics.UserAction, model.Source);
_context.Attach(metric);
// Record data // Record data
await _context await _context
.UserActionDataPoints .UserActionDataPoints
... ...
......
FROM microsoft/dotnet:1.1.1-runtime FROM microsoft/dotnet:2.0.3-runtime
# Create directory for the app source code # Create directory for the app source code
WORKDIR /srv WORKDIR /srv
# Copy the binary # Copy the binary
COPY bin/release/netcoreapp1.1/publish/ /srv COPY bin/release/netcoreapp2.0/publish/ /srv
# Expose the port and start the app # Expose the port and start the app
EXPOSE 5555 EXPOSE 5555
... ...
......
using System; using System;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Console;
using StatusMonitor.Shared.Extensions; using StatusMonitor.Shared.Extensions;
namespace StatusMonitor.Web namespace StatusMonitor.Web
...@@ -42,13 +45,17 @@ namespace StatusMonitor.Web ...@@ -42,13 +45,17 @@ namespace StatusMonitor.Web
{ {
try try
{ {
var host = new WebHostBuilder() var host = WebHost
.UseKestrel() .CreateDefaultBuilder(args)
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>() .UseStartup<Startup>()
.ConfigureLogging(
logging => {
logging.ClearProviders();
logging.AddFilter("Microsoft", LogLevel.None);
}
)
.UseUrls($"http://*:{port}") .UseUrls($"http://*:{port}")
.Build(); // Connection to the database happens in .Build() .Build();
host.Run(); host.Run();
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment