mdb

command module
v1.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2021 License: MIT Imports: 1 Imported by: 0

README

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

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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
exporter
This file takes Rambler parser to our project as Rambler is binary and cannot be imported.
This file takes Rambler parser to our project as Rambler is binary and cannot be imported.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL