Deploy Umbraco Database to Azure

Steps to Update the Umbraco database in Azure.

 

Create .bacpac Data Tier export from your development PC

1. SQL 2012 Management Studio

2. Right-click your Umbraco database -> Tasks – Export Data Tier Application

3. Export Settings: Save to local disk (yourdbname.bacpac)

4. Done.

Get your Azure SQL server/database details

1. https://portal.azure.com  -> Go to SQL Servers

2. Click on the SQL server containing your Umbraco db.

3. Properties -> Server Name = xxxxxx.database.windows.net

4. You’ll also need Login Details =  username /  password

5. Ensure PC’s IP address is whitelisted in Properties -> Firewall

Updating the Umbraco database in Azure

1. Using SQL Management Studio 2014

2. Connect to above sql server  xxxxxx.database.windows.net

3. Note your Umbraco db name.  Then Right-click existing Umbraco database & Delete

4. Right-click Databases in tree -> Tasks -> Import Data-Tier Application

5. Browse to your .bacpac file

6. New Database name = yourUmbracoDbName

7. Edition of Windows Azure SQL Database = Basic

8. Finish

Visual Studio 2013 Typescript – my settings

Here are my current settings using Typescript in VS2013

Visual Studio 2013 Update 5

TypeScript 1.6 (specifically 1.6.2 using tsc -v in “c:\program files (x86)\Microsoft SDKs\TypeScript\1.6”)

TypeScript Build properties:
– ECMAScript version: 5
– Compile on Save: true
– Allow implicit ‘any’ types : false

 

Namespaces:

namespace MyNamespace {

"use strict";

export var …

}

Setting up Dev Environment
– install nodejs
– install github for windows & add git to PATH as in this link; https://gist.github.com/nycdotnet/f7d7b8de0c55b7081cb0#file-new-code
– in solution folder use node command prompt & create “package.json” using command “npm init”
– install grunt using command “npm install grunt-ts –save-dev
– add a Gruntfile.js to project from https://github.com/typestrong/grunt-ts (add to same folder as package.json)
– npm install -g grunt-cli

Grunt Tasks – bundle
– npm install grunt-contrib-concat –save-dev
– edit Gruntfile.js, add new task after line containing grunt-ts and add a new concat setting, and add “concat” to the list of registered grunt tasks:

module.exports = function (grunt) {
    grunt.initConfig({
        ts: {
            default: {
                src: ["**/*.ts", "!node_modules/**/*.ts"]
            }
        },
        concat: {
            default: {
                src: ["Scripts/file1.js",
                    "Scripts/file2.js"
                ],
                dest: "Built/myscripts.js"
            }
        }
    });
    grunt.loadNpmTasks("grunt-ts");
    grunt.loadNpmTasks("grunt-contrib-concat");
    grunt.registerTask("default", ["ts","concat"]);
};

Grunt Tasks – minification
– npm install grunt-contrib-uglify –save-dev

module.exports = function (grunt) {
    grunt.initConfig({
        ts: {
            default: {
                src: ["**/*.ts", "!node_modules/**/*.ts"]
            }
        },
        concat: {
            thirdParty: {
                src: ["Scripts/x.min.js",
                    "Scripts/y.min.js"
                ],
                dest: "Built/myscripts.js"
            }
        },
        uglify: {
             vendor: {
               files: { "Built/vendor.min.js": ["Scripts/file1.js", "!Gruntfile.js"] }
             }
        }
    });
    grunt.loadNpmTasks("grunt-ts");
    grunt.loadNpmTasks("grunt-contrib-concat");
    grunt.loadNpmTasks("grunt-contrib-uglify");
    grunt.registerTask("default", ["ts","concat"]);
};

Visual Studio 2013, Typescript and Knockout.js

I have Visual Studio Professional 2013 Update 5.

My solution has reference to Knockout.js version 3.3. I downloaded the Knockout “definitely typed” Nuget package.

I started to use Typescript, but if I un-tick the TypeScript Build property “Allow implicit ‘any’ types” I get lots errors in the knockout typings file “knockout.d.ts”.

Running tsc -v from Visual Studio command prompt returns “Version 1.0.3.0”

Folder C:\Program Files (x86)\Microsoft SDKs\TypeScript contains only “1.0” subfolder.

To upgrade from Visual Studio: Tools -> Extensions and Updates -> “TypeScript 1.6 for Visual Studio 2013”

Close Visual Studio & re-open the solution. Get message “Upgrade project’s Tools Version?” – answer yes.

The errors in the knockout type file have now gone.

ASP.Net bundling and CSS relative paths

I had this issue today when I deployed an ASP.NET MVC website it was getting 404 errors when attempting to access the font files.

When running the site locally the font files were found.

It turned out this was due to the bundling and because the css stylesheet was using relative paths. When running the site locally, the css files were not bundled & worked fine.

This is the site structure of the source files:

/content/bootstrap/less/bootstrap.css (which included relative path ../fonts/)
/content/bootstrap/fonts

But the bootstrap.css files was bundled as follows:

   BundleTable.Bundles.Add(new StyleBundle("~/Content/bootstrap/base").Include(
                        "~/Content/bootstrap/less/bootstrap.css",
                         ... etc ... etc ...

So bundling had the effect of creating a css file with a virtual path of “/Content/bootstrap” hence the bundled version of my bootstrap.css was looking for the relative path in “/Content/fonts” rather than “/Content/bootstrap/fonts” as in the unbundled case.

So to fix ensure that relative paths are the same in both bundled and unbundled instances. In my case I changed the name of the StyleBundle to this:

   BundleTable.Bundles.Add(new StyleBundle("~/Content/bootstrap/css/base").Include(
                        "~/Content/bootstrap/less/bootstrap.css",
                         ... etc ... etc ...

Attempting to Reduce size of TFS database using Test Attachment Cleaner

References : 1
2

To see how much space is being used:
From SQL Management Studio 2012, right click your TFS collection database, Reports -> Standard Reports -> Disk Usage by TableDiskUsageByTable

Download & install the Microsoft Visual Studio TFS 2013 powertools on the TFS server.

Create a settings file for example:

<!-- View/Delete all attachments on test runs older than 6 months, that are not linked to active bugs --> 
<DeletionCriteria> 
  <TestRun> 
    <AgeInDays OlderThan="180" /> 
  </TestRun> 
  <Attachment /> 
  <LinkedBugs>     
     <Exclude state="Active" /> 
  </LinkedBugs> 
</DeletionCriteria>

Then use the Test Attachment Cleaner to preview:

tcmpt.exe attachmentCleanup /collection:http://localhost:8080/tfs/YourCollectionName /teamProject:YourProjName /settingsFile:yourSettingsFile.xml /mode:preview

To delete the test runs attachments:

tcmpt.exe attachmentCleanup /collection:http://localhost:8080/tfs/YourCollectionName /teamProject:YourProjName /settingsFile:yourSettingsFile.xml /mode:delete

Update : 1 day later
Even though the tcmpt.exe log file showed 32gb deleted, SQL server is still showing the same size. From reference [2] above you may have to wait a few days for the space to be released. (I have tried shrinking the database).