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

A658ec7f1badf73819dfa501165016c1?s=128

Yuuki Tsubouchi (yuuk1)

February 18, 2016
Tweet

More Decks by Yuuki Tsubouchi (yuuk1)

Other Decks in Programming

Transcript

  1. Writing Tools in Go For Ops Engineers Go 1.6 Release

    Party
  2. @y_uuk1 id:y_uuki Web Operations Engineer @Hatena

  3. About 2.5 years since I met Go

  4. My ops tools in Go • yuuki1/droot • yuuki1/grabeni •

    yuuki1/gokc • mackerelio/mkr
  5. Ready for production use

  6. mkr Command Line Tool for Mackerel API

  7. 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)
  8. Grabeni An ops-friendly AWS Elastic Network Interface (ENI) attachment grabbing

    tool.
  9. Grabeni • Help a failover tool (Keepalived/ MHA) switch a

    VIP • Depends on aws/aws-sdk-go • AWS API Retry/Max Attempts HSBCFOJHSBCFOJYYYYYYYYY
  10. Droot A super-easy application container engine with chroot without docker.

  11. IUUQZVVLJIBUFOBCMPHDPNFOUSZESPPU

  12. 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()
  13. gokc Yet Another Keepalived Syntax Checker in Golang.

  14. IUUQZVVLJIBUFOBCMPHDPNFOUSZHPLD

  15. gokc • Keepalived (well known with LVS) • Replace maoe/kc

    written in Haskell (Parser combinator) • Parser with yacc • Lexer with goroutine and channel
  16. I believe Go is a good solution for ops engineers

  17. Pros of Golang for ops engineer

  18. 1 Easy Distribution

  19. Easy Distribution • One Binary • Escaping Dependency Problem

  20. Why is “One binary” so important ?

  21. • 1500+α Hosts • 500+α Roles • Services continued 15

    years • Many Old OSs … Hatena
  22. 2 Quick development on Server

  23. Quick Development on Server • GOOS=linux GOARCH=amd64 (or build on

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

    • My ops tools aim to run on Linux servers. • ex. droot runs on Linux only
  25. 3 Quick deployment as a result

  26. • Not mean that coding is just quick • Mean

    that no hesitation about coding because Go has the simple language specification Quick deployment
  27. 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
  28. Summary • Pros of Go for ops engineers • Easy

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