Merge pull request #1 from home-assistant/master

updates
This commit is contained in:
fransking 2020-08-17 13:20:23 +01:00 committed by GitHub
commit 8e7ef4c623
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 66 deletions

View file

@ -1,40 +1,16 @@
# This install method has been deprecated.
# This installation method is for advanced users only
## https://www.home-assistant.io/blog/2020/05/09/deprecating-home-assistant-supervised-on-generic-linux/
## Make sure you understand [the requirements](https://github.com/home-assistant/architecture/blob/master/adr/0014-home-assistant-supervised.md)
# Install Home Assistant Supervised
As an alternative to using the images which include the Home Assistant operating-system and Docker, it is also possible to run Home Assistant on a generic system running another Linux of your choice such as Ubuntu, Debian, etc as Supervised. Because of all the various possible install options, these are more of a community supported installation choice. It follows that the more esoteric of a choice made with the OS, the less a user will find in terms of information and support from the community.
This installation method provides the full Home Assistant experience on a regular operating system. This means, all components from the Home Assistant method are used, except for the Home Assistant Operating System. This system will run the Home Assistant Supervisor. The Supervisor is not just an application, it is a full appliance that manages the whole system. It will clean up, repair or reset settings to default if they no longer match expected values.
## Warning
By not using the Home Assistant Operating System, the user is responsible for making sure that all required components are installed and maintained. Required components and their versions will change over time. Home Assistant Supervised is provided as-is as a foundation for community supported do-it-yourself solutions. We only accept bug reports for issues that have been reproduced on a freshly installed, fully updated Debian with no additional packages.
The Supervisord system is designed to provide a full-featured environment that is comparable with Kubernetes, which is also a bad idea to run it by the side of another orchestrator on the same Host. The Supervisor is also not caring for other software they run on your Host, and it can affect things bad on both sides. You also need to know that the Home Assistant OS runs with less overhead on your Proxmox or other Hypervisor as if you install first Debian and Ubuntu. In most cases, it's not the best choice to run the Supervisord on top of a Linux, if you not 100% sure what you do. It is not just a container inside Docker!
This method is considered advanced and should only be used if one is an expert in managing a Linux operating system, Docker and networking.
**If you have issues, don't report this to us. You are self responsible for what you do, if you use this installer.**
## Requirements
We only support Linux distributions that follow the [FHS 3.0](https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard)!
```
docker-ce
bash
jq
curl
avahi-daemon
dbus
```
## Optional
```
apparmor-utils
network-manager
```
**Important**: Don't only install NetworkManager, you need also use it on your system.
## Run
## Installation
Run as root (sudo su):

View file

@ -5,7 +5,7 @@ set -e
CONFIG_FILE=%%HASSIO_CONFIG%%
SUPERVISOR="$(jq --raw-output '.supervisor' ${CONFIG_FILE})"
HOMEASSISTANT="$(jq --raw-output '.homeassistant' ${CONFIG_FILE})"
MACHINE="$(jq --raw-output '.machine' ${CONFIG_FILE})"
DATA="$(jq --raw-output '.data // "/usr/share/hassio"' ${CONFIG_FILE})"
# AppArmor Support
@ -30,10 +30,11 @@ runSupervisor() {
--security-opt seccomp=unconfined \
-v /run/docker.sock:/run/docker.sock \
-v /run/dbus:/run/dbus \
-v "${HASSIO_DATA}":/data \
-v /etc/machine-id:/etc/machine-id:ro \
-v "${HASSIO_DATA}":/data:rw \
-e SUPERVISOR_SHARE="${HASSIO_DATA}" \
-e SUPERVISOR_NAME=hassio_supervisor \
-e HOMEASSISTANT_REPOSITORY="${HOMEASSISTANT}" \
-e SUPERVISOR_MACHINE="${MACHINE}" \
"${SUPERVISOR}"
}

View file

