dotnet-monitor Docker & Self-Hosted Deployment

GitHub

This repository contains the source code for .NET Monitor - a tool that allows you to gather diagnostic data from running applications using HTTP endpoints

726 stars C# C# 74 files ยท ~134,475 tokens
RAW Compose
1. Pull Image (DOCKERHUB) docker pull mcr.microsoft.com/dotnet/samples
2. Docker Run (1-Click Launch) docker run -d --name dotnet-monitor -p 8080:8080 --restart always mcr.microsoft.com/dotnet/samples:aspnetapp-chiseled
3. Podman Run podman run -d --name dotnet-monitor -p 8080:8080 --restart always mcr.microsoft.com/dotnet/samples:aspnetapp-chiseled
4. Skopeo Inspect (Zero-Pull Manifest) skopeo inspect docker://docker.io/mcr.microsoft.com/dotnet/samples:aspnetapp-chiseled
5. ORAS Pull (OCI Artifact) oras pull mcr.microsoft.com/dotnet/samples:aspnetapp-chiseled
6. Compose Deployment docker compose up -d
samples/Docker/compose.yaml
Download .yml
# Tell us about your experience using dotnet monitor: https://aka.ms/dotnet-monitor-survey
services:
  app:
    image: mcr.microsoft.com/dotnet/samples:aspnetapp-chiseled
    ports:
      - "8080:8080"
    environment:
      - DOTNET_DiagnosticPorts=/diag/dotnet-monitor.sock
    volumes:
      - diagvol:/diag
    deploy:
      resources:
        limits:
          cpus: '0.250'
          memory: 512M

  monitor:
    image: mcr.microsoft.com/dotnet/monitor:8
    # DO NOT use the --no-auth argument for deployments in production; this argument is used for demonstration
    # purposes only in this example. Please continue reading after this example for further details.
    command: ["collect", "--no-auth"]
    ports:
      - "52323:52323"
      - "52325:52325"
    environment:
      - DOTNETMONITOR_DiagnosticPort__ConnectionMode=Listen
      - DOTNETMONITOR_Storage__DefaultSharedPath=/diag
      # ALWAYS use the HTTPS form of the URL for deployments in production; the removal of HTTPS is done for
      # demonstration purposes only in this example. Please continue reading after this example for further details.
      - DOTNETMONITOR_Urls=http://+:52323
      # The metrics URL is set in the CMD instruction of the image by default. However, this deployment overrides that with the args setting; manually set the URL to the same value using configuration.
      - DOTNETMONITOR_Metrics__Endpoints=http://+:52325
      # The image will output logging in a json format by default, which is great for ingestion by tools such as Azure Monitor Log Analytics.
      # Switch the logging format to simple for this sample for easier reading.
      - Logging__Console__FormatterName=simple
    volumes:
      - diagvol:/diag
    deploy:
      resources:
        reservations:
          cpus: '0.050'
          memory: 50M
        limits:
          cpus: '0.250'
          memory: 256M

volumes:
  diagvol:
    driver_opts:
      type: tmpfs
      device: tmpfs