Skip to content
This repository was archived by the owner on Jan 7, 2024. It is now read-only.

Commit 4495ba3

Browse files
committed
Update readme with mongodb notes
1 parent 748cad1 commit 4495ba3

File tree

2 files changed

+34
-10
lines changed

2 files changed

+34
-10
lines changed

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@ The default device password is `ubnt`. `$address` is the IP address of the host
8282

8383
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 accessable) ip address.
8484

85+
### Setting Up Your External Databases
86+
87+
Formally only Mongo 3.6 and below are supported, however, it has been reported that versions up to 5.x will work. If you choose to use a newer version be aware that you will not be operating a supported configuration.
88+
89+
Create your databases with:
90+
91+
`mongo --eval 'db.getSiblingDB("MONGO_DBNAME").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "readWrite", db: "MONGO_DBNAME"}]})'`
92+
93+
`mongo --eval 'db.getSiblingDB("MONGO_DBNAME_stat").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "readWrite", db: "MONGO_DBNAME_stat"}]})'`
94+
95+
Being sure to replace the placeholders with the same values you supplied to the Unifi container.
96+
8597
### Strict reverse proxies
8698

8799
This image uses a self-signed certificate by default. This naturally means the scheme is `https`.
@@ -174,11 +186,11 @@ Container images are configured using parameters passed at runtime (such as thos
174186
| `-e PUID=1000` | for UserID - see below for explanation |
175187
| `-e PGID=1000` | for GroupID - see below for explanation |
176188
| `-e TZ=Etc/UTC` | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). |
177-
| `-e MONGO_USER=` | MONGO_USER. |
178-
| `-e MONGO_PASS=` | MONGO_PASS. |
179-
| `-e MONGO_HOST=` | MONGO_HOST. |
180-
| `-e MONGO_PORT=` | MONGO_PORT. |
181-
| `-e MONGO_DBNAME=` | MONGO_DBNAME. |
189+
| `-e MONGO_USER=` | Mongodb Username. Only evaluated on first run. |
190+
| `-e MONGO_PASS=` | Mongodb Password. Only evaluated on first run. |
191+
| `-e MONGO_HOST=` | Mongodb Hostname. Only evaluated on first run. |
192+
| `-e MONGO_PORT=` | Mongodb Port. Only evaluated on first run. |
193+
| `-e MONGO_DBNAME=` | Mongodb Database Name (stats DB is automatically suffixed with `_stat`). Only evaluated on first run. |
182194
| `-e MEM_LIMIT=1024` | Optionally change the Java memory limit (in Megabytes). Set to `default` to reset to default |
183195
| `-e MEM_STARTUP=1024` | Optionally change the Java initial/minimum memory (in Megabytes). Set to `default` to reset to default |
184196
| `-v /config` | All Unifi data stored here |

readme-vars.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ param_ports:
3333

3434
param_usage_include_env: true
3535
param_env_vars:
36-
- { env_var: "MONGO_USER", env_value: "", desc: "MONGO_USER." }
37-
- { env_var: "MONGO_PASS", env_value: "", desc: "MONGO_PASS." }
38-
- { env_var: "MONGO_HOST", env_value: "", desc: "MONGO_HOST." }
39-
- { env_var: "MONGO_PORT", env_value: "", desc: "MONGO_PORT." }
40-
- { env_var: "MONGO_DBNAME", env_value: "", desc: "MONGO_DBNAME." }
36+
- { env_var: "MONGO_USER", env_value: "", desc: "Mongodb Username. Only evaluated on first run." }
37+
- { env_var: "MONGO_PASS", env_value: "", desc: "Mongodb Password. Only evaluated on first run." }
38+
- { env_var: "MONGO_HOST", env_value: "", desc: "Mongodb Hostname. Only evaluated on first run." }
39+
- { env_var: "MONGO_PORT", env_value: "", desc: "Mongodb Port. Only evaluated on first run." }
40+
- { env_var: "MONGO_DBNAME", env_value: "", desc: "Mongodb Database Name (stats DB is automatically suffixed with `_stat`). Only evaluated on first run." }
4141

4242
# optional container parameters
4343
opt_param_usage_include_env: true
@@ -71,6 +71,18 @@ app_setup_block: |
7171
7272
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 accessable) ip address.
7373
74+
### Setting Up Your External Databases
75+
76+
Formally only Mongo 3.6 and below are supported, however, it has been reported that versions up to 5.x will work. If you choose to use a newer version be aware that you will not be operating a supported configuration.
77+
78+
Create your databases with:
79+
80+
`mongo --eval 'db.getSiblingDB("MONGO_DBNAME").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "readWrite", db: "MONGO_DBNAME"}]})'`
81+
82+
`mongo --eval 'db.getSiblingDB("MONGO_DBNAME_stat").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "readWrite", db: "MONGO_DBNAME_stat"}]})'`
83+
84+
Being sure to replace the placeholders with the same values you supplied to the Unifi container.
85+
7486
# changelog
7587
changelogs:
7688
- { date: "08.03.23:", desc: "Add mongoless branch."}

0 commit comments

Comments
 (0)