Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dbgjerez/iot-devices-crud
microservice to manage iot device configuration. Developement with gingonic, golang and MongoDB
https://github.com/dbgjerez/iot-devices-crud
crud docker gin gin-gonic golang helm iot kubernetes mongodb
Last synced: 27 days ago
JSON representation
microservice to manage iot device configuration. Developement with gingonic, golang and MongoDB
- Host: GitHub
- URL: https://github.com/dbgjerez/iot-devices-crud
- Owner: dbgjerez
- Created: 2021-01-25T12:49:12.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-25T05:18:45.000Z (over 2 years ago)
- Last Synced: 2024-11-15T22:52:02.013Z (about 1 month ago)
- Topics: crud, docker, gin, gin-gonic, golang, helm, iot, kubernetes, mongodb
- Language: Go
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Go Report Card](https://goreportcard.com/badge/github.com/dbgjerez/iot-devices-crud)](https://goreportcard.com/report/github.com/dbgjerez/iot-devices-crud)
# IOT Devices Management
Application to manage iot devices configuration.Chips have some many sensor connected which could need some configuration.
For example, how often the information is sent.
# Build
## Docker
To build as docker image:
```bash
docker build -t $user/iot-device-manager:$version .
# $docker login (if you're not logged)
docker push
```
*$user: change with your own Docker Hub user**$version: change with yout own microservice version*
# Run
## Golang
```bash
go run app.go
```
*Go to "configuration section" to configure MongoDB connection*## Docker
In this case, MongoDB and the microservice run with Docker
```bash
# create dedicated network
$ docker network create --driver bridge iot
# run MongoDB container
$ docker run -dit --name iot-mongo -p 27017:27017 --network iot mongo:4.0.22
# run microservice container
$ docker run -dit --env MONGODB_HOST=mongodb://iot-mongo:27017 --name device-crud -p 8080:8080 --network iot b0rr3g0/iot-device-manager:0.4
```
*The example above use my own Docker user. If you want use your own user change b0rr3g0 for it and 0.4 for your own version*# Configuration
| Variable | Default value | Description |
| ------ | ------ | ------ |
| GIN_MODE | debug | Gin gonic mode. (release for production mode) |
| MONGODB_HOST | "" | MongoDB host url. For example: mongodb://localhost:27017 |
| MONGODB_DEVICE_DB | iot | Mongo database name |
| MONGODB_DEVICE_COLLECTION_NAME | device | Name of collection into de database |# Architecture and libraries
* MongoDB: NoSQL database used to store the information about chips and sensors.
* Gin-gonic: Framework used to develop the microservice.
* GoDotEnv: library that facilitates working with enviroments variables
* mongo-driver: library to work with MongoDB
* mongo-go-pagination: library helper to paginate MongoDB queries