4. Setting up the BlockyTalky Dev Environment on BBG - mayalassiter/bbg-grove GitHub Wiki
This guide will walk through using the command line and SSH to set up the BlcokyTalky Development Environment on your BBG. First, get the git repository by cloning the BlockyTalky repository from the BlockyTalky git repo here.
Type cd blocktalky/
Type sudo tar xvfw erlang.tar.gz && sudo mv erlang /usr/local/lib
You need to add this to your system path so the Dev Environment finds our version of erlang. You can also just copy the erlang directory from an up and running BBG dev environment by copying it along with the elixir folder as in the next step and type sudo mv erlang /usr/local/lib
.
From an up and running BBG dev environment you navigate to the directory with elixir (for us it's cd ~/
) and type sudo scp -r elixir/ debian@beaglebone:/home/debian
and temppwd
when prompted.
These instructions will be changing when we move elixir to be system wide
add the line export PATH=$PATH:/usr/local/lib/erlang/bin
to the file /etc/bash.bashrc
with your favorite text editor. Next, add the line export PATH=$PATH:/home/debian/elixir/bin
to the file ~/.bashrc
back in the home directory type the following commands:
sudo apt-get install build-essential
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install nodejs
sudo rm -rf node_modules
sudo npm install```
We now have all of the frameworks needed to develop with BlockyTalky. cd into the second level blockytalky directory `cd blocktalky/blockytalky` and type the following commands:
```mix local.hex
mix deps.get
sudo apt-get install inotify-tools
sudo npm install -g brunch
npm install```
Until we develop our own elixir api for BBG I/O, now is a good time to get the Adafruit BBIO library to run our python api. type:
`sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus -y
sudo pip install Adafruit_BBIO`
You now have everything you need to develop with the BBG! You can either follow this guide to start up the server on your BBG or read about [Developing the BBG BlockyTalky API here](https://github.com/mayalassiter/bbg-grove/wiki/5.-The-BBG-BlockyTalky-API).
#Starting the Server#
from the blockytalky/blockytalky/ directory:
Note: run with sudo in the all of the commands in this document if using a system-wide elixir.
`sudo iex -S mix phoenix.server` runs the webserver (by default, on port 4000) and then gives you an iex> repl.
`sudo iex -S mix` runs just the backend code (no webserver / Phoenix.Endpoint). Useful if you want to debug something but don't want to compile the js / css using brunch.
After starting the server, your terminal window will give you live-response to changes on the front end BlockyTalky coding environment. You can use the BlockyTalky coding environment at "beaglebone:4000" or at "<ip-address-of-bbg>:4000"