#1 2017-04-25 08:40:04

turrican
Member
From: Barcelona
Registered: 2015-06-05
Posts: 94
Website

Deploy mORMot HTTP Server on azure as SaaS

Hi!

Currently we are moving to Azure and we found Azure AppServices. This kind of SaaS services can manage backend-webapplications made with .NET, PHP, NodeJS and JAVA. I'm curious if mORMot backend servers can be deployed on this platform. We are going to try the deployment.

Somebody deployed code in this platform?

Offline

#2 2017-04-26 18:26:55

afarias
Member
Registered: 2016-04-13
Posts: 14

Re: Deploy mORMot HTTP Server on azure as SaaS

AFAIK, you'll need a Virtual Machine running Windows or Linux. AppServices is for "managed code" only.

Offline

#3 2017-04-27 06:43:30

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: Deploy mORMot HTTP Server on azure as SaaS

Actually I think you asked yourself in your question - "...made with .NET, PHP, NodeJS and JAVA." Obviously Delphi is not in the list.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#4 2017-04-28 09:45:20

turrican
Member
From: Barcelona
Registered: 2015-06-05
Posts: 94
Website

Re: Deploy mORMot HTTP Server on azure as SaaS

You two are wrong... smile I will upload the instructions when I finished the deployment. But I did it.

Offline

#5 2017-04-28 10:01:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: Deploy mORMot HTTP Server on azure as SaaS

Great!
I guess you are using powershell access to the instance.

But IIRC such Azure instances don't have local persistence: whatever you wrote locally may disappear if the VM manager moves your virtual instance to another hardware...
So you should use remote storage for any persistence...

Worth adding to the framework documentation, once proven.

Offline

#6 2017-04-28 11:13:55

turrican
Member
From: Barcelona
Registered: 2015-06-05
Posts: 94
Website

Re: Deploy mORMot HTTP Server on azure as SaaS

Did!

We are using autoscalable Azure App Services (not VM's).

What do you need to know about this?

  - You have an sandbox enviorment with an IIS acting like a proxy. ex. x.x.x.x:80 -> 127.0.0.1:25000
  - You do not control any machine or VM.
  - You can control vertical and horizontal scalability.
  - You can't do administrative actions on your server.
  - Every console out on your program will be flushed on log file.
  - Your application needs to accept parameters (paramstr[1] -> TCP port forwarded by IIS)
  - You need to bind server on 127.0.0.1 with paramstr[1]

(Only works with non-based HTTPApiServer because you have an IIS-Proxy above)

Here are the instructions :

- Compile your custom .exe HTTP server
- Upload exe to /site/wwwroot folder
- Generate a webconfig file at /site/wwwroot folder with the next content :

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <remove name="httpplatformhandler" />
      <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    </handlers>
    <httpPlatform stdoutLogEnabled="true" stdoutLogFile=".\YOUREXE.log" startupTimeLimit="20" processPath="%HOME%\site\wwwroot\YOUR EXE" arguments="%HTTP_PLATFORM_PORT%"/>
  </system.webServer>
</configuration>

- Restart azure AppService instance
- Open a HTTP/s request to your service
- Voilà

Last edited by turrican (2017-04-28 11:22:43)

Offline

#7 2017-04-28 11:28:43

turrican
Member
From: Barcelona
Registered: 2015-06-05
Posts: 94
Website

Re: Deploy mORMot HTTP Server on azure as SaaS

ab wrote:

Great!
I guess you are using powershell access to the instance.

You can access via powershell or HTTP panel.

ab wrote:

But IIRC such Azure instances don't have local persistence: whatever you wrote locally may disappear if the VM manager moves your virtual instance to another hardware...
So you should use remote storage for any persistence...

Yes, no local persistence. But I don't need persistence at all... I am doing a (Delphi/Assembler Mega optimized) HTTP Image Converter and I want to deploy it to Azure with AppServices (not VM)
VM's are more expensive, hard to scale and deploy.


ab wrote:

Worth adding to the framework documentation, once proven

Of course! this is a big deal for Azure DevOps!

Offline

#8 2017-04-28 11:35:02

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: Deploy mORMot HTTP Server on azure as SaaS

Great input!

MS reference documentation:
https://azure.microsoft.com/en-us/blog/ … for-iis-8/
https://www.iis.net/learn/extensions/ht … -reference
https://technet.microsoft.com/en-us/lib … 25371.aspx

As an alternative, the executable may check the environment variable HTTP_PLATFORM_PORT, and use it instead of paramstr(1).

Offline

#9 2017-04-28 11:44:30

turrican
Member
From: Barcelona
Registered: 2015-06-05
Posts: 94
Website

Re: Deploy mORMot HTTP Server on azure as SaaS

ab wrote:

As an alternative, the executable may check the environment variable HTTP_PLATFORM_PORT, and use it instead of paramstr(1).

Not at all. HTTP_PLATFORM_PORT is not a enviroment variable... I tried to do and nothing found.

PS D:\home> echo %HTTP_PLATFORM_PORT% 

MS is hiding things and wants you code in .NET and popular languajes like JS with Node. But no... I continue to do things natively with C++ and Object Pascal. smile

Last edited by turrican (2017-04-28 11:46:24)

Offline

#10 2017-04-28 12:37:27

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: Deploy mORMot HTTP Server on azure as SaaS

turrican wrote:

Not at all. HTTP_PLATFORM_PORT is not a enviroment variable... I tried to do and nothing found.

So MS documentation is plain wrong.
Not the first time it is not accurate, though... wink

Offline

#11 2017-04-28 17:58:06

afarias
Member
Registered: 2016-04-13
Posts: 14

Re: Deploy mORMot HTTP Server on azure as SaaS

turrican wrote:

You two are wrong... smile I will upload the instructions when I finished the deployment. But I did it.

That's great to know. Thanks.

Although, I full CentOS VM with SSD for database persistence is still cheaper.

smile

Last edited by afarias (2017-04-28 18:10:32)

Offline

#12 2017-04-29 07:23:58

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: Deploy mORMot HTTP Server on azure as SaaS

Yes, I agree with afarias, it's great to know about that!

BTW, this service is not very cheap, the pricing page is here:
https://azure.microsoft.com/en-us/prici … p-service/


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#13 2017-05-03 13:48:19

turrican
Member
From: Barcelona
Registered: 2015-06-05
Posts: 94
Website

Re: Deploy mORMot HTTP Server on azure as SaaS

More documentation here : https://github.com/projectkudu/kudu/wik … pp-sandbox

Last edited by turrican (2017-05-03 13:49:36)

Offline

Board footer

Powered by FluxBB