Package Importer

    Introduction

    With the anticipated arrival of DekiScript special pages and features like user dashboard and content curation reporting, many of our future mashup capabilities will reside with DekiScript pages (as opposed to PHP plugins). This arrival will require a story around updating the templates that are shipped inside MindTouch between updates. This work has not been possible until the import/export story was completed as well.

    Intended Audience

    This feature will be geared for administrators of a site who are responsible for keeping MindTouch up-to-date.

    Additional Information

    This serves as the first utilization of the import/export story outside of the Desktop Connector and will be the foundation for a more robust template discovery/install story.

    With the large number of functional templates that will be shipped with MindTouch, it becomes imperative that we do our best to keep "default" templates out-of-the-way so site-specific templates can easily be discovered from the template dialog. If it becomes possible, we should try to ship all MindTouch-backed templates into Template:MindTouch/* with the default permissions set to Semi-Public.

    (Are there any implications to this?)

    Status

    Initial scoping by RoyK. To be a part of the Olympic release.

    Functional Specification

    This specification will change over time, as our delivery mechanisms may evolve towards something more advanced and automatic. In this first iteration, it will be necessary to have a consistent story that works reliably in updating.

    Use Cases

    Administrator updates MindTouch functional templates through a UI

    The systems administrator will install/upgrade MindTouch in the same method that they've used in the past. Upon successful update, a flag is set within the system that allows the API/UI to know that while the server code has been updated, the MindTouch functional templates have not been updated yet. (Unrelated thought: If we set a site-wide flag, would it be possible to set user-level flags that would pop-them up with a message about "Here's what's new in MindTouch 2010?")

    Administrators will get a warning message indicating they must update their MindTouch functional templates or not everything will function correctly. The message will link to a control panel page, where the user can update their MindTouch functional templates. (Any views that utilize MindTouch templates should stamp with a version.)

    From the control panel view, the administrator will see a list of all the functional templates that will be updated and if they will be adding, removing, or replacing existing functional templates. Upon clicking "Update my templates", the local .war file (which will be pushed as a part of the package) will then be pushed to the import feature in the API. (The operation will be a replace all or none feature).

    Once the import is successfully completed, the warning messages will disappear.

    MT releases a new prepackaged solution framework

    To create a new packaged solution, it'd be possible to create a new .mtarc file which would supplement the default .mtarc file; these would be loaded in sequence to allow for overwriting of default templates.

    System automatically updates MindTouch functional templates

    Another approach to the update of these MindTouch templates would be to try to automate the update upon service startup. A checksum/date of the last known updated .war file could be stored in the site properties, and this information could be used to trigger an automatic import of files. The downsides to this approach are that changes would be blown out without warning, and systems being restarted in distress would fall under additional stress in the case that many files must be updated.

    This approach would not lend itself to extending this functionality for users to discover other functional templates in the MindTouch ecosystem and installing them through a simple CP interface.

    Update functional templates without restarting the host

    The administrator can also go to the MindTouch control panel and refresh the whole template list.

    Non-goals

    • This feature will not attempt to "preserve" custom changes made to MindTouch functional templates. Executing this feature will cause an overwrite of existing pages. Users may always revert or attempt to do a manual merge of these on their own.
      • With the addition of DekiScript special pages, it'll be possible to point Special: URL endpoints to any templates - users could easily modify the existing templates (by copying them) to new endpoints. This would alleviate the content overwriting story.
    • This iteration will rely on local files being pushed to the install as opposed to auto-discovering the templates from a centralized remote location, which would allow updates to be pushed independent of releases.

    Technical Specification

    Not all of these need to be solved in the first iteration

    • Be able to specify a custom path that the updater willl look for .mtarc files (for services - deploying across multiple production instances)
      • Could this be a URL as well? (Definitely not v1)
    • Hierarchical storage:
      • Everything under Template:MindTouch/*
        • Types: Functions, dashboard views (discoverable), default content
        • Should this be "protected" with a message on the UI?
        • Should the feature attempt to wipe this hierarchy upon every import? (Would allow us deal with Core/Commercial code laying around)

    Proposal for v1

    Required Capability: Optionally only overwrite a page if the current content was previously imported and is newer

    Assumption: Page was packaged with an exporter suportting this capability

    Import Workflow:

    • Import lib sends manfest to import feature
      • manifest includes per page checksum and last-modified timestamp
    • Import feature builds import doc
      • for each page
        • if page has date-modified, include as 'importtime' query arg
        • if the page already exists
          • if there is a last import property
            • if 'preserve-local' is true
              • if the page hasn't changed or is locally modified, skip import
            • if the previous import is newer, skip import
          • no last import property, skip import if 'preserve-local' is true
    • Post Page contents
      • Calculates etag of incoming content, saves along with page
      • if 'importtime' query param exists, create/update 'last_import' property

    Mismatched importer tool/feature:

    • New import tool, old feature
      • Will always clobber, since new meta-data in import manifest is unknown
    • Old import tool, new feature
      • Will work as intended, since all new information is part of the import manifest
    API Changes
    • Export
      • Add date.modified and etag to page manifest items
        • If page was previously imported and has not been modified use the 'last_import' date.modified instead of page date.modified
    • Import
      • building import doc checks for 'last_import' page level property
        • checks current version against last import, omits item if no match
        • checks item date.modified to make sure it's newer, otherwise omits item
    • Page
      • Add etag to page and calculate it on saving as md5sum of content
      • Create property 'last_import' property with etag and date.modified from 'import.date.modified' query param
    • mindtouch import lib changes:
      • Add command line option for export to create "overwrite=false" (i.e. non-clobbering) packages
      • .mtarc - don't clobber by default ?
      • .mtapp - do clobber by default ?
    • updater service
      • multi-tenant aware
      • gets tickled by tenant instance startup
        • checks for packages on disk
        • checks instance for site properties to see if the package has been installed and what version
          • ignore unchanged package version
        • import all packages not yet imported or newer
      • allow this importer process to be tickled by hand
        • if a package should be re-imported, simply delete it's site property and tickle updater

    UI requirements

    When forcing a tickle to re-import the packaged files, the UI will clear out the property from site settings and then tickle the service.

    API requirements

    POST:@api/deki/packageupdater/update

    This feature will trigger the updater service to scan for packages in its template folder and import new packages into the instance.

    Request Document:

    <update wikiid="{wikiid}">
      <uri>{apiuri}</uri>
    </update>

    A list of installed packages can be obtained by finding all site properties of the form mindtouch.packageupdater.imported#{packagename}, where {packagename} refers to the package on disk. To force a package to re-import, delete the appropriate site property.

    The import will be performed as the user specified in the config key 'packageupdater/username' or fallback to 'admin' or 'sysop' if no configuration value is found.

    Tag page
    Viewing 4 of 4 comments: view all
    @neilw - Hey Update Templates on next release by platform!!!
    @royk - Neilw pointed about template updates on his TemplateDoc proposal: http://developer.mindtouch.com/User:neilw/Template_Self-Documentation_Project/TemplateDoc%3a_automatically_generate_basic_template_documentation
    Posted 03:48, 17 Mar 2010
    i wouldn't get horribly excited about this - this will just be the first mechanism for pushing mindtouch-backed templates for installs/updates. the first iteration won't be significant for the community in simplifying the template delivery story (we don't want to deal with the remote access story yet, and keep everything local), but we will be evolving this feature to address those use cases over time. baby steps :) edited 16:30, 18 Mar 2010
    Posted 16:29, 18 Mar 2010
    quick notes:
    * permissioning of pages (how is it going to work?) (maybe the feature endpoint does additional logic around permissioning)
    * custom config key for going through .arc files
    * per instance start-up

    * pre-flight page-level checks (UI prompt)
    Posted 16:29, 6 Apr 2010
    @arnec should be "sysop" not "sysadmin"
    Posted 17:27, 27 Apr 2010
    Viewing 4 of 4 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by