You are on page 1of 68

Deployment For

Small Institutions
A working Native Open edX Ubuntu 16.04 64 bit installation

… with a custom theme

… with SSL encryption & SMTP email

Successfully upgrading to Ginkgo.2 using Ansible


After
Your budget is approved
to hire an

Open edX SaaS Provider


FOREWORD

Small Institutions

• Less than 20 instructors


• Less than 20 courses
• Less than 2,500 active users
FOREWORD

Small Institutions

• Budget <= $500 / month


• “Vanilla” platform requirements
FOREWORD

Why Native Build?


FOREWORD

Why Native Build?


1. Because you need to avoid this:

Fixed Costs
&
No Revenue
FOREWORD

doesn’t charge you

when your EC2 instance is turned off.


FOREWORD

Why Native Build?


2. Because you’re looking for this:

Fit
FOREWORD

Why Native Build?


3. Because you’re here:
FOREWORD

What’s different about small


installations?
FOREWORD

Installation & operating


budget

IS SMALL
FOREWORD

Small Installation Budget

• Functional requirements are constrained to the


functional coverage of core functionality +
XBlocks


• Ideally we should use a “no frills” installation


procedure
FOREWORD

Small Installation Budget

• Single-server is the long-term plan


• Reliant on automation to minimize administrative


labor costs


• Upgrade frequency: quarterly or semiannually


FOREWORD

Support team
is

ISOLATED
FOREWORD

“If you’re lost in lower Manhatten, you just ask for


directions. But If you’re lost in the Himalayas then you
might die.”
🧐
— Jack Handy —
FOREWORD

The risk-reward relationship is

ASYMETRIC
when you’re managing an Open edX platform in
isolation.
FOREWORD

Asymetric Risk
You read about platform improvement X

Reward: Adding X to your platform provides


marginal, capped benefit.

Risk: If you make a mistake along the way


then the result could be
disproportionately catastrophic.
Ready?
Let’s Go

On A Deep Dive
Installation Pattern
1. Pristine native build
2. Github repository for all configuration
• Custom theme
• Software configuration
• Nginx configuration
• Administration scripts

3. SMTP email
4. SSL encryption
5. Devops for mere mortals
Important Resources
Installation
Stuff
I wish we’d known about these sooner
Let’s Build A Server
Infrastructure

Installation problems are


often related to
infrastructure
Infrastructure

• I prefer the Memory Optimized EC2 family of servers


• 2 processors + 16gb of memory works well
• At least 100gb of storage space

Vertical scaling is your friend


Infrastructure

• Get your firewall settings correct ahead of time


• Assign a static IP address to your EC2 instance
• Setup an S3 bucket for storing backups
• Use IAM for security
EC2 Security Profile
Too
Loose
Read My Installation Guide
https://blog.lawrencemcdaniel.com

#smart
Server Build Procedure

Do Not Deviate
From The Plan!
Ansible scripts will fail if you do not set a locale.

export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"

# 1. Set the OPENEDX_RELEASE variable:

export OPENEDX_RELEASE=master

You will ALWAYS choose to install from the master branch.

# 2. Bootstrap the Ansible installation:

wget https://raw.githubusercontent.com/edx/configuration/$OPENEDX_RELEASE/util/install/ansible-bootstrap.sh -O - | sudo bash

Takes around 20 minutes to execute

# 3. (Optional) If this is a new installation, randomize the passwords:

wget https://raw.githubusercontent.com/edx/configuration/$OPENEDX_RELEASE/util/install/generate-passwords.sh -O - | bash

Takes around 45 seconds to execute

# 4. Install Open edX:

wget https://raw.githubusercontent.com/edx/configuration/$OPENEDX_RELEASE/util/install/sandbox.sh -O - | bash > install.out

Takes around 1.25 hours to execute


Check Your Work

pretty please.
one of these things

is not like the others


System & Data Files

Subsystems that support the LMS and CMS


from the edx-platform repository

Green Unicorn configuration

Application configuration
This is the other pinned repository
python virtual environment for edxapp user in github.com/edx
Green Unicorn configuration

Application configuration

Node / Ruby support

More subsystems …

Python binaries
Subsystem configurations
User & Course data, logs
Installation Pattern
1. Pristine native build
2. Github repository for all configuration
• Custom theme
• Software configuration If you started with a pristine build
then your Github repository ideally
• Nginx configuration
contains everything that causes your
• Administration scripts build to no longer be pristine.
3. SMTP email
4. SSL encryption
5. Devops for mere mortals
Configuration
edx-platform Configuration repository:
repository for all applications
& sub-systems

Ubuntu EC2 Instance

So many …. sub systems


DO NOT
store passwords in your repository
Example Config Script
#!/bin/bash

# go to ubuntu home directory /home/ubuntu/


cd ~

# remove entirely any existing configuration data


rm -rf edx.configuration

# download the most recent configuration data


git clone https://github.com/your-organization/edx.configuration.git

# change ownership so that the edxapp user can do whatever it needs to do


chown edxapp -R edx.configuration
chgrp edxapp -R edx.configuration

# copy edx-platform configuration files into place


cp /home/ubuntu/edx.configuration/conf/lms.env.json /edx/app/edxapp/lms.env.json
cp /home/ubuntu/edx.configuration/conf/lms.auth.json /edx/app/edxapp/lms.auth.json
cp /home/ubuntu/edx.configuration/conf/cms.env.json /edx/app/edxapp/cms.env.json
cp /home/ubuntu/edx.configuration/conf/cms.auth.json /edx/app/edxapp/cms.auth.json

# copy any other configuration files that you might have modified for some reason.
cp /home/ubuntu/edx.configuration/edx/etc/ecommerce.yml /edx/etc/ecommerce.yml

# set permissions on the edx-platform configuration files


chmod 644 /edx/app/edxapp/*.env.json
chmod 755 /edx/app/edxapp/*.auth.json
Installation Pattern
1. Pristine native build
2. Github repository for all configuration
• Custom theme
• Software configuration
• Nginx configuration
• Administration scripts

3. SMTP email
4. SSL encryption
5. Devops for mere mortals
SMTP Email
To prevent your platform’s emails being flagged as spam you’ll
need to setup SMTP email.
SMTP Email
SMTP Email
Installation Pattern
1. Pristine native build
2. Github repository for all configuration
• Custom theme
• Software configuration
• Nginx configuration
• Administration scripts

3. SMTP email
4. SSL encryption
5. Devops for mere mortals
SSL Encryption

• Remember: Open edX is just like any other web app running on Nginx
• I recommend using Let’s Encrypt
• Installation takes less than one hour
• It’s Free!!
• Easy to maintain
SSL Encryption
Installation Pattern
1. Pristine native build
2. Github repository for all configuration
• Custom theme
• Software configuration
• Nginx configuration
• Administration scripts

3. SMTP email
4. SSL encryption
5. Devops for mere mortals
DevOps
What if you achieve 100% up-time

but no one notices?


Pro Tip:

Don’t tinker with your server.


Ever seen this? Asking for a friend.

• Platform is already highly optimized out-of-the-box.

• The stack is complex. Adding stuff is a terrible idea.

• Upgrading services ad hoc can break the platform.

• Sharing the EC2 Ubuntu instance with other apps is a bad idea.
Pro Tip:

Do it with a script
Your backup script saved my bacon!
Add the minimum permissions
necesary for your service
Pro Tip:

Use the AWS AMI Snapshot tool to


create weekly server images.
Pro Tip:

Get good at upgrading.


Mastery of the platform comes via controlled repitition of the administrative
tasks that you perform during the upgrade process

• Ansible scripts

• Working with Django

• Database migrations

• Virtual environments

• Compile static assets

• Data backups
If you could migrate
MySQL to AWS RDS

That’d be great.
Pro Tip:

Use an up-time monitoring


service.
Thank You!
Lawrence McDaniel
Full Stack Developer

https://lawrencemcdaniel.com

You might also like