Coder Social home page Coder Social logo

chriswhamond / simpleapp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jhoelzel/simpleapp

0.0 0.0 0.0 3 MB

Simpleapp is a simple app that defines a basic kubernetes app i use in my trainings. It contains a simple MVC structure for packages, a Mux subrouter integration, kube manifests and an easy to learn structure.

Makefile 30.61% Go 67.39% Dockerfile 1.02% HTML 0.98%

simpleapp's Introduction

Simpleapp

Simpleapp is a simple app that defines a basic kubernetes app i use in my trainings. It contains a simple MVC structure for packages, a Mux subrouter integration, kube manifests and an easy to learn structure.

Its main goals are:

  • Making kubernetes endpoints for your app is easy
  • Automating the kubernetes manifests with a little help of sed and make it fun to work with it
  • To teach the fact that deploying and testing can go hand in hand
  • To teach how fast you can actually setup a golang application for kubernetes and deploy them

NOTE: I usually present this in combination with a fine tuned visual studio dev container. So this project assumes that you are already running on a linux host. If this is not the case be arware that there will be another build step for you neccesairy in the dockerfile. Another upside of a container based development environment is just that you can skip the buildimage inbetween.

It Contains

  • Gracefull shutdown
  • Logging to SDTOUT
  • MVC Oriented architechture with mux subrouter
  • Kubernetes manifests with nodeport ingress labels and deployment
  • Makefile for debugging testing and deploying in docker as well as kubernetes
  • Stubs for Kubernetes readiness and health
  • Image building, versioning and deploying
  • Build tags that are read inside of the app so version and buildtime are available in the package
  • Uses gcr.io/distroless/static:nonroot as docker base image
  • Thefore the built container is 8 MB only
  • TIMEZONE support

Advantages

  • With the proper use of the makefile you will be able to iterate your project quickly: all thats needed for public use is a push to your cotainer registry
  • You can modify a container quickly by adding different static files into the static folder for proofs. (For instance for demoing going from v1 to v2)
  • Minimal dependencies: the only thing required by this package is gorilla/mux

Makefile instrunctions

HINT: The default namespace for Kubernetes is "default", you can change it by providing a NS argument:

make kube-apply NS=foo applies the kubernetes manifests in the namespace foo. If your namespace does not exist make kube-ns NS=foo will create it for you

Usage:
  make <target>

General
  help             Display this help.

Development
  fmt              Run go fmt against code.
  vet              Run go vet against code.
  test             Run tests.
  run              Run.
  commithistory    create the commithistory in a nice format

Build
  clean            remove previous binaries
  build            build a version of the app, pass Buildversion, Comit and projectname as build arguments
  docker-build     Build the docker image and tag it with the current version and :latest
  docker-run       Build the docker image and tag it and run it in docker

Kubernetes
  kube-manifests   generated the kubernetes manifests and replaces variables in them
  kube-clean       removes release manifests
  kube-apply       apply kube manifests
  kube-remove      remove kube manifests
  kube-renew       build, docker-build, remove existing deployment, deploy

simpleapp's People

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.