This is a collection of community contributed libraries for .NET Aspire
-
First of all, you should have OpenTelemetry Agent for Java. You can download it to your local machine by running the following commands:
# Bash mkdir -p ./agents wget -P ./agents \ https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar # PowerShell New-item -type Directory -Path ./downloaded -Force Invoke-WebRequest ` -OutFile "./agents/opentelemetry-javaagent.jar" ` -Uri "https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar"
-
Build the Spring app with Maven:
pushd ./src/Aspire.Contribs.Spring.Maven ./mvnw clean package popd
-
Build a container image for the Spring app:
pushd ./src/Aspire.Contribs.Spring.Maven docker build . -t aspire-spring-maven-sample:latest popd
-
Push the container image to Docker Hub under your organisation. This sample uses
aliencube
:docker tag aspire-spring-maven-sample:latest aliencube/aspire-spring-maven-sample:latest docker push aliencube/aspire-spring-maven-sample:latest
NOTE: You need to log in to Docker Hub before pushing the image.
-
If you want to integrate the containerised Spring app built above, open
src/Aspire.Contribs.AppHost/Program.cs
and update the following line:var containerapp = builder.AddSpringApp("containerapp", new JavaAppContainerResourceOptions() { // ⬇️⬇️⬇️ Update this line with your container image ContainerImageName = "aliencube/aspire-spring-maven-sample", // ⬆️⬆️⬆️ Update this line with your container image OtelAgentPath = "/agents" });
-
Run .NET Aspire dashboard:
dotnet watch run --project ./src/Aspire.Contribs.AppHost
-
Check the dashboard that both containerised app and executable app are up and running.
-
Open the web app in your browser and navigate to the
/weather
page and see the weather information from ASP.NET Core Web API app, Spring container app and Spring executable app.
TBD
-
Get the Azure environment name ready:
# Bash AZURE_ENV_NAME="contribs$((RANDOM%9000+1000))" # PowerShell $AZURE_ENV_NAME="contribs$((Get-Random -Minimum 1000 -Maximum 9999))"
-
Run the following command to deploy the app to Azure:
azd up -e $AZURE_ENV_NAME
Follow the instruction for the rest of the deployment process.