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

How We Use GitHub and AWS Together at COOKPAD

Naoto Takai
November 16, 2013

How We Use GitHub and AWS Together at COOKPAD

at AWS x GitHub Workshop on Nov 16, 2013

Naoto Takai

November 16, 2013

More Decks by Naoto Takai

Other Decks in Technology


  1. GitHub LDAP SMTP Accessing AWS: LAN AWS Helper Gateway SSH

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

    (autossh) Reverse Proxy Internet Developer Tips ‣ DNS lookup Helper
  3. 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
  4. 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.
  5. We made the rule: ✓ Code review is required to

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

    share our business knowledge, technique, and pitfalls.
  7. 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
  8. 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
  9. 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
  10. Repository Product Support Product Manager Issue Developer UI/UX Designer Pull

    Request le le review open open Usage of Pull Request and Issue
  11. ✓ 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
  12. 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
  13. 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
  14. CI Production DB Development DB Test DB GitHub Enterprise replication

    schema pull Developer Machine Test Database Schema
  15. Puppet Client Puppet Master GitHub Enterprise deploy IT Professional push

    pull Puppet Client Puppet Client Con guration Management with Puppet
  16. 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.