garagepi

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2015 License: MIT Imports: 16 Imported by: 0

README

Garagepi

Build Status Coverage Status

A webserver written in golang to display output of Raspberry Pi camera module and trigger gpio.

A typical use would be to view the interior of a garage and trigger the garage door opener via gpio (and a relay).

Copyright (c) 2014-2015, Robert Dimsdale. Licensed under MIT License.

Getting started

Requires Go v1.2 or higher, and jacksonliam's experimental mjpg-streamer.

Go dependencies

Dependencies are managed using godep. Install it as follows:

go get -u github.com/tools/godep

From within the directory of this cloned repo, fetch the golang dependencies:

godep restore
Installing
go install main.go

If this results in an error go install: no install location for .go files listed on command line (GOBIN not set) then an alternative is:

go build -o $GOPATH/bin/garagepi main.go
Init scripts

Copy the init scripts to /etc/init.d/ and set them to run automatically on boot with the following commands:

sudo cp scripts/init-scripts/* /etc/init.d/
sudo update-rc.d garagepi defaults
sudo update-rc.d garagestreamer defaults

The default location for the garagepi binary is /go/bin/garagepi. This is controlled by the GARAGE_PI_BINARY environment variable in scripts/init-scripts/garagepi.

Logging

By default logs are sent to /dev/null. This is controlled by the OUT_LOG environment variable in scripts/init-scripts/garagepi and scripts/init-scripts/garagestreamer. These can either be set to the same file or different files.

Performance

Multiple Pis

Performance can be improved by using multiple Pis - one for the mjpg streamer (with the camera attached) and one for the Go webserver (with the gpio attached). The responsiveness of the Go webserver is significantly improved and the framerate of the streamer improved slightly. Stability appears much better (the webserver/streamer crash more frequently when co-located on the same Pi).

The gpio utility is lightweight and so it may be installed on both, but it is only required to be installed on the Pi directly attached to the relay. The streamer utility, however, requires much more resouce and therefore should only be installed on the Pi with the camera attached.

On the Pi with the camera, copy only the garage streamer start script:

sudo cp scripts/init-scripts/garagestreamer /etc/init.d/
sudo update-rc.d garagestreamer defaults

On the Pi with the Go webserver and gpio, copy only the garagepi start script:

sudo cp scripts/init-scripts/garagepi /etc/init.d/
sudo update-rc.d garagepi defaults

By default, the garagepi webserver assumes the webcam is available on localhost:8080. This is controlled by the the environment variables $WEBCAM_HOST and $WEBCAM_PORT in scripts/init-scripts/garagepi.

Project administration

Tracker

Find this project on tracker at https://www.pivotaltracker.com/n/projects/1401690

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/GeertJohan/go.rice/embedded
Package embedded defines embedded data types that are shared between the go.rice package and generated code.
Package embedded defines embedded data types that are shared between the go.rice package and generated code.
_workspace/src/github.com/daaku/go.zipexe
Package zipexe attempts to open an executable binary file as a zip file.
Package zipexe attempts to open an executable binary file as a zip file.
_workspace/src/github.com/gorilla/context
Package context stores values shared during a request lifetime.
Package context stores values shared during a request lifetime.
_workspace/src/github.com/gorilla/mux
Package gorilla/mux implements a request router and dispatcher.
Package gorilla/mux implements a request router and dispatcher.
_workspace/src/github.com/kardianos/osext
Extensions to the standard "os" package.
Extensions to the standard "os" package.
_workspace/src/github.com/onsi/ginkgo
Ginkgo is a BDD-style testing framework for Golang The godoc documentation describes Ginkgo's API.
Ginkgo is a BDD-style testing framework for Golang The godoc documentation describes Ginkgo's API.
_workspace/src/github.com/onsi/ginkgo/config
Ginkgo accepts a number of configuration options.
Ginkgo accepts a number of configuration options.
_workspace/src/github.com/onsi/ginkgo/ginkgo
The Ginkgo CLI The Ginkgo CLI is fully documented [here](http://onsi.github.io/ginkgo/#the_ginkgo_cli) You can also learn more by running: ginkgo help Here are some of the more commonly used commands: To install: go install github.com/onsi/ginkgo/ginkgo To run tests: ginkgo To run tests in all subdirectories: ginkgo -r To run tests in particular packages: ginkgo <flags> /path/to/package /path/to/another/package To pass arguments/flags to your tests: ginkgo <flags> <packages> -- <pass-throughs> To run tests in parallel ginkgo -p this will automatically detect the optimal number of nodes to use.
The Ginkgo CLI The Ginkgo CLI is fully documented [here](http://onsi.github.io/ginkgo/#the_ginkgo_cli) You can also learn more by running: ginkgo help Here are some of the more commonly used commands: To install: go install github.com/onsi/ginkgo/ginkgo To run tests: ginkgo To run tests in all subdirectories: ginkgo -r To run tests in particular packages: ginkgo <flags> /path/to/package /path/to/another/package To pass arguments/flags to your tests: ginkgo <flags> <packages> -- <pass-throughs> To run tests in parallel ginkgo -p this will automatically detect the optimal number of nodes to use.
_workspace/src/github.com/onsi/ginkgo/internal/remote
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete.
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete.
_workspace/src/github.com/onsi/ginkgo/reporters
Ginkgo's Default Reporter A number of command line flags are available to tweak Ginkgo's default output.
Ginkgo's Default Reporter A number of command line flags are available to tweak Ginkgo's default output.
_workspace/src/github.com/onsi/gomega
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
_workspace/src/github.com/onsi/gomega/format
Gomega's format package pretty-prints objects.
Gomega's format package pretty-prints objects.
_workspace/src/github.com/onsi/gomega/gbytes
Package gbytes provides a buffer that supports incrementally detecting input.
Package gbytes provides a buffer that supports incrementally detecting input.
_workspace/src/github.com/onsi/gomega/gexec
Package gexec provides support for testing external processes.
Package gexec provides support for testing external processes.
_workspace/src/github.com/onsi/gomega/ghttp
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
_workspace/src/github.com/onsi/gomega/matchers
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported.
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported.
_workspace/src/github.com/tedsuo/ifrit
A process model for go.
A process model for go.
_workspace/src/github.com/tedsuo/ifrit/fake_runner
fake_runner contains test fixtures.
fake_runner contains test fixtures.
_workspace/src/github.com/tedsuo/ifrit/ginkgomon
Ginkgomon provides ginkgo test helpers.
Ginkgomon provides ginkgo test helpers.
_workspace/src/github.com/tedsuo/ifrit/grouper
Grouper implements process orcestration.
Grouper implements process orcestration.
_workspace/src/github.com/tedsuo/ifrit/restart
The restart package implements common restart strategies for ifrit processes.
The restart package implements common restart strategies for ifrit processes.
fakes
This file was generated by counterfeiter
This file was generated by counterfeiter
fakes
This file was generated by counterfeiter
This file was generated by counterfeiter
fakes
This file was generated by counterfeiter
This file was generated by counterfeiter
fakes
This file was generated by counterfeiter
This file was generated by counterfeiter
fakes
This file was generated by counterfeiter
This file was generated by counterfeiter
fakes
This file was generated by counterfeiter
This file was generated by counterfeiter
fakes
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL