Commit Graph

37 Commits

Author SHA1 Message Date
Aleksandar Novaković bd00c5fa13 NOISSUE - Fix event sourcing client on LoRa adapter (#527)
* Fix event sourcing client on LoRa adapter

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>

* Fix tests for things redis streams

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2019-01-07 23:54:18 -02:00
Manuel Imperiale 5f6bbf4b0a MF-419 - Use JSON for CLI commands output (#504)
* MF-419 - Use JSON for CLI commands output

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* dep ensure

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Remove accidentaly added CLI binary

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix cast

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix review

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Typo fix

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use logCreated for token command

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix review

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-16 14:01:37 -05:00
Drasko DRASKOVIC 9725c2723d
MF-486 - Add provisioning command to CLI (#487)
* MF-486 - Add provisioning command to CLI

Resolves #486

Signed-off-by: drasko <drasko.draskovic@gmail.com>

* Add error check on file open

Signed-off-by: drasko <drasko.draskovic@gmail.com>

* Add provision test to CLI

Signed-off-by: drasko <drasko.draskovic@gmail.com>

* Update error handling

Update CSV file.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Fix provision for new SDK

Signed-off-by: drasko <drasko.draskovic@gmail.com>

* Correct structs and sprintfs

Signed-off-by: drasko <drasko.draskovic@gmail.com>

* Check array length

Signed-off-by: drasko <drasko.draskovic@gmail.com>

* Correct sprintf. Update dep lock file.

Signed-off-by: drasko <drasko.draskovic@gmail.com>
2018-12-08 16:59:55 +01:00
Manuel Imperiale 21ab52576c MF-166 - Add lora-adapter service (#481)
* MF-166 - Add lora-adapter service (#416)

* MF-166 - Add lora-adapter service

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix NATS connexion and use credentials with gRPC

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Forward lora msgs to nats

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Add make cmd and docker-compose

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Define lora conf as private

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rename funcs fix nats conn

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Update README and fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rm NATS sub

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* MF-166 - Add lora-adapter service  (#461)

* MF-166 - Add lora-adapter service

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix NATS connexion and use credentials with gRPC

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Forward lora msgs to nats

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Add make cmd and docker-compose

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Define lora conf as private

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rename funcs fix nats conn

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Update README and fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rm NATS sub

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix lora server topic and logs

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix HTTP port

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* NOISSUE - Add event sourcing client to LoRa adapter (#471)

* Add event sourcing client to LoRa adapter

Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com>

* Update redis version in docker compose and update env vars

Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com>

* Add ES subscription to main LoRa function

Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com>

* Add new env vars to readme file of LoRa adapter

Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com>

* Add message acknowledgement to LoRa adapter

Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com>

* Add handling of empty values to event sourcing client (#474)

Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com>

* Add routemap and handle event sourcing

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix eventStore decoding

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Mv docker-compose in docker/addons

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix routemap and logs

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Update Gopkg.toml

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix route map and typos

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Update README

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix reviews

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-04 20:08:30 +01:00
Dušan Borovčanin ec0a148ad4 MF-443 Update project dependencies (#444)
* Update project dependencies

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Update InfluxDB and Cassandra versions

Update InfluxDB and Cassandra versions in docker-compose file as well as
images version in tests.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Update gRPC version

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Make name first value of constraints

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>
2018-11-07 10:18:57 +01:00
Dušan Borovčanin dfa766e013 MF-407 - Values of zero are being omitted (#434)
* Fix empty protobuf values

Update Normalizer service and .proto files. Reader and Writer services
needs to be updated due to message format change.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Update HTTP adapter to use gogo protobuf

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Update Reader services API

Update API or Reader services to match Message changes due to switching to gogo/proto.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Update InfluxDB services

Update InfluxDB Reader and Writer services to match new Message format.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Update MongoDB services

Update MongoDB Reader and Writer services to match new message format.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Update Cassandra services

Update Cassandra Reader and Writer service to match new Message format.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Fix InfluxDB Reader test

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Update Makefile and docs accordingly

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Fix possible data race in InfluxDB writer

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Update InfluxDB Writer tests

Raise test coverage.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Fix InfluxDB reader

Fix wrong ValueSum readings. Upadete tests and raise coverage.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Update MongoDB services tests

Raise test coverage for MongoDB Reader and Writer services.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Update Readers API tests

Raise test coverage.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Raise test coverage

Update Cassandra Reader and Writer services tests.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Use gogo/protobuf in CoAP adapter

Add gogo/protobuf to Gopkg.toml and update dependencies.
Update Dockerfile to run `make proto`.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Update Cassandra Reader tests

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Refactor code

Improve code style and comments to improve readability.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Rename Sum to SumValue

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Rename Values to Value

Since message contains only single value (or possibly no value at all),
`Values` name could be misleading. Rename simple double value from
`Value` to `FloatValue` accordingly.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Fix InfluxDB Reader logging

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Replace exclusive if statements with switch-case

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Update Cassandra services tests

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>
2018-11-05 19:18:51 +01:00
Dušan Borovčanin d6755e4a72 MF-374 - Bring back CoAP adapter (#413)
* Bring old CoAP code back

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Fix channel ID formatting due to type change

Uncomment error handling for authorization.

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update CoAP adapter docs

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Add copyright headers

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Remove redundant type declaration

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Add CoAP adapter to the list of services

Add CoAp adapter in Makefile services list and fix corresponding documentation.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Refactor CoAP code

Merge multipe `const` block int single and declare consts before vars.
Un-export notFound handler since there is no need to export it.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Update http version endpoint

This separates CoAP and HTTP APIs.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Refactor CoAP POST method handling

This PR is a part of CoAP adapter refactoring that will simplify adapter implementation.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Refactor CoAP adapter

Change CoAP message handling to simplify adapter implementation.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Add backoff timeout for server ping to client

Update CoAP adapter to provide subset of necessary features from
protocol specification.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Fix leaking locked goroutine

In case of the stopped ticker, its channel is NOT closed, so pinging might be left stuck waiting for the stopped ticker to send a notification.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Format code

Use more meaningful name for Handlers map.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Use and stop ticker from the same goroutine

Stop handler Ticker from ping goroutine rather than the cancel goroutine.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Check if subscription already exists in put method

Fix potential leak of handlers providing check inside of put method.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Use MessageID as Observe option

Since MessageID satisfies observe option behaviour, use Message ID
instead of local timestamp. Remove Thicker from handler and use it on
transport layer.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Use name Observer insted of Handler

Name `Observer` is used in protocol specification, so this naming makes
code more self-documenting.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Add CoAP adapter to docker-compose.yml

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Add copyright headers

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Remove unused constants

Fix service name in startup log message.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Add metrics endpoint

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Refactor code

Config fields from main.go should not be exported; minor style changes.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>

* Update authorization URI-Query option

Use `authorization` value in URI-Query option instead of `key`. This
mimics Authorization header in some other protocols (e.g. HTTP). Please
note that this value can be replaced with simple `auth` to save space,
due to constrained URI-Query option size.

Signed-off-by: Dusan Borovcanin <dusan.borovcanin@mainflux.com>
2018-10-31 18:53:25 +01:00
Aleksandar Novaković 0c77d84176 MF-382 - Improve performance by adding Redis cache for message auth (#383)
* Add redis caching for thing and channel connections

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>

* Fix authorization caching flow

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>

* Update things documentation

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2018-09-04 22:19:43 +02:00
Aleksandar Novaković 58cdf2cddc MF-312 - Implement basic MongoDB reader (#344)
* Add mongodb reader service

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>

* Add tests for mongodb reader service

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>

* Add documentation for mongodb reader service

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>

* Fix test function name

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>

* Update comment in docker-compose for mongodb-reader service

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2018-08-08 13:38:34 +02:00
Manuel Imperiale b090aa3e02 MF-216 - Integrate Bashflux into monorepo (#308)
* MF-216 - Integrate Bashflux into monorepo

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rename clients -> things

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix FormatResLog

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Initialize Channels commands in channels.go

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Mv bashflux to cmd/ repertory

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Mv API commands files to bashflux repertory

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Initialize Users commands in users.go

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Initialize Version command in version.go

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Initialize Messages command in messages.go

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rm bashflux .gitignore and mv commands to root .gitignore

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rename API commands vars

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix certificates paths

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rm test logs

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Remove get channels cmd without arguments

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix connect and disconnect commands

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix messages endpoint

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rm useless comments and dead code

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use contentTypeSenml var

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rename cmdCobra -> cmd

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rm else statments

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rename SetServerAddr function vars

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rename conf parameters

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rename main with proper name

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix Update channel comment

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix README

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rm .DS_Store from .gitignore

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rename hhtp_client.go -> http.go

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rm DeleteAllChannels and DeleteAllThings funcs

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix BF users usage log

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Improve bashflux logs

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Share types in funcs

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Typo fix

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix BF version cmd

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Set certs paths via env variables

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix package

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rm not direct dependencies from Gopkg.toml

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix README

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Add def prefix to certificates paths

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* User thiings service for version cmd

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rename GetReqResp -> SendRequest

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix version help

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Return directly the pointer in NewVersionCmd

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Define endpoints names as consts and be consistent with naming

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use Spintf for string concatenation

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* typo fix

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix README

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix version endpoint

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix serverAddr

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-07-11 13:53:37 +02:00
Dušan Borovčanin f1537528f9 NOISSUE - Raise test coverage (#324)
* Update WS tests

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Use require in all writer tests

Refactor code.

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Ignore Mainflux generated pb.go files

Ignore *.pb.go files generated by Mainflux, but don't ignore vendored generated code.

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Return an exported ErrNotFound instead of the unexported one

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update mocks to match the actual behaviour

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update mocks error message

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Add auth service unavailable error test

Since this error is caused by gRPC server returning codes.Internal,
this behaviour is simulated using specific token. When that token is
passed as an auth header, the mock gRPC client returns aforementioned error.

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Use require package for postgres tests

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Remove redundant error checks in tests

Refactor tests.

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Rename error flag token

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2018-06-16 02:30:46 +02:00
Aleksandar Novaković 426f59d392 MF-235 - Add support for storing messages in Cassandra (#321)
* Add Cassandra writer implementation

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>

* Add cassandra service with version and metrics endpoints

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>

* Add test for cassandra writer

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>

* Exclude api.go files from code coverage

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>

* Add readme file for cassandra writer

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>

* Add docker compose configuration for cassandra writer

Add README file. Add docker compose configuration.

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>

* Add gocql as project dependency

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>

* Fix init script for cassandra in docker-compose

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>

* Add testifies require subpackage

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2018-06-08 14:25:55 +02:00
Darko Draskovic 2b393ad50f MF-237 - Add support for storing messages in MongoDB (#307)
* Add mongodb-writer

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add official mongodb driver

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Move Connect to main.go

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove bson.NewDoc and write msg directly in db

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add MongoDB writer tests

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update README.md

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Add mongodb services compose to addons dir

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update docs

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update docs and tests

Refactor code.

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Expose MetricsMiddleware to align writers with other services

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Add logging middleware

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update load tests version

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2018-06-01 15:50:23 +02:00
Dušan Borovčanin f0cbc47ee6 MF-236 - Add support for storing messages in InfluxDB (#283) 2018-05-21 16:28:52 +02:00
Dejan Mijić e0e2b2aad0
MF-269 - Replace UUID with BIGSERIAL as primary key (#291) 2018-05-21 12:51:46 +02:00
Dejan Mijić bca3d0774f
MF-201 - Replace ORM with SQL (#265) 2018-05-11 01:00:10 +02:00
Aleksandar Novaković 816c172823 MF-164 - Split manager service (#266) 2018-05-10 23:53:25 +02:00
Dušan Borovčanin db6165aa6b MF-168 - Refactor CoAP adapter (#186) 2018-05-08 16:00:25 +02:00
Dejan Mijić d499068e43
Update protobuf to 1.1.0 (#251) 2018-05-02 08:49:39 +02:00
Aleksandar Novaković 3a5f4395e4 MF-171 - Extract websocket adapter as separate service (#188)
* Add websocket adapter

Add websocket adapter with basic logging and metrics middleware.
Add publish and subscribe to NATS subjects using websocket.
Add websocket handshake authorization over mainflux manager.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Add test for websocket publish

Add test for websocket adapter's publish method. Add dependecy
injected logger to adapter. Remove unnecessary manager client
dependency from adapter.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Add websocket library in dependencies

Add gorilla/websocket dependency in dep toml and lock file.
Add dependency in vendor dir.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Add direct websocket connection

Add direct websocket connection. While messages are still beeing
published over NATS, they are not received over src.ws subject
in WebSocket adapter. Instead messages are sent directly over
websocket connection.

Add swagger file for WebSocket handshake endpoint. Update ReadMe
to reference new swagger file.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Refactore websocket adapter code

Extract listen part from handshake. Update WebSocket adapter code.
Fix subscribe to NATS subject, so that it is independent from other
adapters. Remove message base64 encoding from response..

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Remove connection management from websocket adapter

Align notion of channel with NATS topic. Remove connection
management from adapter logic. Add log messages to adapter's
transport layer.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Update NATS subjects and add subscriber interface

Update NATS subject name to channel.<channel_id>. Add and implement
subscriber interface. Implement subscriber interface in adapter.
Update readme to use new make <service_name> command. Refactor code.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Add basic tests for broadcast and subscribe

Improve mock implementation of NATS pubsub. Add multiple basic test
cases for broadcast and subscribe methods. Add logging for subscribe.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Add listen method test

Add listen method test and refactor existing tests. Refactor listen
method in adapter.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Move broadcast method to message broker interface

Refactor broadcast method to receive send message callback and message
that needs to be sent. Update tests accordingly.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Update pubsub API

Remove listen method from public API. Move listen call to subscribe
implementation. Update domain pubsub API in project root.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Add connection error handlers to adapter API

Update publish and subscribe API to receive connection error handler.
Update tests accordingly. Handle NATS connection error.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Update logs

Replace go-kit logger with custom mainflux logger. Update log messages
where needed..

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Refactor web socket adapter

Remove MessagePubSub interface. Remove unnecessary callbacks. Add
channels to web socket adapter implementation.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Add API layer tests

Update existing tests and add API layer tests.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Update docs with web socket related data

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Refactor web socket adapter

Update subscription struct, and refactor listen and broadcast methods.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Add version and metrics endpoint to ws adapter

Update version to 0.2.0.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Fix race condition bug in ws adapter test

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>

* Rename listen to broadcast and broadcast to listen

Switch names between listen and broadcast methods. Move channel
structure to service.go.

Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>
2018-04-18 13:09:01 +02:00
Dejan Mijić f5fbd6f22a Add protobuf (#192)
Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
2018-03-19 10:14:43 +01:00
Dejan Mijić ccd8965d6f Use PostgreSQL as primary persistence solution (#175)
* Use normalizer as stream source

Renamed 'writer' service to 'normalizer' and dropped Cassandra
facilities from it. Extracted the common dependencies to 'mainflux'
package for easier sharing. Fixed the API docs and unified environment
variables.

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Use docker build arguments to specify build

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Remove cassandra libraries

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Update go-kit version to 0.6.0

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Fix manager configuration

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Refactor docker-compose

Merged individual compose files and dropped external links. Remove CoAP
container since it is not referenced from NginX config at the moment.
Update port mapping in compose and nginx.conf. Dropped bin scripts.
Updated service documentation.

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Drop content-type check

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Implement users data access layer in PostgreSQL

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Bump version to 0.1.0

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Use go-kit logger everywhere (except CoAP)

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Improve factory methods naming

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Implement clients data access layer on PostgreSQL

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Make tests stateless

All tests are refactored to use map-based table-driven tests. No
cross-tests dependencies is present anymore.

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Remove gitignore

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Fix nginx proxying

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Mark client-user FK explicit

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Update API documentation

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Update channel model

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Add channel PostgreSQL repository tests

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Implement PostgreSQL channels DAO

Replaced update queries with raw SQL. Explicitly defined M2M table due
to difficulties of ensuring the referential integrity through GORM.

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Expose connection endpoints

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Fix swagger docs and remove DB logging

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Fix nested query remarks

Signed-off-by: Dejan Mijic <dejan@mainflux.com>

* Add unique indices

Signed-off-by: Dejan Mijic <dejan@mainflux.com>
2018-03-11 18:06:01 +01:00
Jovan Kostovski 7fe8100d6b replaced glide with dep dependency manager
Signed-off-by: Jovan Kostovski <chombium@gmail.com>
2018-02-14 18:28:42 +01:00
Dejan Mijic c11cf5820c
Add circuit breaker toward the manager service
Signed-off-by: Dejan Mijic <dejan@mainflux.com>
2017-12-12 11:20:57 +01:00
Dejan Mijić b651537ba9 Revert "Consul integration" 2017-10-16 11:27:11 +02:00
Dejan Mijic 2e5316e3fd
Register writer to consul
Signed-off-by: Dejan Mijic <dejan@mainflux.com>
2017-10-15 18:07:52 +02:00
Dejan Mijic 9c429d142d
Register manager to Consul
Signed-off-by: Dejan Mijic <dejan@mainflux.com>
2017-10-15 15:25:55 +02:00
Drasko DRASKOVIC a79a9012e4 Add coap support
Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
2017-10-01 16:38:32 +02:00
Dejan Mijic 481b5b230d Validate incoming requests
All validation has been moved to the API resources layer, i.e. the
domain objects provide validation method, but the service itself assumes
no corrupted values are passed to it.

Signed-off-by: Dejan Mijic <dejan@mainflux.com>
2017-10-01 01:12:06 +02:00
Drasko DRASKOVIC 3494c7a5e1 Add normalizer
Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
2017-09-24 15:33:58 +02:00
Dejan Mijic 26a2ea1ce1
Integrate http adapter service
Moved main method to top-level 'cmd' directory. Extracted the dockerfile
to the root as well.

Signed-off-by: Dejan Mijic <dejan@mainflux.com>
2017-09-23 01:57:14 +02:00
Dejan Mijic bcc0bfdc3d
Integrate message writer service
Moved main method to top-level cmd directory. Extracted its dockerfile
as well.

Signed-off-by: Dejan Mijic <dejan@mainflux.com>
2017-09-23 01:22:21 +02:00
Dejan Mijic c966a7802d
Integrate manager service
Setup top-level glide dependencies file. Migrated all of the manager
service code into this repository. Fixed docker build procedure.
Extracted executable to the top-level.

Signed-off-by: Dejan Mijic <dejan@mainflux.com>
2017-09-23 01:03:27 +02:00
Drasko DRASKOVIC 48779e856f Remove all from main repo
We will now use dedicated repos for microservices.

Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
2016-11-12 19:11:40 +01:00
Nikola Marčetić b1fab11c32 Pulled latest master branch version of paho mqtt with glide
Signed-off-by: Nikola Marčetić <nikola.marcetic@nsystems.rs>
2016-10-12 17:45:05 +02:00
Nikola Marčetić bb5f4c1196 Updated paho package, to resolve travis issue
Signed-off-by: Nikola Marčetić <nikola.marcetic@ntsystems.rs>
2016-10-12 15:26:27 +02:00
Drasko DRASKOVIC 1d74046154 Add Glide and vendoring
Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
2016-10-09 20:48:34 +02:00