0

I am trying to host Grafana (as well as a few other logging tools in a sidecar pattern) in an Azure Container App, and I’ve been having an issue where the container appears to start correctly, but when I go to the URL the page just loads forever until it eventually times out.

My setup is fairly basic at the moment, pulling the latest image from docker.io and setting a few environment variables. While I am also using Front Door as a reverse proxy (and have followed the guide on accessing Grafana behind a reverse proxy), neither the Front Door URL, nor the direct container URL work.

There are no obvious errors in the console or system log, there’s a lot of logs to post so if you need any in particular let me know. And Azure is reporting the container revision and provisioned and started.

When I run netstat in the console, I do not see port 3000 but I'm unsure if I'm running it correctly. enter image description here

When I try and access the container URL, it just tries to load until it eventually hits either the Front Door or Envoy timeout. Nothing shows up in the console stream during this time.

enter image description here

The bicep file I am using to deploy:

param containerResources object = {
  cpu: '0.25'
  memory: '0.5Gi'
}
resource containerApp 'Microsoft.App/containerApps@2023-05-02-preview' = {
  name: <containerName>
  location: <azureLocation>
  tags: {
    'Resource-Name': <containerAppEnvironmentName>
    'Resource-Description': 'Containerised application hosted in a managed container environment'
    'Platform-Environment': substring(resourceGroup().name, 0, 3)
  }
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    managedEnvironmentId: <containerAppEnvironment>.id
    configuration: {
      activeRevisionsMode: 'Multiple'
      ingress: {
        external: true
        allowInsecure: false
        targetPort: 3000
        transport: 'auto'
        traffic: [
          {
            weight: 100
            latestRevision: true
          }
        ]
      } 
    }
    template: {
      revisionSuffix: <containerRevision>
      containers: [
        {
          name: 'jaeger-tracing'
          image: 'jaegertracing/all-in-one:latest'
          resources: {
            cpu: containerResources.cpu
            memory: containerResources.memory
          }
        },{
          name: 'loki-logs'
          image: 'grafana/loki:latest'
          args: ['-config.file=/etc/loki/local-config.yaml']
          resources: {
            cpu: containerResources.cpu
            memory: containerResources.memory
          }
        },{
          name: 'prometheus-metrics'
          image: 'prom/prometheus:latest'
          args: ['--config.file=/etc/prometheus/prometheus.yaml', '--web.listen-address=:8080']
          resources: {
            cpu: containerResources.cpu
            memory: containerResources.memory
          }
          env: [ 
            {
              name: 'config.file'
              value: '/etc/prometheus/prometheus.yaml'
            }
          ]
        },{
          name: 'collector-aggregator'
          image: 'otel/opentelemetry-collector-contrib:latest'
          args: ['--config=/etc/otel-collector.yaml']
          resources: {
            cpu: containerResources.cpu
            memory: containerResources.memory
          }
        },{
          name: 'grafana-visualisation'
          image: 'docker.io/grafana/grafana:latest'
          resources: {
            cpu: containerResources.cpu
            memory: containerResources.memory
          }
          volumeMounts: [
            {
              volumeName: 'logging-app-storage'
              mountPath: '/etc/grafana/provisioning/datasources'
            }
          ]
          env: [ 
            {
              name: 'GF_SERVER_DOMAIN'
              value: basePath
            },{
              name: 'GF_SERVER_ROOT_URL'
              value: '${basePath}/logging/'
            },{
              name: 'GF_SERVER_SERVE_FROM_SUB_PATH'
              value: 'true'
            }
          ]
        }
      ]      
      volumes: [
        {
          name: 'logging-app-storage'
          storageName: 'logging-app-storage'
          storageType: 'AzureFile'
        }
      ]
    }
  }
}
Steve
  • 9,335
  • 10
  • 49
  • 81

0 Answers0