30
How to automate Open edX deployments using Github Actions
Open edX is an open-source platform you can use to create and host online courses. It was originally developed in 2012 by MIT and Harvard University and has since been adopted by organizations of all shapes and sizes to power a wide range of online learning use cases.
It has been used by organizations and universities like Microsoft, IBM, MIT, and ASU.
It has been used by organizations and universities like Microsoft, IBM, MIT, and ASU.
We use Ansible to provision and maintain our platform. If you are not familiar with Ansible, it's an open source Devops tool that automates the software provisioning and configuration. It building blocks are:
We have our playbooks, roles and their variables in a GitHub repo. Variables are divided to 2 different files
To change a variable and deploy it to the Open edX server we need to:
1- Pull the Github repo that has Open edX variables on a local machone
2- Change one or multiple variables
3- Push the changes back to the Github repo
4- Deploy new variables to the server from an Ansible Control node. Here we pass new
vars.yml
and passwords.yml
. Passwords file is encrypted using Ansible Vault.To change a variable and deploy it to the Open edX server we need to:
1- Pull the Github repo that has Open edX variables on a local machone
2- Change one or multiple variables
3- Push the changes back to the Github repo
4- Deploy new variables to the server from an Ansible Control node. Here we pass new
vars.yml
and passwords.yml
to ansible-playbook command, Something like:ansible-playbook /edx/app/edx_ansible/edx_ansible/playbooks/openedx_native.yml --vault-password-file ~/.ansible_vault_pass.txt -i ./ansible-configs/inventory -e@./edx-configs/vars.yml -e@./edx-configs/passwords.yml

Problem
Steps 3 and 4 are where things can get complicated. As you see in the previous diagram these steps are manual and it can become really time consuming and tedious if you need to make multiple deployments to the same server or even to a cluster of servers.
Solution
Ideal solution will be to trigger new deployment to our server or servers as as soon as we push a new change to the GitHub repo. GitHub actions can do that for us. We can create a workflow that
Steps 3 and 4 are where things can get complicated. As you see in the previous diagram these steps are manual and it can become really time consuming and tedious if you need to make multiple deployments to the same server or even to a cluster of servers.
Solution
Ideal solution will be to trigger new deployment to our server or servers as as soon as we push a new change to the GitHub repo. GitHub actions can do that for us. We can create a workflow that
- Using
actions/checkout@v2
action
- Using
shimataro/ssh-key-action@v2
action

One of the variables in the

Now let's change it's value to
vars.yml
file is EDXAPP_PLATFORM_NAME
and we use it's value in template in multiple places like the footer.
Now let's change it's value to
Cubite Technologies
and commit the change. It should trigger GitHub action to deploy this new value to our server via Ansible.
cubitetech
/
openedx-actions-demo
Repo to show how we can automate Open edX deployment using Github Actions
To learn more about Open edX check their website
30