How We Use GitHub and AWS Together at COOKPAD

Cf7b553387b247d737c60cfceabb2cea?s=47 Naoto Takai
November 16, 2013

How We Use GitHub and AWS Together at COOKPAD

at AWS x GitHub Workshop on Nov 16, 2013

Cf7b553387b247d737c60cfceabb2cea?s=128

Naoto Takai

November 16, 2013
Tweet

Transcript

  1. How We Use GitHub and AWS Together at COOKPAD @takai

     
  2. Naoto Takai Cowboy Coder

  3. 20M UU/month 1.5M recipes (October 31 2013)

  4. Ruby 2.0 Rails 3.2 (October 31 2013)

  5. None
  6. Bad news: GitHub Enterprise does not support EC2.

  7. None
  8. GitHub LDAP SMTP Accessing AWS: LAN AWS Helper Gateway SSH

    Tunnel (autossh) GitHub Enterprise does not support SSH tunneling
  9. Developer Access from External: LAN AWS GitHub Gateway SSH Tunnel

    (autossh) Reverse Proxy Internet Developer Tips ‣ DNS lookup Helper
  10. Developer Access from External (SSH): LAN AWS GitHub Gateway SSH

    Tunnel (autossh) Internet Developer Tips: SSH con g hack Host github-enterprise Hostname gateway CheckHostIP no StrictHostKeyChecking no port 2222 Helper
  11. 5 pro tips for successful GitHub and AWS

  12. Open pull request every time. Pro Tip:

  13. We are using GitHub Enterprise since 2012. ✗ Quality was

    dependent on individual skills. ✗ Our code base was growing. ✗ It was hard to track changes in the code. ✗ Code review was very hard.
  14. None
  15. We made the rule: ✓ Code review is required to

    be merged into the master. Team Pull Request Owner Developer Developer review open merge review
  16. None
  17. None
  18. Effects: ✓ Everyone talks about “readable code”. ✓ We can

    share our business knowledge, technique, and pitfalls.
  19. Number of Pull Requests 0 100 200 300 400 500

    600 700 800 2012-04 2012-05 2012-06 2012-07 2012-08 2012-09 2012-10 2012-11 2012-12 2013-01 2013-02 2013-03 2013-04 2013-05 2013-06 2013-07 2013-08 2013-09 2013-10 0 10 20 30 40 50 60 Developers Pull Requests
  20. None
  21. Pull Request Best Practices

  22. None
  23. None
  24. None
  25. Use GitHub ow and feature toggle. Pro Tip:

  26. How many people use git?

  27. How many people use git ow?

  28. None
  29. GitHub Flow ✓ Anything in the master branch is deployable

    ✓ To work on something new, create a descriptively named branch off of master (ie: new-oauth2-scopes) ✓ When you need feedback or help, or you think the branch is ready for merging, open a pull request ✓ After someone else has reviewed and signed off on the feature, you can merge it into master http://scottchacon.com/2011/08/31/github- ow.html
  30. feature branch feature branch master branch pull request & merge

    GitHub Flow
  31. Feature Toggle “The basic idea is to have a con

    guration le that de nes a bunch of toggles for various features you have pending. The running application then uses these toggles in order to decide whether or not to show the new feature.” http://martinfowler.com/bliki/FeatureToggle.html
  32. Feature Toggle Target? Original feature New feature User request Yes

    No
  33. None
  34. None
  35. None
  36. Involve non-engineers. Pro Tip:

  37. None
  38. (JUIVCͷαΠτΛݟΔ͚ͩͰɺ։ൃ༻ޠΛ֮͑ΒΕΔ ڞ௨ͷݴޠͰ࿩ͤΔΑ͏ʹͳΔ όάɾϓϩδΣΫτ؅ཧɺXJLJͳͲɺ։ൃʹඞཁͳ͢΂ͯΛҰΧॴͰ ίϚϯυϥΠϯɺϒϥ΢βͳͲ޷͖ͳํ๏Ͱར༻ ϒϥ΢β͔ΒίϛοτͰ͖Δ HJUIVCͱάϧʔϓνϟοτΛ࿈ܞͤͯ͞ɺϦΞϧλΠϜʹ։ൃʹࢀՃ͢Δ ΤϯδχΞʹ࿩͔͚͠΍͘͢ͳΔ HJUͷίϯηϓτʹ׳ΕͨΒɺϩʔΧϧ؀ڥΛͭͬͯ͘ΈΔ ݸਓϨϙδτϦΛ࢖ͬͯɺϑΝΠϧͷڞ༗΍όοΫΞοϓΛ͢Δ (JUIVC্Ͱத਎ΛݟΕͳ͍ϑΝΠϧܗ͕ࣜɺஈʑͱݏ͍ʹͳͬͯ͘Δ

    ࣗ෼ͷۀ຿ΛɺεΫϦϓτʹ୅ΘΓʹ΍ͬͯ΋Β͏ ։ൃऀ͕ϓϧϦΫΤετ͘ΕͨΓɺػೳͱͯ͠औΓࠐ·ΕͨΓ http://www.goodpic.com/mt/archives2/2013/09/non-engineers-should-use-github.html
  39. Repository Product Support Product Manager Issue Developer UI/UX Designer Pull

    Request le le review open open Usage of Pull Request and Issue
  40. Use GitHub as hub for CD. Pro Tip:

  41. How often do you deploy?

  42. 11+ deploys per day

  43. ✓ Development ✓ Source code review ✓ Continuous integration ✓

    Production test ✓ Production Source Code Review Continuous Integration Production Test Developement Production GitHub Git Repository merge pull req pull tag deploy deploy Deployment Pipeline
  44. LAN EC2 CI Server Git Repository Production Test HipChat tag

    pull notify deploy Development DB schema Remote Spec distribute Git Repository clone pusher service hook pull push Developer merge
  45. require 'sinatra' post '/update' do payload = JSON.parse(params[:payload]) project =

    payload['repository']['name'] if system("pgrep -f \"sh -c git --git-dir=#{REPOSITORY_ROOT}/#{project}\"") next "Found another process for #{project}\n" end cmd = "git --git-dir=#{REPOSITORY_ROOT}/#{project} remote prune origin " + "&& git --git-dir=#{REPOSITORY_ROOT}/#{project} fetch -q " + "&& git --git-dir=#{REPOSITORY_ROOT}/#{project} push -q --mirror git-repo" pid = Process.spawn(cmd) Process.detach(pid) "Spawn following command: #{cmd}\n" end Clone Pusher
  46. CI Production DB Development DB Test DB GitHub Enterprise replication

    schema pull Developer Machine Test Database Schema
  47. GitHub is DevOps interface. Pro Tip:

  48. ݈શͳํ

  49. None
  50. Puppet Client Puppet Master GitHub Enterprise deploy IT Professional push

    pull Puppet Client Puppet Client Con guration Management with Puppet
  51. 5 pro tips for successful GitHub and AWS ✓ Open

    pull request every time. ✓ Use GitHub ow and feature toggle. ✓ Involve non-engineers. ✓ Use GitHub as hub for CD. ✓ GitHub is DevOps interface.