https://github.com/aliencube/aspire-contribs
This is a collection of community contributed libraries for .NET Aspire
https://github.com/aliencube/aspire-contribs
aspire azure-api-management contributions dotnet java maven spring springboot
Last synced: about 2 months ago
JSON representation
This is a collection of community contributed libraries for .NET Aspire
- Host: GitHub
- URL: https://github.com/aliencube/aspire-contribs
- Owner: aliencube
- License: mit
- Created: 2024-06-05T06:49:39.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-09-23T05:22:26.000Z (8 months ago)
- Last Synced: 2025-03-25T18:16:16.481Z (2 months ago)
- Topics: aspire, azure-api-management, contributions, dotnet, java, maven, spring, springboot
- Language: C#
- Homepage:
- Size: 553 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Aspire Contribs
This is a collection of community contributed libraries for .NET Aspire
## Prerequisites
- [JDK 17+](https://learn.microsoft.com/java/openjdk/download)
- [Springboot CLI](https://docs.spring.io/spring-boot/installing.html#getting-started.installing.cli)
- [Apache Maven](https://maven.apache.org)
- [Docker](https://docs.docker.com/get-docker/)## For Java App
### Download OpenTelemetry agent
1. First of all, you should have [OpenTelemetry Agent for Java](https://opentelemetry.io/docs/zero-code/java/agent/). You can download it to your local machine by running the following commands:
```bash
# 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 container image
1. Build the Spring app with Maven:
```bash
pushd ./src/Aspire.Contribs.Spring.Maven./mvnw clean package
popd
```1. Build a container image for the Spring app:
```bash
pushd ./src/Aspire.Contribs.Spring.Mavendocker build . -t aspire-spring-maven-sample:latest
popd
```1. Push the container image to [Docker Hub](https://hub.docker.com) under your organisation. This sample uses `aliencube`:
```bash
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.
### Run .NET Aspire
1. If you want to integrate the containerised Spring app built above, open `src/Aspire.Contribs.AppHost/Program.cs` and update the following line:
```csharp
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"
});
```1. Run .NET Aspire dashboard:
```bash
dotnet watch run --project ./src/Aspire.Contribs.AppHost
```1. Check the dashboard that both containerised app and executable app are up and running.

1. 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.

## For Azure API Management
TBD
## Deployment to Azure
1. Get the Azure environment name ready:
```bash
# Bash
AZURE_ENV_NAME="contribs$((RANDOM%9000+1000))"# PowerShell
$AZURE_ENV_NAME="contribs$((Get-Random -Minimum 1000 -Maximum 9999))"
```1. Run the following command to deploy the app to Azure:
```bash
azd up -e $AZURE_ENV_NAME
```Follow the instruction for the rest of the deployment process.