Source location for web apps
Hi,
I'd like to find the source location for the web apps that I've written. I've started to invest a fair amount of time in them, and I'd like to leverage a source control tool. Where are the web apps actually located on my disk so I can use SVN or the like with them?
Thanks,
Rachel
Best Answer
-
Hi Rachel,
Good question. Web apps are actually stored in the RapidMiner Server Repository which is in the RDBMS. Unfortunately Version Control is not yet available for them.
This means that to keep a log of the changes to them you would need to first find the table that they are stored in with the repository and make regular backups of it. Another option (& my recommendation) is that you can create a regular backup of the WebApps you create by storing the XML of the file at regular intervals. The XML looks something like this and is easily extracted using the Read Document operator.
<?xml version="1.0" encoding="UTF-8"?><report>
<title>myReport</title>
<tooltip/>
<description/>
<realm-ref>parameter</realm-ref>
<height>1000</height>
<width>1000</width>
<style-bundle-location/>
<init-process-location/>
<allow-set-report-variables>true</allow-set-report-variables>
<variables/>
<view>
<id>view_1481084817533</id>
<title>New View</title>
<navigatable>false</navigatable>
</view>
<tab-actions/>
</report>These backups can then be stored on disk and that can then be monitored with SVN, Git, etc and so if changes need to be rolled back you can do so.
The below is a simple example, but it could be developed into something much more automated if you have time. Perhaps triggered every hour to compare latest against the previous version for any changes and then to write a new version to disk if there are. (As it is such a simple copy it could also be done using write to database without needing SVN too. Just store the XML in a text field and add a new record for each new version).
<?xml version="1.0" encoding="UTF-8"?><process version="7.3.000">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="7.3.000" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="open_file" compatibility="7.3.000" expanded="true" height="68" name="Open File" width="90" x="112" y="238">
<parameter key="resource_type" value="2"/>
<parameter key="repository_entry" value="MyWebApp"/>
</operator>
<operator activated="true" class="text:read_document" compatibility="7.3.000" expanded="true" height="68" name="Read Document" width="90" x="313" y="238">
<parameter key="extract_text_only" value="false"/>
<parameter key="content_type" value="xml"/>
</operator>
<operator activated="true" class="text:write_document" compatibility="7.3.000" expanded="true" height="82" name="Write Document" width="90" x="514" y="187">
<parameter key="file" value="C:\SVNMonitoredDir\MyWebApp"/>
</operator>
<connect from_op="Open File" from_port="file" to_op="Read Document" to_port="file"/>
<connect from_op="Read Document" from_port="output" to_op="Write Document" to_port="document"/>
<connect from_op="Write Document" from_port="document" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>0
Answers
-
Hi Rachel,
Good question. Web apps are actually stored in the RapidMiner Server Repository which is in the RDBMS. Unfortunately Version Control is not yet available for them.
This means that to keep a log of the changes to them you would need to first find the table that they are stored in with the repository and make regular backups of it. Another option (& my recommendation) is that you can create a regular backup of the WebApps you create by storing the XML of the file at regular intervals. The XML looks something like this and is easily extracted using the Read Document operator.
<?xml version="1.0" encoding="UTF-8"?><report>
<title>myReport</title>
<tooltip/>
<description/>
<realm-ref>parameter</realm-ref>
<height>1000</height>
<width>1000</width>
<style-bundle-location/>
<init-process-location/>
<allow-set-report-variables>true</allow-set-report-variables>
<variables/>
<view>
<id>view_1481084817533</id>
<title>New View</title>
<navigatable>false</navigatable>
</view>
<tab-actions/>
</report>These backups can then be stored on disk and that can then be monitored with SVN, Git, etc and so if changes need to be rolled back you can do so.
The below is a simple example, but it could be developed into something much more automated if you have time. Perhaps triggered every hour to compare latest against the previous version for any changes and then to write a new version to disk if there are. (As it is such a simple copy it could also be done using write to database without needing SVN too. Just store the XML in a text field and add a new record for each new version).
<?xml version="1.0" encoding="UTF-8"?><process version="7.3.000">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="7.3.000" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="open_file" compatibility="7.3.000" expanded="true" height="68" name="Open File" width="90" x="112" y="238">
<parameter key="resource_type" value="2"/>
<parameter key="repository_entry" value="MyWebApp"/>
</operator>
<operator activated="true" class="text:read_document" compatibility="7.3.000" expanded="true" height="68" name="Read Document" width="90" x="313" y="238">
<parameter key="extract_text_only" value="false"/>
<parameter key="content_type" value="xml"/>
</operator>
<operator activated="true" class="text:write_document" compatibility="7.3.000" expanded="true" height="82" name="Write Document" width="90" x="514" y="187">
<parameter key="file" value="C:\SVNMonitoredDir\MyWebApp"/>
</operator>
<connect from_op="Open File" from_port="file" to_op="Read Document" to_port="file"/>
<connect from_op="Read Document" from_port="output" to_op="Write Document" to_port="document"/>
<connect from_op="Write Document" from_port="document" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>0 -
In case anyone else wants to do something like this, I wrapped it in a "Loop Repository" operator and threw everything into a Git repository. Works nicely, and quickly.
1