Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-23013

[fiware-stackoverflow] FIWARE IoT Agent-UL loses service groups and devices after container restart

    Details

      Description

      Created question in FIWARE Q/A platform on 05-05-2025 at 16:05
      Please, ANSWER this question AT https://stackoverflow.com/questions/79607305/fiware-iot-agent-ul-loses-service-groups-and-devices-after-container-restart

      Question:
      FIWARE IoT Agent-UL loses service groups and devices after container restart

      Description:
      I'm running a FIWARE stack using Docker containers. Here's the setup:

      Orion Context Broker with MongoDB
      IoT Agent-UL
      Cygnus for data persistence in MySQL
      All components are running in Docker containers (Docker Compose)

      Everything works fine initially

      I can create service groups and devices via the IoT Agent-UL API
      Data is sent to Orion as expected
      Cygnus saves the data in MySQL correctly

      When I restart the IoT Agent-UL container (or the server running the containers), all the devices and service groups I created disappear. It’s as if they were never created. However, entities in Orion remain intact, I can see the entities collection inside MongoDB.
      Docker Compose:
      services:
      orion:
      image: telefonicaiot/fiware-orion
      ports:

      • "1026:1026"
        restart: always
        depends_on:
      • mongo
        command: -dbURI mongodb://mongoroot:abc123@mongo:27017

      mongo:
      image: mongo:6.0
      restart: always
      volumes:

      • /mongo/datadir:/data/db
        command: mongod --auth --bind_ip_all

      iot-agent:
      image: fiware/iotagent-ul:3.7.0
      hostname: iot-agent
      container_name: fiware-iot-agent
      depends_on:

      • mongo
        expose:
      • "4041"
      • "7896"
        restart: always
        ports:
      • "4041:4041"
      • "7896:7896"
        environment:
      • IOTA_CB_HOST=orion
      • IOTA_CB_PORT=1026
      • IOTA_NORTH_PORT=4041
      • IOTA_REGISTRY_TYPE=mongo
      • IOTA_LOG_LEVEL=DEBUG
      • IOTA_TIMESTAMP=true
      • IOTA_CB_NGSI_VERSION=v2
      • IOTA_AUTOCAST=true
      • IOTA_MONGO_HOST=mongo
      • IOTA_MONGO_PORT=27017
      • IOTA_MONGO_DB=iotagentul
      • IOTA_MONGO_USER=mongoroot
      • IOTA_MONGO_PASS=abc123
      • IOTA_HTTP_PORT=7896
      • IOTA_PROVIDER_URL=http://iot-agent:4041

      mysql-db:
      image: mysql:5.7
      hostname: mysql-db
      container_name: db-mysql
      expose:

      • "3306"
        ports:
      • "3306:3306"
        restart: always
        environment:
      • MYSQL_ROOT_PASSWORD=abc123
      • MYSQL_ROOT_HOST=%
        volumes:
      • /mysql/datadir:/var/lib/mysql

      cygnus:
      image: fiware/cygnus-ngsi:latest
      hostname: cygnus
      container_name: fiware-cygnus
      restart: always
      depends_on:

      • mysql-db
        expose:
      • "5080"
        ports:
      • "5050:5050"
      • "5080:5080"
        environment:
      • CYGNUS_MYSQL_HOST=mysql-db
      • CYGNUS_MYSQL_PORT=3306
      • CYGNUS_MYSQL_USER=root
      • CYGNUS_MYSQL_PASS=abc123
      • CYGNUS_MYSQL_SERVICE_PORT=5050
      • CYGNUS_LOG_LEVEL=DEBUG
      • CYGNUS_API_PORT=5080
      • CYGNUS_SERVICE_PORT=5050

      All services are on the same network.
      What I’ve Tried:

      Verified MongoDB container is using a named volume for data persistence
      Checked that IoT Agent is configured to use the same MongoDB instance as Orion
      Looked through the logs of the IoT Agent and MongoDB after restart. There are no obvious errors

      Is there something specific I need to configure in the IoT Agent or MongoDB to persist this data? Any help is appreciated! Let me know if logs or config files would help further.

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            newbacklogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: