On Fri, May 26, 2017 at 10:25 PM, Shane Curcuru <a...@shanecurcuru.org> wrote:
> Optimization exercise: how would we turn the output of tools/wwwdocs.rb
> get_annotated_scan(...) into a nightly generated
> /public/whimsy-tools.json?  Side effect: learning more about whimsy
> architecture.
>
> * Inputs (all public files):
> - /www/**/*.cgi where line =~ ... PAGETITLE = ...
> -
> whimsy-vm4.apache.org.yaml['vhosts_whimsy::vhosts::vhosts']['whimsy-vm-443']['authldap']
>
> * Output (which would be sucked in by /www/committers/tools.cgi):
> - /www/public/whimsy-tools.json

Answer to the question asked: you want a cron job.  Cron jobs are
managed by puppet.  The file that controls this is here:

https://github.com/apache/infrastructure-puppet/blob/deployment/modules/whimsy_server/manifests/cronjobs.pp

Be sure to read the infra workflow information here before proceeding:

https://github.com/apache/whimsy/blob/master/DEPLOYMENT.md#production-configuration

---

While the above is the answer to the question asked, a better answer
would be to add a call to run wwwdocs.rb to the :update task in the
Rakefile:

https://github.com/apache/whimsy/blob/master/Rakefile#L8

The update task is run any time new code is deployed.

---

> * Questions:
>
> - Why are the scripts that generate /public inside /www/roster, instead
> of being in /tools?  Mere history, or a specific reason?

The initial set of tools were roster related.  If you want to move
them, be sure to update the relevant cronjobs.

> - Does one *need* an ASF::module to wrap the data model, or can the
> existing generation code in wwwdocs.rb just be used as-is, wrapped in
> sufficient calls to public_json_common.rb to handle the 'write file only
> if json data changed' bits?

Either cronjobs or rake tasks can invoke the tool as is.

> - Better suggestions to do this?  I know writing the .json to /public
> maybe premature optimization, but I'm also thinking there might be other
> uses of this data as well, meaning having a URL with the data is useful.

Cool.  It is also useful for debugging (much like the scavenge/analyze
split in the site tool).

> --
>
> - Shane
>   https://www.apache.org/foundation/marks/resources

- Sam Ruby

Reply via email to