edx-platform - A first look at paver in Open edX

Yesterday, I noted that the edx team has moved the edx-platform build system away from rake and use paver instead:

https://groups.google.com/d/msg/edx-code/0duQswYtjqg/A6HOFR_npjcJ

And when I was trying to create a script to update my custom theme from the git repo, I got some feedback and advice to use the paver tool of edx-platform instead for the sake of simplicity :

https://groups.google.com/d/msg/edx-code/ozqkmW3ll10/dsr4TbG3fAUJ

So, I took a while to look into the /edx-platfrom/paverlib/ to see how to use paver, what are the available options of paver in Open edX? Here they are:

edxapp@demo:/edx/app/edxapp/edx-platform$ paver help
---> paver.tasks.help
Usage: paver [global options] taskname [task options] [taskname [taskoptions]]

Options:
  --version             show program's version number and exit
  -n, --dry-run         don't actually do anything
  -v, --verbose         display all logging output
  -q, --quiet           display only errors
  -i, --interactive     enable prompting
  -f FILE, --file=FILE  read tasks from FILE [pavement.py]
  -h, --help            display this help information
  --propagate-traceback
                        propagate traceback, do not hide it under
                        BuildFailure(for debugging)

Tasks from paver.misctasks:
  paverdocs       - Open your web browser and display Paver's documentation.
                                                                                                                                                        
Tasks from paver.tasks:
  help            - This help display.

Tasks from pavelib.servers:
  devstack        - Start the devstack lms or studio server

Tasks from pavelib.assets:
  watch_assets    - Watch for changes to asset files, and regenerate js/css

Tasks from pavelib.servers:
  celery          - Runs Celery workers
  check_settings  - Checks settings files

Tasks from pavelib.assets:
  update_assets   - Compile CoffeeScript and Sass, then collect static assets

Tasks from pavelib.servers:
  lms             - Run the LMS server

Tasks from paver.misctasks:
  generate_setup  - Generates a setup.py file that uses paver behind the scenes

Tasks from pavelib.servers:
  update_db       - Runs syncdb and then migrate

Tasks from pavelib.prereqs:
  install_prereqs - Installs Ruby, Node and Python prerequisites

Tasks from paver.misctasks:
  minilib         - Create a Paver mini library that contains enough for a simple
    pavement.py to be installed using a generated setup.py

Tasks from pavelib.servers:
  run_all_servers - Runs Celery workers, Studio, and LMS
  studio          - Run the Studio server

Tasks from pavelib.docs:
  build_docs      - Invoke sphinx 'make build' to generate docs

For example, to compile the assets (theme):

paver update_assets lms --settings=aws

I also tried to add an option to pavelib/assets.py update_assets to allow me to pull theme from the git repo:

+ https://github.com/dangtrinh/edx-platform/commit/ab8b315bc304478d76bef7f5c764f7986bd80444
https://github.com/dangtrinh/edx-platform/commit/650fbcdbe5ff9a49da66bc885a12479d9694683f

paver update_assets lms --settings=aws --pull-repo

The above command will pull the theme from master branch of the git repo, and then doing the assets compiling.


References:

[0] https://github.com/edx/edx-platform/tree/master/pavelib
[1] https://github.com/edx/edx-platform/blob/master/pavelib/assets.py
[2] https://github.com/edx/edx-platform/blob/master/pavelib/servers.py
[3] https://github.com/edx/edx-platform/blob/master/pavelib/prereqs.py


Comments

  1. Hi Trinh, i want to change the default theme of open edx and replace it with the stanford theme but i failed.
    first i go to :
    1- cd /edx/app/edx_ansible
    2- sudo nano server-vars.yml
    3- copy paste
    edxapp_use_custom_theme: true
    edxapp_theme_name: 'stanford'
    edxapp_theme_source_repo: 'https://github.com/Stanford-Online/edx-theme.git'
    edxapp_theme_version: 'HEAD'
    4- run sudo /edx/bin/update edx-platform master
    5- i get these failure

    Captured Task Output:
    ---------------------

    ---> pavelib.assets.update_assets
    ---> pavelib.prereqs.install_ruby_prereqs
    ---> pavelib.prereqs.install_node_prereqs
    python manage.py cms --settings=aws preprocess_assets
    xmodule_assets common/static/xmodule
    ---> pavelib.assets.compile_coffeescript
    node_modules/.bin/coffee --compile `find /edx/app/edxapp/themes/stanford /edx/app/edxapp/edx-platform/lms /edx/app/edxapp/edx-platform/cms /edx/app/edxapp/edx-platform/common -type f -name "*.coffee"`
    sass --style compressed --cache-location /tmp/sass-cache --load-path ./common/static/sass /edx/app/edxapp/themes/stanford/static/sass --update -E utf-8 */static /edx/app/edxapp/themes/stanford/static/sass

    Build failed running pavelib.assets.update_assets: Subprocess return code: 1

    FATAL: all hosts have already failed -- aborting

    PLAY RECAP ********************************************************************
    to retry, use: --limit @/home/ubuntu/edxapp.retry

    localhost : ok=46 changed=16 unreachable=0 failed=1


    Please any help here, just for note i using AWS EC2 and public ip is 52.11.29.37

    Thanks for your response a soon as possible

    ReplyDelete

Post a Comment