Giter Site home page Giter Site logo

dalal-street-server's Introduction

CircleCI build status Go Report Card

Server for Dalal Street

Prerequisites

Check prerequisites

  • Check the go version installed.
go version
  • Check protobuf installation.
protoc --help
  • Setup SECRET_KEY environment variable to some string

Build instructions

  • Download the repository and cd into it.
go get github.com/delta/dalal-street-server
cd $GOPATH/src/github.com/delta/dalal-street-server
  • Install dependencies
go get -v ./...
go get -v github.com/gemnasium/migrate
go get -v gopkg.in/jarcoal/httpmock.v1
go get -v github.com/golang/protobuf/proto
go get -v github.com/golang/protobuf/protoc-gen-go
go get -v github.com/sendgrid/sendgrid-go
go get -v github.com/delta/plivo-go
  • Setup submodules
git submodule init
git submodule update --recursive
  • Create databases and run migrations
mysql -u root -p -e "CREATE DATABASE dalalstreet_dev; CREATE DATABASE dalalstreet_test;"
migrate -url "mysql://root:YOUR_MYSQL_ROOT_PASSWORD@/dalalstreet_dev" -path ./migrations up
  • Generate proto files
./build_proto.sh
  • Run cp config.json.example config.json
  • Fill in the database credentials in the Dev section of config.json.
  • Run go run main.go

Create Migrations

migrate -url "mysql://root:YOUR_MYSQL_ROOT_PASSWORD@/dalalstreet_dev" -path ./migrations create migration_file_xyz

Tests

  • Run the test script locally before pushing commits.
./test.sh

Docker usage instructions

  • Install docker and docker-compose.
  • Run cp .env.example .env. Fill in the DB_NAME and DB_PASS in .env. These are the credentials for the database container.
  • Use the same credentials in Docker section config.json (DbName and DbPassword) and docker-entry.sh (in the migrate command).
  • Run docker-compose up.
  • Once the containers are up, you can get shell access by using
docker exec -it <CONTAINER_ID> bash

GoMock usage instructions

  • To generate mock for a file using mockgen, place this comment after import statement
 //go:generate mockgen -source {YOUR_FILE_NAME}.go -destination ../mocks/{YOUR_FILE_NAME}.go -package mocks
  • To generate mocks for all packages that has above comment
go generate ./...

  • To manually generate a mock package
mockgen -destination=mocks/{YOUR_FILE_NAME}.go -package=mocks {PATH_TO_YOUR_FILE}

dalal-street-server's People

Contributors

abesheknarayan avatar adwaith007 avatar akspi avatar ar-sibi avatar coderick14 avatar gauthamk97 avatar harsh2098 avatar ishanisri avatar nimishagarwal76 avatar pranavshriram avatar rahulzoldyck avatar sandy9999 avatar thakkarparth007 avatar varunram 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.