Git Product home page Git Product logo

godic's Introduction

godic Build Status

Overview

godic is a web application written in Go that helps you create and maintain a data dictionary of your relational database automatically.
Currently it supports both mysql and postgres databases (latest versions).

How to use?

With Docker

Pull docker image:

docker pull ottosg/godic

Environment variables:

GODIC_SERVER_PORT

This environment variable is not required. If not defined godic will use a default port 8080. This environment variable sets the port that godic will use for the http server to serve the UI.

GODIC_DB_USER

This environment variable is required. It represents the user of your database that godic will scan. Remember that this user should have already the required privileges to access the information schema of your database. Providing the correct permissions to the given user is key for the godic app to work.

GODIC_DB_PASSWORD

This environment variable is required. It represents the password of the given user to login into your database.

GODIC_DB_HOST

This environment variable is required. It represents the host where your database is being served.

GODIC_DB_PORT

This environment variable is required. It represents the port on the host where your database is being served.

GODIC_DB_NAME

This environment variable is required. It represents name of your database, the one godic will scan.

GODIC_DB_DRIVER

This environment variable is required. It represents the driver that your database supports. godic currently support two drivers: mysql and postgres.

GODIC_DB_SCHEMA

This environment variable is not required, but it is desirable to pass it when initializing a container if the default value is not the one you use. This environment variable represents the specific schema that you want to allow godic to check. If not given godic will use public as the default schema.

GODIC_FORCE_DELETE

This environment variable is no required. This variable is needed only in cases where you want to delete the data dictionary you have stored in order to start fresh. I recommend you to use this flag wisely. It can be useful in cases where there is some data corruption of some sort or when you just want to switch to a new database and create a new data dictionary.

VOLUME mount point:

Use this mount point if you want to create a VOLUME to preserve your data dictionary information.

Volume point location:

VOLUME /go/src/github.com/ottotech/godic/data

See example below to check how you can use this mount point.

Start a godic instance:

$ docker run -d \
    --name some-godic-instance \
    -e GODIC_DB_USER=master \
    -e GODIC_DB_PASSWORD=secret \
    -e GODIC_DB_HOST=NAME_OF_CONTAINER_SERVING_DB \
    -e GODIC_DB_PORT=5432 \
    -e GODIC_DB_NAME=mydb \ 
    -e GODIC_DB_DRIVER=postgres \
    -e GODIC_DB_SCHEMA=public \
    -v godic_mount:/go/src/github.com/ottotech/godic/data \
    -p 8080:8080 \
    --network godic_net \
    ottosg/godic

NOTE

Usually you will use a godic container with other containers where you are hosting your database, in that case you will need to add all containers under the same network to be able to use DNS resolution and talk to your container holding your database. Creating a docker network and attaching existing containers to the network in docker is pretty straightforward.

For example:

docker network create godic_net
docker network connect godic_net db_container

If it happens that your are running your database directly in your local machine there are ways to allow a docker container access your local port, but this talk is out of scope here :)

With this repo

go get -d github.com/ottotech/godic
cd $GOPATH/src/github.com/ottotech/godic
go build . 

Now in order to run godic you have to use the same environment variables described above for the docker use case, but as flags.

For example:

$ ./godic \
  -db_user=master \
  -db_password=secret \
  -db_host=localhost \
  -db_port=5432 \
  -db_name=mydb \ 
  -db_driver=postgres \
  -db_schema=public  

TODO

  • more tests
  • UI can be improved.
  • Would be nice to be able to support sqlite as well.
  • Would be nice to support multiple versions of mysql and postgres and not just the latest ones.

WEB UI

Supported browsers: chrome and firefox.

Screenshot of godic web interface

Contributing

Check repository godic

Clone the repo and run:

go get -u github.com/jteeuwen/go-bindata/...

Then on the repo path run:

go-bindata -debug /assets
go run .

There you are, you can start contributing on the go code or the UI.

This project uses react for websites, see link

If you make any changes, run go fmt ./... before submitting a pull request.

Notes

godic by no means is a robust solution for maintaining your data dictionary, specially for big databases or organizations. It serves my personal use cases. Since we are using a file system storage this is prone to errors. You might feel tempted to create your own storage for robustness and implement the Repository interface, I will advise you to do so.

I won't be actively improving this repo, but from time to time I will try to enhance it :)

License

Copyright ยฉโ€Ž 2020, ottotech

Released under MIT license, see LICENSE for details.

godic's People

Contributors

ottotech avatar

Watchers

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