Assign names to applications without Service Fabric - azure-service-fabric

I have an application in the service fabric and I'm going to upload another one.
I wonder if it's possible to assign different names to each application.
With an application, I access using the address:
http://sf-spartan.eastus.cloudapp.azure.com
You can configure for access to look like this:?
http://application1.sf-spartan.eastus.cloudapp.azure.com
or
http://sf-spartan.eastus.cloudapp.azure.com/application1

Sure, have a look here. Use the ApplicationName argument to define it.
Every application instance you create must in fact have a unique name.
You can reach your application instance through its url by using a reverse proxy. (either the built-in one, or a custom one like Traefik)
Usually, the application and service name are part of the url, e.g.:
http://mycluster.eastus.cloudapp.azure.com:19081/MyApp/MyService
This does require a web based communication listener.
Event more info here.

Related

How do I avoid downtime when "upgrading" an Azure static web app to use FrontDoor?

I have a static web app to which I have mapped the domains [domain].se and www.[domain].se. The domain is managed in Azure.
The problem I'm facing is redirecting all calls to [domain].se to www.[domain].se
Since I couldn't come up with any solution to redirecting http traffic from [domain].se to www.[domain].se using a static web app (other than setting up an additional standard web app on [domain].se that manages redirects), I enabled the "Enterprise-grade edge" feature (which by the way is a very silly name) to be able to use FrontDoor.
When attempting to add the domain to the frontdoor resource, there is an error message telling me that it's already mapped to something (which is correct - the site that I want frontdoor to manage).
When trying to remap [domain].se (and www.[domain].se) to the front door endpoint (select Azure resource in the DNS zone manager), the frontdoor resource is not available.
The issue could probably be resolved by simply removing the current records from the name server and then add a cname record to point it to the frontdoor endpoint.
Two reasons not to do that:
1: It would cause downtime.
2: It feels like a hack. Stuff genereally work better when they are used the way they were expected to when developed. I want the platform to recognize what things are connected in order to avoid future issues.

Rest path for application

I'm fairly new to Spring Boot, but I want to want to build my application in such a way, that can deploy mulitple applications on the same server and i want to distinguish the applications in the rest path.
For example, say i have the applications user-management and animal-management and i have a rest-controller in both of them responding to the path \names.
Both those applications run on localhost:8080 so when sending a GET to localhost:8080/users/names, I want the controller of the user-management to react and the same for animal with a GET to localhost:8080/animals/names.
I can put a #RequestMapping on the controller to acchieve the names part, but if i do the same on the application, it gets ignored.
Basically I want to tell my application "Every controller in this application should be mapped to the rest path specified on the controller, but prefixed with 'x'".
How can I do that.
I was looking for the contextPath, I just didn't know the name.
By putting the server.contextPath=/users attribute in the application.properies it worked like i wanted to.
Thank you #Vaionixx

Fake services mock for local development

This has happend to me more than once, thought someone can give some insight.
I have worked on multiple projects where my project depends on external service. When I have to run the application locally, i would need that service to be up. But sometimes I would be coding to the next version of their service which may not be ready.
So the question is, is there already a way that can have a mock service up and running that i could configure with some request and responses?
For example, lets say that I have a local application that needs to make a rest call to some other service outside to obtain some data. E.g, say, for given a user, i need to find all pending shipments which would come from other service. But I dont have access to that service.
In order to run my application, i need a working external service but I dont have access to it in my environment. Is there a better way rather than having to create a fake service?
You should separate the communications concerns from your business logic (something I call "Edge Component" see here and here).
For one it will let you test the business logic by itself. It will also give you the opportunity to rethink the temporal coupling you currently have. e.g. you may want the layer that handle communications to pre-fetch, cache etc. data from other services so that you will also have more resilient services at run time

Using HTTPS and multiple NSURLProtectionSpace's in iOS

I'm creating a iOS app that requires the user to log in at startup, and then uses those credentials to query 4-5 different services on a server over the course of the session.
The server (xyz) it self doesn't accept the credentials, but if the services that it provides are queried then they get accepted. For example https://xyz/service1 works, https://xyz doesn't.
Now what I'm wondering about is if there is anything that stands in the way of creating 4-5 NSURLProtectionSpace's at log in, one for each service on the server, and then use the corresponding protection space when use each service?
Or is there a better way of implementing something that could work in this situation?
All help would be appreciated.
Turns out that there is nothing that stands in the way of creating multiple NSURLProtectionSpace's since each is created for a separate url.

Dynmically consume a web service in Monotouch

I have an issue that hopefully someone could advise me on.
I am creating an enterprise iPhone application that will capture information and write it to a local server.
Depending on which of our sites the user is at will depend on which server the information is written to.
I have created a webservice which I can consume in monotouch and pass it information which it will then write to a SQL database on the local server. The problem I face is how do I go about doing this for all of our locations? If i put a web service at each location then each location will need its own version of the app that write using their webservice (all the servers are on the same network and are not separate)
Can I dynamically consume a webservice by passing the relevant URL?
Should I be taking another approach?
Any advice would be appreciated.
EDIT - I probably should mention we use WCF-style web services that require bindings being generated with SISvcUtil.exe (that is where the WebServiceClient class comes from).
We do something similar where we have a test server and production server and it is simple to change the URL where the web service points to. Obviously this does assume that the web service hosted at all the different locations are the same...
When creating the Client object which consumes the web service you need to specify bindings and an endpointaddress, you can simply change the endpointaddress string to point at the appropriate server. The code below should give you an idea of how to do this...
BasicHttpBinding binding = new BasicHttpBinding();
binding.OpenTimeout = new TimeSpan(0,1,0);
binding.CloseTimeout = new TimeSpan(0,1,0);
binding.SendTimeout = new TimeSpan(0,1,0);
//snip - any other bindings you need to specify...
string fullDomain;
string domain;
if (local)
domain = "local.server.com";
else
domain = "production.server.com";
fullDomain = string.Format("https://{0}/WebService/Service.svc", domain);
EndpointAddress endpointAddress = new EndpointAddress(fullDomain);
WebServiceClient client = new WebServiceClient(binding, endpointAddress);
Yes. There should be either a constructor or a Url property you can set which enables you to pass the URL to your different service endpoints at runtime.
(I presume here that you are talking about multiple instances of the same web service hosted at different URLs)