Add new environment variables to README.md

This commit is contained in:
sturman 2024-03-20 12:25:09 +02:00
parent 41b367182a
commit 1a538030be
2 changed files with 14 additions and 25 deletions

View file

@ -145,15 +145,11 @@ services:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- MONGO_USER=unifi
- MONGO_PASS=
- MONGO_HOST=unifi-db
- MONGO_PORT=27017
- MONGO_URI=mongodb+srv://unifi:password@unifi.mongodb.net/unifi?retryWrites=true&w=majority&appName=unifi
- STAT_MONGO_URI=mongodb+srv://unifi:password@unifi.mongodb.net/unifi_stats?retryWrites=true&w=majority&appName=unifi
- MONGO_DBNAME=unifi
- MEM_LIMIT=1024 #optional
- MEM_STARTUP=1024 #optional
- MONGO_TLS= #optional
- MONGO_AUTHSOURCE= #optional
volumes:
- /path/to/unifi-network-application/data:/config
ports:
@ -177,15 +173,11 @@ docker run -d \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Etc/UTC \
-e MONGO_USER=unifi \
-e MONGO_PASS= \
-e MONGO_HOST=unifi-db \
-e MONGO_PORT=27017 \
-e MONGO_URI=mongodb+srv://unifi:password@unifi.mongodb.net/?retryWrites=true&w=majority&appName=unifi \
-e STAT_MONGO_URI=mongodb+srv://unifi:password@unifi.mongodb.net/?retryWrites=true&w=majority&appName=unifi \
-e MONGO_DBNAME=unifi \
-e MEM_LIMIT=1024 `#optional` \
-e MEM_STARTUP=1024 `#optional` \
-e MONGO_TLS= `#optional` \
-e MONGO_AUTHSOURCE= `#optional` \
-p 8443:8443 \
-p 3478:3478/udp \
-p 10001:10001/udp \

View file

@ -30,19 +30,15 @@ param_ports:
param_usage_include_env: true
param_env_vars:
- { 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_URI", env_value: "unifi", desc: "MongoDB URI. Only evaluated on first run." }
- { env_var: "STAT_MONGO_URI", env_value: "", desc: "MongoDB stat URI. 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." }
# optional container parameters
opt_param_usage_include_env: true
opt_param_env_vars:
- { 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." }
- { 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." }
opt_param_usage_include_ports: true
opt_param_ports:
@ -57,15 +53,15 @@ app_setup_block_enabled: true
app_setup_block: |
After setup, the web UI is available at https://ip:8443. The application can be configured, or a backup restored, using the first run wizard.
**This container requires an external mongodb database instance.**
**This container requires an external MongoDB database instance.**
### Setting Up Your External Database
Starting with version 8.1 of Unifi Network Application, mongodb 3.6 through 7.0 are supported.
Starting with version 8.1 of Unifi Network Application, MongoDB 3.6 through 7.0 are supported.
**Make sure you pin your database image version and do not use `latest`, as mongodb does not support automatic upgrades between major versions.**
**Make sure you pin your database image version and do not use `latest`, as MongoDB does not support automatic upgrades between major versions.**
If you are using the [official mongodb container](https://hub.docker.com/_/mongo/), you can create your user using an `init-mongo.js` file with the following contents:
If you are using the [official MongoDB container](https://hub.docker.com/_/mongo/), you can create your user using an `init-mongo.js` file with the following contents:
```js
db.getSiblingDB("MONGO_DBNAME").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "dbOwner", db: "MONGO_DBNAME"}]});
@ -86,7 +82,7 @@ app_setup_block: |
restart: unless-stopped
```
*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.*
*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.*
*If you are using the init script method do not also set `MONGO_INITDB_ROOT_USERNAME`, `MONGO_INITDB_ROOT_PASSWORD`, or any other "INITDB" values as they will cause conflicts.*
@ -123,6 +119,7 @@ app_setup_block: |
# changelog
changelogs:
- { date: "04.03.24:", desc: "Install from zip package instead of deb." }
- { date: "20.03.24:", desc: "Change environment variables" }
- { date: "04.02.24:", desc: "Install from zip package instead of deb." }
- { date: "17.10.23:", desc: "Add environment variables for TLS and authSource to support Atlas and new MongoDB versions." }
- { date: "05.09.23:", desc: "Initial release." }