You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-30Lines changed: 26 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,48 +70,45 @@ Starting with version 8.1 of Unifi Network Application, mongodb 3.6 through 7.0
70
70
71
71
**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.**
72
72
73
-
If you are using the [official mongodb container](https://hub.docker.com/_/mongo/) in Version >=6, you can create your user using an `init-mongo.js` file with the following contents:
73
+
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):
*Note that 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.*
123
120
124
-
*If you are using the provided init JS or SH snippets, do not also set `MONGO_INITDB_ROOT_USERNAME`, `MONGO_INITDB_ROOT_PASSWORD`, or any other "INITDB" values as they will cause conflicts. If you wish to enable Role Based Access Control (RBAC) in mongodb, you will have to create your own init JS or SH, or create the user and databases manually.*
125
-
126
121
You can also run the commands directly against the database using either `mongo` (< 6.0) or `mongosh` (>= 6.0).
127
122
128
123
### Device Adoption
@@ -180,10 +175,10 @@ services:
180
175
- MONGO_HOST=unifi-db
181
176
- MONGO_PORT=27017
182
177
- MONGO_DBNAME=unifi
178
+
- MONGO_AUTHSOURCE=admin
183
179
- MEM_LIMIT=1024 #optional
184
180
- MEM_STARTUP=1024 #optional
185
181
- MONGO_TLS= #optional
186
-
- MONGO_AUTHSOURCE= #optional
187
182
volumes:
188
183
- /path/to/unifi-network-application/data:/config
189
184
ports:
@@ -212,10 +207,10 @@ docker run -d \
212
207
-e MONGO_HOST=unifi-db \
213
208
-e MONGO_PORT=27017 \
214
209
-e MONGO_DBNAME=unifi \
210
+
-e MONGO_AUTHSOURCE=admin \
215
211
-e MEM_LIMIT=1024 `#optional` \
216
212
-e MEM_STARTUP=1024 `#optional` \
217
213
-e MONGO_TLS= `#optional` \
218
-
-e MONGO_AUTHSOURCE= `#optional` \
219
214
-p 8443:8443 \
220
215
-p 3478:3478/udp \
221
216
-p 10001:10001/udp \
@@ -253,10 +248,10 @@ Containers are configured using parameters passed at runtime (such as those abov
253
248
|`-e MONGO_HOST=unifi-db`| Mongodb Hostname. Only evaluated on first run. |
254
249
|`-e MONGO_PORT=27017`| Mongodb Port. Only evaluated on first run. |
255
250
|`-e MONGO_DBNAME=unifi`| Mongodb Database Name (stats DB is automatically suffixed with `_stat`). Only evaluated on first run. |
251
+
|`-e MONGO_AUTHSOURCE=admin`| 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. |
256
252
|`-e MEM_LIMIT=1024`| Optionally change the Java memory limit (in Megabytes). Set to `default` to reset to default |
257
253
|`-e MEM_STARTUP=1024`| Optionally change the Java initial/minimum memory (in Megabytes). Set to `default` to reset to default |
258
254
|`-e MONGO_TLS=`| Mongodb enable [TLS](https://www.mongodb.com/docs/manual/reference/connection-string/#mongodb-urioption-urioption.tls). Only evaluated on first run. |
259
-
|`-e MONGO_AUTHSOURCE=`| Mongodb [authSource](https://www.mongodb.com/docs/manual/reference/connection-string/#mongodb-urioption-urioption.authSource). For Atlas set to `admin`.Defaults to `MONGO_DBNAME`.Only evaluated on first run. |
260
255
|`-v /config`| Persistent config files |
261
256
262
257
## Environment variables from files (Docker secrets)
@@ -420,6 +415,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
420
415
421
416
## Versions
422
417
418
+
***07.08.24:** - **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.
423
419
***04.03.24:** - Install from zip package instead of deb.
424
420
***17.10.23:** - Add environment variables for TLS and authSource to support Atlas and new MongoDB versions.
Copy file name to clipboardExpand all lines: readme-vars.yml
+24-28Lines changed: 24 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -35,14 +35,14 @@ param_env_vars:
35
35
- { env_var: "MONGO_HOST", env_value: "unifi-db", desc: "Mongodb Hostname. Only evaluated on first run." }
36
36
- { env_var: "MONGO_PORT", env_value: "27017", desc: "Mongodb Port. Only evaluated on first run." }
37
37
- { env_var: "MONGO_DBNAME", env_value: "unifi", desc: "Mongodb Database Name (stats DB is automatically suffixed with `_stat`). Only evaluated on first run." }
38
+
- { 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." }
38
39
39
40
# optional container parameters
40
41
opt_param_usage_include_env: true
41
42
opt_param_env_vars:
42
43
- { env_var: "MEM_LIMIT", env_value: "1024", desc: "Optionally change the Java memory limit (in Megabytes). Set to `default` to reset to default" }
43
44
- { env_var: "MEM_STARTUP", env_value: "1024", desc: "Optionally change the Java initial/minimum memory (in Megabytes). Set to `default` to reset to default" }
44
45
- { 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." }
45
-
- { env_var: "MONGO_AUTHSOURCE", env_value: "", desc: "Mongodb [authSource](https://www.mongodb.com/docs/manual/reference/connection-string/#mongodb-urioption-urioption.authSource). For Atlas set to `admin`.Defaults to `MONGO_DBNAME`.Only evaluated on first run." }
46
46
47
47
opt_param_usage_include_ports: true
48
48
opt_param_ports:
@@ -67,48 +67,45 @@ app_setup_block: |
67
67
68
68
**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.**
69
69
70
-
If you are using the [official mongodb container](https://hub.docker.com/_/mongo/) in Version >=6, you can create your user using an `init-mongo.js` file with the following contents:
70
+
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):
*Note that 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.*
120
117
121
-
*If you are using the provided init JS or SH snippets, do not also set `MONGO_INITDB_ROOT_USERNAME`, `MONGO_INITDB_ROOT_PASSWORD`, or any other "INITDB" values as they will cause conflicts. If you wish to enable Role Based Access Control (RBAC) in mongodb, you will have to create your own init JS or SH, or create the user and databases manually.*
122
-
123
118
You can also run the commands directly against the database using either `mongo` (< 6.0) or `mongosh` (>= 6.0).
124
119
125
120
### Device Adoption
@@ -153,6 +148,7 @@ app_setup_block: |
153
148
154
149
# changelog
155
150
changelogs:
151
+
- { date: "07.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." }
156
152
- { date: "04.03.24:", desc: "Install from zip package instead of deb." }
157
153
- { date: "17.10.23:", desc: "Add environment variables for TLS and authSource to support Atlas and new MongoDB versions." }
0 commit comments