NOTE: These are instructions for the Full Stack or Native configuration, not the Developer Stack.

Managing the server

manage.py commands

login to the server and change to the /edx/app/edxapp/edx-platform directory to use manage.py

Example using the demo course

  cd /var/tmp
  git clone https://github.com/edx/edx-demo-course.git
  cd /edx/app/edxapp/edx-platform
  sudo -u www-data /edx/bin/python.edxapp ./manage.py cms --settings=production import /edx/var/edxapp/data /var/tmp/edx-demo-course 


See help and help <cmd> for more information!

MySQL access

First install jq, then you should be able to just run this. Note that you lms.auth.json location may be different:

sudo apt-get install jq

sudo mysql $(jq -r '.DATABASES.default | "-u" + .USER + " -p\"" + .PASSWORD + "\" -h" + .HOST + " -P" + ( .PORT | tostring ) + " " + .NAME' /opt/openedx/lms.auth.json)

Use runserver instead of gunicorn (helpful for debugging)

sudo /edx/bin/supervisorctl
> stop edxapp: edxapp_worker:
cd /edx/app/edxapp/edx-platform
sudo -u www-data /edx/bin/python.edxapp ./manage.py lms runserver 8000 --settings production 

When you connect your browser requests will go to the debug server instead of gunicorn through nginx. You will still need to compile static assets of they change

See what services are running

sudo /edx/bin/supervisorctl status

you should see something like the following:

certs                            RUNNING    pid 19862, uptime 0:00:04
edxapp:cms                       RUNNING    pid 19884, uptime 0:00:03
edxapp:lms                       RUNNING    pid 19879, uptime 0:00:03
edxapp_worker:cms_default_4      RUNNING    pid 19915, uptime 0:00:03
edxapp_worker:cms_high_1         RUNNING    pid 19901, uptime 0:00:03
edxapp_worker:cms_low_3          RUNNING    pid 19890, uptime 0:00:03
edxapp_worker:lms_default_3      RUNNING    pid 19897, uptime 0:00:03
edxapp_worker:lms_high_4         RUNNING    pid 19922, uptime 0:00:03
edxapp_worker:lms_high_mem_2     RUNNING    pid 19894, uptime 0:00:03
edxapp_worker:lms_low_1          RUNNING    pid 19908, uptime 0:00:03
forum                            RUNNING    pid 19855, uptime 0:00:04
ora                              RUNNING    pid 19875, uptime 0:00:04
ora_celery                       RUNNING    pid 19866, uptime 0:00:04
xqueue                           RUNNING    pid 19853, uptime 0:00:04
xqueue_consumer                  RUNNING    pid 19860, uptime 0:00:04

Restarting Services

(Note: the colon character : at the end of the line is mandatory!)

Updating Versions using edX repos

Use the /edx/bin/update to update repo versions on the server.

Allowed repo names [edx-platform, xqueue, cs_comments_service, xserver, ease, edx-ora, configuration, read-only-certificate-code]

Examples:

Generate certificates after a course ends

Note: the honor@example.com and verified@example.com users have been pre-added to the certificate whitelist in the vagrant image so you can generate a certificate even if they have not passed the course

cert download

These are the django commands to generate certificates for an entire course or a single student. Note the --insecure flag which is so that http is used for the lms callback url. It is not necessary if https is supported on the lms.

# Generate or regenerate a certificate for a single user in a course

sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings production regenerate_user -u honor@example.com -c edX/Open_DemoX/edx_demo_course --insecure

# Grade and generate certs for all users in a course

sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings production ungenerated_certs -c edX/Open_DemoX/edx_demo_course --insecure

Using an edx-platform fork

Compile assets manually

To compile javascript and css outside of the update script run the following commands:

Suggest issuing the following to debug issues with r.js optimizer issues

Generating dummy translations

To generate dummy translation strings for i18n and right-to-left testing:

Troubleshooting

Unable to connect to the LMS

Check to see if nginx is running:

NGINX logs are located in /edx/var/log/nginx NGINX configurations are located in/edx/app/nginx/sites-enabled

Check to see if the lms/cms is running

If you are still unable to connect to the LMS run the following commands:

sudo /edx/bin/supervisorctl stop discern discern_celery \
  forum ora ora_celery xqueue xqueue_consumer xserver edxapp_worker:

While tailing the log files try to connect your browser to the LMS or Studio

Log files

server-vars.yml does not make any changes after running the update bash script

Take a look at this line in the /edx/bin/update bash script to see where the server-vars.yml file should be:

if [[ -f /edx/var/edx_ansible/server-vars.yml ]]; then
    extra_args="-e@/edx/var/edx_ansible/server-vars.yml"
fi
if [[ -f /edx/app/edx_ansible/server-vars.yml ]]; then
    extra_args="-e@/edx/app/edx_ansible/server-vars.yml"
fi