ActiveBlog

How to Deploy .NET Apps to Stackato 2.0
by Diane Mueller

Diane Mueller, July 9, 2012

Stackato 2.0 now has integrated .NET support via the Iron Foundry.NET project. Iron Foundry is an open source project that extends .NET to any Cloud Foundry-based Platform as Service (PaaS). By integrating Iron Foundry with Stackato, we can now make Windows DEAs available on any Stackato cluster with the ability to run the full spectrum of .NET Web Applications, SQL Server, and more. The combination of Iron Foundry and Stackato places the Microsoft application stack on an even footing with the Linux-based stacks. Iron Foundry is all open source and can be deployed anywhere.

Orchard running on Stackato

Now enterprise developers can run Windows-native .NET applications in the Stackato private PaaS eco-system, giving them a truly open, interoperable private PaaS that spans both the .NET and *nix stacks and can run on any cloud.

Operations teams now have the freedom to choose any stack on any cloud to use as their development environment, enabling them to pick the one that meets their specific needs in areas such as security, compliance, availability, location, etc.

How It Works

The staging component for ASP.NET is now included with Stackato 2.0. All you need to do is add an IronFoundry VM to the Stackato Cluster and attach it (as a DEA and MS SQL service) to the Stackato controller. This allows the Iron Foundry VM to become an Iron Foundry Droplet Execution Agent (DEA) resource attached to a Stackato controller, and aspdotnet will automatically be recognized and activated as an available runtime. We have pre-packaged the staging side of the Iron Foundry .NET code (and the mssql service). These components now just await an Iron Foundry DEA to attach to a Stackato cluster, and 'aspdotnet' will magically appear as a framework (no patching of core code necessary).

ASP.NET runtime on Stackato 2.0

How to Add an Iron Foundry DEA to a Stackato Cluster

First of all, get copies of the VM:

The Quick Start Guide in the Stackato documentation will help you step through basic VM setup. Once the Stackato VM is up and running, you need to configure it so that external components can connect to it.

Log in through the VM console or SSH in, then use the new kato utility to run the following:

$ kato setup controller api.stackato-yourhost.local
$ kato enable --all

This setup is essentially the same as a standard micro cloud, but will allow you to attach the Iron Foundry VM.

Next, boot the Micro Iron Foundry VM. Once it has performed initial system setup, it will present you with a Windows console. Change to the C:IronFoundry\Setup\IronFoundry directory and open the setup.rb file in Notepad:

C:\IronFoundry\Setup\IronFoundry>notepad setup.rb

The current Iron Foundry (1.4.0) setup script expects to connect to Stackato 1.x, so a minor modification is necessary. You'll find a section near the bottom starting with def stackato. Remove the section a few lines below starting with "print "Running patch..." and ending with "puts 'Done.'" This patch is no longer required with Stackato 2.0.

Removing the obsolete patch from setup.rb

Save and close the file, then run it with:

C:\IronFoundry\Setup\IronFoundry>ruby setup.rb

You'll be prompted for the hostname of your Stackato VM (without the 'api.' prefix), the IP address and the administrator password (unused since we removed the auto-patching code).

Running setup.rb

Once the setup script finishes, you will see "ASP.NET 4.0" under "Runtimes & Frameworks" and "MS SQL" under "Available Services" in the Features section of the Stackato Management Console.

ASP.NET 4.0 enabled!

Deploying an ASP.NET App

Orchard CMS is a great open source ASP.NET application that you can download and push to your newly .NET-enabled Stackato PaaS. To try it out, download a copy from the "Download-as-a-zip" link on the project's homepage, then unpack it in a convenient local directory. Change to the Orchard directory, then run:

stackato push orchard

You'll be prompted to answer a few questions about the code you're pushing to Stackato. Specify "aspdontnet" for the framework, give the instance the default 256M of memory, and request an "mssql" data service when prompted to "Create services to bind to 'orchard'".

After a few seconds, you should have an instance of Orchard CMS running on Stackato. Go to the new application's URL and step through Orchard's "Get Started" wizard.

Using the MS SQL Data Service

Most of the Stackato samples in the App Store and on Github have some small tweaks to make the app connect to its provisioned data service(s) automatically. Since you've deployed a completely unmodified copy of Orchard, the database connection string must be entered into the "Get Started" wizard explicitly. You could choose the "Use built-in data storage (SQL Server Compact)" option, but that won't scale if you want to spin up more instances.

The connection string can be found in the Web.config file of the deployed application. You can browse to this file in the Stackato Management console, or retrieve it with the stackato client:

stackato files orchard app/Web.config

Find the connectionString attribute, copy the value, select "Use an existing SQL Server" in Orchard's wizard, paste the value in the "Connection string" field, and finish the wizard by clicking "Finish Setup".

Orchard CMS - Get Started

With Iron Foundry .NET Support now integrated into the Stackato plaform, enterprise developers can run .NET web applications, SQL Server, and more on on any Stackato cluster, on any cloud. Enterprise IT teams can manage and scale both .Net and *nix applications within any Stackato cluster. 

Want to learn more? Visit the ActiveState Stackato and IronFoundry websites.

Subscribe to ActiveState Blogs by Email

Share this post:

Category: stackato
About the Author: RSS

Diane Mueller is a Cloud Evangelist at ActiveState. She has been designing & implementing financial applications at Fortune 500 corporations for over 20 years. Diane has been actively involved in development efforts of XBRL Open Standard (http://www.xbrl.org) since 1999.

Comments

3 comments for How to Deploy .NET Apps to Stackato 2.0
Permalink

Hi, i have tested this, without success.

Staging Application [orchard]:
Failed to stage application:
Unable to find a runtime matching 'aspdotnet40' in [{'python27'=>{'version'=>'2.7', 'description'=>'ActivePython 2.7',

Orchard.Web.1.5.1.zip

stackato@stackato-sab4:~$ kato info
Version: ActiveState Stackato v2.2.1
Doozer URI: doozer:?ca=10.92.64.77:8046
:-
endpoint: api.stackato-sab4.local
restricted: true
assigned roles : cloud_controller,controller,dea,filesystem,mdns,memcached,mongodb,mysql,postgresql,rabbit,redis,router,stager
available roles: mdns,cloud_controller,controller,stager,router,dea,postgresql,mysql,rabbit,mongodb,redis,filesystem,memcached

Do i have reboot or restart something after adding MicroIronfoundry?

Best Regards
Axel

Permalink

Axel,

You've hit a limitation in Stackato's integration with Iron Foundry. The 'kato' utility (and the Doozer and Supervisor processes behind it) can't remotely control or monitor the processes on Iron Foundry VMs as it can with clustered Stackato VMs.

Permalink

As to why the initial push of Orchard didn't work with the 'aspdontnet' framework, you can get some help with this on the Stackato Support forum.