-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa7f0ff
commit 9338ef5
Showing
7 changed files
with
97 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
# Local Development | ||
|
||
```shell | ||
docker run --rm -p 8761:8761 springcloud/demo-eureka-server | ||
``` | ||
|
||
# Prepare Variables | ||
```shell | ||
SUBSCRIPTION=6c933f90-8115-4392-90f2-7077c9fa5dbd | ||
LOCATION=westus2 | ||
RESOURCE_GROUP=dixue-asas-vnet-prod | ||
SERVICE_NAME=dixue-asas-vnet-prod | ||
SUBSCRIPTION= | ||
LOCATION= | ||
RESOURCE_GROUP= | ||
SERVICE_NAME= | ||
|
||
az account set --subscription $SUBSCRIPTION | ||
``` | ||
|
||
# Standard Plan | ||
## Provision ASA Service Instance | ||
```shell | ||
|
||
``` | ||
## Deploy Application | ||
```shell | ||
mvn clean package | ||
az spring app create -n java17sample --service $SERVICE_NAME -g $RESOURCE_GROUP --runtime-version Java_17 --assign-endpoint true | ||
az spring app deploy -n java17sample --service $SERVICE_NAME -g $RESOURCE_GROUP --artifact-path ./target/java-17-sample-1.0-SNAPSHOT.jar | ||
``` | ||
# Enterprise Plan | ||
## Provision ASA Service Instance | ||
|
||
## Deploy Application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
java-17-sample/src/main/java/com/azure/asa/sample/EurekaController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.azure.asa.sample; | ||
|
||
import com.netflix.appinfo.InstanceInfo; | ||
import com.netflix.discovery.EurekaClient; | ||
import com.netflix.discovery.shared.Application; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
@RestController | ||
public class EurekaController { | ||
|
||
@Autowired | ||
private EurekaClient discoveryClient; | ||
|
||
@GetMapping("/eureka") | ||
public String getEurekaState() { | ||
StringBuilder sb = new StringBuilder(); | ||
|
||
sb.append("<p>Known Regions</p>"); | ||
sb.append("<ul>"); | ||
Set<String> regions = discoveryClient.getAllKnownRegions(); | ||
for(String region : regions) { | ||
sb.append("<li>").append(region).append("</li>"); | ||
} | ||
sb.append("</ul>"); | ||
|
||
List<Application> apps = discoveryClient.getApplications().getRegisteredApplications(); | ||
sb.append("<p>Registered Applications</p>"); | ||
sb.append("<ul>"); | ||
for(Application app : apps) { | ||
sb.append("<p>Application=").append(app.getName()).append("</p>"); | ||
sb.append("<ul>"); | ||
List<InstanceInfo> instances = app.getInstances(); | ||
for(InstanceInfo instance : instances) { | ||
sb.append("<ul>"); | ||
sb.append("<li>InstanceId=").append(instance.getInstanceId()).append("</li>"); | ||
sb.append("<li>Status=").append(instance.getStatus().toString()).append("</li>"); | ||
sb.append("<li>IPAddr=").append(instance.getIPAddr()).append("</li>"); | ||
sb.append("</ul>"); | ||
} | ||
sb.append("</ul>"); | ||
} | ||
sb.append("</ul>"); | ||
|
||
sb.append("<p>Client Configuration</p>"); | ||
sb.append("<ul>").append(discoveryClient.getEurekaClientConfig().toString()).append("</ul>"); | ||
|
||
return sb.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
spring.application.name=java-17-sample | ||
management.endpoints.web.exposure.include=* | ||
management.endpoint.env.show-values=ALWAYS | ||
management.endpoint.env.show-values=ALWAYS | ||
eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/ | ||
eureka.client.healthcheck.enabled=true | ||
spring.cloud.config.enabled=false |