How to deploy a ISAPI application on AWS Elastic Beanstalk

I’m working on a new infrastructure for a DataSnap server. I need some basic stuff, pretty straightforward in the most technologies, but not very common for delphi servers, like automated distributed deploys, load balancing, auto scaling, failover.

The AWS documentation says that Elastic Beanstalk only supports some technologies (Ruby, .NET, Java, Nodejs, etc), in fact, some languages, which is weird. However, the .NET support includes IIS applications. So, if we can generate a ISAPI DataSnap server, it will work.

It is surprisingly simple. Probably takes less than 5 minutes. We only need to do this:

  • Create a WebDeploy package
  • Create the Elastic Beanstalk application

Creating a Web Deploy package

I created a github repository (RobertoSchneiders/webdeploy-isapi-package) with a web deploy package that contains an ISAPI Datasnap Server, you can use as an example or starting point.

The other option is to configure your ISAPI on your local IIS and then use the Export Application to generate the package. You only have to make sure to rename the “Parameter 1” to “IIS Web Application Name” on the second page of the wizard (References from IIS 7.5, may be different on 8.5).

You will have to add some ebextensions, to allow IIS to run ISAPI applications. More details on the github repository readme.

Creating the application on AWS Elastic Beanstalk

I will show some settings step by step, only for those who do not know the AWS EB, but it’s very simple.

On AWS Elastic Beanstalk console page:

  1. Create New Application -> Inform the nameeb_1
  2. Create web server on the New Environment pageeb_2
  3. On predefined configuration select the IIS platform eb_3You can choose if you want Load balancing and Auto Scaling or a Single Instance.
  4. Upload your WebDeploy package (You can configure automated deploys via AWS S3)eb_4
  5. In the permissions page you have to inform some roles, like this:eb_5If this is the first time you are using EB you have to create them, but not worry, you can use the default values, that the wizard will sugest to you. You can not use the same roles for Instance and Service, it will not work.

And that’s it. Now you have a Datasnap application running on a Windows Server 2012 Core, IIS 8.5, load balancer, auto scaling, failover, almost zero downtime deploy.

Some important details

  1. For the failover work properly you must configure a Health Check URL on Configuration Details page.
  2. You probably will have to customize the Auto Scaling rules according to resource consumption of your application.
  3. With Auto Scaling you will have more then one instance running, so, you must be aware of the context.
  4. If you want to use the HTTP Callbacks you will have to use the Sticky Sessions on the load balancer.
  5. You can delegate the SSL for the load balancer and remove that responsability from the datasnap server, it is very simple to configure. The Elastic Load Balancer also supports cyphers.

Conclusion

It is possible to have a modern infrastructure even if you are dealing with Datasnap, and this is amazing. I hope you enjoyed and that has been helpful.

I have not shown how to configure automated deploy on this post, but I hope to do so in the future.

Advertisements

One thought on “How to deploy a ISAPI application on AWS Elastic Beanstalk

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s