Skip to main content

How to deploy Open-edX services in Distributed Architecture


Hi , I think the first thing you need to do is to move the data to a dedicated database server so that you can set up a farm of edx servers that share the same content.



Here are the steps I did to achieve that:

Step 1 : Installed openedx instance say 'Instance-1' which is your running Web node(Web-server)

Step 2 : Execute the following commands to back up the database on 'Instance-1'
mongodump -o ./mongo-backup
mongorestore -drop ./mongo-backup
mysqldump -u root -p --all-databases > ./backup.sql
mysql -u root -p < ./backup.sql

Step 3 : Setup an instance of mysql on AWS-RD  with URL like: 'http://instance1.123456789012.us-east-1.rds.amazonaws.com/'(If want to you mongodb & mysqlDB on same instance. that is going to work as well.)

Step 4 : Import the Mysql databse data into AWS-RD from Open-edX backup using command: 'mysql -h <endpoint> -u <username> -p < ./backup.sql'

Step 5 : Setup a new Ubuntu instance say 'Instance-2' for mongodb/mysql or for both, so install mongodb/mysql over there by running folowing commands:
To Install MongoDB:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-10gen
To Install Mysql:
sudo apt-get install mysql-server

Step 6 : Then import mongodb data on 'Instance-2'.

Step 7 : Then copy the exported file to the server and import into mongodb
```mongorestore -drop ./mongo-backup```

Steps 8 : Change the mongodb and mysql host address in the following files:
```lms.auth.json
         cms.auth.json
    ora.auth.json
 xqueue.auth.json
 forum/forum_env
```
Step 9: In the edx servers you can stop the mysql and mongodb services. To prevent them to start when booting the system, create the text files /etc/init/mysql.override and /etc/init/mongodb.override with the string: 'manual' into them.

Step 10 : If you are using 'ubuntu 16.04' Then do following change sin file : sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
On mysql server >>> change : 'bind-address = 0.0.0.0'.
On web node server do the changes :'bind-address = IP address of mysql server' 

If you are using 'Ubuntu 12.04': Then do following change sin file : sudo nano /etc/mysql/my.cnf
On mysql server >>> change : 'bind-address = 0.0.0.0'.
On web node server do the changes :'bind-address = IP address of mysql server'

Step 11 : After MySQL changes Run following commands on MySQL server:
sudo systemctl restart mysql.service
sudo service mysql restart

Step 12: Login to MySQL DB to Grant all permission's by running following commands:
Login to MySQL :
MySQL -u root
[ GRANT ALL ON <local database name>.* TO <remote web node user name>@<remote web node server ip address> IDENTIFIED BY '<database user password>';]

GRANT ALL ON *.* TO dbuser@192.0.2.50 IDENTIFIED BY 'dbuserpassword';
FLUSH PRIVILEGES;

Step 13: Change Mongo-DB related changes in file: 'sudo nano /etc/mongodb.conf'
Change the follwing points:
bind_ip = 0.0.0.0
port = 27017

Steps 14: Lastly shutdown and disable MongoDB and MySQL on the local instance.

Steps 15: Test LMS CMS are accessible.

Reference Links:
1. https://github.com/edx/configuration/wiki/Preparation-For-Production-Launch
2. https://support.plesk.com/hc/en-us/articles/213904365-How-to-enable-remote-access-to-MySQL-database-server
3. http://devdocs.magento.com/guides/v2.0/install-gde/prereq/mysql_remote.html
4. https://help.ubuntu.com/16.04/serverguide/mysql.html

Popular posts from this blog

How to read or extract text data from passport using python utility.

Hi ,  Lets get start with some utility which can be really helpful in extracting the text data from passport documents which can be images, pdf.  So instead of jumping to code directly lets understand the MRZ, & how it works basically. MRZ Parser :                 A machine-readable passport (MRP) is a machine-readable travel document (MRTD) with the data on the identity page encoded in optical character recognition format Most travel passports worldwide are MRPs.  It can have 2 lines or 3 lines of machine-readable data. This method allows to process MRZ written in accordance with ICAO Document 9303 (endorsed by the International Organization for Standardization and the International Electrotechnical Commission as ISO/IEC 7501-1)). Some applications will need to be able to scan such data of someway, so one of the easiest methods is to recognize it from an image file. I 'll show you how to retrieve the MRZ information from a picture of a passport using the PassportE

How to generate class diagrams pictures in a Django/Open-edX project from console

A class diagram in the Unified Modeling Language ( UML ) is a type of static structure diagram that describes the structure of a system by showing the system’s classes, their attributes, operations (or methods), and the relationships among objects. https://github.com/django-extensions/django-extensions Step 1:   Install django extensions Command:  pip install django-extensions Step 2:  Add to installed apps INSTALLED_APPS = ( ... 'django_extensions' , ... ) Step 3:  Install diagrams generators You have to choose between two diagram generators: Graphviz or Dotplus before using the command or you will get: python manage.py graph_models -a -o myapp_models.png Note:  I prefer to use   pydotplus   as it easier to install than Graphviz and its dependencies so we use   pip install pydotplus . Command:  pip install pydotplus Step 4:  Generate diagrams Now we have everything installed and ready to generate diagrams using the comm

How to Remove course from Open-edX

Go to vagrant  => 1. In the edx-platform directory:  - cd /edx/app/edxapp/edx-platform 2. Run the following Django management command:   - sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp lms dump_course_ids --settings aws    - sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp lms dump_course_ids --settings=devstack 3. Find the course ID which you'd like to delete in the resulting list of course IDs. 4. Copy the course ID into the following command and run it:  - sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp cms delete_course <COURSE_ID> --settings aws  -   sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp cms delete_course <COURSE_ID> --settings=devstack  - You'll be asked to verify the deletion . To verify the deletion, run the command from step 2 above and ensure that the course ID is not in the list. Help reference : https://openedx.atlassian.net/wiki/spa