From 9d6e638356d8eab13a936255723cdbebf58dd9ed Mon Sep 17 00:00:00 2001 From: sturman <4456572+sturman@users.noreply.github.com> Date: Sat, 24 Feb 2024 19:30:48 +0200 Subject: [PATCH 01/11] Use `https` in download URL --- .github/workflows/external_trigger.yml | 2 +- Dockerfile | 2 +- Dockerfile.aarch64 | 2 +- Jenkinsfile | 2 +- jenkins-vars.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/external_trigger.yml b/.github/workflows/external_trigger.yml index 8f92e31..648bf97 100755 --- a/.github/workflows/external_trigger.yml +++ b/.github/workflows/external_trigger.yml @@ -20,7 +20,7 @@ jobs: echo "**** External trigger running off of main branch. To disable this trigger, set a Github secret named \"PAUSE_EXTERNAL_TRIGGER_UNIFI_NETWORK_APPLICATION_MAIN\". ****" echo "External trigger running off of main branch. To disable this trigger, set a Github secret named \`PAUSE_EXTERNAL_TRIGGER_UNIFI_NETWORK_APPLICATION_MAIN\`" >> $GITHUB_STEP_SUMMARY echo "**** Retrieving external version ****" - EXT_RELEASE=$(curl -sX GET http://dl.ui.com/unifi/debian/dists/stable/ubiquiti/binary-amd64/Packages |grep -A 7 -m 1 'Package: unifi' | awk -F ': ' '/Version/{print $2;exit}' | awk -F '-' '{print $1}') + EXT_RELEASE=$(curl -sX GET https://dl.ui.com/unifi/debian/dists/stable/ubiquiti/binary-amd64/Packages |grep -A 7 -m 1 'Package: unifi' | awk -F ': ' '/Version/{print $2;exit}' | awk -F '-' '{print $1}') if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then echo "**** Can't retrieve external version, exiting ****" FAILURE_REASON="Can't retrieve external version for unifi-network-application branch main" diff --git a/Dockerfile b/Dockerfile index 3e8e069..0b0e97a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ RUN \ unzip && \ echo "**** install unifi ****" && \ if [ -z ${UNIFI_VERSION+x} ]; then \ - UNIFI_VERSION=$(curl -sX GET http://dl.ui.com/unifi/debian/dists/${UNIFI_BRANCH}/ubiquiti/binary-amd64/Packages \ + UNIFI_VERSION=$(curl -sX GET https://dl.ui.com/unifi/debian/dists/${UNIFI_BRANCH}/ubiquiti/binary-amd64/Packages \ |grep -A 7 -m 1 'Package: unifi' \ | awk -F ': ' '/Version/{print $2;exit}' \ | awk -F '-' '{print $1}'); \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 93d023b..d171bbb 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -23,7 +23,7 @@ RUN \ unzip && \ echo "**** install unifi ****" && \ if [ -z ${UNIFI_VERSION+x} ]; then \ - UNIFI_VERSION=$(curl -sX GET http://dl.ui.com/unifi/debian/dists/${UNIFI_BRANCH}/ubiquiti/binary-amd64/Packages \ + UNIFI_VERSION=$(curl -sX GET https://dl.ui.com/unifi/debian/dists/${UNIFI_BRANCH}/ubiquiti/binary-amd64/Packages \ |grep -A 7 -m 1 'Package: unifi' \ | awk -F ': ' '/Version/{print $2;exit}' \ | awk -F '-' '{print $1}'); \ diff --git a/Jenkinsfile b/Jenkinsfile index bf802b8..854e7c5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -115,7 +115,7 @@ pipeline { steps{ script{ env.EXT_RELEASE = sh( - script: ''' curl -sX GET http://dl.ui.com/unifi/debian/dists/stable/ubiquiti/binary-amd64/Packages |grep -A 7 -m 1 'Package: unifi' | awk -F ': ' '/Version/{print $2;exit}' | awk -F '-' '{print $1}' ''', + script: ''' curl -sX GET https://dl.ui.com/unifi/debian/dists/stable/ubiquiti/binary-amd64/Packages |grep -A 7 -m 1 'Package: unifi' | awk -F ': ' '/Version/{print $2;exit}' | awk -F '-' '{print $1}' ''', returnStdout: true).trim() env.RELEASE_LINK = 'custom_command' } diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 4f184a2..493da5a 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -3,7 +3,7 @@ # jenkins variables project_name: unifi-network-application external_type: na -custom_version_command: "curl -sX GET http://dl.ui.com/unifi/debian/dists/stable/ubiquiti/binary-amd64/Packages |grep -A 7 -m 1 'Package: unifi' | awk -F ': ' '/Version/{print $2;exit}' | awk -F '-' '{print $1}'" +custom_version_command: "curl -sX GET https://dl.ui.com/unifi/debian/dists/stable/ubiquiti/binary-amd64/Packages |grep -A 7 -m 1 'Package: unifi' | awk -F ': ' '/Version/{print $2;exit}' | awk -F '-' '{print $1}'" release_type: stable release_tag: latest ls_branch: main From 53a8ea070fbdde9d80a14952bf5378afa292a623 Mon Sep 17 00:00:00 2001 From: sturman <4456572+sturman@users.noreply.github.com> Date: Sat, 24 Feb 2024 19:31:12 +0200 Subject: [PATCH 02/11] Fix set environment variable in docker files --- Dockerfile | 2 +- Dockerfile.aarch64 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0b0e97a..d33126c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ LABEL maintainer="thespad" # environment settings ARG UNIFI_BRANCH="stable" \ -DEBIAN_FRONTEND="noninteractive" +ENV DEBIAN_FRONTEND="noninteractive" RUN \ echo "**** install packages ****" && \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index d171bbb..a37d691 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -11,7 +11,7 @@ LABEL maintainer="thespad" # environment settings ARG UNIFI_BRANCH="stable" \ -DEBIAN_FRONTEND="noninteractive" +ENV DEBIAN_FRONTEND="noninteractive" RUN \ echo "**** install packages ****" && \ From 21494a2538940d8b397327e83230232478fbf8b3 Mon Sep 17 00:00:00 2001 From: sturman <4456572+sturman@users.noreply.github.com> Date: Sat, 24 Feb 2024 20:36:36 +0200 Subject: [PATCH 03/11] Fix slash --- Dockerfile | 2 +- Dockerfile.aarch64 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d33126c..d25a9c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA LABEL maintainer="thespad" # environment settings -ARG UNIFI_BRANCH="stable" \ +ARG UNIFI_BRANCH="stable" ENV DEBIAN_FRONTEND="noninteractive" RUN \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index a37d691..5881280 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -10,7 +10,7 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA LABEL maintainer="thespad" # environment settings -ARG UNIFI_BRANCH="stable" \ +ARG UNIFI_BRANCH="stable" ENV DEBIAN_FRONTEND="noninteractive" RUN \ From 5c7a3d3ffc4faccf1b5e8e14daec8cf39a6f063c Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Tue, 30 Apr 2024 17:25:53 +0000 Subject: [PATCH 04/11] Bot Updating Templated Files --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b99df64..0e155ba 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -275,7 +275,7 @@ pipeline { # ${TEMPDIR}/unraid/docker-templates: Cloned docker-templates repo to check for logos # ${TEMPDIR}/unraid/templates: Cloned templates repo for commiting unraid template changes and pushing back to Github git clone --branch main --depth 1 https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/docker-${CONTAINER_NAME} - docker run --rm -v ${TEMPDIR}/docker-${CONTAINER_NAME}:/tmp -e LOCAL=true ghcr.io/linuxserver/jenkins-builder:latest + docker run --rm -v ${TEMPDIR}/docker-${CONTAINER_NAME}:/tmp -e LOCAL=true -e PUID=$(id -u) -e PGID=$(id -g) ghcr.io/linuxserver/jenkins-builder:latest echo "Starting Stage 1 - Jenkinsfile update" if [[ "$(md5sum Jenkinsfile | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/Jenkinsfile | awk '{ print $1 }')" ]]; then mkdir -p ${TEMPDIR}/repo @@ -608,7 +608,7 @@ pipeline { sh '''#! /bin/bash set -e TEMPDIR=$(mktemp -d) - if [ "${MULTIARCH}" == "true" ] && [ "${PACKAGE_CHECK}" == "false" ]; then + if [ "${MULTIARCH}" == "true" ] && [ "${PACKAGE_CHECK}" != "true" ]; then LOCAL_CONTAINER=${IMAGE}:amd64-${META_TAG} else LOCAL_CONTAINER=${IMAGE}:${META_TAG} From e730a7621dee4bff24b72291ad111789302d5c2c Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Tue, 7 May 2024 17:27:43 +0000 Subject: [PATCH 05/11] Bot Updating Templated Files --- Jenkinsfile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0e155ba..f3528b6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -382,11 +382,15 @@ pipeline { cd ${TEMPDIR}/unraid/templates/ GH_TEMPLATES_DEFAULT_BRANCH=$(git remote show origin | grep "HEAD branch:" | sed 's|.*HEAD branch: ||') if grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then - echo "Image is on the ignore list, marking Unraid template as deprecated" - cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/ - git add -u unraid/${CONTAINER_NAME}.xml - git mv unraid/${CONTAINER_NAME}.xml unraid/deprecated/${CONTAINER_NAME}.xml || : - git commit -m 'Bot Moving Deprecated Unraid Template' || : + if [[ -f ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ]]; then + echo "Image is on the ignore list, marking Unraid template as deprecated" + cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/ + git add -u unraid/${CONTAINER_NAME}.xml + git mv unraid/${CONTAINER_NAME}.xml unraid/deprecated/${CONTAINER_NAME}.xml || : + git commit -m 'Bot Moving Deprecated Unraid Template' || : + else + echo "Image is on the ignore list, but no template exist, skipping deprecation" + fi else cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/ git add unraid/${CONTAINER_NAME}.xml From ac3bd298f856c2f8b522a3fb52e051b06f4116ea Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Tue, 7 May 2024 17:32:16 +0000 Subject: [PATCH 06/11] Bot Updating Package Versions --- package_versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package_versions.txt b/package_versions.txt index 19785ba..846a5cc 100755 --- a/package_versions.txt +++ b/package_versions.txt @@ -204,7 +204,7 @@ libmount1 2.37.2-4ubuntu3.4 libncurses6 6.3-2ubuntu0.1 deb libncursesw6 6.3-2ubuntu0.1 deb libnettle8 3.7.3-1build2 deb -libnghttp2-14 1.43.0-1ubuntu0.1 deb +libnghttp2-14 1.43.0-1ubuntu0.2 deb libnpth0 1.6-3build2 deb libnsl2 1.3.0-2build2 deb libnspr4 2:4.35-0ubuntu0.22.04.1 deb From 85254746b9ff9b39d346eb3208cce257a582f7b6 Mon Sep 17 00:00:00 2001 From: Tschuuuls Date: Wed, 8 May 2024 23:14:06 +0200 Subject: [PATCH 07/11] Account for older MongoDB Versions --- readme-vars.yml | 58 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/readme-vars.yml b/readme-vars.yml index a297ca9..9e7b982 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -64,31 +64,63 @@ app_setup_block: | 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.** + + **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.js` file with the following contents: + If you are using the [official mongodb container](https://hub.docker.com/_/mongo/) in Version 6 and up, 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"}]}); db.getSiblingDB("MONGO_DBNAME_stat").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "dbOwner", db: "MONGO_DBNAME_stat"}]}); ``` + + If you are using mongodb < 6.0 and below, you can create a `init-mongo.sh` file with the following contents: + ```sh + #!/bin/bash + + mongo <= 6.0 and up: + ```yaml + unifi-db: + image: docker.io/mongo: + container_name: unifi-db + volumes: + - /path/to/data:/data/db + - /path/to/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro + restart: unless-stopped + ``` + MongoDB < 6.0: + ```yaml + unifi-db: + image: docker.io/mongo: + container_name: unifi-db + volumes: + - /path/to/data:/data/db + - /path/to/init-mongo.sh:/docker-entrypoint-initdb.d/init-mongo.sh:ro + restart: unless-stopped + ``` + - ```yaml - unifi-db: - image: docker.io/mongo: - container_name: unifi-db - volumes: - - /path/to/data:/data/db - - /path/to/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro - 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.* + *If you are using the init JS method do not also set `MONGO_INITDB_ROOT_USERNAME`, `MONGO_INITDB_ROOT_PASSWORD`, or any other "INITDB" values as they will cause conflicts. Setting these variables for the .sh file is necessary* You can also run the commands directly against the database using either `mongo` (< 6.0) or `mongosh` (>= 6.0). From 20122b1d33d02b679f09cd2e7d39016f1598d155 Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Tue, 14 May 2024 17:25:57 +0000 Subject: [PATCH 08/11] Bot Updating Templated Files --- Jenkinsfile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f3528b6..4ad8a0e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -381,16 +381,14 @@ pipeline { echo "Updating Unraid template" cd ${TEMPDIR}/unraid/templates/ GH_TEMPLATES_DEFAULT_BRANCH=$(git remote show origin | grep "HEAD branch:" | sed 's|.*HEAD branch: ||') - if grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then - if [[ -f ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ]]; then - echo "Image is on the ignore list, marking Unraid template as deprecated" - cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/ - git add -u unraid/${CONTAINER_NAME}.xml - git mv unraid/${CONTAINER_NAME}.xml unraid/deprecated/${CONTAINER_NAME}.xml || : - git commit -m 'Bot Moving Deprecated Unraid Template' || : - else - echo "Image is on the ignore list, but no template exist, skipping deprecation" - fi + if grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list && [[ -f ${TEMPDIR}/unraid/templates/unraid/deprecated/${CONTAINER_NAME}.xml ]]; then + echo "Image is on the ignore list, and already in the deprecation folder." + elif grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then + echo "Image is on the ignore list, marking Unraid template as deprecated" + cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/ + git add -u unraid/${CONTAINER_NAME}.xml + git mv unraid/${CONTAINER_NAME}.xml unraid/deprecated/${CONTAINER_NAME}.xml || : + git commit -m 'Bot Moving Deprecated Unraid Template' || : else cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/ git add unraid/${CONTAINER_NAME}.xml From 286ca2325124e751a3e934db77552537fb5daf83 Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Tue, 14 May 2024 17:29:20 +0000 Subject: [PATCH 09/11] Bot Updating Package Versions --- package_versions.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package_versions.txt b/package_versions.txt index 846a5cc..1a5738b 100755 --- a/package_versions.txt +++ b/package_versions.txt @@ -17,7 +17,6 @@ aws-java-sdk-s3 1.11.409 base-files 12ubuntu4.6 deb base-passwd 3.5.52build1 deb bash 5.1-6ubuntu1.1 deb -bash 5.1.16 binary bcpkix-jdk18on 1.75 java-archive bcprov-jdk18on 1.75 java-archive bcutil-jdk18on 1.75 java-archive @@ -27,6 +26,7 @@ bson-record-codec 4.11.1 ca-certificates 20230311ubuntu0.22.04.1 deb ca-certificates-java java-archive ca-certificates-java 20190909ubuntu1.2 deb +catatonit 0.1.7-1 deb checker-qual 3.12.0 java-archive classmate 1.6.0 java-archive coloring 1.0 java-archive @@ -177,7 +177,7 @@ libfontconfig1 2.13.1-4.2ubuntu5 libfreetype6 2.11.1+dfsg-1ubuntu0.2 deb libgcc-s1 12.3.0-1ubuntu1~22.04 deb libgcrypt20 1.9.4-3ubuntu3 deb -libglib2.0-0 2.72.4-0ubuntu2.2 deb +libglib2.0-0 2.72.4-0ubuntu2.3 deb libgmp10 2:6.2.1+dfsg-3ubuntu1 deb libgnutls30 3.7.3-4ubuntu1.5 deb libgpg-error0 1.43-3 deb From f3e65ae0a613163fd05f098f76b144baeb4ed3a3 Mon Sep 17 00:00:00 2001 From: Tschuuuls Date: Sun, 19 May 2024 23:14:41 +0200 Subject: [PATCH 10/11] Update readme-vars.yml Improve ambiguous language --- readme-vars.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readme-vars.yml b/readme-vars.yml index 9e7b982..579137e 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -67,14 +67,14 @@ app_setup_block: | **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/) in Version 6 and up, 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/) in Version >=6, 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"}]}); db.getSiblingDB("MONGO_DBNAME_stat").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "dbOwner", db: "MONGO_DBNAME_stat"}]}); ``` - If you are using mongodb < 6.0 and below, you can create a `init-mongo.sh` file with the following contents: + If you are using mongodb < 6.0, you can create a `init-mongo.sh` file with the following contents: ```sh #!/bin/bash @@ -96,7 +96,7 @@ app_setup_block: | Being sure to replace the placeholders with the same values you supplied to the Unifi container, and mount it into your *mongodb* container. For example: - MongoDB >= 6.0 and up: + MongoDB >= 6.0: ```yaml unifi-db: image: docker.io/mongo: From cb61a9553efc1f5b06a47455697632890814f462 Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Mon, 20 May 2024 12:18:13 +0000 Subject: [PATCH 11/11] Bot Updating Templated Files --- README.md | 56 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 0f5425a..5c3cee1 100644 --- a/README.md +++ b/README.md @@ -68,30 +68,62 @@ Starting with version 8.1 of Unifi Network Application, mongodb 3.6 through 7.0 **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: +**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/) in Version >=6, 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"}]}); db.getSiblingDB("MONGO_DBNAME_stat").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "dbOwner", db: "MONGO_DBNAME_stat"}]}); ``` +If you are using mongodb < 6.0, you can create a `init-mongo.sh` file with the following contents: +```sh +#!/bin/bash + +mongo <= 6.0: + ```yaml + unifi-db: + image: docker.io/mongo: + container_name: unifi-db + volumes: + - /path/to/data:/data/db + - /path/to/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro + restart: unless-stopped + ``` + MongoDB < 6.0: + ```yaml + unifi-db: + image: docker.io/mongo: + container_name: unifi-db + volumes: + - /path/to/data:/data/db + - /path/to/init-mongo.sh:/docker-entrypoint-initdb.d/init-mongo.sh:ro + restart: unless-stopped + ``` -```yaml - unifi-db: - image: docker.io/mongo: - container_name: unifi-db - volumes: - - /path/to/data:/data/db - - /path/to/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro - 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.* +*If you are using the init JS method do not also set `MONGO_INITDB_ROOT_USERNAME`, `MONGO_INITDB_ROOT_PASSWORD`, or any other "INITDB" values as they will cause conflicts. Setting these variables for the .sh file is necessary* You can also run the commands directly against the database using either `mongo` (< 6.0) or `mongosh` (>= 6.0).