The following is instructions for how to bring up Otto ecommerce service alongside Native installations. Although the readthedocs information has instructions for how to install the ecommerce service, that is tailored for devstack installations.
This is a work in progress. It currently covers up to the configuration of the payment processors, however PayPal is not receiving a proper return URL. The page that is supposed to follow after the payment through PayPal is to complete the enrollment within edX. Please remove this notice when information for that is updated. There is also PR #3313 that adds an automated SSL certificate installation which should help both make these instructions smoother, as well as provide a greater level of security during the payment processing steps. The instructions are currently being developed on a server without SSL. Testing of this with SSL still needs to be confirmed. |
Assumptions:
You have at least 30GB of space assigned to the root drive
Preconfiguration of the server
Update and install system dependencies
sudo apt-get update -y sudo apt-get install -y build-essential software-properties-common python-software-properties curl git-core libxml2-dev libxslt1-dev libfreetype6-dev python-pip python-apt python-dev libxmlsec1-dev swig libmysqlclient-dev sudo pip install --upgrade pip sudo pip install --upgrade virtualenv |
Clone the edx configuration repository and install edX and ecommerce
cd /var/tmp git clone https://github.com/edx/configuration cd /var/tmp/configuration sudo pip install -r requirements.txt sudo pip install setuptools --upgrade cd /var/tmp/configuration/playbooks nano -w edx_sandbox.yml |
Inside the edx_sandbox.yml file, change the SANDBOX_ENABLE_ECOMMERCE flag from False to True.
sudo ansible-playbook -c local edx_sandbox.yml -i "localhost," |
Create a superuser account
cd /edx/app/edxapp/edx-platform sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings aws create_user -s -p edx -e user@example.com sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings aws changepassword user sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings aws shell from django.contrib.auth.models import User me = User.objects.get(username="user") me.is_superuser = True me.is_staff = True me.save() exit() |
NOTE: The username for this account will be the first half of the email address provided in line 2 (the user part). As such, user in lines 2, 3, and 7 should all be identical. In line 6, User is to be entered exactly as listed as that's referencing a django model and not an explit user.
Configure edX
Edit /edx/app/edxapp/lms.env.json (replacing <server> with the ip address or url of your server)
sudo /edx/bin/supervisorctl restart edxapp: |
sudo su ecommerce -s /bin/bash cd ~/ecommerce source ../ecommerce_env python manage.py makemigrations python manage.py migrate python manage.py create_or_update_site --site-id=1 --site-domain=<server:18130 or url> --partner-code=edX --partner-name='Open edX' --lms-url-root=http://<server or url> --payment-processors=cybersource,paypal --client-id=<change to OIDC client ID> --client-secret=<change to OIDC client secret> --from-email=user@example.com --discovery_api_url=http://<discovery url> |
change payment-processors to the name of the processor(s) you are using.
For site-domain it is important to not include the http:// or https:// |
Edit /edx/etc/ecommerce.yml (replacing <server> with your server's IP or url)
If you do not have SSL set up, edit /edx/app/ecommerce/ecommerce/ecommerce/settings/production.py
Just after the from ecommerce.settings.logger import get_logger_config line, add the following
Besides for creating http instead of https in the build_ecommerce_url function, what else does setting the DEBUG flag to True do? |
Payment Processor configuration - PayPal
You will need to add a REST API application to your PayPal account. More information on how to do this can be found at the PayPal Developer Documentation site. You will need the API Credentials to fill in the appropriate sections below. |
Restart ecommerce and edxapp processes
sudo /edx/bin/supervisorctl restart edxapp: ecommerce: |
If you're working with other Open edX repositories instead of the official one, please check when was the last commit. If the last commit of your Open edX repository is behind the e-commerce repository (e.g. 2 months), there is a chance that this tutorial will not work. If that's the case, you can fix it by do as following:
0. Go to Mysql and drop the e-commerce database (if you haven't done the database migration, skip this)
1. Go the the ecommerce directory:
cd /edx/app/ecommerce
2. Delete the default ecommerce source code directory:
rm -rf ecommerce
3. Clone again the repo:
git clone https://github.com/edx/ecommerce.git
4. Go inside the repo:
cd ecommerce
(at this point, you're at the latest commit of master)
5. Checkout the desired commit (the one that was committed around the same time with your Open EdX's last commit):
git checkout <a commit hash>
6. Then run the migration
|