Changes between Initial Version and Version 1 of MapGuideRfc160


Ignore:
Timestamp:
Jun 9, 2017, 6:36:12 AM (7 years ago)
Author:
jng
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MapGuideRfc160

    v1 v1  
     1
     2= !MapGuide RFC 160 - Enhanced command-line support =
     3
     4This page contains a change request (RFC) for the !MapGuide Open Source project.
     5More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page.
     6
     7
     8== Status ==
     9
     10||RFC Template Version||(1.0)||
     11||Submission Date||||
     12||Last Modified||||
     13||Author||Jackie Ng||
     14||RFC Status||draft||
     15||Implementation Status||Pending||
     16||Proposed Milestone||3.3||
     17||Assigned PSC guide(s)||(when determined)||
     18||'''Voting History'''||(vote date)||
     19||+1||||
     20||+0||||
     21||-0||||
     22||-1||||
     23||no vote|| ||
     24
     25== Overview ==
     26
     27This RFC proposes to add support in the mgserver executable with extra command-line capabilities to facilitiate automated/scripted setup and configuration.
     28
     29== Motivation ==
     30
     31MapGuide is very easy to install in a headless/automated manner, making the process of putting MapGuide inside a docker container or other automated provisioning/deployment processes quite simple.
     32
     33However, what is a bit difficult at the moment is to automate the process of configuring/provisioning MapGuide's resource repository and being able to set/change the passwords of built-in users
     34
     35Such functionality exists in the MapGuide API, but that requires the MapGuide Server to be actually running first.
     36
     37In an automated deployment/provisioning scenario, this presents an awkward chicken-and-egg problem where you can't do such actions without some coordination to have your setup code (that uses the MapGuide API) have to wait for the server tier to become online first before running the setup code.
     38
     39== Proposed Solution ==
     40
     41Enhance the command-line capabilities of mgserver to support:
     42
     43 * Loading a package file
     44 * Setting the Administrator password
     45
     46=== Package Loading ===
     47
     48Usage will be as follows:
     49
     50{{{mgserver loadpackage <path to package file>}}}
     51
     52In this mode, the MapGuide Server will initalize the required services (same way as unit testing), load the given package through MgResourceService.ApplyResourcePackage and exit
     53
     54=== Setting Password for built-in users ===
     55
     56Usage will be as follows:
     57
     58{{{mgserver setpwd <mapguide username> <administrator password>}}}
     59
     60In this mode, the MapGuide Server will set the account password of the specified built-in user to the value provided from the command line
     61
     62=== Command classes ===
     63
     64To make adding support for new commands in the future an easier task, this RFC also refactors the ServerCore code to use command classes. A new abstract {{{MgServerInteractiveCommand}}} is introduced to model a particular {{{mgserver}}} command.
     65
     66{{{
     67// The base class of all interactive commands
     68class MgServerInteractiveCommand
     69{
     70protected:
     71    MgServerInteractiveCommand();
     72
     73public:
     74    virtual ~MgServerInteractiveCommand();
     75
     76    virtual INT32 Execute() = 0;
     77};
     78}}}
     79
     80From this, this RFC adds the following subclasses:
     81
     82 * {{{MgTestCommand}}}: For {{{mgserver test}}}
     83 * {{{MgTestFdoCommand}}}: For {{{mgserver testfdo}}}
     84 * {{{MgLoadPackageCommand}}}: For {{{mgserver loadpackage}}}
     85 * {{{MgSetPwdCommand}}}: For {{{mgserver setpwd}}}
     86
     87In {{{MgServer::ParseArgs()}}}, we now set the appropriate command pointer and in {{{MgServer::svc()}}} we now check for a set command pointer, which if set we instruct it to {{{Execute()}}} and capture its return code. Otherwise we proceed with normal service (or interactive) startup
     88
     89== Implications ==
     90
     91The {{{setpwd}}} command does a blind {{{UpdateUser}}} call on {{{MgServerSiteService}}} (this API will throw if the user id does not exist). However, this will blank out the user name (not related to user id) and description properties of the user whose password is changed through this command. To preserve this information would require an {{{EnumerateUsers}}} call, manual parsing of the XML response to find the details of the matching user and calling {{{UpdateUser}}} with the preserved information and the new password.
     92
     93Due to this information not being essential (it is merely descriptors of the user accounts), it was decided for the simplicity of implementation that losing such information through this command was an acceptable trade-off.
     94
     95== Test Plan ==
     96
     97 * Verify new commands perform as expected
     98 * Verify we can still run unit tests through the refactored test command
     99 * Create a MapGuide docker image that auto-loads the Sheboygan dataset via {{{mgserver loadpackage}}} and changes the Administrator password via {{{mgserver setpwd}}}. Verify that when running the built docker container, that we can load the AJAX viewer with the Sheboygan Web Layout straight away (the sample data should've already been loaded) and login to the Site Administrator with the changed password.
     100
     101== Funding / Resources ==
     102
     103Community