GithubHelp home page GithubHelp logo

shanboyang / service Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ardanlabs/service

0.0 1.0 0.0 11.79 MB

Starter code for writing web services in Go

License: Apache License 2.0

Go 99.55% Makefile 0.45%

service's Introduction

Service

William Kennedy
Ardan Labs
[email protected]

Service is a project that provides a starter-kit for a REST based web service. It provides best practices around Go web services using POD architecture and design. It contains the following features:

  • Minimal application web framework
  • Middleware integration
  • Database support using MongoDB
  • CRUD based pattern
  • Distributed logging and tracing
  • Testing patterns
  • POD architecture with sidecars for metrics and tracing
  • Use of Docker, Docker Compose, Makefile
  • Vendoring with dep and vgo
  • Deployment to Kubernetes

Local Installation

This project contains three services and uses 3rd party services such as MongoDB and Zipkin. Docker is required to run this software on your local machine.

Getting the project

You can use the traditional go get command to download this project into your configured GOPATH.

$ go get -u github.com/ardanlabs/gotraining

Installing Docker

Docker is a critical component to managing and running this project. It kills me to just send you to the Docker installation page but it's all I got for now.

https://docs.docker.com/install/

If you are having problems installing docker reach out or jump on Gopher Slack for help.

Running The Project

All the source code, including any dependencies, have been vendored into the project. We have been experimenting with vgo but dep is the offical vendoring tool being used. There is a single dockerfile for each service and a docker-compose file that knows how to run all the services.

A makefile has also been provide to make building, running and testing the software easier.

Building the project

Navigate to the root of the project and use the makefile to build all of the services.

$ cd $GOPATH/src/github.com/ardanlabs/service
$ make all

Running the project

Navigate to the root of the project and use the makefile to run all of the services.

$ cd $GOPATH/src/github.com/ardanlabs/service
$ make up

The make up command will leverage Docker Compose to run all the services, including the 3rd party services. The first time to run this command, Docker will download the required images for the 3rd party services.

Default configuration is set which should be valid for most systems. Use the docker-compose.yaml file to configure the services differently is necessary. Email me if you have issues or questions.

Stopping the project

You can hit C in the terminal window running make up. Once that shutdown sequence is complete, it is important to run the make down command.

$ <ctrl>C
$ make down

Running make down will properly stop and terminate the Docker Compose session.

What's Next

We are in the process of writing more documentation about this code. Classes are being finalized as part of the Ultimate series.

service's People

Contributors

ardan-bkennedy avatar jcbwlkr avatar bobintornado avatar egonzo avatar slycrel avatar wyattjoh avatar

Watchers

 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.