Code Monkey home page Code Monkey logo

mdb's Introduction

MDB - Metadata DB

Maintainability

Test Coverage

Overview

BB archive Metadata Database.

This system aims to be a single source of truth for all content produced by Bnei Baruch.

Commands

The mdb is meant to be executed as command line. Type mdb <command> -h to see how to use each command.

mdb server

Run the server

mdb config <path>

Generate default configuration in the given path. If path is omitted STDOUT is used instead. Note that default value to config file is config.toml in project root directory.

 mdb migration my-migration-name

Create new migration. (See Schema migrations section for more information).

mdb version

Print the version of MDB

Implementation Notes

Dates and Times

All timestamps fields are expecting values in UTC only.

Languages

Languages are represented in the system as a two letters code adhering to the ISO_639-1 standard.

Special values:

  • Unknown - xx
  • Multiple languages - zz

Release and Deployment

Once development is done, all tests are green, we want to go live. All we have to do is simply execute misc/release.sh.

To add a pre-release tag, add the relevant environment variable. For example,

PRE_RELEASE=rc.1 misc/release.sh

Schema Migrations

We keep track of all changes to the MDB schema under migrations. These are pure postgres sql scripts. To create a new migration file with name run in project root directory:

mdb migration my-migration-name

This will create a migration file in migrations directory with name like: 2017-01-07_14:21:02_my-migration-name.sql

They play along well with rambler A simple and language-independent SQL schema migration tool. Download the rambler executable for your system from the release page. (on linux chmod +x)

Under migrations folder add a rambler.json config file. An example:

{
  "driver": "postgresql",
  "protocol": "tcp",
  "host": "localhost",
  "port": 5432,
  "user": "",
  "password": "",
  "database": "mdb",
  "directory": "migrations",
  "table": "migrations"
}

Important make sure never to commit such files to SCM.

On the command line:

rambler -c migrations/rambler.json apply -a

Logging

We use logrus for logging.

All logs are written to STDOUT or STDERR. It's up to the running environment to pipe these into physical files and rotate those using logrotate(8).

Rollbar

If the rollbar-token config is found we'll use our own recovery middleware to send errors to Rollbar. If not, we'll use gin.Recovery() to print stacktrace to console. Using rollbar is meant for production environment.

In addition, you could log whatever error you want to rollbar directly, for example:

   if _, err := SomeErrorProneFunc(); err != nil {
       rollbar.Error("level", err,...)
   }

Check out the docs for more info on how to use the Rollbar client.

Documentation

Documentation is based on tests and will be generated automatically with each make build. To generate static html documentation (docs.html) install:

npm install -g aglio

Then run:

make api

Installation details

Postgresql installation

https://wiki.postgresql.org/wiki/Apt

Go related installations

sudo apt-get update
sudo curl -O https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz

Detailes can be found here: https://www.digitalocean.com/community/tutorials/how-to-install-go-1-6-on-ubuntu-14-04)

sudo tar -xvf go1.8.linux-amd64.tar.gz
sudo mv go /usr/local
export GOROOT=/user/local/go

While at /home/kolmanv/go

export GOPATH=/home/kolmanv/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
git clone https://github.com/Bnei-Baruch/mdb.git

Install Packages - Using godep

go get -u github.com/jteeuwen/go-bindata/...
go get gopkg.in/gin-gonic/gin.v1
go get github.com/lib/pq
go get github.com/tools/godep
# https://github.com/tools/godep
godep save

License

MIT

mdb's People

Contributors

edoshor avatar bbfsdev avatar yurihechter avatar ramigg avatar kolmanv avatar yanivel avatar gshilin avatar yosefy avatar

Watchers

James Cloos 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.