mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 10:11:10 +00:00
Adds a local observability stack and container wiring
This commit is contained in:
1 parent
6af3d4f5e5
commit
0f903e6ff2
10 files changed
+314
-2
No files matched your search
+1
@@ -29,6 +29,7 @@ internal static class PresentationApiLayerConfiguration
|
|||||||
configuration.SetBasePath(basePath);
|
configuration.SetBasePath(basePath);
|
||||||
configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
||||||
configuration.AddJsonFile("appsettings.development.json", optional: true, reloadOnChange: true);
|
configuration.AddJsonFile("appsettings.development.json", optional: true, reloadOnChange: true);
|
||||||
|
configuration.AddEnvironmentVariables(); // environment variables should override the configuration files
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
# This stage is used when running from VS in fast mode (Default for Debug configuration)
|
# This stage is used when running from VS in fast mode (Default for Debug configuration)
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
||||||
RUN mkdir /logs && chown -R app:app /logs
|
# curl is used by the container healthcheck to probe the /health endpoints
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends curl \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& mkdir /logs && chown -R app:app /logs
|
||||||
USER app
|
USER app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 5214
|
EXPOSE 5214
|
||||||
@@ -18,8 +22,10 @@ COPY ["Lumina.Presentation.Api/Lumina.Presentation.Api.csproj", "Lumina.Presenta
|
|||||||
COPY ["Lumina.Application/Lumina.Application.csproj", "Lumina.Application/"]
|
COPY ["Lumina.Application/Lumina.Application.csproj", "Lumina.Application/"]
|
||||||
COPY ["Lumina.Contracts/Lumina.Contracts.csproj", "Lumina.Contracts/"]
|
COPY ["Lumina.Contracts/Lumina.Contracts.csproj", "Lumina.Contracts/"]
|
||||||
COPY ["Lumina.Domain/Lumina.Domain.csproj", "Lumina.Domain/"]
|
COPY ["Lumina.Domain/Lumina.Domain.csproj", "Lumina.Domain/"]
|
||||||
|
COPY ["Lumina.Domain.SharedKernel/Lumina.Domain.SharedKernel.csproj", "Lumina.Domain.SharedKernel/"]
|
||||||
COPY ["Lumina.Infrastructure/Lumina.Infrastructure.csproj", "Lumina.Infrastructure/"]
|
COPY ["Lumina.Infrastructure/Lumina.Infrastructure.csproj", "Lumina.Infrastructure/"]
|
||||||
COPY ["Lumina.DataAccess/Lumina.DataAccess.csproj", "Lumina.DataAccess/"]
|
COPY ["Lumina.DataAccess/Lumina.DataAccess.csproj", "Lumina.DataAccess/"]
|
||||||
|
COPY ["Lumina.Plugins.Contracts/Lumina.Plugins.Contracts.csproj", "Lumina.Plugins.Contracts/"]
|
||||||
|
|
||||||
RUN dotnet restore "./Lumina.Presentation.Api/Lumina.Presentation.Api.csproj" /p:BaseOutputPath=/app/publish/
|
RUN dotnet restore "./Lumina.Presentation.Api/Lumina.Presentation.Api.csproj" /p:BaseOutputPath=/app/publish/
|
||||||
|
|
||||||
@@ -49,6 +55,8 @@ FROM base AS final
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=publish /app/publish .
|
COPY --from=publish /app/publish .
|
||||||
|
# The HTTP port is controlled per run mode: launchSettings.json for local development, ASPNETCORE_HTTP_PORTS here for
|
||||||
|
# Docker, and for a published DLL run directly on a host, ASPNETCORE_URLS (or ASPNETCORE_HTTP_PORTS) must be set
|
||||||
ENV ASPNETCORE_HTTP_PORTS=5214
|
ENV ASPNETCORE_HTTP_PORTS=5214
|
||||||
EXPOSE 5214
|
EXPOSE 5214
|
||||||
ENTRYPOINT ["dotnet", "Lumina.Presentation.Api.dll"]
|
ENTRYPOINT ["dotnet", "Lumina.Presentation.Api.dll"]
|
||||||
|
|||||||
+1
@@ -25,6 +25,7 @@ internal static class PresentationWebLayerConfiguration
|
|||||||
// add the configuration sources to the configuration builder
|
// add the configuration sources to the configuration builder
|
||||||
configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
||||||
configuration.AddJsonFile("appsettings.development.json", optional: true, reloadOnChange: true);
|
configuration.AddJsonFile("appsettings.development.json", optional: true, reloadOnChange: true);
|
||||||
|
configuration.AddEnvironmentVariables(); // environment variables should override the configuration files
|
||||||
|
|
||||||
serviceCollection.AddOptions<ServerConfigurationDto>()
|
serviceCollection.AddOptions<ServerConfigurationDto>()
|
||||||
.Bind(configuration.GetRequiredSection(ServerConfigurationDto.SECTION_NAME))
|
.Bind(configuration.GetRequiredSection(ServerConfigurationDto.SECTION_NAME))
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
# This stage is used when running from VS in fast mode (Default for Debug configuration)
|
# This stage is used when running from VS in fast mode (Default for Debug configuration)
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
||||||
RUN mkdir /logs && chown -R app:app /logs
|
# curl is used by the container healthcheck to probe the /health endpoints
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends curl \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& mkdir /logs && chown -R app:app /logs
|
||||||
USER app
|
USER app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 5012
|
EXPOSE 5012
|
||||||
@@ -40,6 +44,8 @@ FROM base AS final
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=publish /app/publish .
|
COPY --from=publish /app/publish .
|
||||||
|
# The HTTP port is controlled per run mode: launchSettings.json for local development, ASPNETCORE_HTTP_PORTS here for
|
||||||
|
# Docker, and for a published DLL run directly on a host, ASPNETCORE_URLS (or ASPNETCORE_HTTP_PORTS) must be set
|
||||||
ENV ASPNETCORE_HTTP_PORTS=5012
|
ENV ASPNETCORE_HTTP_PORTS=5012
|
||||||
EXPOSE 5012
|
EXPOSE 5012
|
||||||
ENTRYPOINT ["dotnet", "Lumina.Presentation.Web.dll"]
|
ENTRYPOINT ["dotnet", "Lumina.Presentation.Web.dll"]
|
||||||
|
|||||||
@@ -7,6 +7,20 @@ services:
|
|||||||
dockerfile: Lumina.Presentation.Api/Dockerfile
|
dockerfile: Lumina.Presentation.Api/Dockerfile
|
||||||
environment:
|
environment:
|
||||||
- LOG_PATH=/logs
|
- LOG_PATH=/logs
|
||||||
|
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
|
||||||
|
# The API validates JwtSettings:SecretKey and EncryptionSettings:SecretKey with ValidateOnStart(). In the
|
||||||
|
# Development environment they come from appsettings.development.json; for any non-development run they must be
|
||||||
|
# supplied here, otherwise the API crashes on startup:
|
||||||
|
# - JwtSettings__SecretKey=<secret>
|
||||||
|
# - EncryptionSettings__SecretKey=<base64 secret>
|
||||||
|
depends_on:
|
||||||
|
- otel-collector
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "curl -sf http://localhost:5214/health/ready || exit 1"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 3
|
||||||
|
start_period: 60s
|
||||||
|
|
||||||
lumina-web:
|
lumina-web:
|
||||||
container_name: lumina-web
|
container_name: lumina-web
|
||||||
@@ -16,3 +30,64 @@ services:
|
|||||||
dockerfile: Lumina.Presentation.Web/Dockerfile
|
dockerfile: Lumina.Presentation.Web/Dockerfile
|
||||||
environment:
|
environment:
|
||||||
- LOG_PATH=/logs
|
- LOG_PATH=/logs
|
||||||
|
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
|
||||||
|
- ServerConfiguration__BaseAddress=http://lumina-api
|
||||||
|
depends_on:
|
||||||
|
- otel-collector
|
||||||
|
- lumina-api
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "curl -sf http://localhost:5012/health/ready || exit 1"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 3
|
||||||
|
start_period: 60s
|
||||||
|
|
||||||
|
otel-collector:
|
||||||
|
container_name: otel-collector
|
||||||
|
image: otel/opentelemetry-collector-contrib:0.159.0
|
||||||
|
command:
|
||||||
|
- "--config=/etc/otelcol/config.yml"
|
||||||
|
volumes:
|
||||||
|
- ./otel-collector/otel-collector-config.yml:/etc/otelcol/config.yml:ro
|
||||||
|
ports:
|
||||||
|
- "4317:4317"
|
||||||
|
- "4318:4318"
|
||||||
|
- "8889:8889"
|
||||||
|
depends_on:
|
||||||
|
- jaeger
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
jaeger:
|
||||||
|
container_name: jaeger
|
||||||
|
image: jaegertracing/all-in-one:1.76.0
|
||||||
|
environment:
|
||||||
|
- COLLECTOR_OTLP_ENABLED=true
|
||||||
|
ports:
|
||||||
|
- "16686:16686"
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
prometheus:
|
||||||
|
container_name: prometheus
|
||||||
|
image: prom/prometheus:v3
|
||||||
|
volumes:
|
||||||
|
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||||||
|
ports:
|
||||||
|
- "9090:9090"
|
||||||
|
depends_on:
|
||||||
|
- otel-collector
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
grafana:
|
||||||
|
container_name: grafana
|
||||||
|
image: grafana/grafana:13.0.7-ubuntu-slim
|
||||||
|
environment:
|
||||||
|
# dev-only stack: set a non-default admin password (override GRAFANA_ADMIN_PASSWORD in real deployments)
|
||||||
|
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-lumina-admin}
|
||||||
|
volumes:
|
||||||
|
- ./grafana/provisioning:/etc/grafana/provisioning:ro
|
||||||
|
- ./grafana/dashboards:/var/lib/grafana/dashboards:ro
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:3000:3000"
|
||||||
|
depends_on:
|
||||||
|
- prometheus
|
||||||
|
restart: unless-stopped
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
{
|
||||||
|
"annotations": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"builtIn": 1,
|
||||||
|
"datasource": {
|
||||||
|
"type": "grafana",
|
||||||
|
"uid": "-- Grafana --"
|
||||||
|
},
|
||||||
|
"enable": true,
|
||||||
|
"hide": true,
|
||||||
|
"iconColor": "rgba(0, 211, 255, 1)",
|
||||||
|
"name": "Annotations & Alerts",
|
||||||
|
"type": "dashboard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"editable": true,
|
||||||
|
"fiscalYearStartMonth": 0,
|
||||||
|
"graphTooltip": 1,
|
||||||
|
"id": null,
|
||||||
|
"links": [],
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"datasource": {
|
||||||
|
"type": "prometheus",
|
||||||
|
"uid": "prometheus"
|
||||||
|
},
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"unit": "ms"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 8,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 1,
|
||||||
|
"options": {
|
||||||
|
"legend": {
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"showLegend": true
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "multi",
|
||||||
|
"sort": "desc"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"datasource": {
|
||||||
|
"type": "prometheus",
|
||||||
|
"uid": "prometheus"
|
||||||
|
},
|
||||||
|
"expr": "histogram_quantile(0.95, sum(rate(lumina_application_handler_duration_bucket[5m])) by (le, lumina_handler_type))",
|
||||||
|
"legendFormat": "p95 {{lumina_handler_type}}",
|
||||||
|
"refId": "A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": {
|
||||||
|
"type": "prometheus",
|
||||||
|
"uid": "prometheus"
|
||||||
|
},
|
||||||
|
"expr": "histogram_quantile(0.50, sum(rate(lumina_application_handler_duration_bucket[5m])) by (le, lumina_handler_type))",
|
||||||
|
"legendFormat": "p50 {{lumina_handler_type}}",
|
||||||
|
"refId": "B"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Application handler duration",
|
||||||
|
"type": "timeseries"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": {
|
||||||
|
"type": "prometheus",
|
||||||
|
"uid": "prometheus"
|
||||||
|
},
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"unit": "ops"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 8,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 2,
|
||||||
|
"options": {
|
||||||
|
"legend": {
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"showLegend": true
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "multi",
|
||||||
|
"sort": "desc"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"datasource": {
|
||||||
|
"type": "prometheus",
|
||||||
|
"uid": "prometheus"
|
||||||
|
},
|
||||||
|
"expr": "sum(rate(lumina_application_handler_invocations_total[5m])) by (lumina_handler_type, lumina_outcome)",
|
||||||
|
"legendFormat": "{{lumina_handler_type}} {{lumina_outcome}}",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Application handler invocations",
|
||||||
|
"type": "timeseries"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"refresh": "10s",
|
||||||
|
"schemaVersion": 40,
|
||||||
|
"tags": [
|
||||||
|
"lumina",
|
||||||
|
"telemetry"
|
||||||
|
],
|
||||||
|
"templating": {
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"from": "now-15m",
|
||||||
|
"to": "now"
|
||||||
|
},
|
||||||
|
"timepicker": {},
|
||||||
|
"timezone": "",
|
||||||
|
"title": "Lumina",
|
||||||
|
"uid": "lumina-overview",
|
||||||
|
"version": 1
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: 1
|
||||||
|
|
||||||
|
providers:
|
||||||
|
- name: Lumina
|
||||||
|
orgId: 1
|
||||||
|
folder: Lumina
|
||||||
|
type: file
|
||||||
|
disableDeletion: false
|
||||||
|
updateIntervalSeconds: 30
|
||||||
|
allowUiUpdates: true
|
||||||
|
options:
|
||||||
|
path: /var/lib/grafana/dashboards
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
apiVersion: 1
|
||||||
|
|
||||||
|
datasources:
|
||||||
|
- name: Prometheus
|
||||||
|
uid: prometheus
|
||||||
|
type: prometheus
|
||||||
|
access: proxy
|
||||||
|
url: http://prometheus:9090
|
||||||
|
isDefault: true
|
||||||
|
editable: true
|
||||||
|
- name: Jaeger
|
||||||
|
uid: jaeger
|
||||||
|
type: jaeger
|
||||||
|
access: proxy
|
||||||
|
url: http://jaeger:16686
|
||||||
|
editable: true
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
receivers:
|
||||||
|
otlp:
|
||||||
|
protocols:
|
||||||
|
grpc:
|
||||||
|
endpoint: 0.0.0.0:4317
|
||||||
|
http:
|
||||||
|
endpoint: 0.0.0.0:4318
|
||||||
|
|
||||||
|
processors:
|
||||||
|
memory_limiter:
|
||||||
|
check_interval: 5s
|
||||||
|
limit_mib: 512
|
||||||
|
spike_limit_mib: 128
|
||||||
|
batch:
|
||||||
|
|
||||||
|
exporters:
|
||||||
|
otlp/jaeger:
|
||||||
|
endpoint: jaeger:4317
|
||||||
|
tls:
|
||||||
|
insecure: true
|
||||||
|
prometheus:
|
||||||
|
endpoint: 0.0.0.0:8889
|
||||||
|
|
||||||
|
extensions:
|
||||||
|
health_check:
|
||||||
|
|
||||||
|
service:
|
||||||
|
extensions:
|
||||||
|
- health_check
|
||||||
|
pipelines:
|
||||||
|
traces:
|
||||||
|
receivers:
|
||||||
|
- otlp
|
||||||
|
processors:
|
||||||
|
- memory_limiter
|
||||||
|
- batch
|
||||||
|
exporters:
|
||||||
|
- otlp/jaeger
|
||||||
|
metrics:
|
||||||
|
receivers:
|
||||||
|
- otlp
|
||||||
|
processors:
|
||||||
|
- memory_limiter
|
||||||
|
- batch
|
||||||
|
exporters:
|
||||||
|
- prometheus
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
global:
|
||||||
|
scrape_interval: 15s
|
||||||
|
evaluation_interval: 15s
|
||||||
|
|
||||||
|
scrape_configs:
|
||||||
|
- job_name: otel-collector
|
||||||
|
static_configs:
|
||||||
|
- targets:
|
||||||
|
- otel-collector:8889
|
||||||
Reference in new issue
Block a user