From cd9d247be95c1f3bbeb4e245821ae258ad8717cd Mon Sep 17 00:00:00 2001 From: Tomasz Date: Tue, 7 Sep 2021 21:13:24 +0200 Subject: [PATCH] adds demo using vagrant --- .gitignore | 2 ++ README.md | 13 +++++++++++++ vagrant/Vagrantfile | 24 ++++++++++++++++++++++++ vagrant/bootstrap.sh | 9 +++++++++ 4 files changed, 48 insertions(+) create mode 100644 .gitignore create mode 100644 vagrant/Vagrantfile create mode 100644 vagrant/bootstrap.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f72a1ba --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/vagrant/.vagrant/ +/vagrant/backup/ diff --git a/README.md b/README.md index bb66a69..687d306 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,19 @@ bash installer.sh --machine MY_MACHINE - tinker - khadas-vim3 +## Demo +Vagrant can create virtual mashine with the Home Assistant Supervisor. It can be used to play around with Home Assistant. +All files are kept inside virtual machine besides backup directory. Backup directory is mapped to `vagrant/backup`. +It can be used to restore Home Assistant after destroying virtual machine. + +Installation can be accessed by http://192.168.50.4:8123 + + +```bash +cd vagrant +vagrant up +``` + ## Troubleshooting If somethings going wrong, use `journalctl -f` to get your system logs. If you are not familiar with Linux and how you can fix issues, we recommend to use our Home Assistant OS. diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile new file mode 100644 index 0000000..a30974d --- /dev/null +++ b/vagrant/Vagrantfile @@ -0,0 +1,24 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "debian/bullseye64" + config.vm.synced_folder "backup", "/usr/share/hassio/backup/", owner: "root", group: "root", create: true + + config.vm.provider "virtualbox" do |vb| + vb.memory = "2048" + vb.cpus = "2" + #uncomment those if you need to redirect USB devices + # vb.customize ["modifyvm", :id, "--usb", "on"] + # vb.customize ["modifyvm", :id, "--usbehci", "on"] + #to find vendorid and producctid please use 'VBoxManage list usbhost' + # vb.customize ["usbfilter", "add", "0", + # "--target", :id, + # "--name", "Zigbee", + # "--vendorid", "0x1a86", + # "--productid", "0x7523"] + end + + config.vm.provision :shell, path: "bootstrap.sh" + config.vm.network "private_network", ip: "192.168.50.4" +end diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh new file mode 100644 index 0000000..c6a39ac --- /dev/null +++ b/vagrant/bootstrap.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +apt-get update +apt-get install -y curl network-manager apparmor docker.io jq +curl -sLo installer.sh https://raw.githubusercontent.com/home-assistant/supervised-installer/master/installer.sh +sed -i "s/read answer.*/answer=n/g" installer.sh +sed -i "/sleep 10/d" installer.sh +sed -i "s/IP_ADDRESS=.*/IP_ADDRESS=192.168.50.4/g" installer.sh +sudo bash installer.sh \ No newline at end of file