Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

Table of Contents

Managing the server

manage.py commands

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

  • list all manage.py commands
    sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings production help
  • create a final grade and generate a certificate for a single user
    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

  • create or upgrade a user to superuser

    • Execute the following commands (updating the username and email account appropriately)

      Code Block
      languagetext
      > sudo su edxapp -s /bin/bash
      > cd
      > /edx/bin/python.edxapp /edx/bin/manage.edxapp lms manage_user staff staff@example.com --staff --superuser --settings=production


    • See also Creating an admin user in LMS/CMS, which is written for devstack

  • set or change password 
    sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings production changepassword user
  • launch the django shell
     sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings production shell
  • importing a course from github

...

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 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)

  • Shutdown the lms and cms (and optionally the workers)

...

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

...

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

  • LMS - sudo /edx/bin/supervisorctl restart lms
  • CMS - sudo /edx/bin/supervisorctl restart cms
  • Workers - sudo /edx/bin/supervisorctl restart edxapp_worker:

(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.

...

  • sudo /edx/bin/update edx-platform master - change edx-platform to use the latest on the master branch
  • sudo /edx/bin/update cs_comments_service master - change the forums service to use the latest on the master branch

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

...

# 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

  • sudo rm -rf /edx/app/edxapp/edx-platform - to change the remote you need to remove the existing edx-platform checkout
  • Add the following line to /edx/app/edx_ansible/server-vars.yml - edx_platform_repo: "https://github.com/<user>/edx-platform.git"
  • sudo /edx/bin/update edx-platform master - update edx-platform using the forked repo

Compile assets manually

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

...

  • python manage.py cms --settings=production collectstatic --noinput
  • python manage.py lms --settings=production collectstatic --noinput

Generating dummy translations

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

  • sudo -H -u edxapp bash
  • source /edx/app/edxapp/edxapp_env
  • cd /edx/app/edxapp/edx-platform
  • paver i18n_dummy

Troubleshooting

Unable to connect to the LMS

Check to see if nginx is running:

...

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

Log files

  • The Full stack sends all application logs to rsyslog which writes config files to the/edx/var/log directory.
  • Supervisor logs stderr and stdout, its logs are located in /edx/var/log/supervisor

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:

...