Model Management Server Import Utility
Table of Contents
Overview
The TIBCO Streaming Model Management Server (MMS) Import Utility is used for importing assets from the Artifact Management Server (AMS) into the MMS. The features of this utility are:
- Import all projects along with their history.
- Import all eligible deployment descriptors.
- Import all users and roles into a file.
Note
- Only APPROVED commits are imported.
- It is preferred that users should do an initial migration from AMS to MMS for testing purposes. If satisfied, they can proceed with the final migration.
- OIDC is not supported for the AMS side of the migration. The workaround is to add a local authentication realm in the AMS config to enable an admin with basic authentication to perform the migration.
Import Modes
A single AMS project can have artifacts that can be deployed to multiple targets whereas MMS allows only a single deployment target per project. To accommodate this change, the import utility supports two import modes as given below:
Import by Projects
This mode follows the AMS project organization. All the AMS artifacts are imported in a single MMS project (primary project
). The MMS Import Utility attempts to determine a primary deployment target from all the AMS deployment descriptors and update the primary project to deploy to that target. The utility supports three primary deployment target decision policies as given below:
by-count
: selects the most commonly used target.by-modified-date
: selects the most recently updated target.ignore
: ignores all deployment targets.
If the target deployment descriptor contains multiple targets, then there is no guarantee which one of them is selected as the primary target. The utility designates all the non-primary deployment targets as secondary targets and supports two secondary deployment target creation policies as given below:
dependents
: creates a project per secondary target which depends on the primary project.ignore
: ignores all the secondary targets.
As each descriptor contains multiple targets, the MMS Import Utility breaks down all AMS deployment descriptors into individual targets. As a result, in this mode all artifacts are in the primary project. The N secondary project(s) will contain only a deployment descriptor for each additional deployment target. All the secondary project(s) will depend on the primary project.
Import by Deployments
This mode is similar to the AMS deployment. All the AMS artifacts are imported into specific MMS projects targeting their deployment. The utility still creates a project (primary project) that contains all the non-deployable artifacts and the deployable artifacts of the first encountered target. All the subsequent targets are mapped to different projects that depend on the primary project.
This mode results in artifacts distributed across multiple projects based on where they are being deployed. Also, the AMS commit can cause the artifact to move between projects.
Limitations
The MMS Import Utility has the following limitations:
- Before the import, all Subversion & GIT projects should be in sync with the external repositories without any conflicts.
- All the resources are imported under a single user. MMS does not maintain committer and approver details as AMS. The committer and resolver details are stored in the attributes against the fields
ams.committer.name
andams.resolver.name
respectively. - MMS does not support metadata and as a result no metadata from AMS artifacts is imported.
Supported Platforms
For more information on the platforms supported by the MMS Import Utility, see Supported Platforms.
Command Line Options
The MMS Import Utility supports the following common options across all commands:
-h, --help
- Shows help message-V, --version
- Shows version information
The MMS Import Utility supports the following ‘import commands’:
- Common options for all ‘import commands’
-l, --ams-url
- The API base URL for AMS (required)-u, --ams-user
- The username to connect to AMS-p, --ams-password
- The password to connect to AMS. The password can be read from stdin-t, --ams-token
- The token to connect to AMS-f, --ams-project-filter
- The filter to use to choose AMS projects to import (optional, If not specified all AMS projects are imported)-L, --url
- The API base URL for MMS (required)-U, --user
- The username to connect to MMS-P, --password
- The password to connect to MMS. The password can be read from stdin-T, --token
- The token to connect to MMS-s, --space-name
- The name of the space in which to import all projects (optional if MMS has a single accessible and update-able space)-g, --group-identifier
- The group identifier to use for all imported AMS projects (required)-i, --artifact-identifier-prefix
- An optional prefix to use for non-compliant artifactId (generated from the project name) (optional, defaults toams-
)-d, --default-streaming-cluster
- The name of the default MMS streaming cluster (optional if MMS has discovered a single streaming cluster)--dry-run
- A flag to trigger a dry run (optional, defaults tofalse
)-M, --deployment-mapping
- The file that contains the mapping AMS deployment descriptors to MMS streaming clusters (optional if MMS has discovered a single streaming cluster)-R, --report-file-path
- The file to write the import report to (optional defaults to import-<timestamp>.txt in current working directory)-W, --password-file-path
- The file to write the exported passwords to (optional defaults to passwords-<timestamp>.txt in current working directory)-B, --permission-bindings-file-path
- The file to write the exported permission bindings to (optional defaults to permission-bindings-<timestamp>.txt in current working directory)-c, --retain-commits
- The number of latest commits to retain during import (required)-1
to import and retain all commits0
to import but squash all commitsn
where n is a positive number indicating the number of commits to retain
-v, --verbose
- Decides the verbosity of the import logs1
- set logging toDEBUG
level2
- set logging toTRACE
level
-o, --timeout-seconds
- Sets the timeout in seconds for checkpoint creation, publishing operations
- Import Commands
import-by-projects
- Triggers ‘Import by Projects’ mode and supports the following options-D, --primary-target-decision-policy
- An optional policy to decide how the primary deployment target is chosen (optional, defaults toby-count
)- by-count - Chooses the most commonly used target
- by-modified-date - Chooses the most recently updated target
- ignore - Ignores targets completely
-S, --secondary-target-creation-policy
- An optional policy to decide how the secondary deployment targets will be processed (optional, defaults toignore
)- dependents - Create a project per target dependent on the primary imported project
- ignore - Ignores all targets
import-by-deployments
- Triggers ‘Import by Deployments’ mode
- Browse Commands
browse-mms
- Browses MMS and prints succinct information of the artifacts as a tree to the console.-L, --url
- The API base URL for MMS (required)-U, --user
- The username to connect to MMS-P, --password
- The password to connect to MMS. The password can be read from stdin-T, --token
- The token to connect to MMS-F, --content-filter
- A multi value option of artifact names/regexs whose contents should be printed to the console.
browse-ams
- Browses AMS and prints succinct information of the artifacts as a tree to the console.-l, --ams-url
- The API base URL for AMS (required)-u, --ams-user
- The username to connect to AMS-p, --ams-password
- The password to connect to AMS. The password can be read from stdin-t, --ams-token
- The token to connect to AMS-f, --ams-project-filter
- The filter to use to choose AMS projects to browse (optional, If not specified all AMS projects are browsed)
NOTE The user needs to provide either
-u, --ams-user
and-p, --ams-password
or-t, --ams-token
to connect to AMS.
NOTE The user needs to provide either
-U, --user
and-P, --password
or-T, --token
to connect to MMS.
Import Utility Output
Report
The MMS Import Utility produces a text report for each import done. This report helps to understand how the AMS data is utilized in MMS.
Log File
The MMS Import Utility produces a detail timestamped log file.
Additional Files
The following files are added to the imported MMS project:
ams-commit.log
The text file ams-commit.log
is added to each project which contains the commit log from AMS. The commit log is cumulative up to the imported AMS commit.
ams-descriptors.json
The JSON text file ams-descriptors.json
is added to each project which contains all the contributing AMS deployment descriptors.
Supported AMS Resources
The following tables give the details of the translation of AMS resources to MMS resources.
Project
The following values are used for creating MMS projects:
MMS | AMS | Description |
---|---|---|
Group Identifier | Utility Input | The group identifier for all imported projects are the same |
Artifact Identifier | Sanitized project name | The artifact identifier is generated by replacing all whitespaces with - . Additionally, if the artifact identifier does not comply with MMS standards, it is prefixed with the -i, --artifact-identifier-prefix option. |
Name | Project Name | The AMS project name is used as it is. |
Major Version | 1 | The major version is always set to 1 . |
Minor Version | 0 | The minor version is always set to 0 . |
Patch Version | project.commit[*].version |
Every AMS commit becomes a checkpoint in MMS with the patch number matching the version in the commit |
Artifacts
The AMS artifact types and their MMS equivalents are as given in the table below:
AMS | AMS Artifact Type | AMS Content Type | MMS Artifact Type |
---|---|---|---|
AVRO_SCHEMA | avsc | application/json | Managed File (Avro Schema) |
COMPRESSED_SPARK_MODEL | zip | application/zip | Model (Spark) |
DECISION_TABLE | rulefunctionimpl | application/xml | Managed File (rule-function-impl) |
DOMAIN_MODEL | domain | application/xml | Managed File (domain) |
EXCEL | xlsx | application/octet_stream | Managed File (Excel) |
H2O_POJO | pojo | text/plain | Managed File (H2O POJO) |
PREDICTIVE_MODEL | pmml | application/xml | Model (PMML) |
PYTHON_SCRIPT | py | text/plain | Model (Python) |
R_DATA | rdata | application/octet_stream | Managed File (r-data) |
R_OBJECT | rds | application/octet_stream | Managed File (r-object) |
R_SCRIPT | r | text/plain | Model (R) |
RULE_FUNCTION | rulefunction | text/plain | Managed File (rule-function) |
RULE_TEMPLATE | ruletemplate | text/plain | Managed File (rule-template) |
RULE_TEMPLATE_INSTANCE | ruletemplateinstance | application/xml | Managed File (rule-template-instance) |
SB_DECISION_TABLE | sbdt | application/xml | Managed File (Decision Table) |
SCALA | scala | text/plain | Managed File (Scala) |
TENSORFLOW_MODEL | tfm | application/octet_stream | Model (TensorFlow) |
TEXT_FILE | txt | text/plain | Managed File (Text) |
OTHER | other | application/unknown | Managed File (Unknown) |
The following values are used for creating MMS artifacts:
MMS Field | AMS Field | Description |
---|---|---|
path |
$path |
Represents the relative path of the artifact within the project. |
type |
$type |
Specifies the artifact type. Uses a defined “type mapping” strategy to determine the AMS type. If no mapping is found, defaults to “Managed File (Unknown)”. |
content |
$content |
Contains the actual content (binary or text) of the artifact. |
Users
The users in AMS are exported to a local file with the following structure. AMS APIs do not provide passwords of the existing users, so the exported file has the literal <hashed-password>
.
$ams-user: <hashed-password>,$ams-role
where,
$ams-user
: is the username of the exported user.<hashed-password>
: is the literal<hashed-password
> as password is not provided by the AMS APIs .$ams-role
: is the role of the exported user.
NOTE It is the responsibility of the user to update all
<hashed-password>
to valid hashed passwords using themms-launcher
utility.
Roles
The MMS Import Utility exports roles in AMS as bindings
in MMS. AMS defines all roles with a set of privilege or permission. Each permission is defined as,
type:action:instance
where,
type
: is one of project, decision_table, rule_function, manage_server, manage_permissions, or *
action
: is one of import, read, write, delete, approve, deploy, or *]
instance
: is the specified project or artifact instance.
Type Mapping
The type mapping from AMS to MMS is as given in the table below:
AMS | MMS | Description |
---|---|---|
project | Supported | All actions are translated to bindings as per the action mapping rules. |
decision_table | Ignored | An artifact level permission and is ignored. |
rule_function | Ignored | An artifact level permission and is ignored. |
manage_server | Ignored | No equivalent translation in MMS. |
manage_permissions | Supported | Translates to com.spotfire.sw.am.model.Permission.CHANGE_PERMISSIONS . |
* | Supported | All actions are translated to bindings as per the mapping rules for actions. |
Action Mapping
The action mapping from AMS to MMS is as given in the table below:
AMS | MMS |
---|---|
import | Not Supported |
read | com.spotfire.sw.am.model.Permission.READ |
write | com.spotfire.sw.am.model.Permission.UPDATE |
delete | com.spotfire.sw.am.model.Permission.DELETE |
approve | com.spotfire.sw.am.model.Permission.APPROVAL |
deploy | com.spotfire.sw.am.model.Permission.DEPLOY |
* | com.spotfire.sw.am.model.Permission.CREATE , com.spotfire.sw.am.model.Permission.READ , com.spotfire.sw.am.model.Permission.UPDATE , com.spotfire.sw.am.model.Permission.DELETE , com.spotfire.sw.am.model.Permission.APPROVAL , com.spotfire.sw.am.model.Permission.DEPLOY |
Instance Mapping
The MMS Import Utility does not support Instance mapping.
Migration Example
The migration process is demonstrated in this example. This example is based on the below rules and set of AMS permissions:
{
"@class": "com.tibco.ep.ams.model.response.RoleRecord",
"name": "AMSAdmin",
"users": [
"admin",
"test"
],
"permissions": [
"*"
],
"entityId": "f67bc01de8864f349d8d8d524d628f53"
},
{
"@class": "com.tibco.ep.ams.model.response.RoleRecord",
"name": "AMSGuest",
"users": [
"guest"
],
"permissions": [
"project:read",
"artifact:read",
"group:read"
],
"entityId": "1b36ad3ad7004e8cb71f5c5fb08d2b66"
}
This translates to the following MMS permission bindings:
{
"bindings" : {
"AMSAdmin" : [ "create", "read", "update", "delete", "approval", "deploy", "change permissions" ],
"AMSGuest" : [ "read" ]
}
}
Deployment
Descriptors
MMS discovers all running Streaming clusters during startup and makes them available for deployment.
AMS supports deployment descriptors targeting versioned artifacts. This leads to selective deployment of artifacts within the same project to one or more deployment targets. MMS only supports a single deployment descriptor per project and does not support selective artifact deployment within a project. This necessitates creating only one deployment descriptor per project and then creating policies on how to choose the right deployment target (primary target) and how to deal with all other targets (secondary target).
The MMS Import Utility uses deployment descriptors targeting the version artifacts in each commit except if the commit is the latest one. In this case, the latest descriptors are used.
AMS | MMS | MMS Streaming Cluster Search Strategy |
---|---|---|
StreamBase URI (StreamBase 7 only)/STREAMBASE_URI |
StreamingCluster |
$.streamBaseTarget to $StreamingCluster.name mapping or defaultStreamingCluster |
StreamBase Service Name/STREAMBASE_SERVICE_NAME |
StreamingCluster |
$.streamBaseTarget to $StreamingCluster.name mapping or defaultStreamingCluster |
StreamBase Service Address/STREAMBASE_SERVICE_ADDRESS |
StreamingCluster |
$.streamBaseTarget to $StreamingCluster.name mapping or defaultStreamingCluster |
STREAMBASE_URI
The utility finds a mapping between $.streamBaseTarget
and $StreamingCluster.name
. If none is found, then the defaultStreamingCluster
is used.
STREAMBASE_SERVICE_NAME
The utility finds a mapping between $.streamBaseTarget
and $StreamingCluster.name
. If none is found, then the defaultStreamingCluster
is used. The $.streamBaseTarget
is a comma-separated list. Each item in the list is converted to a MMS deployment descriptor.
STREAMBASE_SERVICE_ADDRESS
The utility finds a mapping between $.streamBaseTarget
and $StreamingCluster.name
. If none is found, then the defaultStreamingCluster
is used. The $.streamBaseTarget
is a comma-separated list. Each item in the list is converted to a MMS deployment descriptor.
Mapping file syntax
Each line in the file represents a mapping of key=value
where the key is AMS streamBaseTarget
and the value is a MMS StreamingCluster
name.
# A mapping between AMS STREAMBASE_URI streamBase target and MMS streaming cluster name
sb://localhost:10000=foo.bar.streaming.cluster
# A mapping between AMS STREAMBASE_SERVICE_NAME streamBase target and MMS streaming cluster name
some.service.name=someother.foo.bar.streaming.cluster
# A mapping between AMS STREAMBASE_SERVICE_ADDRESS streamBase target and MMS streaming cluster name
some.service.address=another.foo.bar.streaming.cluster
Commit Translation
The utility can control how commits are imported in MMS from AMS using retain-commits
.
Each commit in AMS is imported as a published checkpoint in MMS.
If retain-commits
is -1
, then all commits in AMS are individually imported into MMS as checkpoints/dependencies
.
If retain-commits
is 0
, then all commits in AMS are imported into MMS as a single squashed checkpoint/dependency
.
If retain-commits
is n
, then the latest n
commits from AMS are imported into MMS as individual checkpoints or dependencies. All older commits from AMS are squashed into MMS as a single checkpoint or dependency. If the AMS project has more than n
commits, then the MMS project has n+1
commits. If the AMS project has less than or equal to n
commits, then the MMS project has all the commits.