Learn how to manage your Open edX configuration from VS Code on your desktop computer, using a Github repository as your archive and deployment platform.
Maintaining your Open edX configuration files offline, using an integrated development environment like VS Code along with a code repository like Github offers many advantages. First and most importantly, it’s your first step towards maintaining an offline copy of your configuration, which could prove invaluable in the event of a server crash or if you irreparably break your Open edX instance; both of which happen to me occasionally. Additionally, it also positions you for setting up a Continuous Integration loop. And lastly, it’s an important step forward in your devops planning, paving the way for you to begin to think about more sophisticated infrastructure plans like say, an application cluster behind a public-facing load balancer.
Granted, our continuous integration loop is only rudimentary, but it’s a giant leap forward compared to managing everything directly on your server instance.
1. Create a Local Git Repository
Git is a version control technology that was created in the 1980’s by Linus Torvalds while he was working on the first Linux shell. Today, 30 years later, there are several cloud based platforms where you can upload and archive the version history of your projects like for example, your Open edX configuration history. GitHub and Bitbucket are two of the most popular. We’ll use GitHub for this example for no other better reason than I happen to already have an account there. Git is preinstalled on most modern operating systems, including Ubuntu Linux, MacOS and Windows.
There are multiple ways to create a new git repository, though the gist of what is being accomplished is the same: to create a new hidden folder inside your project’s root folder named .git.
In this case since our objective is to store our configuration data in GitHub, I’m going to create a new repository there, in my existing GitHub account, and then afterwards I’ll clone this repository on my development computers which in my case is a MacBook Air laptop.
Once you’ve created your new repository, you can “clone” the repository contents to your local computer, in the location of your choice using the following 1-line command from a terminal window, of course, substituting the URL for your repository with that of this example:
git clone https://github.com/lpm0073/edx-configuration-tutorial.git
Solely for the sake of illustration I’ll also demonstrate doing the same thing in reverse. That is, creating a new repository on my laptop and the “pushing” this repository up to my GitHub account:
# Alternative strategy: create a new local repository, # and then push it upstream to GitHub echo "# edx-configuration-tutorial" >> README.md git init git add README.md git commit -m "first commit" git branch -M main git remote add origin https://github.com/lpm0073/edx-configuration-tutorial.git git push -u origin main
Note that in this alternative scenario the command “git remote add origin” will automatically create a new repository for us in GitHub.