Skip to content

Commit

Permalink
Merge pull request txn2#1 from LelandSindt/tnx2-txwifi
Browse files Browse the repository at this point in the history
cjimti/iotwifi -> txn2/txwifi
  • Loading branch information
cjimti authored Jan 29, 2019
2 parents 2e30617 + 00b8ac0 commit 2965bd1
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ FROM arm32v6/golang:1.10.1-alpine3.7 AS builder
ENV GOPATH /go
WORKDIR /go/src

RUN mkdir -p /go/src/github.com/cjimti/iotwifi
COPY . /go/src/github.com/cjimti/iotwifi
RUN mkdir -p /go/src/github.com/txn2/txwifi
COPY . /go/src/github.com/txn2/txwifi

RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o /go/bin/wifi /go/src/github.com/cjimti/iotwifi/main.go
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o /go/bin/wifi /go/src/github.com/txn2/txwifi/main.go

FROM arm32v6/alpine

Expand Down
2 changes: 1 addition & 1 deletion Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
IMAGE ?= cjimti/iotwifi
NAME ?= iotwifi
NAME ?= txwifi
VERSION ?= 1.0.4

all: build push
Expand All @@ -19,8 +19,8 @@ dev_build:

dev_run:
sudo docker run --rm -it --privileged --network=host \
-v $(CURDIR):/go/src/github.com/cjimti/iotwifi \
-w /go/src/github.com/cjimti/iotwifi \
-v $(CURDIR):/go/src/github.com/txn2/txwifi \
-w /go/src/github.com/txn2/txwifi \
--name=$(NAME) $(IMAGE):latest


29 changes: 25 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@

**Update**: Tested and functioning on well on the [Raspberry Pi 3 B+](https://amzn.to/2jfXhCA) and [Raspberry Pi 3 B](https://amzn.to/2Kq9Doa). Looking to support additional SOCs in upcoming versions. (Disclosure: the Pi links to Amazon are affiliate links, why not?)

**NOTICE**: This project is intended to aid in developing "configure wifi over wifi" solutions for IOT projects using the Raspberry Pi. The main use case for this project is to reproduce functionality common to devices like Nest or Echo, where the user turns on the device, connects to it and configures it for wifi. I have over 800 devices running this software in production and all have had their wifi configured using it.

**This is not a captive portal project. While I have personaly used it for this, it requires additional networking and can be unstable. I don't support this use and so your millage may vary.**

**txwifi** is only expected to run properly on stock Raspberry Pis and not tested on any other hardware configurations.

# IOT Wifi (Raspberry Pi AP + Client)

[![Go Report Card](https://goreportcard.com/badge/github.com/cjimti/iotwifi)](https://goreportcard.com/report/github.com/cjimti/iotwifi)
[![GoDoc](https://godoc.org/github.com/cjimti/iotwifi/iotwifi?status.svg)](https://godoc.org/github.com/cjimti/iotwifi/iotwifi)
[![Go Report Card](https://goreportcard.com/badge/github.com/txn2/txwifi)](https://goreportcard.com/report/github.com/txn2/txwifi)
[![GoDoc](https://godoc.org/github.com/txn2/txwifi/iotwifi?status.svg)](https://godoc.org/github.com/txn2/txwifi/iotwifi)
[![Docker Container Image Size](https://shields.beevelop.com/docker/image/image-size/cjimti/iotwifi/latest.svg)](https://hub.docker.com/r/cjimti/iotwifi/)
[![Docker Container Layers](https://shields.beevelop.com/docker/image/layers/cjimti/iotwifi/latest.svg)](https://hub.docker.com/r/cjimti/iotwifi/)
[![Docker Container Pulls](https://img.shields.io/docker/pulls/cjimti/iotwifi.svg)](https://hub.docker.com/r/cjimti/iotwifi/)
Expand Down Expand Up @@ -74,6 +80,10 @@ with the **IOT Wifi** container.
# prevent wpa_supplicant from starting on boot
$ sudo systemctl mask wpa_supplicant.service

# rename wpa_supplicant on the host to ensure that it is not
# used.
sudo mv /sbin/wpa_supplicant /sbin/no_wpa_supplicant

# kill any running processes named wpa_supplicant
$ sudo pkill wpa_supplicant
```
Expand Down Expand Up @@ -121,7 +131,7 @@ started quickly I'll show you how to use a pre-built Docker Image. At
only 16MB this little image contains everything you need. The image
is based on [Alpine Linux] and contains [hostapd], [wpa_supplicant] and
[dnsmasq], along with a compiled wifi management utility written in go,
the source is found in this repository: https://github.com/cjimti/iotwifi.
the source is found in this repository: https://github.com/txn2/txwifi.

```bash
# Pull the IOT Wifi Docker Image
Expand All @@ -142,7 +152,7 @@ Use the default configuration file and location for testing:
```bash
# Download the default configuration file

$ wget https://raw.githubusercontent.com/cjimti/iotwifi/master/cfg/wificfg.json
$ wget https://raw.githubusercontent.com/txn2/txwifi/master/cfg/wificfg.json

```

Expand Down Expand Up @@ -190,6 +200,17 @@ $ docker run --rm --privileged --net host \
cjimti/iotwifi
```

Optionally, you can also provide a `wpa_supplicant.conf`, like so:

```bash
$ docker run --rm --privileged --net host \
-v $(pwd)/wificfg.json:/cfg/wificfg.json \
-v <HOST_PATH>/wpa_supplicant.conf:<CONTAINER_PATH>/wpa_supplicant.conf \
cjimti/iotwifi
```

Where `<CONTAINER_PATH>` is the path to `wpa_supplicant.conf` specified in `wificfg.json`.

The IOT Wifi container outputs logs in the JSON format. While this makes
them a bit more challenging to read, we can feed them directly (or indirectly)
into tools like Elastic Search or other databases for alerting or analytics.
Expand Down
2 changes: 1 addition & 1 deletion dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apk add alpine-sdk go bridge hostapd wireless-tools wireless-tools-dev wpa_s
RUN mkdir -p /etc/wpa_supplicant/
COPY ./configs/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf

RUN mkdir -p /go/src/github.com/cjimti/iotwifi/
RUN mkdir -p /go/src/github.com/tnx2/txwifi/

ENV GOPATH /go
WORKDIR /go/src
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"strings"

"github.com/bhoriuchi/go-bunyan/bunyan"
"github.com/cjimti/iotwifi/iotwifi"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"github.com/txn2/txwifi/iotwifi"
)

// ApiReturn structures a message for returned API calls.
Expand All @@ -25,7 +25,7 @@ type ApiReturn struct {
func main() {

logConfig := bunyan.Config{
Name: "iotwifi",
Name: "txwifi",
Stream: os.Stdout,
Level: bunyan.LogLevelDebug,
}
Expand Down

0 comments on commit 2965bd1

Please sign in to comment.