@ -1,29 +1,21 @@
#!/usr/bin/env bash
set -e
function info { echo -e "[Info] $*"; }
function error { echo -e "[Error] $*"; exit 1; }
function warn { echo -e "[Warning] $*"; }
warn "This installer is no longer supported."
warn ""
warn "Home Assistant might work today, tomorrow maybe not."
warn ""
warn "If you want more control over your own system, run"
warn "Home Assistant as a VM or run Home Assistant Core"
warn "via a Docker container."
warn ""
echo 'Please typ "not supported" to continue this installation'
read x
if [ "$x" != "not supported" ]
then
echo "OK, bye!"
exit 1
fi
ARCH=$(uname -m)
DOCKER_BINARY=/usr/bin/docker
DOCKER_REPO=homeassistant
DOCKER_SERVICE=docker.service
DOCKER_DAEMON_CONFIG=/etc/docker/daemon.json
URL_VERSION="https://version.home-assistant.io/stable.json"
URL_HA="https://raw.githubusercontent.com/home-assistant/supervised-installer/master/files/ha"
URL_BIN_HASSIO="https://raw.githubusercontent.com/home-assistant/supervised-installer/master/files/hassio-supervisor"
@ -39,8 +31,8 @@ command -v jq > /dev/null 2>&1 || error "Please install jq first"
command -v curl > /dev/null 2>&1 || error "Please install curl first"
command -v avahi-daemon > /dev/null 2>&1 || error "Please install avahi first"
command -v dbus-daemon > /dev/null 2>&1 || error "Please install dbus first"
command -v nmcli > /dev/null 2>&1 || warn "No NetworkManager support on host."
command -v apparmor_parser > /dev/null 2>&1 || warn "No AppArmor support on host."
command -v nmcli > /dev/null 2>&1 || error "No NetworkManager support on host."
command -v apparmor_parser > /dev/null 2>&1 || error "No AppArmor support on host."
# Check if Modem Manager is enabled
@ -48,12 +40,28 @@ if systemctl list-unit-files ModemManager.service | grep enabled; then
warn "ModemManager service is enabled. This might cause issue when using serial devices."
fi
# Detect if running on snapped docker
if snap list docker >/dev/null 2>&1; then
DOCKER_BINARY=/snap/bin/docker
DATA_SHARE=/root/snap/docker/common/hassio
CONFIG=$DATA_SHARE/hassio.json
DOCKER_SERVICE="snap.docker.dockerd.service"
# Detect wrong docker logger config
if [ ! -f "$DOCKER_DAEMON_CONFIG" ]; then
# Write default configuration
info "Creating default docker deamon configuration $DOCKER_DAEMON_CONFIG"
cat > "$DOCKER_DAEMON_CONFIG" <<- EOF
{
"log-driver": "journald",
"storage-driver": "overlay2"
}
EOF
# Restart Docker service
info "Restarting docker service"
systemctl restart "$DOCKER_SERVICE"
else
STORRAGE_DRIVER=$(docker info -f "{{json .}}" | jq -r -e .Driver)
LOGGING_DRIVER=$(docker info -f "{{json .}}" | jq -r -e .LoggingDriver)
if [[ "$STORRAGE_DRIVER" != "overlay2" ]]; then
warn "Docker is using $STORRAGE_DRIVER and not 'overlay2' as the storrage driver, this is not supported."
fi
if [[ "$LOGGING_DRIVER" != "journald" ]]; then
warn "Docker is using $LOGGING_DRIVER and not 'journald' as the logging driver, this is not supported."
fi
fi
# Parse command line parameters
@ -93,33 +101,28 @@ CONFIG=$SYSCONFDIR/hassio.json
case $ARCH in
"i386" | "i686")
MACHINE=${MACHINE:=qemux86}
HOMEASSISTANT_DOCKER="$DOCKER_REPO/$MACHINE-homeassistant"
HASSIO_DOCKER="$DOCKER_REPO/i386-hassio-supervisor"
;;
"x86_64")
MACHINE=${MACHINE:=qemux86-64}
HOMEASSISTANT_DOCKER="$DOCKER_REPO/$MACHINE-homeassistant"
HASSIO_DOCKER="$DOCKER_REPO/amd64-hassio-supervisor"
;;
"arm" |"armv6l")
if [ -z $MACHINE ]; then
error "Please set machine for $ARCH"
fi
HOMEASSISTANT_DOCKER="$DOCKER_REPO/$MACHINE-homeassistant"
HASSIO_DOCKER="$DOCKER_REPO/armhf-hassio-supervisor"
;;
"armv7l")
if [ -z $MACHINE ]; then
error "Please set machine for $ARCH"
fi
HOMEASSISTANT_DOCKER="$DOCKER_REPO/$MACHINE-homeassistant"
HASSIO_DOCKER="$DOCKER_REPO/armv7-hassio-supervisor"
;;
"aarch64")
if [ -z $MACHINE ]; then
error "Please set machine for $ARCH"
fi
HOMEASSISTANT_DOCKER="$DOCKER_REPO/$MACHINE-homeassistant"
HASSIO_DOCKER="$DOCKER_REPO/aarch64-hassio-supervisor"
;;
*)
@ -127,10 +130,6 @@ case $ARCH in
;;
esac
if [ -z "${HOMEASSISTANT_DOCKER}" ]; then
error "Found no Home Assistant Docker images for this host!"
fi
if [[ ! "intel-nuc odroid-c2 odroid-n2 odroid-xu qemuarm qemuarm-64 qemux86 qemux86-64 raspberrypi raspberrypi2 raspberrypi3 raspberrypi4 raspberrypi3-64 raspberrypi4-64 tinker" = *"${MACHINE}"* ]]; then
error "Unknown machine type ${MACHINE}!"
fi
@ -150,20 +149,20 @@ HASSIO_VERSION=$(curl -s $URL_VERSION | jq -e -r '.supervisor')
cat > "$CONFIG" <<- EOF
{
"supervisor": "${HASSIO_DOCKER}",
"homeassistant": "${HOMEASSISTANT_DOCKER}",
"machine": "${MACHINE}",
"data": "${DATA_SHARE}"
}
EOF
##
# Pull supervisor image
echo "[Info] Install supervisor Docker container"
info "Install supervisor Docker container"
docker pull "$HASSIO_DOCKER:$HASSIO_VERSION" > /dev/null
docker tag "$HASSIO_DOCKER:$HASSIO_VERSION" "$HASSIO_DOCKER:latest" > /dev/null
##
# Install Hass.io Supervisor
echo "[Info] Install supervisor startup scripts"
info "Install supervisor startup scripts"
curl -sL ${URL_BIN_HASSIO} > "${PREFIX}/sbin/hassio-supervisor"
curl -sL ${URL_SERVICE_HASSIO} > "${SYSCONFDIR}/systemd/system/hassio-supervisor.service"
@ -179,7 +178,7 @@ systemctl enable hassio-supervisor.service
#
# Install Hass.io AppArmor
if command -v apparmor_parser > /dev/null 2>&1; then
echo "[Info] Install AppArmor scripts"
info "Install AppArmor scripts"
mkdir -p "${DATA_SHARE}/apparmor"
curl -sL ${URL_BIN_APPARMOR} > "${PREFIX}/sbin/hassio-apparmor"
curl -sL ${URL_SERVICE_APPARMOR} > "${SYSCONFDIR}/systemd/system/hassio-apparmor.service"
@ -197,11 +196,11 @@ fi
##
# Init system
echo "[Info] Run Hass.io"
info "Run Home Assistant Supervised"
systemctl start hassio-supervisor.service
##
# Setup CLI
echo "[Info] Install cli 'ha'"
info "Install cli 'ha'"
curl -sL ${URL_HA} > "${PREFIX}/bin/ha"
chmod a+x "${PREFIX}/bin/ha"