Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into replace-placeholers-i…
Browse files Browse the repository at this point in the history
…n-proeprties

# Conflicts:
#	readme-vars.yml
  • Loading branch information
sturman committed May 21, 2024
2 parents 9f8030f + cb61a95 commit 96d3003
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/external_trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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}'); \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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}'); \
Expand Down
10 changes: 6 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -381,7 +381,9 @@ 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 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
Expand Down Expand Up @@ -608,7 +610,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}
Expand Down
62 changes: 47 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"}]});
```

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:

```yaml
unifi-db:
image: docker.io/mongo:<version tag>
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
If you are using mongodb < 6.0, you can create a `init-mongo.sh` file with the following contents:
```sh
#!/bin/bash

mongo <<EOF
use admin
db.auth("${MONGO_INITDB_ROOT_USERNAME}", "${MONGO_INITDB_ROOT_PASSWORD}")
use ${MONGO_DBNAME}
db.createUser({
user: "${MONGO_USER}",
pwd: "${MONGO_PASS}",
roles: [
{ db: "${MONGO_DBNAME}", role: "dbOwner" },
{ db: "${MONGO_DBNAME}_stat", role: "dbOwner" }
]
})
EOF
```

*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.*
Being sure to replace the placeholders with the same values you supplied to the Unifi container, and mount it into your *mongodb* container.

*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.*
For example:
MongoDB >= 6.0:
```yaml
unifi-db:
image: docker.io/mongo:<version tag>
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:<version tag>
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
```
*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 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).

Expand Down
2 changes: 1 addition & 1 deletion jenkins-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions package_versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
58 changes: 45 additions & 13 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,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, 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 <<EOF
use admin
db.auth("${MONGO_INITDB_ROOT_USERNAME}", "${MONGO_INITDB_ROOT_PASSWORD}")
use ${MONGO_DBNAME}
db.createUser({
user: "${MONGO_USER}",
pwd: "${MONGO_PASS}",
roles: [
{ db: "${MONGO_DBNAME}", role: "dbOwner" },
{ db: "${MONGO_DBNAME}_stat", role: "dbOwner" }
]
})
EOF
```
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:
```yaml
unifi-db:
image: docker.io/mongo:<version tag>
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:<version tag>
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:<version tag>
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
```
*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).
Expand Down Expand Up @@ -119,7 +151,7 @@ app_setup_block: |
# changelog
changelogs:
- { date: "20.03.24:", desc: "Change environment variables" }
- { date: "21.05.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." }

0 comments on commit 96d3003

Please sign in to comment.