-
Notifications
You must be signed in to change notification settings - Fork 4
Upgrading to State Conductor 1.0.0
The update from State conductor 0.x.x to 1.0.0 is a major change because the code, files and vernacular has been changed to align more fulling to amazon state language. Here is a list of the changes that are needed in order to upgrade to 1.0.0
- Change the mlBundle to 1.0.0 in the dependencies section of the build.gradle file
- Update 0.x.x flow files to state machine files
- Query to run before deploying to remove old roles
- Clean up
dependencies {
mlBundle "com.marklogic:marklogic-state-conductor:1.0.0"
}
In effort to align with amazon state language the flow files where changed to state machine files. There location has changes as well as their name and some of the schema/properties. see State Machine Definition Syntax for more information.
Run this query on each environment before deploying.
'use strict';
// execute this against the security database
declareUpdate();
if (xdmp.databaseName(xdmp.database()) !== "Security"){
"Your database is not set as Security change you database to Security"
} else {
const sec = require('/MarkLogic/security.xqy');
//removes all state-conductor privileges
xdmp.privileges().toArray().map(function(item){
return { name: xdmp.privilegeName(item),
kind: xdmp.privilegeKind(item),
id: item
}
}).filter(item => item.name.startsWith("state-conductor")).map(function(item){
let doc = fn.head(cts.search(cts.andQuery([cts.elementValueQuery(fn.QName("http://marklogic.com/xdmp/security","privilege-id"), item.id.toString()),cts.collectionQuery("http://marklogic.com/xdmp/privileges")])))
item.action = doc.xpath("sec:privilege/sec:action/text()", {"sec":"http://marklogic.com/xdmp/security"}).toString()
return sec.removePrivilege(item.action, item.kind)
})
//removes all state-conductor roles
sec.getRoleNames().toArray().map(item => item.xpath('text()').toString()).filter(item => item.startsWith("state-conductor")).forEach(function(item){
//call it this way to not get conflicing updates
let uri = cts.uris(null,null,cts.andQuery([cts.elementValueQuery(fn.QName("http://marklogic.com/xdmp/security","role-name"), item),cts.collectionQuery("http://marklogic.com/xdmp/roles")]))
sec.removeRoleFromUsers(item);
sec.removeRoleFromAmps(item);
xdmp.documentDelete(uri);
})
}
- remove old jobs database (its been moved to executions)
- remove old flow files
If you get an error like this the ones below then make sure that you have removed the roles with the (query)[(oldRoles). This has to be done on each environment.
Task :state-conductor-dhf5-example:mlDeployApp FAILED Logging HTTP response body to assist with debugging: {"errorResponse":{"statusCode":"500", "status":"Internal Server Error", "messageCode":"CMA-ERRORCONFIG", "message":"CMA-ERRORCONFIG (err:FOER0000): MANAGE-CONFLICTINGCONFIGerr:FOER00001.0-mlA conflict has been detected:MANAGE-CONFLICTINGCONFIG: (err:FOER0000) A conflict has been detected: [...]
or
Error occurred while sending POST request to /manage/v3; logging request body to assist with debugging: [...]