Skip to content

Commit

Permalink
Merge pull request #90 from me-box/development
Browse files Browse the repository at this point in the history
SDK and Tp-link drivers, merging to put master into a fully working state.
  • Loading branch information
Toshbrown committed Sep 21, 2017
2 parents 8ceb955 + 7666d2d commit 5c8ed24
Show file tree
Hide file tree
Showing 13 changed files with 219 additions and 124 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,8 @@ package-lock\.json
store-timeseries/

lib-go-databox/


driver-tplink-smart-plug/

sdk/
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sudo: required
language: node_js
node_js:
- "6"
language: Bash
script:
- exit 0

services:
- docker
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
* Re-enable docker hub builds
* removed need for remote app-store (for now)
* removed syslog loging will be done by stores
* new UI and Android app

## [0.1.2]
### Changed
Expand All @@ -22,6 +23,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
* moved the container manager into it own repo me-box/databox-cm
* Removed some modules and implemented mod clean to reduce container manager image size
* Docker Network API issue - when creating network first time. Fixed #29
* Integrated the graphical SDK

## [0.1.1] 2017-04-05
### Changed
Expand Down
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ then
Once docker is installed, just run the following to get your databox up and
running using images published to <https://hub.docker.com/r/databoxsystems>:

./startDatabox.sh
./databox-start

Once it's started point a web browser at <https://127.0.0.1:8989> and have fun.

To stop databox and clean up,

./stopDatabox.sh
./databox-stop

## Development

To develop on the platform and core components run

./startDatabox.sh dev
./databox-start dev

This will clones all the relevant repositories locally, and builds them into the
required Docker images. To try your component out, add your code into a
Expand All @@ -39,10 +39,25 @@ UI, ready for you to install.

## Known issues

- Error response from daemon: `network databox_[some network] not found`.
### Get Started with the Graphical SDK

The graphical SDK will allow you to quickly build and test simple databox apps. To start the sdk run:

./databox-start sdk

The SDK web UI is available at http://127.0.0.1:8086

To stop the SDK run:

./databox-stop sdk


### Develop system components and custom drivers

To develop on the platform and core components you can run

This is caused by starting Databox before docker has cleaned up the networks.
Should be fixed if you run `./startDatabox.sh`
Should be fixed if you run `./databox-start`

- TLS certificates invalid.

Expand Down
1 change: 1 addition & 0 deletions databox-fetch-components
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ update_repo "driver-twitter" &
update_repo "driver-sensingkit" &
update_repo "driver-google-takeout" &
update_repo "driver-phillips-hue" &
update_repo "driver-tplink-smart-plug" &

update_repo "app-twitter-sentiment" &
update_repo "app-light-graph" &
Expand Down
21 changes: 19 additions & 2 deletions databox-start
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,34 @@ if ! [ -x "$(command -v docker-compose)" ]; then
fi

## parse command line args
DOCKER_REPO="" #default to local images
DATABOX_SDK="0"
DATABOX_DEV="0"
DEV=0
SDK=0
case "$1" in
dev )
DEV=1
export DATABOX_DEV="1"
;;

sdk )
export DATABOX_SDK="1"
SDK=1
;;
esac

#Start the SDK
if [ "$SDK" == "1" ]
then
err "Starting SDK"

#SDK only works in DEV mode so force it
DEV=1
export DATABOX_DEV="1"
export HOSTMOUNT=$(pwd -P)
docker-compose -f docker-databox-sdk.yaml up -d
fi

## test if Databox is already running
err "testing if Databox is already running ..."
docker node ls >/dev/null 2>&1
Expand Down Expand Up @@ -102,8 +116,9 @@ DOCKER_REPO=""
if [ "$DEV" != "1" ]
then
# use images from https://hub.docker.com/r/databoxsystems/
export DOCKER_REPO="databoxsystems/"
DOCKER_REPO="databoxsystems/"
fi
export DOCKER_REPO=$DOCKER_REPO

function _exec {
docker run \
Expand All @@ -122,12 +137,14 @@ _exec node ./src/createCerts.js

if [ "$DEV" == "1" ]; then
# build all images locally in dev mode
err "Building Databox localy in dev mode"
./databox-fetch-components
docker-compose build
docker-compose -f ./docker-compose-dev-local-images.yaml build
fi

err "starting Databox"
docker-compose -f ./docker-databox-appstore.yaml up -d
docker stack deploy -c docker-compose.yaml databox

DARGS="-e DATABOX_DEV=$DEV"
Expand Down
8 changes: 6 additions & 2 deletions databox-stop
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash

set -e

## debug
if [[ "$DATABOX_DEBUG" = "true" ]]; then
set -x
Expand Down Expand Up @@ -30,6 +28,12 @@ if ! [ -x "$(command -v docker-compose)" ]; then
`"see https://docs.docker.com/compose/install/#install-compose"
fi

if [ "$1" == "sdk" ]
then
docker-compose -f docker-databox-sdk.yaml down
die 3 "SDK stoped."
fi

## stop Databox
err "stopping Databox ..."
docker stack rm databox
Expand Down
28 changes: 17 additions & 11 deletions docker-compose-dev-local-images.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
version: '3'


# Build only (put your images in here)
services:
store-json:
build:
context: ./store-json
dockerfile: Dockerfile${DATABOX_ARCH}
image: store-json

store-timeseries:
build:
context: ./store-timeseries
dockerfile: Dockerfile${DATABOX_ARCH}
image: store-timeseries

driver-os-monitor:
build:
context: ./driver-os-monitor
Expand All @@ -12,7 +25,7 @@ services:
build:
context: ./driver-twitter
dockerfile: Dockerfile${DATABOX_ARCH}
image: driver-twitter
image: driver-twitter

driver-phillips-hue:
build:
Expand Down Expand Up @@ -50,15 +63,8 @@ services:
dockerfile: Dockerfile${DATABOX_ARCH}
image: app-os-monitor

# Build the datastores
store-json:
build:
context: ./store-json
dockerfile: Dockerfile${DATABOX_ARCH}
image: store-json

store-timeseries:
driver-tplink-smart-plug:
build:
context: ./store-timeseries
context: ./driver-tplink-smart-plug
dockerfile: Dockerfile${DATABOX_ARCH}
image: store-timeseries
image: driver-tplink-smart-plug
Loading

0 comments on commit 5c8ed24

Please sign in to comment.