Update the custom theme independently

264 views
Skip to first unread message

Trinh Nguyen

unread,
May 19, 2014, 9:05:08 PM5/19/14
to edx-...@googlegroups.com
Hi,

To help our front-end designer I just created a PR to the configuration repo to add a bash script called update_theme. You can use it to reload your custom theme with changes from a git repo without updating a whole stack (using /edx/bin/update).


As feanil suggested in the comment, a better solution would be to add a new option to the update script. But, I just want to avoid adding more params to the update script and to make the task as simple as possible.

All comment and feedback are welcome!

Yarko Tymciurak

unread,
May 19, 2014, 11:22:03 PM5/19/14
to edx-...@googlegroups.com
Having been in on the bringup efforts last June, where everything was a script - I agree with Feanil, this is not a good idea.

For one thing, if you need to just update a theme, you have little more to do than you would to run your script:

As edxapp user (environment & shell all setup, as per any maintenance task on fullstack, as per

all you need to is:

git -C ../themes/out_theme  pull
paver update_assets lms --settings=aws

and / or if you want:

paver update_assets cms --settings=aws


If anything, for convenience (and there's some point to it), updating  edx-platform/paverlib/assets::update_assets  would be the way to do this (not a shell script, and not ansible).

Here's what I suggest:

- do this manually for now (it's simply too easy w/ paver / rake / whatever-may-come-next);

- wait for others to chime in (I suspect there will be more theme usage);

If people agree, then the way I suggest is add a "--update_theme" flag to "paver update_assets", and conditioned on that being set, referring to the appropriate env file:  /edx/app/edxapp/{lms,cms}.env.json:
  • if edxapp_use_custom_theme is true, then:
    • run: "git -C ../themes" / edxapp_theme_name + " pull" before the other asset commands
This is simple enough, consistent enough, and presupposes a naturally useful constraint:

  • You have already at least once done an "update" which included your desired theme repo & version/branch pull
If you want to change the branch or repo, then - in order to ensure other commands reading lms.env.json are consistent,
the prerequisite is to (in those cases) would be do to another update.



Yarko Tymciurak

unread,
May 19, 2014, 11:43:00 PM5/19/14
to edx-...@googlegroups.com
BTW - you don't need options in the update script - the theme is already picked up (and should be initially picked up so that ansible can appropriately set all the {lms, cms}.env.json  variables, which other commands (such as the update_assets)  look at and need.   This is already set (currently) in your edit of server-vars.yml, update does what its needed to do already.

what you want is a superset of "update_assets", which includes updating (an already used) theme from a repo.

I do think that the paver command is the natural place to put this.

Yarko Tymciurak

unread,
May 20, 2014, 12:08:09 AM5/20/14
to edx-...@googlegroups.com
to put it another way - 

since themes are a part of edx-platform, ansible-playbooks need to process the edx-platform roles and playbooks to generate a consistent {lms,cms}.env.json anyway, so there is no benefit to having a separate "update just the theme repo" command, I think.

In any case, if you did try to do it that way, you would add a lot of complexity (unnecessarily) to either [a] just have it be syntactic sugar for an edx-platform update, or [b]  you'd have to write parallel playbooks/roles to process all the needed variable for lms.env.json, without actually updating the repositories (if that is what you mean to do).

If it's simpler you want - that wouldn't be.
If it's faster you want - that also wouldn't be.

This is what points to updating / adding an option to paver command as the right "kind" of place to put this (if you really want it - I still think a git pull, and a paver update_assets is simple enough).

Trinh Nguyen

unread,
May 20, 2014, 12:19:43 AM5/20/14
to edx-...@googlegroups.com
Thank Yarko for your comments and suggestions!

I haven't catch up with the paver kind-of-thing since I'm still using the old version of configuration. So, I guess this is the right time to look at it.

Yarko Tymciurak

unread,
May 20, 2014, 12:26:16 AM5/20/14
to edx-...@googlegroups.com
paver is in edx-platform, not edx/configuration

Yarko Tymciurak

unread,
May 20, 2014, 12:27:56 AM5/20/14
to edx-...@googlegroups.com
Still - I don't think it's worth the bother with paver (and I certainly would not add a shell script to the repo):

It's simply 2 commands to run (all you save with any tool / paver / shell extension is _one command line!!!_

Just run those two commands manually.

git pull
paver assets_update

That's easy enough.

No need to do anything to the repo for that.

Trinh Nguyen

unread,
May 20, 2014, 12:35:32 AM5/20/14
to edx-...@googlegroups.com
Wow, It's pretty simple!

BTW, Just noted that the document about compiling assets manually has been changed recently (use paver instead of rake).

Trinh Nguyen

unread,
May 20, 2014, 3:00:39 AM5/20/14
to edx-...@googlegroups.com
There is one more thing, Is there any documentation showing how to use paver in Open edX?


On Tue, May 20, 2014 at 11:35 AM, Trinh Nguyen <dangt...@gmail.com> wrote:
Wow, It's pretty simple!

BTW, Just noted that the document about compiling assets manually has been changed recently (use paver instead of rake).



Yarko Tymciurak

unread,
May 20, 2014, 3:03:44 AM5/20/14
to edx-...@googlegroups.com
RE:  compiling assets;  it didn't matter - the rake command has been running paver for a while.   It just looks like they've finally deprecated the rake command.

RE:  documentation:   http://paver.github.io/paver/cmdline.html   should help,  e.g.  "paver help"

Trinh Nguyen

unread,
May 20, 2014, 7:30:28 PM5/20/14
to edx-...@googlegroups.com
I meant what are the options of paver in Open edX, something like:

paver update_assets ...
or
paver watch_assets ...


So, I think the best way to get started is to look into the paverlib/assets.py


Yarko Tymciurak

unread,
May 20, 2014, 8:49:22 PM5/20/14
to edx-...@googlegroups.com

Well, but like rake also - its more than the assets file, and is meant to be self I documenting.

paver help

Will give hi level list

paver some_cmd -h

Will give synopsis & options for that.

Trinh Nguyen

unread,
May 20, 2014, 9:05:15 PM5/20/14
to edx-...@googlegroups.com
Got it. Thanks Yarko!

Trinh Nguyen

unread,
May 21, 2014, 4:18:51 AM5/21/14
to edx-...@googlegroups.com
I just added an option to pull the custom theme repo into the update_assets:


So I can pull updates from my custom theme repo and compile assets with:

paver update_assets pull-repo lms --settings=aws

What do you think?

Trinh Nguyen

unread,
May 21, 2014, 4:48:21 AM5/21/14
to edx-...@googlegroups.com
Sorry, use this instead (confused with order of the system argument. e.g: lms/studio):

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

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

Yarko Tymciurak

unread,
May 21, 2014, 11:07:54 AM5/21/14
to edx-...@googlegroups.com

Thanks Trinh -

I'll look at in more detail, comment in the PR in a little while.

Regards,
- Yarko

Yarko Tymciurak

unread,
May 21, 2014, 2:18:48 PM5/21/14
to edx-...@googlegroups.com


On Wednesday, May 21, 2014 3:48:21 AM UTC-5, Trinh Nguyen wrote:
Sorry, use this instead (confused with order of the system argument. e.g: lms/studio):

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

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

Thanks Trinh -

I've made some comments on your code change in github.

I've suggested renaming the option to "--update-theme";  I think that might be clearer, and is more consistent with its link to the update command (which should be called at least once, first).   There are a few other logic comments on your code in the repo. 

Trinh Nguyen

unread,
May 21, 2014, 7:04:11 PM5/21/14
to edx-...@googlegroups.com
Thanks Yarko! Just getting started. Your suggestions will help me a lot!

Trinh Nguyen

unread,
May 21, 2014, 8:22:39 PM5/21/14
to edx-...@googlegroups.com
I made some changes based on your advice: ee5362e


On Thu, May 22, 2014 at 6:04 AM, Trinh Nguyen <dangt...@gmail.com> wrote:
Thanks Yarko! Just getting started. Your suggestions will help me a lot!



Reply all
Reply to author
Forward
0 new messages