Skip to content

intra1/toasties-galore

 
 

Repository files navigation

toasties-galore

Code and resources for a talk about Continuous Deployment for Gophercon AU Build Status

Monorepo

This is a small monorepo with a naive implementation of some HTTP APIs, and some build tooling.

For the purposes of the talk, there are also 3 Pull Requests open for discussion.

Services

The jafflr is an imaginary machine which assembles and cooks toasted sandwiches.

It attaches onto a chilly bin ('Chilly bin' is NZ English parlance - aka Esky, in Australian).

There are 2 services, jafflr and the chillybin. Crucially, jafflr depends on chillybin.

Endpoints

Some of these endpoints use the wrong verb (GET instead of POST) - this has been left as "change needed":

  • chillybin:
  • /pick?name=cheese&quantity=1 - pick stock from chillybin
  • / - show current stock
  • /restock - restock
  • /health - health check
  • jafflr:
  • /toastie?i=cheese&i=vegemite - make a toastie
  • this invokes chillybin
  • / retrieves status (toasting/available)
  • /health - health check

Approaches detailed

  • Table-driven integration tests; fixtures, assertions, chaining together calls:
  • Using httptest - example provided
  • Managing database definitions with ‘migrations’:
  • go-migrate. See chillybin
  • With mongodb this can be as simple as "EnsureIndex()":w
  • Bundling resources with your app (Docker or go-bindata):
  • docker in this case
  • Mitigating risk of changes:
  • Feature Flags implemented via ENV or db
    • 3 steps:
      1. Release something cross-compatible.
      2. Switch client over to the new API
      3. Delete old endpoint (for 3rd parties this gets more complicated)
  • Versioning your APIs
    1. Could be a path /v2/
    2. Could be version headers
    3. GraphQL supports deprecated fields
    4. gRPC, Twirp [Protocol Buffers] support deprecations and field renaming
  • Zero-downtime deploys:
  • HTTP - graceful restart. See jafflr
  • healthchecks
  • Metrics and alerting
  • Tooling for your build system:
  • Containerising build steps
  • Deployment and confirmation (ECS/K8S)
  • go list -deps for granular version checking. See last_commit.sh

About

Resources for a talk about Continuous Deployment for Gophercon AU

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 72.3%
  • Shell 11.8%
  • Makefile 8.2%
  • Dockerfile 6.6%
  • TSQL 1.1%