Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
COPY . /src/

WORKDIR /src
RUN dotnet restore
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.7-alpine AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
WORKDIR /app
COPY --from=build /src/out ./
COPY --from=opbeans/opbeans-frontend:latest /app/build /opbeans-frontend
Expand Down
95 changes: 0 additions & 95 deletions docker-compose-elastic-cloud.yml

This file was deleted.

147 changes: 0 additions & 147 deletions docker-compose.yml

This file was deleted.

2 changes: 1 addition & 1 deletion opbeans-dotnet/Controllers/ProductsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public ActionResult<IEnumerable<Product>> Get() =>

[HttpGet("top")]
public ActionResult<IEnumerable<Product>> Top() =>
_dbDbContext.Products.FromSql(@"SELECT
_dbDbContext.Products.FromSqlRaw(@"SELECT
products.id, sku, name, description, cost, selling_price, stock, type_id , SUM(order_lines.amount) AS sold
FROM products JOIN order_lines ON products.id=product_id GROUP BY products.id ORDER BY sold DESC")
.Select(n => Mapper.Map<Product>(n)).ToList();
Expand Down
2 changes: 1 addition & 1 deletion opbeans-dotnet/Data/Seed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class Seed
//without a primary key I added 'id INTEGER PRIMARY KEY AUTOINCREMENT' to the `order_lines` table. Other than that
//this is the default sql script.
public static void SeedDb(OpbeansDbContext dbDbContext) =>
dbDbContext.Database.ExecuteSqlCommand(
dbDbContext.Database.ExecuteSqlRaw(
@"
-- Drop everything
DROP TABLE IF EXISTS 'products';
Expand Down
16 changes: 10 additions & 6 deletions opbeans-dotnet/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ public void ConfigureServices(IServiceCollection services)
Seed.SeedDb(context);

services.AddDbContext<OpbeansDbContext>
(options => options.UseSqlite(@"Data Source=opbeans.db"));
(options =>
{
options.UseSqlite(@"Data Source=opbeans.db");
// This is a sample app with a sample dummy db
// it's fine to log any data, it's better for debugging.
options.EnableSensitiveDataLogging();
}
);
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Expand All @@ -62,7 +69,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
var dtProbabilityEnvVar = Environment.GetEnvironmentVariable("OPBEANS_DT_PROBABILITY");

if (!double.TryParse(dtProbabilityEnvVar, NumberStyles.Float, CultureInfo.InvariantCulture,
out var dtProbability))
out var dtProbability))
dtProbability = 0.5;

var random = new Random(DateTime.UtcNow.Millisecond);
Expand Down Expand Up @@ -115,10 +122,7 @@ await httpClient.GetAsync(
app.UseHttpsRedirection();

app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
}

private static List<string> KnownApis =>
Expand Down
6 changes: 3 additions & 3 deletions opbeans-dotnet/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Debug",
"Microsoft": "Debug"
"Default": "Trace",
"System": "Trace",
"Microsoft": "Trace"
}
}
}
2 changes: 1 addition & 1 deletion opbeans-dotnet/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug"
"Default": "Trace"
}
},
"ElasticApm":
Expand Down
7 changes: 4 additions & 3 deletions opbeans-dotnet/opbeans-dotnet.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<RootNamespace>OpbeansDotnet</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="8.0.0" />
<PackageReference Include="Elastic.Apm.NetCoreAll" Version="1.11.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.0" />
<PackageReference Include="Elastic.Apm.NetCoreAll" Version="1.14.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.5" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>

</Project>