fix(README): adapt the README file to the current flucky source code

This commit is contained in:
Markus Pesch 2019-08-25 16:31:52 +02:00
parent 60ee044b88
commit 1ed700edbb
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
2 changed files with 102 additions and 15 deletions

View File

@ -10,8 +10,13 @@ GID?=$(shell id --group)
# value is taken.
VERSION:=$(or ${TRAVIS_TAG}, $(shell git rev-parse --short HEAD)-git)
# CONTAINER_RUNTIME
CONTAINER_RUNTIME?=$(shell which docker)
# BUILD_IMAGE
BUILD_IMAGE:=volkerraschek/build-image:latest
# GO ENVIRONMENT
GOARCH?=amd64
GOOS?=linux
@ -20,11 +25,20 @@ go-build: bindata
GOOS=${GOOS} \
GOARCH=${GOARCH} \
go build -ldflags "-X main.version=${VERSION}"
chown -R ${UID}:${GID} *
chown ${UID}:${GID} ./*
go-test: go-build
go test -v ./pkg/...
rpm-build: go-build
rpm-builder \
--arch x86_64 \
--compression gzip \
--exec-file "flucky:/usr/bin/flucky" \
--file "systemd/flucky.service:/usr/lib/systemd/system/flucky.service" \
--version ${VERSION} \
flucky-${VERSION}
bindata:
go-bindata -pkg db -o ./pkg/db/bindataSQL.go ./pkg/db/sql/***
go-bindata -pkg goldenfiles -o ./test/goldenfiles/bindata.go ./test/goldenfiles/json/***
@ -35,12 +49,20 @@ container-go-build:
container-go-test:
$(MAKE) container-run COMMAND=go-test
container-rpm-build:
$(MAKE) container-run COMMAND=rpm-build
container-run:
${CONTAINER_RUNTIME} run \
--volume ${PWD}:/workspace \
--rm \
volkerraschek/build-image:latest\
make ${COMMAND} UID=${UID} GID=${GID} VERSION=${VERSION} GOOS=${GOOS} GOARCH=${GOARCH}
--volume ${PWD}:/workspace \
${BUILD_IMAGE} \
make ${COMMAND} \
UID=${UID} \
GID=${GID} \
VERSION=${VERSION} \
GOOS=${GOOS} \
GOARCH=${GOARCH}
remote:
$(MAKE) go-build GOARCH=arm

View File

@ -1,23 +1,88 @@
# flucky [![Build Status](https://travis-ci.com/go-flucky/flucky.svg?branch=master)](https://travis-ci.com/go-flucky/flucky)
Flucky is a lightweight program written in go for reading data from sensors with a raspberry pi.
## Compiling
Flucky can be compiled directly with go.
Flucky is a lightweight program written in go for reading data from sensors, for
example with a banana or raspberry pi. In addition, flucky provides a REST-API
to receive from other flucky installations measured values. The measured values
can be saved in a logfile or into a database. Currently is only postgres
supported.
## Installation
Flucky can be installed over multiple ways, for example with your local package
manager from your linux distribution. At the moment it's only the rpm package
format supported. Alternatively the source code can be compiled to get the
flucky binary.
### RPM-Package
To install flucky over a RPM package you can download a specific version from
github.com or configure the RPM-Mirror.
#### RPM-Mirror
```bash
$ go get -u github.com/go-flucky/flucky
$ cat > /etc/yum.repos.d/flucky.rpm <<EOF
[flucky]
name=flucky
baseurl=http://rpm-mirror.cryptic.systems
gpgcheck=0
EOF
$ yum update && yum install --assumeyes flucky
```
Alternatively you can checkout this repository and compile it with make for your architecture. For examample for a raspberry pi with arm architecture.
#### Download github.com
```bash
$ make build
$ make build GOARCH=arm # for raspberry-pi
$ VERSION=v0.1.0 \
curl --location https://github.com/volker-raschek/flucky/releases/${VERSION}/flucky.rpm -O flucky-${VERSION}.rpm
$ yum install --assumeyes ./flucky-${VERSION}.rpm
```
If you have installed docker oder podman but not go, you can compile the source code via one of the container runtimes.
### Compiling the source code
An additional ways to install flucky is to compile the source code. There are
two different ways to compile flucky from scratch. The easier ways is
to use the pre-defined container image in the Makefile, which has included all
dependancies to compile flucky. Alternatively, if all dependencies are met,
flucky can also be compiled without the container image. Both variants are
briefly described.
#### Compiling the source code via container image
To compile flucky via container image it's necessary, that a container runtime
is installed. In the Makefile is predefined docker, but it's can be also used
podman. Execute `make container-go-build` to start the compiling process.
```bash
$ make container-build
$ make container-build GOARCH=arm # for raspberry-pi
```
$ make container-go-build
make container-run COMMAND=go-build
make[1]: Directory „/home/markus/workspace/flucky“ is entered
/usr/bin/docker run \
--rm \
--volume /home/markus/workspace/flucky:/workspace \
volkerraschek/build-image:latest \
make go-build \
UID=1000 \
GID=1000 \
VERSION=60ee044-git \
GOOS=linux \
GOARCH=amd64
go-bindata -pkg db -o ./pkg/db/bindataSQL.go ./pkg/db/sql/***
go-bindata -pkg goldenfiles -o ./test/goldenfiles/bindata.go ./test/goldenfiles/json/***
GOOS=linux \
GOARCH=amd64 \
go build -ldflags "-X main.version=60ee044-git"
go: finding github.com/spf13/pflag v1.0.3
go: finding github.com/satori/go.uuid v1.2.0
...
```
#### Compiling the source code without container image
Make sure you have installed go >= v1.12. Execute `make go-build` to compile
flucky without a container-image. There should be a similar output as when
compiling flucky via the container image.
## Enhancements
+ Provide flucky additionally as AUR and deb package