Saturday, 30 March 2013

Extracting content files from a Azure deployed version of TeamMentor (pre 3.3 git support), starting with a failed SFTP attemp and ending with a CSharp REPL script

I was asked by Serge to retrieve some changes he made to a test version of TM hosted in Azure.

This site was hosted at https://tm-hashes.azurewebsites.net and since this was a version before the built-in Git Support (where git TM Libraries are natively supported by TM), the only way to get the files was to copy them from the live server.

So my first attempt was to use SFTP (which Azure supports) to connect directly to the web root.

To get the STFP address, I went into Azure’s control panel for the tm-hashes site:

image

Copied the SFTP address and opened it in local windows explorer (which will require login into the tm-hashes\tmci account):

image

Navigated to the site's webroot (which are the deployed files)

image

Then into TM's Library_Data folder, which is located inside the App_Data folder (because this is the main location where this site's IIS account has 'write privileges')

image

In there we can find the XmlDatabase\TM_Libraries folder which contains all libraries currently loaded in this server

image

Back in my local VM, I have clone of the target git repository (https://github.com/TMContent/Lib_Hashes):

image

into which I’m going to copy the folders from the SFTP live site:

image

After some time of starting the drop ....

image

.... I confirm the overwrite

image

.... and it looks like it will take 1 hour

image

or maybe 6 hours :

image

After 38m of copying it is now down to 3h

image

hummm….. F&*^!!    (after 1h and a bit of copying)

image

That kinda sucks

I think I need to try a different approach :)

Time to open up the C# REPL included in TM:

image

Get the path to the Xml Libraries folder:

image

Confirm that the folders we want are in there:

image

Lets first try to zip the forth library:

image

Which is the Android one:

image

After the script shown above executes, a quick look at the ftp site shows the expected Android.zip in there:

image

Which contains the files we want to get:

image

Next lets do the zip of the entire Libraries folder:

image

It takes about 1m to create the 11Mb file

image

Which can now be copied locally

image

...note how this is much faster than the multiple hours wait we experienced above:

image

Once the zip file is downloaded:

image

I unziped the files into the Lib_Hashes folder:

image

Choosing to overwrite the existing files:

image

After the copy, Git will pick up the changed files:

image

Which we can commit:

image

And push to GitHub:

image
Post a Comment