Home Automation with docker


$ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
$ sudo usermod -aG docker pi
  [This adds the user "pi" to the group "docker". Log out and back in for this to take effect.]
$ docker --version
  Docker version 19.03.4, build 9013bf5
$ sudo apt install -y python python-pip libffi-dev python-backports.ssl-match-hostname
$ sudo pip install docker-compose
$ docker-compose --version
  docker-compose version 1.24.1, build 4667896
$ sudo mkdir /opt
$ sudo chown pi:pi /opt
  [change the owner of /opt to pi]
$ cd /opt
$ mkdir dockermon
$ mkdir grafana
$ mkdir homeassistant
$ mkdir influxdb
$ mkdir mosquitto
$ mkdir node-red
$ mkdir organizr
$ mkdir portainer
$ nano /opt/docker-compose.yaml
  [ copy from https://gist.github.com/x99percent/d65b6f1ae4abfd64c2e1d6fffd3db371]
$ docker-compose pull
  [INFLUXDB]
$ docker run --rm influxdb influxd config > /opt/influxdb/influxdb.conf
$ docker run --rm -v /opt/influxdb/influxdb.conf:/etc/influxdb/influxdb.conf -v /opt/influxdb:/var/lib/influxdb -e INFLUXDB_DB=homeassistant -e INFLUXDB_ADMIN_USER=admin -e INFLUXDB_ADMIN_PASSWORD=7qSiAwcQGk42QilEyxm$ influxdb -config /etc/influxdb/influxdb.conf /init-influxdb.sh

certbot
  install to /usr/local/bin
  and follow instruction: https://community.letsencrypt.org/t/certbot-auto-deployment-best-practices/91979
  and https://community.letsencrypt.org/t/certbot-has-problem-setting-up-the-virtual-environment/83678/7

References

  - https://www.reddit.com/r/homeassistant/comments/895iw6/my_home_assistant_setup_rpi_3b_docker_compose/
  - https://github.com/jgarff/rpi_ws281x/issues/294#issuecomment-517008522