This commit is contained in:
50
_apps/smarthome/Containerfile
Normal file
50
_apps/smarthome/Containerfile
Normal file
@@ -0,0 +1,50 @@
|
||||
FROM node:current-buster
|
||||
|
||||
# Set the commit of Zwave2Mqtt to checkout when cloning the repo
|
||||
ENV Z2M_VERSION=9cc3740740b57f1e896139b5ffdb25be7576ad58
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
#setup local apt cache
|
||||
#RUN sed -i 's@http://@http://apt-cache.lan/@g' /etc/apt/sources.list
|
||||
#/apt-cache
|
||||
|
||||
# Install required dependencies
|
||||
RUN apt update -y
|
||||
RUN apt full-upgrade -y
|
||||
|
||||
# Packages we need
|
||||
RUN apt install -y \
|
||||
socat libopenzwave1.5 npm git
|
||||
|
||||
# Clone Zwave2Mqtt build pkg files and move them to /dist/pkg
|
||||
RUN npm config set unsafe-perm true && npm install -g pkg
|
||||
RUN cd /root \
|
||||
&& git clone https://github.com/OpenZWave/Zwave2Mqtt.git \
|
||||
&& cd Zwave2Mqtt \
|
||||
&& git checkout ${Z2M_VERSION} \
|
||||
&& npm install \
|
||||
&& npm run build
|
||||
|
||||
# Clean up
|
||||
RUN apt autoremove -y
|
||||
RUN apt clean -y
|
||||
RUN rm -rf /root/*
|
||||
RUN apt-get clean -y
|
||||
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
COPY --from=build /dist/lib/ /lib/
|
||||
COPY --from=build /dist/pkg /usr/src/app
|
||||
|
||||
# supervisor base configuration
|
||||
ADD supervisor.conf /etc/supervisor.conf
|
||||
|
||||
LABEL maintainer="zoide"
|
||||
|
||||
# Set enviroment
|
||||
ENV LD_LIBRARY_PATH /lib
|
||||
|
||||
EXPOSE 8091
|
||||
|
||||
CMD ["supervisord", "-c", "/etc/supervisor.conf"]
|
||||
#CMD ["/usr/src/app/zwave2mqtt"]
|
||||
|
||||
179
_apps/smarthome/home-assistant.yaml
Normal file
179
_apps/smarthome/home-assistant.yaml
Normal file
@@ -0,0 +1,179 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hassio
|
||||
labels:
|
||||
app: hassio
|
||||
release: latest
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: hassio
|
||||
release: latest
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: hassio
|
||||
release: latest
|
||||
spec:
|
||||
containers:
|
||||
- name: hassio
|
||||
image: homeassistant/home-assistant:latest
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: TZ
|
||||
value: Europe/Berlin
|
||||
volumeMounts:
|
||||
- name: hassio-storage
|
||||
mountPath: /config
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8123
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 300
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 120
|
||||
periodSeconds: 5
|
||||
resources:
|
||||
requests:
|
||||
memory: "200Mi"
|
||||
cpu: "250m"
|
||||
limits:
|
||||
memory: "256Mi"
|
||||
cpu: "500m"
|
||||
- name: configurator
|
||||
image: "causticlab/hass-configurator-docker:arm"
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: HC_HASS_API
|
||||
value: http://127.0.0.1:8123/api/
|
||||
- name: HC_HASS_API_PASSWORD
|
||||
value: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhMzBmYjU1ZjcyZGE0Yzc2YmU2NmY0NjljNTAyMjdjZCIsImlhdCI6MTYxMjg4MzI5NywiZXhwIjoxOTI4MjQzMjk3fQ.1ICsHliUXR0CG4H8vQRYJ5jVqFwmqKSB0fScSitC-Q4
|
||||
ports:
|
||||
- name: adm
|
||||
containerPort: 3218
|
||||
protocol: TCP
|
||||
#livenessProbe:
|
||||
# httpGet:
|
||||
# path: /
|
||||
# port: 3218
|
||||
# initialDelaySeconds: 60
|
||||
# periodSeconds: 3
|
||||
#readinessProbe:
|
||||
# httpGet:
|
||||
# path: /
|
||||
# port: 3218
|
||||
# initialDelaySeconds: 60
|
||||
# periodSeconds: 5
|
||||
volumeMounts:
|
||||
- name: hassio-storage
|
||||
mountPath: /hass-config
|
||||
- name: hassio-conf-storage
|
||||
mountPath: /config
|
||||
volumes:
|
||||
- name: hassio-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: hassio-storage
|
||||
- name: hassio-conf-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: hassio-configurator
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: hassio-storage
|
||||
labels:
|
||||
app: hassio
|
||||
spec:
|
||||
storageClassName: nfs-ssd
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 20Mi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: hassio-configurator
|
||||
labels:
|
||||
app: hassio
|
||||
spec:
|
||||
storageClassName: nfs-ssd
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 20Mi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hassio
|
||||
labels:
|
||||
app: hassio
|
||||
release: latest
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
app: hassio
|
||||
release: latest
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hassio-conf
|
||||
labels:
|
||||
app: hassio
|
||||
release: latest
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: adm
|
||||
protocol: TCP
|
||||
name: adm
|
||||
selector:
|
||||
app: hassio
|
||||
release: latest
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: hassio
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: nginx
|
||||
spec:
|
||||
rules:
|
||||
- host: hassio.lan
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: hassio
|
||||
port:
|
||||
name: http
|
||||
- host: hassio-conf.lan
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: hassio-conf
|
||||
port:
|
||||
name: adm
|
||||
8
_apps/smarthome/socat/Containerfile
Normal file
8
_apps/smarthome/socat/Containerfile
Normal file
@@ -0,0 +1,8 @@
|
||||
FROM alpine:latest
|
||||
|
||||
ARG VERSION=1.7.3.2
|
||||
|
||||
RUN apk --no-cache add socat
|
||||
#=${VERSION}
|
||||
|
||||
ENTRYPOINT ["socat"]
|
||||
13
_apps/smarthome/supervisor.conf
Normal file
13
_apps/smarthome/supervisor.conf
Normal file
@@ -0,0 +1,13 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
[program:socat]
|
||||
command=/usr/bin/socat -d -d -d pty,link=/dev/ttySER2NET0,raw,user=root,group=root,mode=660 tcp:auto:3333
|
||||
killasgroup=true
|
||||
stopasgroup=true
|
||||
redirect_stderr=true
|
||||
|
||||
[program:zwave2mqtt]
|
||||
directory=/usr/src/app
|
||||
command=/usr/src/app/zwave2mqtt
|
||||
redirect_stderr=true
|
||||
120
_apps/smarthome/zwave2mqtt.yaml
Normal file
120
_apps/smarthome/zwave2mqtt.yaml
Normal file
@@ -0,0 +1,120 @@
|
||||
## FROM: https://github.com/OpenZWave/Zwave2Mqtt
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: zwave2mqtt
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
name: zwave2mqtt
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: zwave2mqtt
|
||||
spec:
|
||||
containers:
|
||||
- name: zwave2mqtt
|
||||
image: docker-registry.lan/zwave2mqtt:arm64
|
||||
livenessProbe:
|
||||
failureThreshold: 12
|
||||
httpGet:
|
||||
httpHeaders:
|
||||
- name: Accept
|
||||
value: text/plain
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 2
|
||||
ports:
|
||||
- containerPort: 8091
|
||||
name: http
|
||||
protocol: TCP
|
||||
resources:
|
||||
limits:
|
||||
cpu: '1'
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: '1'
|
||||
memory: 200Mi
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: true
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- mountPath: /usr/src/app/store
|
||||
name: data
|
||||
# - mountPath: /usr/local/etc/openzwave
|
||||
# name: ozwdatabase
|
||||
# - mountPath: /usr/src/app/store/settings.json <-- if putting your settings.json in a secret
|
||||
# name: config
|
||||
# readOnly: true
|
||||
# subPath: settings.json
|
||||
# nodeSelector:
|
||||
# kubernetes.io/hostname: stick1 #<--- the name of your cluster node that the zwave usb stick in
|
||||
# - name: socat
|
||||
# image: docker-registry.lan/socat:arm64
|
||||
# args:
|
||||
# - pty,link=/dev/ttySER2NET0,raw,user=root,group=root,mode=660
|
||||
# - tcp:auto:3333
|
||||
# securityContext:
|
||||
# allowPrivilegeEscalation: true
|
||||
# privileged: true
|
||||
volumes:
|
||||
# - name: config <-- if putting your settings.json in a secret
|
||||
# secret:
|
||||
# defaultMode: 420
|
||||
# secretName: zwave2mqtt
|
||||
#- name: zwavestick
|
||||
# hostPath:
|
||||
# path: /dev/ttyACM0
|
||||
# type: File
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: zwave2mqtt-storage
|
||||
# - name: ozwdatabase
|
||||
# hostPath:
|
||||
# path: /zwave2mqtt/database
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: zwave2mqtt-storage
|
||||
labels:
|
||||
app: zwave2mqtt
|
||||
spec:
|
||||
storageClassName: nfs-ssd
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 20Mi
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: zwave2mqtt
|
||||
spec:
|
||||
rules:
|
||||
- host: zwave.lan
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: zwave2mqtt
|
||||
servicePort: http
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: zwave2mqtt
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: http
|
||||
selector:
|
||||
name: zwave2mqtt
|
||||
Reference in New Issue
Block a user