created initial files for deploying homeassistant server
This commit is contained in:
6
Dockerfile
Normal file
6
Dockerfile
Normal file
@@ -0,0 +1,6 @@
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk --update --no-cache add yq
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod a+x /entrypoint.sh
|
41
entrypoint.sh
Normal file
41
entrypoint.sh
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
|
||||
DOMAIN=$DOMAIN
|
||||
SELECTOR=$HOMEASSISTANT
|
||||
HOMEASSISTANT_IP=$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d '/' -f1)
|
||||
HOST_FILE=/etc/system/data/dns/host.local;
|
||||
|
||||
EXISTS=$(grep -w -F $SELECTOR $HOST_FILE);
|
||||
if [ -n "$EXISTS" ]; then
|
||||
# selector already exists in hosts file and SCALE is not in use
|
||||
IP=$(echo $EXISTS | cut -d ' ' -f1);
|
||||
sed "s/'$IP'/'$HOMEASSISTANT_IP'/g" $HOST_FILE > /tmp/host.local
|
||||
mv /tmp/host.local $HOST_FILE;
|
||||
else
|
||||
echo "'$HOMEASSISTANT_IP' '$SELECTOR'" >> $HOST_FILE
|
||||
fi
|
||||
|
||||
mkdir -p /etc/user/data/homeassistant/config
|
||||
|
||||
if [ ! -f /etc/user/data/homeassistant/config/config.yaml ]; then
|
||||
|
||||
echo '# Loads default set of integrations. Do not remove.
|
||||
default_config:
|
||||
homeassistant:
|
||||
external_url: "DOMAIN"
|
||||
http:
|
||||
use_x_forwarded_for: true
|
||||
trusted_proxies:
|
||||
- 172.18.104.2
|
||||
- 172.18.105.2
|
||||
# Load frontend themes from the themes folder
|
||||
frontend:
|
||||
themes: !include_dir_merge_named themes
|
||||
|
||||
automation: !include automations.yaml
|
||||
script: !include scripts.yaml
|
||||
scene: !include scenes.yaml
|
||||
' >/etc/user/data/homeassistant/config/config.yaml
|
||||
fi
|
||||
|
||||
yq eval .'.homeassistant.external_url = "'$DOMAIN'"' -i /etc/user/data/homeassistant/config/config.yaml
|
Reference in New Issue
Block a user