Skip to content

Commit 643c156

Browse files
simplifying the webservice again
1 parent d89cc8b commit 643c156

9 files changed

+36
-246
lines changed

WebService/Controllers/HealthCheckController.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace WebService.Controllers
44
{
5-
[Route("/")]
5+
[Route("/healthcheck")]
66
public class HealthCheckController : Controller
77
{
88
[HttpGet]

WebService/Dockerfile

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
FROM microsoft/dotnet:1.1.0-sdk-projectjson
2-
3-
COPY . ./app
4-
WORKDIR ./app
5-
RUN dotnet restore
6-
RUN dotnet build
1+
FROM microsoft/dotnet:1.1.2-sdk
2+
3+
COPY . /app
4+
5+
WORKDIR /app
6+
7+
RUN dotnet restore
8+
9+
RUN dotnet build -c Release
710

811
EXPOSE 4000
912

WebService/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.IO;
1+
using System.IO;
22
using Microsoft.AspNetCore.Hosting;
33
using Serilog;
44

WebService/Program.cs.orig

-38
This file was deleted.

WebService/Startup.cs

+2-14
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
using Microsoft.AspNetCore.Builder;
1+
using Microsoft.AspNetCore.Builder;
22
using Microsoft.AspNetCore.Hosting;
33
using Microsoft.Extensions.Configuration;
44
using Microsoft.Extensions.DependencyInjection;
55
using Microsoft.Extensions.Logging;
66
using Serilog;
7-
using Serilog.Core;
87

98
namespace WebService
109
{
@@ -19,12 +18,6 @@ public Startup(IHostingEnvironment env)
1918
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
2019
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
2120

22-
if (env.IsEnvironment("Development"))
23-
{
24-
// This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
25-
builder.AddApplicationInsightsSettings(developerMode: true);
26-
}
27-
2821
builder.AddEnvironmentVariables();
2922
Configuration = builder.Build();
3023

@@ -37,19 +30,14 @@ public Startup(IHostingEnvironment env)
3730
public void ConfigureServices(IServiceCollection services)
3831
{
3932
// Add framework services.
40-
services.AddApplicationInsightsTelemetry(Configuration);
4133
services.AddMvc();
4234
}
4335

4436
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
4537
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
4638
{
4739
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
48-
loggerFactory.AddDebug();
49-
50-
app.UseApplicationInsightsRequestTelemetry();
51-
52-
app.UseApplicationInsightsExceptionTelemetry();
40+
loggerFactory.AddDebug();
5341

5442
app.UseMvc();
5543
}

WebService/WebService.csproj

+11-26
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
44
<TargetFramework>netcoreapp1.1</TargetFramework>
@@ -18,31 +18,16 @@
1818
</ItemGroup>
1919

2020
<ItemGroup>
21-
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="1.0.0" />
22-
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.0.2" />
23-
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.0.2" />
24-
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.0.2" />
25-
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.0.2" />
26-
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.3" />
27-
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.0.3" />
28-
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.0.2" />
29-
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.0.3" />
30-
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.2" />
31-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="1.0.3" />
32-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.0.0">
33-
<PrivateAssets>All</PrivateAssets>
34-
</PackageReference>
35-
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.0.2" />
36-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.0.2" />
37-
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.0.2" />
38-
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.0.2" />
39-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.0.2" />
40-
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.2" />
41-
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.0.1" />
42-
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.0.0">
43-
<PrivateAssets>All</PrivateAssets>
44-
</PackageReference>
45-
<PackageReference Include="Serilog.Sinks.Literate" Version="2.1.0-dev-00034" />
21+
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
22+
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.2" />
23+
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.2" />
24+
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
25+
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.2" />
26+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.2" />
27+
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
28+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.2" />
29+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
30+
<PackageReference Include="Serilog.Sinks.Literate" Version="2.1.0" />
4631
</ItemGroup>
4732

4833
</Project>

WebService/appsettings.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
{
2-
"Logging": {
3-
"IncludeScopes": false,
4-
"LogLevel": {
5-
"Default": "Verbose",
6-
"System": "Information",
7-
"Microsoft": "Information"
8-
}
9-
}
10-
}
1+
{
2+
"Logging": {
3+
"IncludeScopes": false,
4+
"LogLevel": {
5+
"Default": "Verbose",
6+
"System": "Warning",
7+
"Microsoft": "Warning"
8+
}
9+
}
10+
}

WebService/project.json.orig

-94
This file was deleted.

docker-compose.yml

+2-56
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,13 @@
1-
#
1+
#
22
# WebService - microservice
33
#
44
webservice:
55
build: ./WebService
66
ports:
7-
- "4000:4000"
8-
environment:
9-
AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID}"
10-
AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY}"
11-
AWS_SESSION_TOKEN: "${AWS_SESSION_TOKEN}"
12-
ENV: "${ENV}"
13-
DC: "${DC}"
14-
REGION: "${REGION}"
7+
- 4001:4000
158

169
#
1710
# WorkerService - microservice
1811
#
1912
workerservice:
2013
build: ./WorkerService
21-
environment:
22-
AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID}"
23-
AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY}"
24-
AWS_SESSION_TOKEN: "${AWS_SESSION_TOKEN}"
25-
ENV: "${ENV}"
26-
DC: "${DC}"
27-
REGION: "${REGION}"
28-
29-
#
30-
# Example using links and environment variables
31-
# Delete it if you dont need it
32-
#
33-
#
34-
# eventstore
35-
#
36-
#eventstore:
37-
# image: kpadmanabhan/eventstore
38-
# environment:
39-
# SERVICE_2113_NAME: "eventstore-http"
40-
# SERVICE_1113_NAME: "eventstore-tcp"
41-
# ports:
42-
# - "2113:2113"
43-
# - "1113:1113"
44-
# links:
45-
# - consul
46-
# - registrator
47-
#
48-
# Service Discovery - Consul
49-
#
50-
#consul:
51-
# command: -server -bootstrap -advertise 192.168.98.100 -dc dev
52-
# image: progrium/consul:latest
53-
# ports:
54-
# - "8300:8300"
55-
# - "8400:8400"
56-
# - "8500:8500"
57-
# - "8600:53/udp"
58-
#
59-
# Service Discovery - Registrator
60-
#
61-
#registrator:
62-
# command: -ip 192.168.98.100 consul://192.168.98.100:8500
63-
# image: gliderlabs/registrator:latest
64-
# links:
65-
# - consul
66-
# volumes:
67-
# - "/var/run/docker.sock:/tmp/docker.sock"

0 commit comments

Comments
 (0)