Skip to content

Commit

Permalink
Add more documentation. Migrate to Go modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
brocaar committed Mar 7, 2019
1 parent 4f721aa commit 046bb70
Show file tree
Hide file tree
Showing 11 changed files with 194 additions and 253 deletions.
3 changes: 0 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
git:
short_hash: true

project_name: lora-packet-multiplexer

builds:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1.11-alpine AS development

ENV PROJECT_PATH=/go/src/github.com/brocaar/lora-packet-multiplexer
ENV PROJECT_PATH=/lora-packet-multiplexer
ENV PATH=$PATH:$PROJECT_PATH/build
ENV CGO_ENABLED=0
ENV GO_EXTRA_BUILD_ARGS="-a -installsuffix cgo"
Expand All @@ -11,12 +11,12 @@ RUN mkdir -p $PROJECT_PATH
COPY . $PROJECT_PATH
WORKDIR $PROJECT_PATH

RUN make dev-requirements requirements
RUN make dev-requirements
RUN make

FROM alpine:latest AS production

WORKDIR /root/
RUN apk --no-cache add tzdata
COPY --from=development /go/src/github.com/brocaar/lora-packet-multiplexer/build/lora-packet-multiplexer .
COPY --from=development /lora-packet-multiplexer .
ENTRYPOINT ["./lora-packet-multiplexer"]
2 changes: 1 addition & 1 deletion Dockerfile-devel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1.11-alpine

ENV PROJECT_PATH=/go/src/github.com/brocaar/lora-packet-multiplexer
ENV PROJECT_PATH=/lora-packet-multiplexer
ENV PATH=$PATH:$PROJECT_PATH/build
ENV CGO_ENABLED=0
ENV GO_EXTRA_BUILD_ARGS="-a -installsuffix cgo"
Expand Down
220 changes: 0 additions & 220 deletions Gopkg.lock

This file was deleted.

19 changes: 0 additions & 19 deletions Gopkg.toml

This file was deleted.

9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ snapshot:
goreleaser --snapshot

dev-requirements:
go get -u golang.org/x/tools/cmd/stringer
go get -u github.com/golang/dep/cmd/dep
go get -u github.com/goreleaser/goreleaser
go get -u github.com/goreleaser/nfpm
go install golang.org/x/tools/cmd/stringer
go install github.com/goreleaser/goreleaser
go install github.com/goreleaser/nfpm

requirements:
dep ensure -v
74 changes: 74 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,77 @@
The LoRa Packet Multiplexer utility forwards the [Semtech packet-forwarder](https://github.com/lora-net/packet_forwarder)
UDP data to multiple endpoints. It makes it possible to connect a single
LoRa gateway to multiple networks. It is part of the [LoRa Server project](https://www.loraserver.io).

## Building

### Binary

It is recommended to run the commands below inside a [Docker Compose](https://docs.docker.com/compose/)
environment.

```bash
docker-compose run --rm packetmultiplexer bash
```

```bash
# build binary
make

# create snapshot release
make snapshot

# run tests
make test
```

### Docker image

```bash
docker build -t IMAGENAME .
```

## Usage

Run `lora-packet-multiplexer --help` for usage information.

## Example configuration

Executing `lora-packet-multiplexer configfile` returns the following configuration
template:

```toml
[general]
# Log level
#
# debug=5, info=4, warning=3, error=2, fatal=1, panic=0
log_level=4


[packet_multiplexer]
# Bind
#
# The interface:port on which the packet-multiplexer will bind for receiving
# data from the packet-forwarder (UDP data).
bind="0.0.0.0:1700"


# Backends
#
# The backends to which the packet-multiplexer will forward the
# packet-forwarder UDP data.
#
# Example:
# [[packet_multiplexer.backend]]
# # Host
# #
# # The host:IP of the backend.
# host="192.16.1.5:1700"
#
# # Gateway IDs
# #
# # The Gateway IDs to forward data for.
# gateway_ids = [
# "0101010101010101",
# "0202020202020202",
# ]
```
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ services:
context: .
dockerfile: Dockerfile-devel
volumes:
- ./:/go/src/github.com/brocaar/lora-packet-multiplexer
- ./:/lora-packet-multiplexer
17 changes: 17 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module github.com/brocaar/lora-packet-multiplexer

require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/goreleaser/goreleaser v0.102.0
github.com/goreleaser/nfpm v0.10.0
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.1.1 // indirect
github.com/pkg/errors v0.8.0
github.com/sirupsen/logrus v1.1.0
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3 // indirect
github.com/spf13/viper v1.2.1
github.com/stretchr/testify v1.3.0
golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4 // indirect
golang.org/x/tools v0.0.0-20190306162903-69e0dcfa1121
)
Loading

0 comments on commit 046bb70

Please sign in to comment.