How to Install and Start the E-Commerce Service in Native Installations
The following are instructions on how to bring up Otto e-commerce service alongside Native installations. Although the readthedocs information has instructions on how to install the e-commerce service, that is tailored for devstack installations.
Step-by-step guide
Assumptions:
You are installing this on an AWS instance of Ubuntu 16.04, 64-bit
You have at least 30GB of space assigned to the root drive
You are installing the master branch of edx and not a named release. For named release related installation instructions, refer to the Native Open edX Ubuntu 12.04 64 bit installation Installation.
These instructions are as current as of the Ginkgo.2 platform release
Preconfiguration of the server
Update and install system dependenciessudo 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 virtualenvClone the edx configuration repository and install edX and e-commerce
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.ymlInside 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 production create_user -s -p edx -e user@example.com sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings production changepassword user sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings production 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 explicit user.
Configure edX
Edit /edx/app/edxapp/lms.env.json (replacing <server> with the IP address or URL of your server)
Change flag FEATURES['ENABLE_OAUTH2_PROVIDER'] to true
Change flag OAUTH_ENFORCE_SECURE to false if not using SSL; also change https to http for the remaining items.
Change flag JWT_ISSUER to "https://<server>:80/oauth2"
Change JWT_AUTH [ JWT_ISSUER ] to "https://<server>:80/oauth2"
sudo /edx/bin/supervisorctl restart edxapp:Create and register the client with OIDC/OAUTH
Browse to <server>/admin/oauth2/client/1/ and log into the Django administration panel using the superuser username and password created earlier
User: select the user we created earlier
URL is http://<server>:18130/
Redirect Url is https://<server>:18130/complete/edx-oidc/ (change to http is not using SSL)
Client type is Confidential (Web applications)
Logout URI: http://<server>:18130/logout/
Note or change the Client ID and Client Secret. You will need this for the site configuration
Browse to <server>/admin/edx_oauth2_provider
Add trusted client
From the drop-down menu, select the redirect URL you just entered
Instruct the LMS to use Otto e-commerce (the one we're setting up)
Browse to <server>/admin/commerce/commerceconfiguration and log into the Django administration panel using the superuser username and password created earlier
Click the Add commerce configuration button in the upper right-hand corner
In the Add commerce configuration screen, check the boxes for Enabled and Checkout on e-commerce service. Then click the save button in the lower right-hand corner.
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.
Edit /edx/etc/ecommerce.yml (replacing <server> with your server's IP or url)
Change COMMERCE_API_URL to http://<server>:80/api/commerce/v1/
Change COURSE_CATALOG_API_URL to http://<server>:8008/api/v1/
Change ENROLLMENT_API_URL to http://<server>:80/api/enrollment/v1/enrollment
Change JWT_AUTH / JWT_ISSUERS (preserving the ecommerce_worker entry) to http://<server>:80/oauth2
Change SOCIAL_AUTH_EDX_OIDC_LOGOUT_URL to http://<server>:80/logout
Change SOCIAL_AUTH_EDX_OIDC_URL_ROOT to http://<server>:80/oauth2
If you do not have SSL set up, edit /edx/app/ecommerce/ecommerce/ecommerce/settings/production.py
Payment Processor configuration - PayPal
Restart e-commerce and edxapp processes
sudo /edx/bin/supervisorctl restart edxapp: ecommerce: