Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ShohjahonSohibov/repo-for-agent/llms.txt

Use this file to discover all available pages before exploring further.

UpdaterAgent is packaged as a containerised .NET 8 application alongside a PostgreSQL 16.4 database. The same Docker Compose file drives all environments; runtime behaviour is controlled by ASPNETCORE_ENVIRONMENT and the corresponding appsettings file. This page covers everything needed to build, run, and observe a deployed instance.

Docker Compose services

The docker-compose.yml at the repository root defines two services that share a private db-network.
services:
  updater-agent-api:
    image: updater-agent-api:latest
    build:
      context: .
      dockerfile: src/UpdaterAgent.Api/Dockerfile
      args:
        ASPNETCORE_ENVIRONMENT: ${ASPNETCORE_ENVIRONMENT}
    ports:
      - "8080:8080"
    environment:
      OTEL_EXPORTER_OTLP_PROTOCOL: ${OTEL_EXPORTER_OTLP_PROTOCOL}
      OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT}
      OTEL_EXPORTER_OTLP_HEADERS: ${OTEL_EXPORTER_OTLP_HEADERS}
      ConnectionStrings__DefaultConnectionString: "Host=${DB_HOST};Port=${DB_PORT};Database=${DB_NAME};Username=${DB_USER};Password=${DB_PASSWORD}"
      LOKI_URL: ${LOKI_URL}
      LOKI_USERNAME: ${LOKI_USERNAME}
      LOKI_PASSWORD: ${LOKI_PASSWORD}
      TELEGRAM_TOKEN: ${TELEGRAM_TOKEN}
      TELEGRAM_GROUP_ID: ${TELEGRAM_GROUP_ID}
    restart: always
    networks:
      - db-network

  db:
    image: postgres:16.4
    container_name: agent_db
    restart: unless-stopped
    ports:
      - "5432:5432"
    volumes:
      - ~/apps/postgres:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: ${DB_USER}
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_DB: ${DB_NAME}
    networks:
      - db-network
All sensitive values (DB_PASSWORD, TELEGRAM_TOKEN, OTLP headers, Loki credentials) are read from environment variables at runtime. Never hard-code secrets in docker-compose.yml or commit them to the repository.

Environment configurations

The API reads its configuration from appsettings.json combined with the environment-specific override file. Set ASPNETCORE_ENVIRONMENT to control which file is loaded.
Environmentappsettings filePurpose
Developmentappsettings.Development.jsonLocal development
Stagingappsettings.Staging.jsonPre-production testing
Sandboxappsettings.Sandbox.jsonIntegration testing
Productionappsettings.Production.jsonLive environment
# Set the target environment before starting the container
export ASPNETCORE_ENVIRONMENT=Staging
docker compose up -d

Deployment steps

1

Build the solution

Verify the solution compiles cleanly before building the container image.
dotnet build UpdaterAgent.sln
2

Apply database migrations

Run EF Core migrations against the target database before starting the application. This creates or updates the schema to match the current codebase.
# Add a new migration (development only)
dotnet ef migrations add MigrationName \
  -p src/UpdaterAgent.Infrastructure \
  -s src/UpdaterAgent.Api

# Apply all pending migrations
dotnet ef database update \
  --project src/UpdaterAgent.Infrastructure \
  --startup-project src/UpdaterAgent.Api
3

Start the services

Launch both the API and the database with Docker Compose.
docker compose up -d
To run the API locally without Docker:
cd src/UpdaterAgent.Api && dotnet run
4

Verify the deployment

Confirm the application is healthy before routing traffic to it.
curl http://localhost:5000/health
# Expected: {"status":"Healthy"}

Useful URLs

ResourceURL
Swagger UIhttps://localhost:5001/swagger
Hangfire dashboardhttps://localhost:5001/hangfire
Health checkhttp://localhost:5000/health
API basehttps://localhost:5001/api/v1

Observability stack

UpdaterAgent ships with a full observability stack configured at startup.
All log output is structured JSON via Serilog. Multiple sinks are configured per environment, including console, file, and Grafana Loki. Log level and sink destinations are controlled by appsettings.{Environment}.json.
{
  "Serilog": {
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Microsoft": "Warning",
        "Microsoft.AspNetCore": "Warning"
      }
    }
  }
}
Logs are shipped to a Grafana Loki instance using the LOKI_URL, LOKI_USERNAME, and LOKI_PASSWORD environment variables. Loki labels are set per service and environment for efficient querying in Grafana dashboards.
The application uses TELEGRAM_TOKEN and TELEGRAM_GROUP_ID to send critical error alerts directly to a configured Telegram group. Background job failures and unhandled exceptions at or above the Error level trigger a notification.
Traces are exported via the OTLP exporter. Configure the endpoint and authentication using the environment variables below.
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_ENDPOINT=https://your-otlp-endpoint
OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer <token>
The Hangfire dashboard at /hangfire is protected by HangfireAuthorizationFilter. Access requires an authenticated session with an admin role. A 403 response in a fresh environment indicates the user is not logged in or does not have the required role.

Build docs developers (and LLMs) love