Skip to content
teusHPublic

About

Home Assistant toolset, e.g. script to install HAS with companion docker containers and service on RPi5.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

HAS toolset

Home Assistant toolset, e.g. script to install HAS with companion docker containers and service on RPi5.

containers-install.sh

Bash script to install docker containers family on RPi (work in progress): Home Assistant, Zigbee2MQTT, Mosquitto, WUD, Portainer, etc.

How to use this command:

containers-install.sh [--level=LEVEL|--debug|help|default|install|purge|container|upgrade/service ...]

Optional arguments:
--level=LEVEL or -l=LEVEL: level of verbosity, default level: ALL
Levels of verbosity (prioritized): ERROR, INFO, ALL, EMERGE, QUIET, CRITICAL, ALERT, WARN, NOTICE, DEBUG.

--debug: Script will show statements executed. Or use CLI environment variable DEBUG=on.
In debug mode the script will install containers with tty and attached.
Tip: Terminal access to running container: docker debug container_name,

help gives this information as shown here.
help name1 ... shows container docker docker run --detach ...

install installs or updates a docker container/image or system service (docker, mosquitto).

update update and restarts a docker container.
Install or update may be followed with container name(s). Default: default set of containers.
container is either a container name (prefer lowercase) or defaults (all default containers).
The container will be created via the docker run args ... image (detached/always start), where args are generated by the script. A copy of the run options can be found in container home directory: setup.sh.
Use enivironment variable DEBUG=log to run The script 'setup.sh' in attach mode.
On successful install an experimental compose.yaml file is generated in the container home directory.

service either upgrade, mosquitto or docker will do a system service (full) upgrade or installation.

Command arguments configuration examples:

containers-install.sh help homeassistant
Shows installation information for the docker container homeassistant.

containers-install.sh default
Runs with default container/image and service set. Default containers or services are: mosquitto, homeassistant, wud, go2rtc.

containers-install.sh delete [container|service ...]

containers-install.sh purge [container|service ...]
Will stop, remove, delete container(s) and image(s).
purge will not remove local stored data in home directory. 'delete' removes local data.
If container name is 'docker' the docker app also will be removed from system.

containers-install.sh help name
Will show actions and help when installing name.
Before installing containers or services first use help service/container.

dump container name ... Create a 'tar' dump of container data directory.
Store the data in /home/containers/backups directory for each installed container.
Dumps older as a month will be deleted when new data is found.
Default: make a dump of all installed container data.
Hint: save the dumps on a separate filesystem! To do: encrypt the archive.

*restore container name ... * Restore a (compressed) container dump file or config file.

*upgrade" (Full) upgrade of debian OS and applications.

Notice: Side effect installing a container is the file 'setup.sh' is generated in the container home directory. If setup.sh is available or command option help container from script looks ok, one can rm with docker CLI the container and use docker run or compose to start container via setup.sh.

Advise:
Before installing a docker container one is advised to obtain some preparation information. E.g. use the command 'containers-install.sh help container_name'.
An alternative is to use Portainer docker container to create, add/delete configuration items to the container, stop and restart, update docker containers. And use help containerNAME to give hints for the container configuration items. Portainer is however more complex to manage.

The script will use preconfigured installation. See DOCKER array variable definitions to change them if needed.
Docker container may use a serial dongle device. The group needed to access it is automatically discovered and added as group membership for the container. E.g. dialout. A reboot maybe required to activate user and group id mapping in hte OS kernel.

Available and configured debian installable services:

*mosquitto*       : Mosquitto system broker service for MQTT messages e.g. from zigbee2mqtt, tasmota, etc.

*docker*          : Docker container install and management system service/deamon.

Manage the debian service via CLI command (remote ssh):

sudo systemctl [start|restart|stop|status|enable] ServiceName.

Available and configured docker containers:

*go2rtc*          : Video streaming service. WebGui on *port 1984*.

*homeassistant*   : Home Assistant Systsem (HAS). WebGui on *port 8123*.

*lyrionmusic*     : LyrionMusic Server for Lyrion Players. WebGui on *port 9000*.

*matter*          : Generalized device managing service for matter devices. Preferrable via Thread.

*mqtt5*           : Mosquitto service (eclipse) for MQTT messages e.g. zigbee2mqtt, tasmota, etc. WebGui on *port 1883*. Not operational.

*portainer*       : Portainer docker container (create/edit/stop/start) manager. WubGui on *port 9002*.

*wud*             : Watch's Update Docker service. WebGui on *port 3000*.

*zigbee2mqtt*     : Zigbee to MQTT gateway service. WebGui on *port 8080*.

Manage docker containers via CLI command: docker [ps|restart|stop|status] dockerContainerName or uset 'setup.sh' in the home directory (default /opt/containers/<container_name>) of the container.
Or use (remote) portainer or wud.

Security

The script only uses sudo when needed.

Hint: after downloading the script take a look at the bash source. In particular look at the SUDO statemanets.

Then try 'bash containers-install.sh help' to test the bash version.

About

Home Assistant toolset, e.g. script to install HAS with companion docker containers and service on RPi5.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages