I gave a live demonstration of doing that in the MarkLogic User Group Benelux meetup 'Stop horsing around with NoSQL — How to Build a NoSQL Demo to Impress Your Boss'. This article gives full details on that demo.
Capturing and redeploying an Application Builder app basically comes down to the following steps:
- Create and deploy a Roxy REST project
- Use Roxy MLCP features to ingest data
- Use Roxy to deploy the analyze-data tool
- Create indexes using the analyze-data tool
- Create an App-Builder project for the content db of the Roxy project
- Run through the App-Builder wizard and deploy
- Use Roxy capture to capture the app-builder project
- Customize the app-builder code
- Redeploy to the Roxy project
And that is it. Roughly 7 steps to build a fully running demo, and then you can customize it any way you like, and redeploy as much and anywhere you like.
I’ll run through some details briefly, point to other blog articles of mine that are relevant, and wrap up with links to code, data and recordings of the live demo.
Other capture parameters
My previous blog article ‘Capturing MarkLogic applications with Roxy’ discusses capturing MarkLogic applications in general. It also mentions creating a new Roxy project, and various commands useful for capturing an Application Builder application.
In addition there is one other previously not mentioned capture flag that could be of interest. It is another way to capture configurations, but not all of them at once. Instead it just captures databases and servers matching the current Roxy project. Just use --ml-config instead of --full-ml-config:
./ml local capture --ml-config
This capture command runs faster as it is capturing much less, and you can often find the settings you are looking for easier, as the resulting ml-config file is much smaller. It actually allows targeting specific databases, and servers using extra parameters --databases and --servers:
./ml local capture --ml-config --databases=App-Services,Extensions,Fab --servers=App-Services
Using MLCP features of Roxy was discussed briefly as well in my previous article. MLCP allows ingesting data directly from compressed archives, which is very convenient. You can also apply a transform while ingesting. The demo material contains runnable examples of both. Below just a little example of how such a command-line could look like:
./ml local mlcp import -input_file_path ../sample-data/horse-racing/ -input_compressed -transform_module /ingest/ingest-events-with-geo.xqy -transform_namespace http://marklogic.com/demo
The analyze-data tool is described in one of my earlier blog articles ‘Analyze your data!‘. Just a very crude tool, and far from flawless, but it can often be useful to get a jumpstart with it, just to get you going quickly.
Customizing app-builder projects
A brief word on customizing app-builder projects: if you intend to push the changes back into the modules database generated by the wizard itself, then make sure to put any customizations into the /application/custom/ folder. Not that there is much reason to push files back there if you can push them to anywhere with Roxy.
Doing so makes sure not only that you can go back to the wizard, make some changes, and redeploy, but also that you can recapture it with Roxy. Roxy will refresh the files in the src/ folder of Roxy, but will leave src/application/custom/ untouched. That means you can go back and forth between the wizard, and your own customizations as many times as you like!
The demo material
The demo material consists of:
- Cheatsheet (890 Kb zip, html slides)
- Cheats (33 Kb zip, various pieces of code and configs)
- Geonames country info (156 Kb xml)
- Horse racing data (70 Mb zip)
- DBPedia triple data (35 Mb zip, ML xml format)
The cheatsheet contains a brief intro, and a long list of all commands and steps you need to go through to run the entire demo yourself. Note that you need to go down on some slides to not miss steps!
The cheats are comprised of a set of various files. It would have take too much time to type everything myself live. The full demo already took about one and half hour with all the cheats.
The latter three provide all of the pieces of data that I used for the demo. I use the Geonames country info for a crude way to show a geospatial map with markers. The horse racing data is the core information. The triples are used to pull in extra info from DBPedia, and use that to add some semantics to the demo.
You can watch the recording of the entire live demo with the following two links (we had a break roughly half-way). The quality is not perfect, but it should be understandable:
- MarkLogic User Group Benelux meetup at June 19th, 2014 in Amsterdam, recording part 1 (36 min, moderate quality)
- MarkLogic User Group Benelux meetup at June 19th, 2014 in Amsterdam, recording part 2 (51 min, moderate quality)