ttn

command module
v2.5.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2017 License: MIT Imports: 2 Imported by: 0

README

The Things Network

Build Status Slack Status Coverage Status

The Things Network

The Things Network is a global open crowdsourced Internet of Things data network.

Getting Started With The Things Network

When you get started with The Things Network, you'll probably have some questions. Here are some things you can do to find the answer to them:

Prepare your Development Environment

  1. Make sure you have Go installed (version 1.7 or later).
  2. Set up your Go environment
  3. Install the protobuf compiler (protoc)
  4. Install make. On Linux install build-essential. On macOS, make comes with XCode or the developer tools. On Windows you can get make from https://gnuarmeclipse.github.io/windows-build-tools/
  5. Make sure you have Redis and RabbitMQ installed and running.
    On a fresh installation you might need to install the MQTT plugin for RabbitMQ.
    If you're on Linux, you probably know how to do that. On a Mac, just run brew bundle. The Windows installer will setup and start RabbitMQ as a service. Use the RabbitMQ Command Prompt (sbin dir) to run commands, i.e. to enable plugins.
  6. Declare a RabbitMQ exchange ttn.handler of type topic. Using the management plugin, declare the exchange in the web interface http://server-name:15672 or using the management cli, run rabbitmqadmin declare exchange name=ttn.handler type=topic auto_delete=false durable=true. If your handler's user has sufficient permissions on RabbitMQ, it will attempt to create the exchange if not present.

Set up The Things Network's backend for Development

  1. Fork this repository
  2. Clone your fork: git clone --branch develop https://github.com/YOURUSERNAME/ttn.git $GOPATH/src/github.com/TheThingsNetwork/ttn
  3. cd $GOPATH/src/github.com/TheThingsNetwork/ttn
  4. Install the dependencies for development: make dev-deps
  5. Run the tests: make test
  6. Run make build to build both ttn and ttnctl from source.
  7. Run make dev to install the go binaries into $GOPATH/bin/
    • Optionally on Linux or Mac you can use make link to link them to $GOPATH/bin/ (In order to run the commands, you should have export PATH="$GOPATH/bin:$PATH" in your profile).
  8. Configure your ttnctl with the settings in .env/ttnctl.yml.dev-example by copying that file to ~/.ttnctl.yml.

You can check your ttnctl configuration by running ttnctl config. It should look like this:

  INFO Using config:

         config file: /home/your-user/.ttnctl.yml
            data dir: /home/your-user/.ttnctl

         auth-server: https://account.thethingsnetwork.org
   discovery-address: localhost:1900
           router-id: dev
          handler-id: dev
        mqtt-address: localhost:1883

NOTE: From now on you should run all commands from the $GOPATH/src/github.com/TheThingsNetwork/ttn directory.

Run The Things Network's backend locally

  • Set up the backend as described above.
  • Run forego start to start all backend services at the same time. Make sure that Redis and RabbitMQ are running on your machine.
  • First time only (or when Redis is flushed):
    • Run ttn broker register-prefix 00000000/0 --config ./.env/broker/dev.yml
    • Restart the backend services

Build and run The Things Network's backend in Docker

  • Set up the backend as described above.
  • Add the following line to your /etc/hosts file: 127.0.0.1 router handler
  • Run make docker to build the docker image
  • Run docker-compose up to start all backend services in Docker. Make sure that Redis and RabbitMQ are not running on your local machine, because they will be started by docker-compose.
  • First time only (or when Redis is flushed):
    • Run docker-compose run broker broker register-prefix 00000000/0 --config ./.env/broker/dev.yml
    • Restart the backend services

Contributing

Source code for The Things Network is MIT licensed. We encourage users to make contributions on Github and to participate in discussions on Slack.

If you encounter any problems, please check open issues before creating a new issue. Please be specific and give a detailed description of the issue. Explain the steps to reproduce the problem. If you're able to fix the issue yourself, please help the community by forking the repository and submitting a pull request with your fix.

For contributing a feature, please open an issue that explains what you're working on. Work in your own fork of the repository and submit a pull request when you're done.

If you want to contribute, but don't know where to start, you could have a look at issues with the label help wanted or difficulty/easy.

License

Source code for The Things Network is released under the MIT License, which can be found in the LICENSE file. A list of authors can be found in the AUTHORS file.

Documentation

Overview

Package ttn contains the backend server systems for The Things Network.

Directories

Path Synopsis
api
Package api is a generated protocol buffer package.
Package api is a generated protocol buffer package.
broker
Package broker is a generated protocol buffer package.
Package broker is a generated protocol buffer package.
discovery
Package discovery is a generated protocol buffer package.
Package discovery is a generated protocol buffer package.
gateway
Package gateway is a generated protocol buffer package.
Package gateway is a generated protocol buffer package.
handler
Package handler is a generated protocol buffer package.
Package handler is a generated protocol buffer package.
monitor
Package monitor is a generated protocol buffer package.
Package monitor is a generated protocol buffer package.
networkserver
Package networkserver is a generated protocol buffer package.
Package networkserver is a generated protocol buffer package.
protocol
Package protocol is a generated protocol buffer package.
Package protocol is a generated protocol buffer package.
protocol/lorawan
Package lorawan is a generated protocol buffer package.
Package lorawan is a generated protocol buffer package.
router
Package router is a generated protocol buffer package.
Package router is a generated protocol buffer package.
trace
Package trace is a generated protocol buffer package.
Package trace is a generated protocol buffer package.
cmd
core
component
Package component contains code that is shared by all components (discovery, router, broker, networkserver, handler)
Package component contains code that is shared by all components (discovery, router, broker, networkserver, handler)
discovery
Package discovery implements TTN Service Discovery.
Package discovery implements TTN Service Discovery.
cmd
utils
backoff
Package backoff is a slightly changed version of the backoff algorithm that comes with gRPC See: vendor/google.golang.org/grpc/LICENSE for the license
Package backoff is a slightly changed version of the backoff algorithm that comes with gRPC See: vendor/google.golang.org/grpc/LICENSE for the license
elasticsearch/handler
Package elasticsearch implements an Elasticsearch batch handler.
Package elasticsearch implements an Elasticsearch batch handler.
pointer
Package pointer provides helper method to quickly define pointer from basic go types
Package pointer provides helper method to quickly define pointer from basic go types
testing
Package testing offers some handy methods to display check and cross symbols with colors in test logs.
Package testing offers some handy methods to display check and cross symbols with colors in test logs.
toa

Jump to

Keyboard shortcuts

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