- {env_var:"MONGO_USER", env_value:"unifi", desc:"Mongodb Username. Only evaluated on first run. **Special characters must be [url encoded](https://en.wikipedia.org/wiki/Percent-encoding)**."}
- {env_var:"MONGO_PASS", env_value:"", desc:"Mongodb Password. Only evaluated on first run. **Special characters must be [url encoded](https://en.wikipedia.org/wiki/Percent-encoding)**."}
- {env_var:"MONGO_HOST", env_value:"unifi-db", desc:"Mongodb Hostname. Only evaluated on first run."}
- {env_var:"MONGO_PORT", env_value:"27017", desc:"Mongodb Port. Only evaluated on first run."}
- {env_var:"MONGO_DBNAME", env_value:"unifi", desc:"Mongodb Database Name (stats DB is automatically suffixed with `_stat`). Only evaluated on first run."}
- {env_var:"MONGO_AUTHSOURCE", env_value:"admin", desc:"Mongodb [authSource](https://www.mongodb.com/docs/manual/reference/connection-string/#mongodb-urioption-urioption.authSource). For Atlas set to `admin`. Only evaluated on first run."}
- {env_var:"MEM_LIMIT", env_value:"1024", desc:"Optionally change the Java memory limit (in Megabytes). Set to `default` to reset to default"}
- {env_var:"MEM_STARTUP", env_value:"1024", desc:"Optionally change the Java initial/minimum memory (in Megabytes). Set to `default` to reset to default"}
- {env_var:"MONGO_TLS", env_value:"", desc:"Mongodb enable [TLS](https://www.mongodb.com/docs/manual/reference/connection-string/#mongodb-urioption-urioption.tls). Only evaluated on first run."}
**MongoDB>4.4 on X86_64 Hardware needs a CPU with AVX support. Some lower end Intel CPU models like Celeron and Pentium (before Tiger-Lake) more Details:[Advanced Vector Extensions - Wikipedia](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#CPUs_with_AVX) don't support AVX, but you can still use MongoDB 4.4.**
If you are using the [official mongodb container](https://hub.docker.com/_/mongo/), you can create your user using an `init-mongo.sh` file with the following contents (do not modify; copy/paste as is):
*Notethat the init script method will only work on first run. If you start the Mongodb container without an init script it will generate test data automatically and you will have to manually create your databases, or restart with a clean `/data/db` volume and an init script mounted.*
You can also run the commands directly against the database using either `mongo` (< 6.0) or `mongosh` (>= 6.0).
### Device Adoption
For Unifi to adopt other devices, e.g. an Access Point, it is required to change the inform IP address. Because Unifi runs inside Docker by default it uses an IP address not accessible by other devices. To change this go to Settings > System > Advanced and set the Inform Host to a hostname or IP address accessible by your devices. Additionally the checkbox "Override" has to be checked, so that devices can connect to the controller during adoption (devices use the inform-endpoint during adoption).
Note that you must use 8080:8080. If you MUST change the port, it must be changed on both sides and manually changed in your system.properties file. Otherwise, devices will initially communicate and then break after.
**Pleasenote, Unifi change the location of this option every few releases so if it's not where it says, search for "Inform" or "Inform Host" in the settings.**
In order to manually adopt a device take these steps:
```
ssh ubnt@$AP-IP
set-inform http://$address:8080/inform
```
The default device password is `ubnt`. `$address` is the IP address of the host you are running this container on and `$AP-IP` is the Access Point IP address.
When using a Security Gateway (router) it could be that network connected devices are unable to obtain an ip address. This can be fixed by setting "DHCP Gateway IP", under Settings > Networks > network_name, to a correct (and accessible) ip address.
### Migration From [Unifi-Controller](https://github.com/linuxserver/docker-unifi-controller)
If you were using the `mongoless` tag for the Unifi Controller container, you can switch directly to the Unifi Network Application container without needing to perform any migration steps.
**Youcannot perform an in-place upgrade from an existing Unifi-Controller container, you must run a backup and then a restore.**
The simplest migration approach is to take a full backup of your existing install, including history, from the Unifi-Controller web UI, then shut down the old container.
You can then start up the new container with a clean `/config` mount (and a database container configured), and perform a restore using the setup wizard.
- {date:"11.08.24:", desc:"**Important**: The mongodb init instructions have been updated to enable auth ([RBAC](https://www.mongodb.com/docs/manual/core/authorization/#role-based-access-control)). We have been notified that if RBAC is not enabled, the official mongodb container allows remote access to the db contents over port 27017 without credentials. If you set up the mongodb container with the old instructions we provided, you should not map or expose port 27017. If you would like to enable auth, the easiest way is to create new instances of both unifi and mongodb with the new instructions and restore unifi from a backup."}
- {date:"11.08.24:", desc:"Rebase to Ubuntu Noble."}