diff --git a/README.md b/README.md index 93fae7a..0849398 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,17 @@ ![image](images/hass_icon.png) ![image](images/plus.png) ![image](images/fabric_icon.png) - Easily deploy [Home-Assistant](http://home-assistant.io) along with a websockets enabled build of [Mosquitto](https://github.com/eclipse/mosquitto) to your Raspberry Pi with Fabric. - - The fabric script deploys hass in a virtualenv, and is run by a service account. This build is done in alignment with the install instructions found on Home-Assistant's website. The script also installs hass and Mosquitto as a Systemd service for you with the supplied .service files. + Easily deploy [Home-Assistant](http://home-assistant.io) and it's componants from a fresh Raspbian Jessie or Debian 8 install. The deploy script will do the following: +* Create needed directories +* Create needed service accounts +* Install OS and Python dependencies +* Setup a virtualenv to run Home-Assistant and components inside. +* Run as a service account +* Build Mosquitto from source with websocket support +* Install Python-openzwave in the Home-Assistant virtualenv +* Add both Home-Assistant and Mosquitto to systemd services + + **What is [Fabric](http://www.fabfile.org)?** The official README says: @@ -17,11 +25,18 @@ ### To Run: Simply install fabric locally: - ```pip install fabric``` + ```pip install fabric``` (for python 3 support, install fabric3 [https://github.com/mathiasertl/fabric.git](https://github.com/mathiasertl/fabric)) + + Ensure you're able to SSH into the target server. Clone the contents: ``` git clone https://github.com/jbags81/fabric-home-assistant.git ``` + Add the host info from before to the beginning of ```fabfile.py``` + + Run the "deploy" function to build a new home-assistant server: ``` fab deploy ``` + + Fabric allows any of the underlying functions to be ran individually as well. run ``` fab -l ``` to see a list of all callable jobs. - Run the "deploy" function: ``` fab deploy ``` + Future support for non-virtualenv based servers will be added, along with the ability to auto upload existing or backup .yaml Home-Assistant configs. I'm also working on a turn-key devlopment script to make testing and development environments one click setups.. More to come! diff --git a/fabfile.py b/fabfile.py index a4f7688..42e5a13 100644 --- a/fabfile.py +++ b/fabfile.py @@ -37,6 +37,9 @@ def setup_dirs(): with cd("/srv"): sudo("mkdir hass") sudo("chown hass hass") + with cd("hass"): + sudo("mkdir -p src") + sudo("chown hass:hass src") with cd("/home"): sudo("mkdir -p hass") sudo("chown hass:hass hass") @@ -99,6 +102,17 @@ def setup_homeassistant(): """ Activate VirtualEnv, Install Home-Assistant """ sudo("source /srv/hass/hass_venv/bin/activate && pip3 install homeassistant", user="hass") +def setup_pyzwave(): + """ Install python-openzwave and configure """ + sudo("apt-get install -y cython3 libudev-dev python3-sphinx python3-setuptools") + sudo("source /srv/hass/hass_venv/bin/activate && pip3 install --upgrade cython", user="hass") + with cd("/srv/hass/src"): + sudo("git clone https://github.com/OpenZWave/python-openzwave.git", user="hass") + with cd("python-openzwave"): + sudo("git checkout python3", user="hass") + sudo("source /srv/hass/hass_venv/bin/activate && PYTHON_EXEC=`which python3` make build", user="hass") + sudo("source /srv/hass/hass_venv/bin/activate && PYTHON_EXEC=`which python3` make install", user="hass") + def setup_services(): """ Enable applications to start at boot via systemd """ with cd("/etc/systemd/system/"): @@ -136,5 +150,8 @@ def deploy(): ## Activate venv, install Home-Assistant ## setup_homeassistant() + ## Activate venv, build and install python-openzwave ## + setup_pyzwave() + ## Make apps start at boot ## setup_services()