You are on page 1of 30

Git-based Courses

Carson Gee and Peter Pinch


@carsongee & @pdpinch

1 / 30

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

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

Git Course Flow Overview

4 / 30

What We'll Cover


Course Production
Workflow
How to make it go (tech
details)

5 / 30

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

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

XML Course Development

8 / 30

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

example commit graph

10 / 30

example PR with comments

11 / 30

Studio Course Development

12 / 30

Studio Course Development


1.
2.
3.
4.

author course on studio server


review on staging server, repeat
export to Git
trigger updates course on production
server

13 / 30

Technical Implementation
Course Import and Export
via Git
Workflow Automation

14 / 30

Git Course Import via Command


s
u
dos
u-edxapp-s/bin/ba
sh
.ed
xa
p
p_env
m
k
di
r/
edx/var/edxapp/cours
e_
re
pos
p
y
th
onedx-platform/manage.
pyl
ms-set
ti
ngs
=a
ws\
g
it
_
add_coursehttp://gi
th
ub
.co
m/
edx
/e
dxde
mo
-co
ur
se

Options
Directory to check out into
Branch to use

15 / 30

Sysadmin Dashboard Import


Enable with:
E
N
AB
LE
_
SYSADMIN_DASHBOARD=T
ru
e

flag in FE
A
TU
R
ESdict
Head to:
h
t
tp
s:
/
/<
y
our_instance>/sysadm
i
nwith
global staff privs

16 / 30

Sysadmin Dashboard Import

17 / 30

Sysadmin Dashboard Import

18 / 30

Git Course Export via Command


s
u
dos
u-edxapp-s/bin/ba
sh
.ed
xa
p
p_env
m
k
di
r/
edx/var/edxapp/expor
t_
co
urs
e_
rep
os
c
de
dx
platform
p
y
th
onmanage.pycms--sett
in
gs
=aw
s\
g
it
_
exportedX/DemoX/Dem
o_
Co
urs
e\
g
it
@
github.com:carsongee
/e
dx
-de
mo
-co
ur
se.
gi
t

Options
username (for commit authorship)
repo_dir (specify location of local repo
location)
19 / 30

Export to Git in Studio


Enable with:
E
N
AB
LE
_
EXPORT_GIT=True

flag in FE
A
TU
R
ESdict
Set g
i
tu
r
lin course's advanced settings

20 / 30

Export to Git in Studio

21 / 30

Workflow Automation
Enter gitreload:
https://github.com/mitodl/gitreload
Responds to hooks from github/gitlab
Runs g
it
_
ad
d_coursefrom hookshot
Only operates on courses already
checked out

22 / 30

Installing gitreload
Try before you buy:
s
u
dos
u-edxapp-s/bin/ba
sh
.ed
xa
p
p_env
p
i
pin
s
tallgitreload
g
i
tr
el
o
ad

Install for realsies with Ansible:


-h
os
t
s:all
s
ud
o
:True
v
ar
s
:
C
O
MMON_ENABLE_BASIC_AU
TH
:Tru
e
r
ol
e
s:
-gitreload
-role:nginx
nginx_sites:
-gitreload

23 / 30

Add the Hook

24 / 30

Who needs ContentStore?


Setup shared filesystem for course
storage
Symlink to:
{
{edxapp_data_dir}}/
co
ur
se_
st
at
ic

Set G
I
T_
I
MP
ORT_STATIC=False

25 / 30

Who needs ContentStore?


Add to static nginx server rule:
lo
ca
t
ion~^/static/(?P<f
il
e>
.*){
r
oot{{edxapp_data_d
ir}
};
t
ry_files/staticfile
s/
$f
ile
/course_static/$fil
e=4
04;

Changes to:
l
o
ca
ti
o
n~/static/((?P<dir
>[
^/
]+)
/(
?P<
fi
le>
.*
)|
(?P
<r
fil
e>
[\w
\d
\.
]
+
)
){
root{{edxapp_app_
di
r}};
try_files/staticfi
le
s/
$di
r/
$fi
le
/course_static/$d
ir
/s
tat
ic
/$f
il
e
/staticfiles/$rfi
le=
404
;

26 / 30

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

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

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

Questions?
mitodl/git-based-courses-slides

30 / 30

You might also like