diff --git a/netdaemon/CHANGELOG.md b/netdaemon/CHANGELOG.md index 9dc9492..a1ae79c 100644 --- a/netdaemon/CHANGELOG.md +++ b/netdaemon/CHANGELOG.md @@ -19,3 +19,8 @@ - Better error management in initialization - Support for Camera in Fluent API +## [0.3.2] + +- Better logging and error handling +- Serilog now main logsink +- Improved Log methods in NetDaemonApps diff --git a/netdaemon/Dockerfile b/netdaemon/Dockerfile index 08559dc..9ee518b 100644 --- a/netdaemon/Dockerfile +++ b/netdaemon/Dockerfile @@ -1,5 +1,5 @@ -ARG BUILD_FROM=hassioaddons/base-amd64:5.0.3 +ARG BUILD_FROM=hassioaddons/base-amd64:7.1.0 FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine as build @@ -34,11 +34,18 @@ RUN \ # STAGE 2: Include binary in target add-on container FROM ${BUILD_FROM} AS runtime +# Set shell +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + # Build arguments ARG BUILD_ARCH # Copy binary and the config from build container COPY --from=build /netdaemon/bin/publish /daemon +RUN chmod +x /daemon/Service + +# Copy root filesystem +COPY rootfs / COPY install_dotnet_dep.sh /install_dotnet_dep.sh @@ -54,7 +61,6 @@ ENV ASPNETCORE_URLS=http://+:80 \ ENV HASS_DAEMONAPPFOLDER /config/netdaemon -CMD [ "/daemon/Service" ] # # LABEL target docker image diff --git a/netdaemon/build.json b/netdaemon/build.json index 829517d..64474e8 100644 --- a/netdaemon/build.json +++ b/netdaemon/build.json @@ -1,9 +1,9 @@ { "build_from": { - "aarch64": "hassioaddons/debian-base-aarch64:3.0.1", - "amd64": "hassioaddons/base-amd64:7.0.2", - "armhf": "hassioaddons/debian-base-armhf:3.0.1", - "armv7": "hassioaddons/debian-base-armv7:3.0.1" + "aarch64": "hassioaddons/debian-base-aarch64:3.1.0", + "amd64": "hassioaddons/base-amd64:7.1.0", + "armhf": "hassioaddons/debian-base-armhf:3.1.0", + "armv7": "hassioaddons/debian-base-armv7:3.1.0" }, "args": {} -} +} \ No newline at end of file diff --git a/netdaemon/config.json b/netdaemon/config.json index 893ba37..d001b4b 100644 --- a/netdaemon/config.json +++ b/netdaemon/config.json @@ -1,6 +1,6 @@ { "name": "NetDaemon", - "version": "0.3.1", + "version": "0.3.2", "slug": "netdaemon", "description": "Application daemon written in .NET core 3.1", "url": "http://netdaemon.xyz", diff --git a/netdaemon/rootfs/etc/services.d/NetDaemon/finish b/netdaemon/rootfs/etc/services.d/NetDaemon/finish new file mode 100644 index 0000000..b443f41 --- /dev/null +++ b/netdaemon/rootfs/etc/services.d/NetDaemon/finish @@ -0,0 +1,9 @@ +#!/usr/bin/execlineb -S0 +# ============================================================================== +# NetDaemon add-on +# Take down the S6 supervision tree when NetDaemon fails +# ============================================================================== +if -n { s6-test $# -ne 0 } +if -n { s6-test ${1} -eq 256 } + +s6-svscanctl -t /var/run/s6/services diff --git a/netdaemon/rootfs/etc/services.d/NetDaemon/run b/netdaemon/rootfs/etc/services.d/NetDaemon/run new file mode 100644 index 0000000..6d54f13 --- /dev/null +++ b/netdaemon/rootfs/etc/services.d/NetDaemon/run @@ -0,0 +1,11 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# NetDaemon Add-on +# Starts NetDaemon +# ============================================================================== + +cd /daemon || bashio::exit.nok "Could not change directory to Node-RED" + +bashio::log.info "Starting NetDaemon..." + +exec ./Service