1. mike S
  2. PowerServer
  3. Friday, 23 September 2022 21:05 PM UTC

has anyone had any luck in hosting the webapi in either the azure container app or container instance?  

I can't get the container app to start (possibly due to ports).   While the container instance starts but i can't communicate via the ports that have been setup.  using 5009.  I do get the webapi to load up from snapdevelop into the containers.  

 

using IIS to host the pbl downloads, using postman to test the webapi connectivity. 

I can host the webapi in IIS, and it works fine - i can connect via postman as well as the actual PS app.  

I would prefer using the container app (limited to linux).

Accepted Answer
mike S Accepted Answer Pending Moderation
  1. Monday, 26 September 2022 18:31 PM UTC
  2. PowerServer
  3. # Permalink

For quick testing, I call the JWT api in postman to make sure i am talking to everything correctly.  In postman setup the header with the content type of application/json, and the body contains the json string with the username and password

When it works, it sends back a token.  I'm running it against docker desktop, IIS (azure vm server not local), azure container instance, azure container app.  When the jwt works, the powerserver application will work.  (if the JWT is not set to enabled/required, then any of the other powerserver api's can be called instead for testing)

 

With IIS i can setup different ports and call it with HTTPS.  

With docker (local) instance, i can setup different ports (5009 etc.) and it works, but only if call it with HTTP.  https does not work. for docker the api call is:  http://localhost:5009/connect/token   

 

with container instances, they can easily setup containers with different ports, but only 80 works with http.   Once an container instance is setup, you can not change the port.  you have to delete and recreate it.

 

container app fails in the deploy.

 

https is what i need to use to connect for security.  I can get that to work with IIS only.

 

most (all?) examples that are provided use http and not https.

 

 

 

Comment
  1. Logan Liu @Appeon
  2. Tuesday, 27 September 2022 06:56 AM UTC
Hi Mike,

I found an Azure Container Instances guide that shows how to create a container group with an application container and a sidecar container running a TLS/SSL provider. By setting up a container group with a separate TLS endpoint, you enable TLS connections for your application without changing your application code.

Refer to: https://learn.microsoft.com/en-us/azure/container-instances/container-instances-container-group-ssl

it seems easier to maintain TLS in the sidecar container if you don't want to upgrade all of the application containers just because a certification expires.

Regards, Logan
  1. Helpful 1
  1. mike S
  2. Tuesday, 27 September 2022 13:02 PM UTC
thanks, yes, these types of configurations are what i am looking to do. the container app already handles these things which is a reason they look so compelling.



The authentication may move me to instance instead of app container however. I was planning on using built in JWT with some custom validations, but the container app seems to clear the token cache. or i could use external service i suppose.

  1. Helpful
  1. mike S
  2. Wednesday, 28 September 2022 16:25 PM UTC
It is looking like the container app may have been sized too small (.25 cpu) and was causing issues with the JWT .part of the net service. Moved to a 1 CPU/2GB container size and the problems seem to have gone away.



Looking into the scale requirements as well to allow it to scale to zero in order to save money when its not in use. The cost is pretty low in any case (35/month to run full time, but probably about 1/2 that if it is setup to scale to 0 ). The scale to zero option is really compelling for a testing server since it should scale to zero most days. The https cert is included with the container app, so depending on what you are doing it can be very cost effective.
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Saturday, 24 September 2022 04:53 AM UTC
  2. PowerServer
  3. # 1

Fili Sosa did an Elevate session on this and it works well.  https://www.appeon.com/conference/elevate-2021/live?id=334

 

Comment
  1. mike S
  2. Monday, 26 September 2022 22:11 PM UTC
this did help - gave me the idea of just running the web apis on docker port 80 and using postman to make sure i am getting to it. then moving to container instance and getting that working on 80, then figuring out the container app.
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Monday, 26 September 2022 23:27 PM UTC
Glad to hear that!
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.