include healthcheck in default actions
This commit is contained in:
@@ -28,7 +28,7 @@ jobs:
|
|||||||
echo ::set-output name=version::${GITHUB_SHA::8}
|
echo ::set-output name=version::${GITHUB_SHA::8}
|
||||||
fi
|
fi
|
||||||
echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||||
echo ::set-output name=docker_platforms::linux/amd64,linux/arm/v6
|
echo ::set-output name=docker_platforms::linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386
|
||||||
echo ::set-output name=docker_image::bushrangers/ha-voltronic-mqtt
|
echo ::set-output name=docker_image::bushrangers/ha-voltronic-mqtt
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
@@ -60,7 +60,7 @@ jobs:
|
|||||||
--build-arg "VERSION=${{ steps.prepare.outputs.version }}" \
|
--build-arg "VERSION=${{ steps.prepare.outputs.version }}" \
|
||||||
--tag "${{ steps.prepare.outputs.docker_image }}:latest" \
|
--tag "${{ steps.prepare.outputs.docker_image }}:latest" \
|
||||||
--tag "${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}" \
|
--tag "${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}" \
|
||||||
--file Dockerfile .
|
--file Dockerfile.multiarch .
|
||||||
-
|
-
|
||||||
name: Clear
|
name: Clear
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
FROM debian:stretch
|
||||||
|
|
||||||
|
RUN apt update && apt install -y \
|
||||||
|
curl \
|
||||||
|
git \
|
||||||
|
build-essential \
|
||||||
|
cmake \
|
||||||
|
jq \
|
||||||
|
mosquitto-clients
|
||||||
|
|
||||||
|
ADD sources/ /opt/
|
||||||
|
ADD config/ /etc/inverter/
|
||||||
|
|
||||||
|
RUN cd /opt/inverter-cli && \
|
||||||
|
mkdir bin && cmake . && make && mv inverter_poller bin/
|
||||||
|
|
||||||
|
HEALTHCHECK \
|
||||||
|
--interval=30s \
|
||||||
|
--timeout=10s \
|
||||||
|
--start-period=1m \
|
||||||
|
--retries=3 \
|
||||||
|
CMD /opt/healthcheck
|
||||||
|
|
||||||
|
WORKDIR /opt
|
||||||
|
ENTRYPOINT ["/bin/bash", "/opt/inverter-mqtt/entrypoint.sh"]
|
||||||
@@ -26,5 +26,12 @@ ADD config/ /etc/inverter/
|
|||||||
RUN cd /opt/inverter-cli && \
|
RUN cd /opt/inverter-cli && \
|
||||||
mkdir bin && cmake . && make && mv inverter_poller bin/
|
mkdir bin && cmake . && make && mv inverter_poller bin/
|
||||||
|
|
||||||
|
HEALTHCHECK \
|
||||||
|
--interval=30s \
|
||||||
|
--timeout=10s \
|
||||||
|
--start-period=1m \
|
||||||
|
--retries=3 \
|
||||||
|
CMD /opt/healthcheck
|
||||||
|
|
||||||
WORKDIR /opt
|
WORKDIR /opt
|
||||||
ENTRYPOINT ["/bin/bash", "/opt/inverter-mqtt/entrypoint.sh"]
|
ENTRYPOINT ["/bin/bash", "/opt/inverter-mqtt/entrypoint.sh"]
|
||||||
@@ -29,7 +29,7 @@ grafana-example.jpg
|
|||||||
|
|
||||||
**Docker Hub:** [`bushrangers/ha-voltronic-mqtt`](https://hub.docker.com/r/bushrangers/ha-voltronic-mqtt/)
|
**Docker Hub:** [`bushrangers/ha-voltronic-mqtt`](https://hub.docker.com/r/bushrangers/ha-voltronic-mqtt/)
|
||||||
|
|
||||||
 
|
  
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
@@ -64,7 +64,11 @@ docker-compose up -d
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
_**Note:** builds on docker hub are currently for x64 -- If you have issues standing up the image on your Linux distribution (i.e. Your Raspberry Pi/ARM device) you will need to manually build the image - This can be done by uncommenting the build flag in your docker-compose.yml file._
|
_**Note:**_
|
||||||
|
|
||||||
|
- builds on docker hub are currently for `linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386` -- If you have issues standing up the image on your Linux distribution (i.e. An old Pi/ARM device) you may need to manually build the image to support your local device architecture - This can be done by uncommenting the build flag in your docker-compose.yml file.
|
||||||
|
|
||||||
|
- The default `docker-compose.yml` file includes Watchtower, which can be configured to auto-update this image when we push new changes to github - Please **uncomment if you wish to auto-update to the latest builds of this project**.
|
||||||
|
|
||||||
## Integrating into Home Assistant.
|
## Integrating into Home Assistant.
|
||||||
|
|
||||||
|
|||||||
+24
-2
@@ -1,11 +1,17 @@
|
|||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
voltronic-mqtt:
|
voltronic-mqtt:
|
||||||
|
|
||||||
build: .
|
# We're now (finally) supporting Multi-Arch builds (via Github actions) on Docker Hub!
|
||||||
# image: bushrangers/ha-voltronic-mqtt
|
# image: bushrangers/ha-voltronic-mqtt
|
||||||
|
|
||||||
|
# Uncomment if you want to build your own local version.
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile.dev
|
||||||
|
|
||||||
|
|
||||||
container_name: voltronic-mqtt
|
container_name: voltronic-mqtt
|
||||||
|
|
||||||
privileged: true
|
privileged: true
|
||||||
@@ -26,3 +32,19 @@ services:
|
|||||||
- /dev/ttyS0:/dev/ttyS0
|
- /dev/ttyS0:/dev/ttyS0
|
||||||
- /dev/ttyS1:/dev/ttyS1
|
- /dev/ttyS1:/dev/ttyS1
|
||||||
- /dev/ttyS2:/dev/ttyS2
|
- /dev/ttyS2:/dev/ttyS2
|
||||||
|
|
||||||
|
# Used to auto-update images as we release new versions...
|
||||||
|
watchtower:
|
||||||
|
# Please see the following for configuration options:
|
||||||
|
# https://containrrr.github.io/watchtower/container-selection/
|
||||||
|
image: containrrr/watchtower
|
||||||
|
container_name: watchtower
|
||||||
|
|
||||||
|
restart: always
|
||||||
|
privileged: true
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
|
||||||
|
command: --interval 500
|
||||||
|
|
||||||
|
|||||||
Executable
+9
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
PROC=`ps cax | grep -E "mqtt-subscriber|mosquitto_sub|watch" | awk '{print $5}' | sort -u | wc -l`
|
||||||
|
|
||||||
|
if [ "$PROC" -eq "3" ] ; then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
exit 99
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user