-
-
Notifications
You must be signed in to change notification settings - Fork 88
Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
I launched the unifi-network-application using docker compose as recomended in the docs. I also adopted by 2 AP discs (AC PRO) and a switch (US 8)
today.
Later after a simple docker compose down and docker compose up, it had lost contact with all three devices (though I can still log on as normal on the web interface). It re-adopted the switch relatively quickly, but the two AP disks were stuck in an "Adopting" and "Offline" loop.
I can not ssh into them again.
docker-compose.yml:
services:
unifi-db:
image: docker.io/mongo:8.0.5-noble
container_name: unifi-db
environment:
- MONGO_INITDB_ROOT_USERNAME=${MONGO_ROOT_USER:-root}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_ROOT_PASSWORD:-xxx}
- MONGO_USER=${MONGO_USER:-unifi}
- MONGO_PASS=${MONGO_PASS:-yyy}
- MONGO_DBNAME=${MONGO_DBNAME:-unifi}
- MONGO_AUTHSOURCE=admin
volumes:
- ${DATA_DIR:-${HOME}/.local/share/unifi-network-application}/data:/data/db
- ${DATA_DIR:-${HOME}/.local/share/unifi-network-application}/init-mongo.sh:/docker-entrypoint-initdb.d/init-mongo.sh:ro
restart: unless-stopped
healthcheck:
test: ["CMD", "mongosh", "--eval", "'db.runCommand(\"ping\").ok'", "--quiet"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- traefik_traefiknet
mem_limit: 1024M
unifi-network-application:
image: lscr.io/linuxserver/unifi-network-application:9.0.114
container_name: unifi-network-application
environment:
- PUID=${PUID:-1001}
- PGID=${PGID:-1001}
- TZ=${TZ:-Etc/UTC}
- MONGO_USER=${MONGO_USER:-unifi}
- MONGO_PASS=${MONGO_PASS:-yyy}
- MONGO_HOST=unifi-db
- MONGO_PORT=27017
- MONGO_DBNAME=${MONGO_DBNAME:-unifi}
- MONGO_AUTHSOURCE=admin
- MEM_LIMIT=${UNIFI_MEM_LIMIT:-1024}
- MEM_STARTUP=${UNIFI_MEM_STARTUP:-1024}
- MONGO_TLS=${MONGO_TLS:-}
volumes:
- ${DATA_DIR:-${HOME}/.local/share/unifi-network-application}/config:/config
ports:
- 3478:3478/udp
- 10001:10001/udp
- 8080:8080
- 1900:1900/udp
- 8880:8880
- 6789:6789
- 5514:5514/udp
- 8443:8443
restart: unless-stopped
depends_on:
unifi-db:
condition: service_healthy
networks:
- traefik_traefiknet
labels:
- "traefik.enable=true"
- "traefik.http.routers.unifi.rule=Host(`example.com`)"
- "traefik.http.routers.unifi.entrypoints=websecure"
- "traefik.http.routers.unifi.tls=true"
- "traefik.http.routers.unifi.service=unifi"
- "traefik.http.routers.unifi.tls.certresolver=myresolver"
- "traefik.http.services.unifi.loadbalancer.server.port=8443"
- "traefik.http.services.unifi.loadbalancer.server.scheme=https"
- "traefik.http.services.unifi.loadbalancer.serversTransport=insecuretransport@file"
networks:
traefik_traefiknet:
external: true
init-mongo.sh
#!/bin/bash
if which mongosh > /dev/null 2>&1; then
mongo_init_bin='mongosh'
else
mongo_init_bin='mongo'
fi
"${mongo_init_bin}" <<EOF
use ${MONGO_AUTHSOURCE}
db.auth("${MONGO_INITDB_ROOT_USERNAME}", "${MONGO_INITDB_ROOT_PASSWORD}")
db.createUser({
user: "${MONGO_USER}",
pwd: "${MONGO_PASS}",
roles: [
{ db: "${MONGO_DBNAME}", role: "dbOwner" },
{ db: "${MONGO_DBNAME}_stat", role: "dbOwner" }
]
})
db.grantRolesToUser("${MONGO_USER}", [{ role: "clusterMonitor", db: "admin" }]);
EOFunifi-network-application.service
[Unit]
Description=Unifi Network Application Service
After=network-online.target
Documentation=https://docs.linuxserver.io/images/docker-unifi-network-application
[Service]
Type=simple
WorkingDirectory=/home/lindahl/.local/share/unifi-network-application
Environment="COMPOSE_HTTP_TIMEOUT=300"
# Ensure Docker is running before starting
ExecStartPre=/bin/bash -c 'until /usr/bin/docker info >/dev/null 2>&1; do sleep 1; done'
# Create .env file if not exists with default values
ExecStartPre=/bin/bash -c 'if [ ! -f .env ]; then echo "DATA_DIR=/home/lindahl/.local/share/unifi-network-application" > .env; fi'
ExecStart=/usr/bin/docker compose up
ExecStop=/usr/bin/docker compose down --timeout 180
# Restart policy
Restart=always
RestartSec=10
# Limits
TimeoutStartSec=180s
TimeoutStopSec=180s
LimitNOFILE=infinity
LimitNPROC=infinity
[Install]
WantedBy=multi-user.targetThis is my device view in the controller:
Expected Behavior
Server restarts and all devices are ready since they were already adopted before the restart
Steps To Reproduce
- docker compose up
- adopt devices
- docker compose down
- docker compose up
- observe that devices have to be readopted
Environment
- OS: ubuntu noble
- How docker service was installed: docker compose file as shownCPU architecture
x86-64
Docker creation
systemctl start --user unifi-network-application
This in turn just does a docker compose upContainer logs
I attached log files further up, they are roughly 4k lines.
I have done docker compose logs and journalctl --user-unit=unifi-network-application
Or.. I tried to add them (tar.gz files) but I'm not sure if anything happenedMetadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done
