Skip to content

Problem with subscriptions when orion container crashes or stops. #1708

Closed
@AizenvoltPrime

Description

services:
    orion:
        labels:
            org.fiware: "tutorial"
        image: fiware/orion-ld:${ORION_LD_VERSION}
        hostname: orion
        container_name: fiware-orion
        depends_on:
            - mongo-db
        networks:
            - default
        ports:
            - "${ORION_LD_PORT}:${ORION_LD_PORT}"
        command: -dbhost mongo-db -logLevel DEBUG -forwarding -mongocOnly -wip entityMaps
        healthcheck:
            test: curl --fail -s http://orion:${ORION_LD_PORT}/version || exit 1
            interval: 5s

    # Quantum Leap is persisting Short Term History to Crate-DB
    quantumleap:
        image: orchestracities/quantumleap:${QUANTUMLEAP_VERSION}
        labels:
            org.fiware: "tutorial"
        hostname: quantumleap
        container_name: fiware-quantumleap
        ports:
            - "${QUANTUMLEAP_PORT}:${QUANTUMLEAP_PORT}"
        depends_on:
            - crate-db
            - redis-db
        environment:
            - CRATE_HOST=crate-db
            - REDIS_HOST=redis-db
            - REDIS_PORT=${REDIS_PORT}
            - REDIS_USERNAME=${REDIS_USERNAME}
            - REDIS_PASSWORD=${REDIS_PASSWORD}
            - LOGLEVEL=DEBUG
        healthcheck:
            test: curl --fail -s http://quantumleap:${QUANTUMLEAP_PORT}/version || exit 1

    # Databases
    mongo-db:
        labels:
            org.fiware: "tutorial"
        image: mongo:${MONGO_DB_VERSION}
        hostname: mongo-db
        container_name: db-mongo
        expose:
            - "${MONGO_DB_PORT}"
        ports:
            - "${MONGO_DB_PORT}:${MONGO_DB_PORT}" # localhost:27017
        networks:
            - default
        volumes:
            - mongo-db:/data
        healthcheck:
            test:
                [
                    "CMD",
                    "mongo",
                    "--quiet",
                    "127.0.0.1/test",
                    "--eval",
                    "'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'",
                ]
            interval: 5s

    crate-db:
        labels:
            org.fiware: "tutorial"
        image: crate:${CRATE_VERSION}
        hostname: crate-db
        container_name: db-crate
        networks:
            - default
        ports:
            # Admin UI
            - "4200:4200"
            # Transport protocol
            - "4300:4300"
        command: crate -Cauth.host_based.enabled=false  -Ccluster.name=democluster -Chttp.cors.enabled=true -Chttp.cors.allow-origin="*" -Cdiscovery.type=single-node
        environment:
            - CRATE_HEAP_SIZE=2g # see https://crate.io/docs/crate/howtos/en/latest/deployment/containers/docker.html#troubleshooting
        volumes:
            - crate-db:/data

    redis-db:
        labels:
            org.fiware: "tutorial"
        image: redis:${REDIS_VERSION}
        hostname: redis-db
        container_name: db-redis
        networks:
            - default
        ports:
            - "${REDIS_PORT}:${REDIS_PORT}"
        volumes:
            - redis-db:/data
            - ./redis.conf:/usr/local/etc/redis/redis.conf
        command: redis-server /usr/local/etc/redis/redis.conf
        environment:
            - REDIS_USERNAME=${REDIS_USERNAME}
            - REDIS_PASSWORD=${REDIS_PASSWORD}
        healthcheck:
            test: >
                sh -c 'export REDISCLI_AUTH="${REDIS_PASSWORD}" &&
                redis-cli -h redis-db -p ${REDIS_PORT} --user ${REDIS_USERNAME} ping'
            interval: 10s


networks:
    default:
        labels:
            org.fiware: "tutorial"
        ipam:
            config:
                - subnet: 172.18.1.0/24

volumes:
    mongo-db: ~
    crate-db: ~
    redis-db: ~

I have the above docker compose. The problem is that if orion container crashes or stops and I start it again the subscriptions made to quantumleap even though they still exist in mongo db, they don't work and when I update entity data only the orion entity data is updated and the new data doesn't get added to crate db. I have to recreate the subscriptions manually in order for them to work again. Is there any solution to this or am I doing something wrong with the setup?

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions