Chirpstack as Azure Container Instance

I’m trying to run Chirpstack on Azure as a container instance. Until now, without success.

I’ve tried it in two different ways:

  • Using a docker compose file
  • Using an azure deploy yaml file

I started with the docker compose file from Github and added volume mounts to azure file shares.

The resulting file with some containers not active:

version: "3"

services:
  chirpstack:
    image: chirpstack/chirpstack:4.0.2
    command: chirpstack --config-dir /etc/chirpstack
    restart: unless-stopped
    volumes:
      - chirpstack:/etc/chirpstack
     # - ./lorawan-devices:/opt/lorawan-devices
    environment:
      - MQTT_BROKER_HOST=mosquitto
      - REDIS_HOST=redis
      - POSTGRESQL_HOST=postgres
    ports:
      - 8080:8080
      
  chirpstack-gateway-bridge-eu868:
    image: chirpstack/chirpstack-gateway-bridge:4.0.0
    restart: unless-stopped
    ports:
      - 1700:1700/udp
    volumes:
      - chirpsackbridge:/etc/chirpstack-gateway-bridge
  chirpstack-rest-api:
    image: chirpstack/chirpstack-rest-api:4.0.2
    restart: unless-stopped
    command: --server chirpstack:8080 --bind 0.0.0.0:8090 --insecure
    ports:
      - 8090:8090
    depends_on:
      - chirpstack

  # postgres:
  #   image: postgres:14-alpine
  #   restart: unless-stopped
  #   volumes:
  #     - ./configuration/postgresql/initdb:/docker-entrypoint-initdb.d
  #     - postgresqldata:/var/lib/postgresql/data
  #   environment:
  #     - POSTGRES_PASSWORD=root

  # redis:
  #   image: redis:7-alpine
  #   restart: unless-stopped
  #   volumes:
  #     - redisdata:/data

  # mosquitto:
  #   image: eclipse-mosquitto:2
  #   restart: unless-stopped
  #   ports:
  #     - 1883:1883
  #   volumes: 
  #     - ./configuration/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf

volumes:
  chirpstack:
    driver: azure_file
    driver_opts:
      share_name: test-chirpstack
      storage_account_name: wedevtmonpersiststorage
  chirpsackbridge:
    driver: azure_file
    driver_opts:
      share_name: test-chirpstack-bridge
      storage_account_name: wedevtmonpersiststorage

The Chirpstack container will always be killed at startup and gets the status “terminated” without any further information at the logs.

Then I´ve tried it with a azure deploy yaml file, which would be my preferred way.

The yaml file:

api-version: 2021-10-01
location: westeurope
name: chirpstack
properties:
  containers:
    - name: chirpstack
      properties:
        image: chirpstack/chirpstack:4.0.2
        ports:
          - port: 8080
            protocol: TCP
        resources:
          requests:
            cpu: 1.0
            memoryInGB: 1.5
        volumeMounts:
          - name: test-chirpstack
            mountPath: /etc/chirpstack
        environmentVariables:
          - name: MQTT_BROKER_HOST
            value: mosquitto
          - name: REDIS_HOST
            value: redis
          - name: POSTGRESQL_HOST
            value: postgres
        command: ["chirpstack --config-dir /etc/chirpstack"]
    - name: chirpstack-gateway-bridge-eu868
      properties:
        image: chirpstack/chirpstack-gateway-bridge:4.0.0
        ports:
          - port: 1700
            protocol: UDP
        resources:
          requests:
            cpu: 0.5
            memoryInGB: 1.5
        volumeMounts:
          - name: test-chirpstack-bridge
            mountPath: /etc/chirpstack-gateway-bridge
    - name: chirpstack-rest-api
      properties:
        image: chirpstack/chirpstack-rest-api:4.0.2
        ports:
          - port: 8090
            protocol: TCP
        resources:
          requests:
            cpu: 0.5
            memoryInGB: 1.5
        command: ["--server chirpstack:8080 --bind 0.0.0.0:8090 --insecure"]
    - name: postgres
      properties:
        image: postgres:14-alpine
        resources:
          requests:
            cpu: 0.5
            memoryInGB: 1.0
        environmentVariables:
          - name: POSTGRES_PASSWORD
            value: root
    - name: redis
      properties:
        image: redis:7-alpine
        resources:
          requests:
            cpu: 0.5
            memoryInGB: 1.0
    - name: mosquitto
      properties:
        image: eclipse-mosquitto:2
        resources:
          requests:
            cpu: 0.5
            memoryInGB: 1.0
  ipAddress:
    ports:
      - port: 8080
        protocol: TCP
    type: Public
    dnsNameLabel: chirpstack
  volumes:
    - name: test-chirpstack
      azureFile:
        shareName: test-chirpstack
        storageAccountName: wedevtmonpersiststorage
        storageAccountKey: XXXXXX
    - name: test-chirpstack-bridge
      azureFile:
        shareName: test-chirpstack-bridge
        storageAccountName: wedevtmonpersiststorage
        storageAccountKey: XXXXXX
  diagnostics:
    logAnalytics:
      workspaceId: XXXXXX
      workspaceKey: XXXXXX
  osType: Linux
tags: null
type: Microsoft.ContainerInstance/containerGroups

Chirpstack does crash again at startup with the error log:

Error: Failed to start container chirpstack, Error response: to create containerd task: failed to create shim task: failed to create container 856dcc15d67b8225adfd5fedfed0c865d48a0492583fde05e6fe1b6512ff7b87: guest RPC failure: failed to create container: failed to run runc create/exec call for container 856dcc15d67b8225adfd5fedfed0c865d48a0492583fde05e6fe1b6512ff7b87 with exit status 1: container_linux.go:380: starting container process caused: exec: “chirpstack --config-dir /etc/chirpstack”: stat chirpstack --config-dir /etc/chirpstack: no such file or directory: unknown

The config files from github are in the file share on azure available, but I think the container does not even reach the file share?

Does anyone know where my mistake is and how a correct yaml file should look like?