Skip to content

[BUG] Changing mongo server host has no effect #124

@aporcupine

Description

@aporcupine

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Even after updating MONGO_HOST and restarting, the container continues to connect to the old MongoDB host, ignoring the new host specified.

Expected Behavior

After changing MONGO_HOST, the container should connect to the newly defined MongoDB host upon restart, rather than continuing to use the old one.

Steps To Reproduce

  1. Set up the container according to the official documentation, using an external MongoDB instance.
  2. Confirm the container is running and using the specified MONGO_HOST.
  3. Update the MONGO_HOST environment variable to point to a different MongoDB host (with the same content database).
  4. Restart the container.

Environment

- OS: Ubuntu 24.04 
- How docker service was installed: k8s (bare metal, kubeadm)

CPU architecture

arm64

Docker creation

- image: lscr.io/linuxserver/unifi-network-application:latest
        name: unifi-v2
        env:
        - name: MONGO_HOST
          value: 127.0.0.1
        - name: MONGO_PORT
          value: "27017"
        - name: MONGO_DBNAME
          value: unifi
        - name: MONGO_AUTHSOURCE
          value: admin
        - name: MONGO_USER
          value: unifi
        - name: MONGO_PASS
          valueFrom:
            secretKeyRef:
              name: ####
              key: password
        volumeMounts:
        - mountPath: /config
          name: ####
          subPath: unifi-config

Container logs

Caused by: com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=unifi-mongo:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: Connect timed out}}]

NOTE: unifi-mongo is the old host

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions