Git Product home page Git Product logo

go-demo's Introduction

Simple Go with kubernetes example

This repo shows a simple walk through how to build and deploy service with http interface to kubernetes. Starting with the hello world example in the first commit and ending up with small REST API with benchmarks and test cases with data race detection.

Requirements

Workflow

Building

Edit your code and run

make docker-build

This will run docker build command and bump version if build was successful. If you check the Dockerfile you can se that we are using multi-stage build.

In first stage we use golang:1.10 to test and build the binary and then copy that to actual image which is build from scratch.

Deploying

Run

make kube-deploy

This command will call kubectl apply with our deployment.yaml file and replace the version in deployment.yaml to match one in VERSION

After the first deployment it is required to expose our app by running

make kube-expose

Now the app should be accessible and minikube should give the url for it

minikube service demo-app --url

Testing and benchmarking

To run all tests locally with race detection and code coverage run

make benchmark

To run all bencmarks run

make test

go-demo's People

Contributors

heppu avatar

Stargazers

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