Skip to content

Commit 7876369

Browse files
Fix AI Gallery Standard Validation requirements for java-ai template (#50)
* Initial plan * Fix storage account naming and add missing required files Co-authored-by: SandraAhlgrimm <5214683+SandraAhlgrimm@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: SandraAhlgrimm <5214683+SandraAhlgrimm@users.noreply.github.com>
1 parent e5e4b6f commit 7876369

6 files changed

Lines changed: 371 additions & 2 deletions

File tree

CONTRIBUTING.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Contributing to Java AI - AI Shop
2+
3+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
4+
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
5+
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
6+
7+
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
8+
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
9+
provided by the bot. You will only need to do this once across all repos using our CLA.
10+
11+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
12+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
13+
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
14+
15+
## How to contribute
16+
17+
### Reporting bugs
18+
19+
If you find a bug, please report it by [opening an issue](https://github.com/Azure-Samples/java-ai/issues/new). Please include:
20+
21+
- A clear and descriptive title
22+
- A detailed description of the issue
23+
- Steps to reproduce the problem
24+
- Expected vs actual behavior
25+
- Screenshots if applicable
26+
- Environment details (OS, Java version, etc.)
27+
28+
### Suggesting enhancements
29+
30+
Enhancement suggestions are tracked as [GitHub issues](https://github.com/Azure-Samples/java-ai/issues). When creating an enhancement suggestion, please include:
31+
32+
- A clear and descriptive title
33+
- A detailed description of the proposed enhancement
34+
- An explanation of why this enhancement would be useful
35+
- If possible, a draft implementation approach
36+
37+
### Pull requests
38+
39+
1. Fork the repository
40+
2. Create a feature branch from `main`
41+
3. Make your changes
42+
4. Add or update tests as needed
43+
5. Ensure all tests pass
44+
6. Update documentation if needed
45+
7. Submit a pull request
46+
47+
### Development setup
48+
49+
To set up the development environment:
50+
51+
1. Clone the repository
52+
2. Ensure you have Java 17+ installed
53+
3. Install Azure CLI and Azure Developer CLI (azd)
54+
4. Install Docker or Podman
55+
5. Follow the instructions in the [README.md](README.md) to build and run locally
56+
57+
### Code style
58+
59+
- Follow existing code style and formatting
60+
- Use meaningful variable and method names
61+
- Add comments for complex logic
62+
- Ensure all public methods have appropriate documentation
63+
64+
### Testing
65+
66+
- Add unit tests for new functionality
67+
- Ensure all existing tests pass
68+
- Test your changes locally before submitting
69+
70+
### Documentation
71+
72+
- Update README.md if needed
73+
- Add inline documentation for new public APIs
74+
- Update any relevant markdown files in the documentation
75+
76+
## Resources
77+
78+
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
79+
- [Azure Developer CLI Documentation](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/)
80+
- [Spring Boot Documentation](https://spring.io/projects/spring-boot)
81+
- [React Documentation](https://reactjs.org/docs/getting-started.html)

ISSUE_TEMPLATE.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
name: Issue template
3+
about: Use this template to report bugs or request features
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
## Issue Type
11+
<!-- Please check one -->
12+
- [ ] Bug report
13+
- [ ] Feature request
14+
- [ ] Documentation issue
15+
- [ ] Question
16+
17+
## Description
18+
<!-- Provide a clear and concise description of the issue -->
19+
20+
## Steps to Reproduce (for bugs)
21+
<!-- Provide detailed steps to reproduce the issue -->
22+
1. Go to '...'
23+
2. Click on '....'
24+
3. Scroll down to '....'
25+
4. See error
26+
27+
## Expected Behavior
28+
<!-- What you expected to happen -->
29+
30+
## Actual Behavior
31+
<!-- What actually happened -->
32+
33+
## Screenshots
34+
<!-- If applicable, add screenshots to help explain your problem -->
35+
36+
## Environment
37+
<!-- Please complete the following information -->
38+
- OS: [e.g. Windows 10, macOS, Ubuntu 20.04]
39+
- Java Version: [e.g. Java 17]
40+
- Azure CLI Version: [e.g. 2.x.x]
41+
- Azure Developer CLI Version: [e.g. 1.x.x]
42+
- Docker Version: [e.g. 20.x.x]
43+
44+
## Additional Context
45+
<!-- Add any other context about the problem here -->
46+
47+
## Logs
48+
<!-- If applicable, add relevant log outputs -->
49+
```
50+
Paste logs here
51+
```
52+
53+
## Feature Request Details (if applicable)
54+
<!-- Describe the feature you'd like to see -->
55+
56+
### Use Case
57+
<!-- Describe your use case for this feature -->
58+
59+
### Proposed Solution
60+
<!-- If you have ideas on how to implement this, please share -->
61+
62+
### Alternatives Considered
63+
<!-- What alternatives have you considered? -->

README.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,103 @@ The functional architecture of the application is as follows:
1313

1414
![Functional Architecture](./media/functional-architecture.png)
1515

16+
## Features
17+
18+
This AI Shop application demonstrates several key features:
19+
20+
- **Multi-modal AI Integration**: Uses Azure OpenAI's vision capabilities to analyze product images and generate comprehensive product information automatically
21+
- **Microservices Architecture**: Built with Spring Boot microservices including API Gateway, Eureka service discovery, and specialized services for different functions
22+
- **Cloud-Native Deployment**: Fully containerized application deployable to Azure Container Apps with Azure Developer CLI (azd)
23+
- **AI-Powered Categorization**: Intelligent product categorization using LangChain4j for enhanced product organization
24+
- **Secure Blob Storage**: Azure Blob Storage integration with SAS token generation for secure image handling
25+
- **Modern React UI**: Clean, responsive user interface for easy product upload and management
26+
- **Enterprise Security**: Entra ID authentication and role-based access control for production readiness
27+
28+
## Getting Started
29+
30+
### Quick Start with Azure
31+
32+
The fastest way to get started is to deploy directly to Azure:
33+
34+
1. **Fork this repository** to your GitHub account
35+
2. **Open in GitHub Codespace** (recommended) or clone locally
36+
3. **Login to Azure** and run deployment:
37+
```bash
38+
azd auth login
39+
azd up
40+
```
41+
4. **Access your application** at the provided endpoint after deployment completes
42+
43+
### Local Development
44+
45+
For local development and testing:
46+
47+
1. **Prerequisites**: Ensure you have Java 17+, Azure CLI, azd, and Docker installed
48+
2. **Build the common module**: Follow instructions in [src/java-ai-common/common/README.md](src/java-ai-common/common/README.md)
49+
3. **Start services in order**: Follow the detailed steps in the "Run locally" section below
50+
4. **Access the application** at http://localhost:3000
51+
52+
## Guidance
53+
54+
### Architecture Decisions
55+
56+
This application follows several architectural patterns:
57+
58+
- **Microservices Pattern**: Each service has a single responsibility and can be deployed independently
59+
- **API Gateway Pattern**: Centralized entry point for all client requests with service orchestration
60+
- **Service Discovery**: Uses Eureka for dynamic service registration and discovery in local development
61+
- **Event-Driven Architecture**: Services communicate through well-defined APIs and events
62+
- **Cloud-First Design**: Built specifically for Azure Container Apps with proper scaling and monitoring
63+
64+
### Best Practices Implemented
65+
66+
- **Security**: Entra ID authentication, managed identities, and secure secret management
67+
- **Monitoring**: Azure Log Analytics integration for comprehensive observability
68+
- **Scalability**: Container Apps auto-scaling based on demand
69+
- **Reliability**: Health checks, graceful degradation, and proper error handling
70+
- **Performance**: Optimized container images and efficient resource utilization
71+
72+
### Customization Guidelines
73+
74+
To adapt this application for your use case:
75+
76+
1. **Model Configuration**: Update AI model deployments in `infra/bicep/deploy.bicep`
77+
2. **Service Logic**: Modify business logic in individual service modules
78+
3. **UI Customization**: Update React components in `src/ai-shop-ui`
79+
4. **Data Models**: Extend DTOs in `src/java-ai-common` for additional fields
80+
5. **Infrastructure**: Adjust Azure resources in bicep templates as needed
81+
82+
## Resources
83+
84+
### Documentation
85+
86+
- [Azure Developer CLI Documentation](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/)
87+
- [Azure Container Apps Documentation](https://learn.microsoft.com/en-us/azure/container-apps/)
88+
- [Azure OpenAI Service Documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/)
89+
- [Spring Boot Documentation](https://spring.io/projects/spring-boot)
90+
- [Spring AI Documentation](https://spring.io/projects/spring-ai)
91+
- [LangChain4j Documentation](https://docs.langchain4j.dev/)
92+
93+
### Learning Resources
94+
95+
- [Azure AI Services Learning Path](https://learn.microsoft.com/en-us/training/paths/get-started-azure-ai/)
96+
- [Java on Azure Learning Path](https://learn.microsoft.com/en-us/training/paths/java-on-azure/)
97+
- [Microservices with Spring Boot](https://spring.io/microservices)
98+
- [React.js Tutorial](https://reactjs.org/tutorial/tutorial.html)
99+
100+
### Sample Code and Templates
101+
102+
- [Azure-Samples GitHub Organization](https://github.com/Azure-Samples)
103+
- [Azure Developer CLI Templates](https://azure.github.io/awesome-azd/)
104+
- [Spring Boot Sample Applications](https://github.com/spring-projects/spring-boot/tree/main/spring-boot-samples)
105+
106+
### Community and Support
107+
108+
- [Azure Developer Community](https://techcommunity.microsoft.com/t5/azure-developer-community/ct-p/AzureDevCommunity)
109+
- [Stack Overflow - Azure](https://stackoverflow.com/questions/tagged/azure)
110+
- [GitHub Issues](https://github.com/Azure-Samples/java-ai/issues) for project-specific questions
111+
- [Microsoft Q&A for Azure](https://learn.microsoft.com/en-us/answers/products/azure)
112+
16113
## Prerequisites
17114

18115
Easiest way to start is to Fork and [open the repository in a GitHub Codespace](https://github.com/codespaces/new/Azure-Samples/java-ai) as it contains all the prerequisites.

SECURITY.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
We release patches for security vulnerabilities. Which versions are eligible for receiving such patches depends on the CVSS v3.0 Rating:
6+
7+
| CVSS v3.0 | Supported Versions |
8+
| --------- | ----------------------------------------- |
9+
| 9.0-10.0 | Releases within the previous three months |
10+
| 4.0-8.9 | Most recent release |
11+
12+
## Reporting a Vulnerability
13+
14+
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
15+
16+
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.
17+
18+
## Reporting Security Issues
19+
20+
**Please do not report security vulnerabilities through public GitHub issues.**
21+
22+
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
23+
24+
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
25+
26+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
27+
28+
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
29+
30+
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
31+
* Full paths of source file(s) related to the manifestation of the issue
32+
* The location of the affected source code (tag/branch/commit or direct URL)
33+
* Any special configuration required to reproduce the issue
34+
* Step-by-step instructions to reproduce the issue
35+
* Proof-of-concept or exploit code (if possible)
36+
* Impact of the issue, including how an attacker might exploit the issue
37+
38+
This information will help us triage your report more quickly.
39+
40+
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
41+
42+
## Preferred Languages
43+
44+
We prefer all communications to be in English.
45+
46+
## Policy
47+
48+
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).

azure-dev.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json
2+
3+
name: java-ai-lab
4+
5+
workflows:
6+
up:
7+
- azd: provision
8+
- azd: package --all
9+
- azd: deploy --all
10+
11+
infra:
12+
provider: bicep
13+
path: infra/bicep
14+
15+
services:
16+
api-gateway:
17+
resourceName: ${apiGatewayContainerAppName}
18+
project: ./src/api-gateway
19+
host: containerapp
20+
language: java
21+
docker:
22+
registry: ${AZURE_CONTAINER_REGISTRY_ENDPOINT}
23+
image: java-ai/api-gateway
24+
tag: ${AZD_PROVISION_TIMESTAMP}
25+
remoteBuild: true
26+
27+
ai-image-processing-service:
28+
resourceName: ${imageProcessingServiceContainerAppName}
29+
project: ./src/ai-image-processing-service
30+
host: containerapp
31+
language: java
32+
docker:
33+
registry: ${AZURE_CONTAINER_REGISTRY_ENDPOINT}
34+
image: java-ai/ai-image-processing-service
35+
tag: ${AZD_PROVISION_TIMESTAMP}
36+
remoteBuild: true
37+
38+
blob-storage-service:
39+
resourceName: ${blobStorageServiceContainerAppName}
40+
project: ./src/blob-storage-service
41+
host: containerapp
42+
language: java
43+
docker:
44+
registry: ${AZURE_CONTAINER_REGISTRY_ENDPOINT}
45+
image: java-ai/blob-storage-service
46+
tag: ${AZD_PROVISION_TIMESTAMP}
47+
remoteBuild: true
48+
49+
ai-shop-ui:
50+
resourceName: ${aiShopUiContainerApps}
51+
project: ./src/ai-shop-ui
52+
host: containerapp
53+
language: js
54+
docker:
55+
registry: ${AZURE_CONTAINER_REGISTRY_ENDPOINT}
56+
image: java-ai/ai-shop-ui
57+
tag: ${AZD_PROVISION_TIMESTAMP}
58+
remoteBuild: true
59+
60+
item-category-service:
61+
resourceName: ${itemCategoryServiceContainerAppName}
62+
project: ./src/item-category-service
63+
host: containerapp
64+
language: java
65+
docker:
66+
registry: ${AZURE_CONTAINER_REGISTRY_ENDPOINT}
67+
image: java-ai/item-category-service
68+
tag: ${AZD_PROVISION_TIMESTAMP}
69+
remoteBuild: true
70+
71+
hooks:
72+
postprovision:
73+
posix:
74+
shell: sh
75+
run: 'chmod +x ./infra/bicep/hooks/export-env.sh; ./infra/bicep/hooks/export-env.sh'
76+
prepackage:
77+
posix:
78+
shell: sh
79+
run: 'chmod +x ./infra/bicep/hooks/build-java.sh; ./infra/bicep/hooks/build-java.sh'

0 commit comments

Comments
 (0)