Slide 1

Slide 1 text

Git-based Courses Carson Gee and Peter Pinch @carsongee & @pdpinch 1 / 30

Slide 2

Slide 2 text

Peter Pinch education at scale pbs.org, pbslearningmedia.org Ask me about animatronic aardvarks MIT OpenCourseWare 2,240 courses and counting man of many hats at MITx 2 / 30

Slide 3

Slide 3 text

Carson Gee Seriously into process automation Over a year with Open edX Over 100 PRs between platform and configuration Not serious about much else 3 / 30

Slide 4

Slide 4 text

Git Course Flow Overview 4 / 30

Slide 5

Slide 5 text

What We'll Cover Course Production Workflow How to make it go (tech details) 5 / 30

Slide 6

Slide 6 text

Why do we do it this way? Course teams want to: use familiar tools migrate content manage versions manage multiple contributors preview and release 6 / 30

Slide 7

Slide 7 text

Why do we do it this way? Admins need to: help course teams, safely bulk updates move courses from staging to production archive (and restore) courses 7 / 30

Slide 8

Slide 8 text

XML Course Development 8 / 30

Slide 9

Slide 9 text

XML Course Development 1. edit XML 2. commit and push to master branch 3. trigger ➞ updates course on staging server 4. review on staging, repeat as necessary 5. merge to live branch 6. trigger ➞ updates course on production server 9 / 30

Slide 10

Slide 10 text

example commit graph 10 / 30

Slide 11

Slide 11 text

example PR with comments 11 / 30

Slide 12

Slide 12 text

Studio Course Development 12 / 30

Slide 13

Slide 13 text

Studio Course Development 1. author course on studio server 2. review on staging server, repeat 3. export to Git 4. trigger ➞ updates course on production server 13 / 30

Slide 14

Slide 14 text

Technical Implementation Course Import and Export via Git Workflow Automation 14 / 30

Slide 15

Slide 15 text

Git Course Import via Command s u d o s u - e d x a p p - s / b i n / b a s h . e d x a p p _ e n v m k d i r / e d x / v a r / e d x a p p / c o u r s e _ r e p o s p y t h o n e d x - p l a t f o r m / m a n a g e . p y l m s - - s e t t i n g s = a w s \ g i t _ a d d _ c o u r s e h t t p : / / g i t h u b . c o m / e d x / e d x - d e m o - c o u r s e Options Directory to check out into Branch to use 15 / 30

Slide 16

Slide 16 text

Sysadmin Dashboard Import Enable with: E N A B L E _ S Y S A D M I N _ D A S H B O A R D = T r u e flag in F E A T U R E S dict Head to: h t t p s : / / < y o u r _ i n s t a n c e > / s y s a d m i n with global staff privs 16 / 30

Slide 17

Slide 17 text

Sysadmin Dashboard Import 17 / 30

Slide 18

Slide 18 text

Sysadmin Dashboard Import 18 / 30

Slide 19

Slide 19 text

Git Course Export via Command s u d o s u - e d x a p p - s / b i n / b a s h . e d x a p p _ e n v m k d i r / e d x / v a r / e d x a p p / e x p o r t _ c o u r s e _ r e p o s c d e d x - p l a t f o r m p y t h o n m a n a g e . p y c m s - - s e t t i n g s = a w s \ g i t _ e x p o r t e d X / D e m o X / D e m o _ C o u r s e \ g i t @ g i t h u b . c o m : c a r s o n g e e / e d x - d e m o - c o u r s e . g i t Options username (for commit authorship) repo_dir (specify location of local repo location) 19 / 30

Slide 20

Slide 20 text

Export to Git in Studio Enable with: E N A B L E _ E X P O R T _ G I T = T r u e flag in F E A T U R E S dict Set g i t u r l in course's advanced settings 20 / 30

Slide 21

Slide 21 text

Export to Git in Studio 21 / 30

Slide 22

Slide 22 text

Workflow Automation Enter gitreload: https://github.com/mitodl/gitreload Responds to hooks from github/gitlab Runs g i t _ a d d _ c o u r s e from hookshot Only operates on courses already checked out 22 / 30

Slide 23

Slide 23 text

Installing gitreload Try before you buy: s u d o s u - e d x a p p - s / b i n / b a s h . e d x a p p _ e n v p i p i n s t a l l g i t r e l o a d g i t r e l o a d Install for realsies with Ansible: - h o s t s : a l l s u d o : T r u e v a r s : C O M M O N _ E N A B L E _ B A S I C _ A U T H : T r u e r o l e s : - g i t r e l o a d - r o l e : n g i n x n g i n x _ s i t e s : - g i t r e l o a d 23 / 30

Slide 24

Slide 24 text

Add the Hook 24 / 30

Slide 25

Slide 25 text

Who needs ContentStore? Setup shared filesystem for course storage Symlink to: { { e d x a p p _ d a t a _ d i r } } / c o u r s e _ s t a t i c Set G I T _ I M P O R T _ S T A T I C = F a l s e 25 / 30

Slide 26

Slide 26 text

Who needs ContentStore? Add to static nginx server rule: l o c a t i o n ~ ^ / s t a t i c / ( ? P < f i l e > . * ) { r o o t { { e d x a p p _ d a t a _ d i r } } ; t r y _ f i l e s / s t a t i c f i l e s / $ f i l e / c o u r s e _ s t a t i c / $ f i l e = 4 0 4 ; Changes to: l o c a t i o n ~ / s t a t i c / ( ( ? P < d i r > [ ^ / ] + ) / ( ? P < f i l e > . * ) | ( ? P < r f i l e > [ \ w \ d \ - . ] + ) ) { r o o t { { e d x a p p _ a p p _ d i r } } ; t r y _ f i l e s / s t a t i c f i l e s / $ d i r / $ f i l e / c o u r s e _ s t a t i c / $ d i r / s t a t i c / $ f i l e / s t a t i c f i l e s / $ r f i l e = 4 0 4 ; 26 / 30

Slide 27

Slide 27 text

Conclusions The Good Simple and safe to publish to students Social course development w/ github Versioned per course backups gratis Support of multiple student LMS targets Better courseware debugging 27 / 30

Slide 28

Slide 28 text

Conclusions The Bad More complex setup git hooks repository creation manual first checkout Extra step for Studio courses Did the hook work? Easier to break courses when editing raw XML 28 / 30

Slide 29

Slide 29 text

Future Work Create RESTful token auth Course Import/Export API Studio and LMS "Create a Course" Application Automatic course/repo creation Initial LMS import Hook setup "giturl" setting 29 / 30

Slide 30

Slide 30 text

Questions? mitodl/git-based-courses-slides 30 / 30