Skip to content

Commit

Permalink
Merge pull request #16 from loopy321/revert-pull
Browse files Browse the repository at this point in the history
Update (NS14.2.6) + Fix(import_config_url) + New(MONGODB_URI config option)
  • Loading branch information
marciogranzotto authored Apr 19, 2023
2 parents 43e53c4 + f0cfa83 commit c38918c
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build_local_amd64.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cd nightscout && docker build --build-arg BUILD_FROM="ghcr.io/hassio-addons/ubuntu-base/amd64:6.1.3" --build-arg BUILD_ARCH=amd64 --progress plain --no-cache -t nightscout .
cd nightscout && docker build --build-arg BUILD_FROM="ghcr.io/hassio-addons/ubuntu-base:8.1.1" --build-arg BUILD_ARCH=amd64 --progress plain --no-cache -t nightscout .
8 changes: 5 additions & 3 deletions nightscout/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ COPY . /opt
WORKDIR /opt/app

ARG BUILD_ARCH=amd64
ARG NIGHTSCOUT_VERSION=14.2.2
ARG NIGHTSCOUT_VERSION=14.2.6
# hadolint ignore=DL3008
RUN \
URL="http://archive.ubuntu.com/ubuntu/" \
Expand All @@ -26,7 +26,7 @@ RUN \
&& curl -sL "https://deb.nodesource.com/setup_14.x" | bash - \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
mongodb-server=1:3.6.3-0ubuntu1.4 \
mongodb-server \
nodejs \
git \
webpack \
Expand All @@ -37,13 +37,15 @@ RUN \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
\
&& git clone --depth 1 --branch ${NIGHTSCOUT_VERSION} git://github.com/nightscout/cgm-remote-monitor.git /opt/app \
&& git clone --depth 1 --branch ${NIGHTSCOUT_VERSION} https://github.com/nightscout/cgm-remote-monitor.git /opt/app \
\
&& npm install \
&& npm run postinstall \
&& npm run env \
&& npm audit fix

RUN npm install [email protected]

VOLUME ["/data/db"]

# Copy root filesystem
Expand Down
2 changes: 1 addition & 1 deletion nightscout/build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"args": {},
"build_from": {
"aarch64": "ghcr.io/hassio-addons/ubuntu-base/aarch64:6.2.1",
"amd64": "ghcr.io/hassio-addons/ubuntu-base/amd64:6.2.1"
"amd64": "ghcr.io/hassio-addons/ubuntu-base:8.1.1"
}
}
5 changes: 4 additions & 1 deletion nightscout/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"arch": ["aarch64", "amd64"],
"webui": "[PROTO:ssl]://[HOST]:[PORT:5423]",
"startup": "services",
"init": "false",
"boot": "auto",
"image": "marciogranzotto/image-{arch}-addon-nightscout",
"hassio_role": "default",
Expand All @@ -23,6 +24,7 @@
"certfile": "fullchain.pem",
"keyfile": "privkey.pem",
"api_key": "",
"mongodb_uri": "mongodb://127.0.0.1:27017/admin",
"auth_default_roles": "readable",
"theme": "colors",
"import_config_url": "",
Expand Down Expand Up @@ -51,9 +53,10 @@
"certfile": "str",
"keyfile": "str",
"api_key": "str",
"mongodb_uri": "str",
"auth_default_roles": "list(admin|denied|status-only|readable|careportal|devicestatus-upload|activity)?",
"theme": "list(default|colors|colorblindfriendly)",
"import_config_url": "str?",
"plugins": ["str"]
}
}
}
Empty file modified nightscout/rootfs/etc/cont-init.d/mongodb.sh
100644 → 100755
Empty file.
Empty file modified nightscout/rootfs/etc/cont-init.d/nginx.sh
100644 → 100755
Empty file.
3 changes: 3 additions & 0 deletions nightscout/rootfs/etc/cont-init.d/nightscout.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
# ==============================================================================

readonly api_key=$(bashio::config 'api_key')
readonly mongodb_uri=$(bashio::config 'mongodb_uri')

bashio::log.info "Setting up API KEY: ${api_key}"
export API_SECRET="${api_key}"
bashio::log.info "Using Mongo URI: ${mongodb_uri}"
export MONGODB_URI="${mongodb_uri}"
Empty file modified nightscout/rootfs/etc/nginx/nginx-ssl.conf
100644 → 100755
Empty file.
Empty file modified nightscout/rootfs/etc/nginx/nginx.conf
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion nightscout/rootfs/etc/services.d/nginx/finish
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
if -n { s6-test $# -ne 0 }
if -n { s6-test ${1} -eq 256 }

s6-svscanctl -t /var/run/s6/services
#s6-svscanctl -t /var/run/s6/services
/run/s6/basedir/bin/halt
Empty file modified nightscout/rootfs/etc/services.d/nginx/run
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion nightscout/rootfs/etc/services.d/nightscout/finish
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
if -n { s6-test $# -ne 0 }
if -n { s6-test ${1} -eq 256 }

s6-svscanctl -t /var/run/s6/services
#s6-svscanctl -t /var/run/s6/services
/run/s6/basedir/bin/halt
10 changes: 8 additions & 2 deletions nightscout/rootfs/etc/services.d/nightscout/run
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ bashio::log.info 'Starting the Nightscout server...'
# Config server variables
readonly api_key=$(bashio::config 'api_key')
bashio::log.debug "Setting up API KEY: ${api_key}"
readonly mongodb_uri=$(bashio::config 'mongodb_uri')
bashio::log.debug "Setting up MONGODB_URI: ${mongodb_uri}"


export API_SECRET="${api_key}"
export HOSTNAME="127.0.0.1"
export PORT=1337
export MONGO_CONNECTION="mongodb://127.0.0.1:27017/admin"
#export MONGO_CONNECTION="mongodb://127.0.0.1:27017/admin"
export MONGODB_URI="${mongodb_uri}"
export INSECURE_USE_HTTP=true
export SECURE_HSTS_HEADER=false

Expand Down Expand Up @@ -48,13 +52,15 @@ fi

# Theme
if bashio::config.has_value 'import_config_url'; then
readonly theme=$(bashio::config 'import_config_url')
readonly import_config_url=$(bashio::config 'import_config_url')
bashio::log.info "Importing config from URL: ${import_config_url}"
export IMPORT_CONFIG="${import_config_url}"
fi

# Change current working directory
cd /opt/app || bashio::exit.nok 'Failed changing working directory'

npm install

# Run Nightscout server
exec node server.js

0 comments on commit c38918c

Please sign in to comment.