get hooked on integrations with github

30
Get Hooked on Integrations With GitHub Christopher Thomas HighEdWeb 2016 10/17/2016

Upload: chris-thomas

Post on 08-Feb-2017

448 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Get Hooked on Integrations with GitHub

Get Hooked on Integrations With GitHubChristopher Thomas

HighEdWeb 201610/17/2016

Page 2: Get Hooked on Integrations with GitHub

#DPA2

Page 3: Get Hooked on Integrations with GitHub

Intro» What is Git?» What is Github?» GitHub Integrations» GitHub Webhooks» Webhook usage at Loma Linda University» Summary» Resources» Questions

Page 4: Get Hooked on Integrations with GitHub

About Me: Christopher Thomas» Responsible for tools and technologies used to develop web apps at Loma

Linda University» For many years, active in the web community through contributions» SoCal born and raised!» Marathon runner

Page 5: Get Hooked on Integrations with GitHub

About Loma Linda University (LLU)» Location: 1 hour from Los Angeles» Students: 4,500+» Programs: 100+» Schools: 8» Ownership: Privately owned by the Seventh-Day-Adventist Church» Mission: “To continue the teaching and healing ministry of Jesus Christ”» Other facts:

~ Institution mainly focused on health sciences at the graduate level~ City of Loma Linda is the only Blue Zone in the country~ No mascot, but “Good Samaritan” statue is an unofficial proxy~ Institution is a part of a 6 hospital 1,000+ bed health system

Page 6: Get Hooked on Integrations with GitHub

What is Git?» Source code version control» Developed by Linus Torvalds, the creator of Linux» Distributed» Full history of commits are in each copy of the repository» Users can make commits without being connected to the network» Can work without a main/central repository

Page 7: Get Hooked on Integrations with GitHub

What is GitHub?» A git server / git repository hosting site» Has arguably the best web based UI of all git server solutions» Easily allows users to share code and to collaborate» Largest git repository hosting site» Comes in two versions

~ Cloud based (github.com)~ On premise, VM appliance (GitHub Enterprise)

Page 8: Get Hooked on Integrations with GitHub

What are Integrations and Webhooks?» Events in GitHub are broadcasted» Integrations are predefined event broadcasts to a specific vendor solution» Webhooks are user setup HTTP requests

Page 9: Get Hooked on Integrations with GitHub

Types of Events» Fork» Branch» Issues (opened, closed, comments, assigned)» Push» Team (add, edit memberships, delete, etc..)» Merge

Page 10: Get Hooked on Integrations with GitHub

Integrations» GitHub has over 70 predefined integrations» Lots of popular apps and services are on the list» Very little configuration needed to set up» Not all events are broadcasted for each integration» GitHub.com calls them integrations, GitHub Enterprise calls them services

Page 11: Get Hooked on Integrations with GitHub

Integrations» Project Management

~ JIRA» Continuous Integration

~ TravisCI~ Jenkins / Hudson (plugin needed)

» Communication~ #Slack~ HipChat

» Other

Page 12: Get Hooked on Integrations with GitHub

Your Integration / Vendor Service Not on List?» Options:

~ Integrations Early Access Program~ Webhooks

Page 13: Get Hooked on Integrations with GitHub

Integrations Early Access Program» Used to be able to submit a Pull Request to submit an integration» Process recently changed to the integrations early access program» More formal process» Inclusion requirements more clearly stated than in the past

Page 14: Get Hooked on Integrations with GitHub

Webhooks

Page 15: Get Hooked on Integrations with GitHub

Webhooks» Best when the integration you need can’t be handled by something in the

integrations directory or eligible for the integrations early access program; when you need a custom integration

» GitHub sends a HTTP POST request to a specified URL» POST body contains data about the event in either JSON or form data

format» Can set up via settings webpage or via GitHub’s API» Can trigger webhook for all events or certain type of events

Page 16: Get Hooked on Integrations with GitHub
Page 17: Get Hooked on Integrations with GitHub

Case studyWebhooks usage at Loma Linda University

Page 18: Get Hooked on Integrations with GitHub

Administrative Systems Department» Consists of roughly two dozen people with a mixture of programmer /

business / application analysts and managers.» “We write the programs that run the University”» Develop mostly for the web using PHP for an in-house developed platform » Everyone in department has ability to push code to production

Page 19: Get Hooked on Integrations with GitHub

MyLLU Portal» Web portal that serves the entire enterprise» Dozens of apps» 100,000s of lines of PHP code» Two instances of portal (internal vs external apps)» Types of apps:

~ Admissions committee tools~ Collaboration tools~ Finance tools~ Identity management tools~ Job board~ Student forms workflow processing~ Training requirements tracker

Page 20: Get Hooked on Integrations with GitHub

Developer Workflow» Initial steps:

~ Developer forks main repository~ Clones repo in their account~ Adds main repository as a remote (upstream)

» Development steps:~ Create feature branch and push to origin, if working with others~ Make code changes~ Test on local VM~ Commit Changes~ Merge Changes back to master~ Push master to upstream

Page 21: Get Hooked on Integrations with GitHub

MyLLU Deployment Process» Before Git / GitHub

~ Developers would FTP files to production servers~ Sometimes process would take minuets if code was in separate

directories~ Potential app downtime while code is copied to servers

» After Git / GitHub~ Webhook used to initiate code deployment~ Code copied to servers in seconds~ Minimized potential app downtime while code is copied

Page 22: Get Hooked on Integrations with GitHub

MyLLU Deployment Process» Developer pushes code (upstream) to repository in our GitHub Enterprise

instance» GitHub triggers the webhook, which contacts the intermediate server» Intermediate server pulls changes from GitHub to a local repo» Intermediate pushes code from local repo to production web servers» Intermediate server sends notice to all developers with commits in the push

that their changes have been published

Page 23: Get Hooked on Integrations with GitHub

MyLLU Deployment Process

Page 24: Get Hooked on Integrations with GitHub

Intermediate Server» Had to do for network policy reasons (not necessary in most enviroments)» Dedicated account used to process GitHub webhook» Must create SSH key pair so server can pull code from GitHub Enterprise

and push code to production servers» Add newly created public key to GitHub as a deploy key

Page 25: Get Hooked on Integrations with GitHub

Deploy Key

Page 26: Get Hooked on Integrations with GitHub

Production Servers» Process based on Evanto Tuts+ article “Setting Up A Staging Environment”» Have a separate account just for the webhook process» SSH keys so intermediate server can connect» Two git repos

~ Bare repo in git process home repo~ Regular repo in the webroot

Page 27: Get Hooked on Integrations with GitHub

Summary» GitHub was built to integrate with other systems» Many predefined integrations for lots of vendor systems» Can ask for new intergration to be added through a formal process» Custom integrations can be done through webhooks» Loma Linda has leveraged webhooks to deploy code to its portal platform

Page 28: Get Hooked on Integrations with GitHub

Resources» GitHub Integrations Directory

~ https://github.com/integrations

» GitHub Early Access Integrations~ https://developer.github.com/early-access/integrations/

» Setting Up a Staging Environment~ https://code.tutsplus.com/articles/setting-up-a-staging-environment--net-29738

» Webhooks API Docs~ https://developer.github.com/v3/repos/hooks/

Page 29: Get Hooked on Integrations with GitHub

Questions

Page 30: Get Hooked on Integrations with GitHub

#DPA2