Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Writing Tools in Go For Ops Engineers

Writing Tools in Go For Ops Engineers

Yuuki Tsubouchi (yuuk1)

February 18, 2016
Tweet

More Decks by Yuuki Tsubouchi (yuuk1)

Other Decks in Programming

Transcript

  1. mkr • For programable server operations with Mackerel • JSON

    output (Enable to parse with jq) • Depends on mackerelio/mackerel- client-go • More useful on server (No need to pass an API Key)
  2. Grabeni • Help a failover tool (Keepalived/ MHA) switch a

    VIP • Depends on aws/aws-sdk-go • AWS API Retry/Max Attempts HSBCFOJHSBCFOJYYYYYYYYY
  3. Droot • chroot an extracted archive from Docker images •

    Pull an archive from AWS S3 • Atomic deploy with symlink and rename(2) • `docker export | s3 upload` by io.Pipe()
  4. gokc • Keepalived (well known with LVS) • Replace maoe/kc

    written in Haskell (Parser combinator) • Parser with yacc • Lexer with goroutine and channel
  5. Quick Development on Server • GOOS=linux GOARCH=amd64 (or build on

    Docker) • scp ./binary [remote server] • ./binary
  6. Quick Development on Server • One binary & Cross compile

    • My ops tools aim to run on Linux servers. • ex. droot runs on Linux only
  7. • Not mean that coding is just quick • Mean

    that no hesitation about coding because Go has the simple language specification Quick deployment
  8. Others • Concurrency by goroutine • `io.Pipe()` • Fast runtime

    rather than LL • Error handing by returning error type • `defer` statement • Easy to clear temp resources on failure
  9. Summary • Pros of Go for ops engineers • Easy

    binary distribution • Quick development on server • Quick deployment as a result