How To Get Early PaaS ROI by Onboarding Existing Apps

Chris Nelson

By Chris Nelson3.8.16

Onboarding Existing Apps

Enterprises invest in Platform as a Service (PaaS) solutions like Apprenda because no one can afford to throw out or rewrite existing applications. Realizing a seamless return on an existing investment requires migrating those apps to the platform.

This is a use case where the Apprenda platform excels. With a few strategic uses of platform API functions, developers can easily adapt existing apps to cloud-ready platform apps.

Case Study: Survey™ Project

For a recent project, we adapted Survey Project to run on the Apprenda platform. This blog post recaps that process. Survey Project is an open-source C#.Net program for creating and administering web-based surveys. The original source on GitHub is comprised of roughly 30 kLOC of C#, 20 kLOC of SQL, and 145 kLOC of XML. The build output is approximately 8 megabytes.

Missing Files

The automated process for packaging a .NET app for the platform is driven by the data in the Visual Studio solution file. When Survey Project was built with the original source, one JavaScript file was missing and the web UI didn’t behave properly. This is arguably a flaw in the original source that has nothing to do with Apprenda but was revealed by the app-packaging process.

You can see this change in commit 1809abf870, a one-line change to the solution file.

File Encoding

Survey Project’s database provisioning script was encoded in UTF-16, the default used by SQL Server Management Studio. Git, the Apprenda platform, and other tools treat this encoding as a binary format. This causes issues such as Git not being able to properly show the changes between two versions of a file with this encoding. Fortunately, UTF-16 encoding can be converted to UTF-8 without loss of content and that format is treated as text by Git and the platform.

You can see this change in commit cc82e526a2, though the before file is “binary” so the change isn’t very interesting.

Database Changes

One of the advantages of PaaS is that the platform handles details of deploying your services to appropriate servers. A consequence of this is that a static connection string or fixed database names can’t be used to access the application data.

The first change this requires is simply removing the USE clause from the top of the provisioning script. Second, Survey Project uses a forward alias in one of its stored procedures. This construction is somewhat non-portable and was remediated with a one-line change.

You can see these changes in commit 24922922b8.

The last change required for using databases on the platform is to add a platform-based connection string in web.config. The platform additions are done in such a way that the configuration file can still be used as before for local debugging and direct deployment.

This change can be seen in commit d9d435ff72.

Logic Changes

The advantages of PaaS aren’t completely free. One necessary change in Survey Project was getting the connection string from the context provided by the platform rather than static text in a configuration file. The configuration change referenced above has a companion change in the code which gets the connection string from the platform when available and falls back to the existing configuration if it is not. You can see this small change in commit f79dc488de.

Survey Project has built-in authentication and authorization with which you can create users, manage passwords, and determine which users have what rights (creating surveys, creating reports, etc.). The platform also provides for authentication and authorization (and can delegate them to external services). To make a seamless experience when using surveys on the platform, we made one more small change to use the platform authentication when available.

For now, Survey Project on the Apprenda platform uses a very simple authorization model: you are either an administrator with all rights or a survey taker who can only provide answers.

The change to use platform authentication is in commit 7aa6bbfd0c.

Platform Configuration

With the changes described so far, you can manually build Survey Project and deploy it to Apprenda, letting the platform take care of authentication and database server selection. You can automate that process somewhat by putting some app configuration into a deployment manifest and packaging it with the app.

You can create the manifest from scratch or configure the app in the Developer Portal and export the settings for later reuse. For this simple case, the manifest specifies that the app is multi-tenant and uses the SurveyAdmin securable to control Survey Project rights.

You can see the manifest in commit 17b46f3e34.

Apps on the Platform

In all, we changed or added approximately 70 lines in eight existing files to make the Survey Project platform ready. We also added a deployment manifest to make rebuilding and redeploying easy and automatic. While every application presents different challenges when onboarding to the Apprenda platform, many can be quite straight forward. Here we changed just 0.2% of the C# code and got the benefit of platform data management, authentication, and authorization.

If you want to use Survey Project on your Apprenda platform, the cloud-ready source can be downloaded from GitHub.

Chris Nelson
Chris Nelson

Chris Nelson is a Solutions Architect at Apprenda. He is passionate about robust refactoring. Chris has a BS in Electrical Engineering and an MS in Computer Science from Rensselaer Polytechnic Institute. He is also among the first in the United States to receive a Professional Engineer license with a specialization in software. You can follow him on twitter at @ChrisNelsonPE.

View Comments

Leave a Reply

Your email address will not be published. Required fields are marked *