Git Product home page Git Product logo

delivery_svc's Introduction

How to run locally

Requirements to run locally (Without docker):

  • Golang version: go1.13.6
  • MySQL 5.6

Create .env file with some environment variables:

MYSQL_USERNAME=your_username
MYSQL_PASSWORD=your_password
MYSQL_HOST=localhost
MYSQL_PORT=3306
DATABASE_NAME=delivery_app
APP_PORT=:5000
ENV=dev
MAP_API_KEY=your_google_map_api_key
  1. Create database delivery_app and import database in db/init_db.sql
  2. Run using make
make all

Application service ready on port 5000, I also provide swagger interface accessible at http://localhost:5000/v1/delivery_svc/swagger/index.html

To run unittest separately:

go test -v -count=1 ./... -coverprofile=c.out

How to run using docker container

You need to provide google api key and run start.sh as follow

./start your_google_map_api_key

example:

./start AIzaSyDUYcUu5xG8-R5_X5A0eSWwBXmE-WRONG-KEY

start.sh will execute docker-compose command and will run 2 services, MySql service and Application service. If there are no errors during start, the service can be access on port 8080. http://localhost:8080/v1/delivery_svc/swagger/index.html

Notes

I put some environment variables in docker-compose.yml. In production, we need to store in centralized way, either using consul KV, AWS SSM parameter store or other 3rd party service for storing service configuration and metadata.

delivery_svc's People

Contributors

andreyderma 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.