Giter VIP home page Giter VIP logo

goan's Introduction

goan - GoAnalytics

Build Status GoDoc Code Climate

v. 0.2.1

A very basic analytics microservice that uses MongoDB or MySQL (soon) to store basic events that can be queried.

Why?

I was bored and wanted to learn GoLang. I needed a project to work on so I created this.

What does it do?

It uses a Gin-based RESTful API to take in event entries and store them in a data store. You can then pull those entries out for analysis. Eventually, there will be filtering, searching, and a frontend. For now, it is pretty bare bones and nowhere near ready for real use.

What does it use?

Currently it uses:

  • Gin for the API
  • mgo For the Mongo driver
  • Testify for unit testing

Environment variables

You should set the following environment variables to setup the service:

  • GOAN_AUTHTOKEN: The API auth token (passed as auth in query string or form posts) that allows access to the system. If not specified, a random token will be generated on each startup
  • GOAN_API_PORT: The API port goan will listen on. If not specified, the default is 44889
  • GOAN_DBTYPE: Currently only "mongo", although "mysql" support is coming soon. If not specified, the default is "mongo"
  • GOAN_DBURL: The database connection string; if set, all other DB* variables will be ignored
  • GOAN_DBNAME: The database name to connect to. If not specified, the default is goan
  • GOAN_DBHOST: The database host to connect to. If not specified, the default is localhost
  • GOAN_DBPORT: The database port to connect to. If not specified, the default is 27017
  • GOAN_DBUSER: The database user to connect to. If not specified, the default is the database default
  • GOAN_DBPASSWORD: The database password to connect to. If not specified, the default is the database default

Running

To run, type:

GIN_MODE=release GOAN_AUTHTOKEN=agoodencryptedtoken go run main.go

Testing

To test with a local mongodb installed (environment variables can be specified otherwise):

cd ./lib

GIN_MODE=release go test -coverprofile cover.out && go tool cover -html=cover.out -o cover.html

Todo

  • Add sorting and pagination on Mongo
  • Implement better logging
  • Implement CORS
  • Add MySQL support
  • Put Dockerfile in source for easier deploy
  • ???
  • Profit!

goan's People

Contributors

kevineaton avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.