Loading Dockerfile 0 → 100644 +32 −0 Original line number Diff line number Diff line # Build stage FROM maven:3.9-eclipse-temurin-17 AS builder WORKDIR /build # Copy pom.xml and download dependencies COPY pom.xml . RUN mvn dependency:resolve # Copy source code COPY src ./src # Build the application RUN mvn clean package -DskipTests # Runtime stage FROM eclipse-temurin:17-jre WORKDIR /app # Copy the built JAR from builder stage COPY --from=builder /build/target/org.etsi.osl.controllers.askagent-0.0.1-SNAPSHOT.jar app.jar # Expose default port (server.port=0 in application.yaml means random port, override if needed) EXPOSE 8080 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD java -cp app.jar org.springframework.boot.loader.JarLauncher -v || exit 1 # Run the application ENTRYPOINT ["java", "-jar", "app.jar"] README.md +66 −5 Original line number Diff line number Diff line Loading @@ -13,6 +13,10 @@ An AI-powered agent service for the OpenSlice (ETSI OSL) ecosystem. This Spring ## Prerequisites ### Docker Compose (Recommended) - Docker and Docker Compose ### Local Development - Java 17 or higher - Maven 3.6+ - [Ollama](https://ollama.ai/) running locally with a compatible model Loading @@ -20,20 +24,44 @@ An AI-powered agent service for the OpenSlice (ETSI OSL) ecosystem. This Spring ## Quick Start ### 1. Start Required Services ### Option 1: Docker Compose (Recommended) Start the entire stack with a single command: ```bash docker-compose up -d ``` This starts: - **Ollama** on port 11434 - **ActiveMQ/Artemis** on ports 61616 and 8161 - **Ask Agent** on port 8080 **Start Ollama:** All services are configured to communicate automatically. View logs with: ```bash docker-compose logs -f ``` Stop all services with: ```bash docker-compose down ``` ### Option 2: Local Development **1. Start Required Services** Start Ollama: ```bash ollama run qwen3:8b ``` **Start ActiveMQ/Artemis:** Start ActiveMQ/Artemis (follow your installation instructions): ```bash # Follow your ActiveMQ/Artemis installation instructions # Default configuration expects broker at tcp://localhost:61616 ``` ### 2. Build and Run **2. Build and Run** ```bash # Build the project Loading Loading @@ -113,6 +141,31 @@ mvn package The executable JAR will be in `target/` directory. ### Build Docker Image ```bash docker build -t osl-ask-agent:latest . ``` Uses a two-stage build for optimal image size. ### Docker Compose Management ```bash # Start services docker-compose up -d # View logs docker-compose logs -f # Stop services docker-compose down # Remove volumes (clean slate) docker-compose down -v # Rebuild services docker-compose up -d --build ``` ### Changing AI Model Edit `application.yaml`: Loading @@ -120,6 +173,14 @@ Edit `application.yaml`: spring.ai.ollama.chat.options.model: llama3:8b # or any Ollama model ``` Or override via environment variable: ```bash export SPRING_AI_OLLAMA_CHAT_OPTIONS_MODEL=llama3:8b mvn spring-boot:run ``` When using Docker Compose, edit the `docker-compose.yml` and redeploy. ### Adding Custom Tools Create a `@Component` that implements `ToolCallbackProvider` - it will be automatically discovered and injected into ChatController. Loading docker-compose.yml 0 → 100644 +42 −0 Original line number Diff line number Diff line version: '3.8' services: ollama: image: ollama/ollama:latest container_name: osl-ollama ports: - "11434:11434" environment: - OLLAMA_HOST=0.0.0.0:11434 volumes: - ollama_data:/root/.ollama healthcheck: test: ["CMD", "curl", "-f", "http://localhost:11434/api/tags"] interval: 10s timeout: 5s retries: 5 start_period: 30s ask-agent: build: context: . dockerfile: Dockerfile container_name: osl-ask-agent ports: - "8080:8080" environment: - SPRING_ACTIVEMQ_BROKERURL=tcp://activemq:61616 - SPRING_AI_OLLAMA_BASE_URL=http://ollama:11434 - SPRING_ACTIVEMQ_USER=artemis - SPRING_ACTIVEMQ_PASSWORD=artemis - LOGGING_LEVEL_ROOT=INFO - LOGGING_LEVEL_ORG_ETSI_OSL=DEBUG healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"] interval: 30s timeout: 3s retries: 3 start_period: 10s volumes: ollama_data: Loading
Dockerfile 0 → 100644 +32 −0 Original line number Diff line number Diff line # Build stage FROM maven:3.9-eclipse-temurin-17 AS builder WORKDIR /build # Copy pom.xml and download dependencies COPY pom.xml . RUN mvn dependency:resolve # Copy source code COPY src ./src # Build the application RUN mvn clean package -DskipTests # Runtime stage FROM eclipse-temurin:17-jre WORKDIR /app # Copy the built JAR from builder stage COPY --from=builder /build/target/org.etsi.osl.controllers.askagent-0.0.1-SNAPSHOT.jar app.jar # Expose default port (server.port=0 in application.yaml means random port, override if needed) EXPOSE 8080 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD java -cp app.jar org.springframework.boot.loader.JarLauncher -v || exit 1 # Run the application ENTRYPOINT ["java", "-jar", "app.jar"]
README.md +66 −5 Original line number Diff line number Diff line Loading @@ -13,6 +13,10 @@ An AI-powered agent service for the OpenSlice (ETSI OSL) ecosystem. This Spring ## Prerequisites ### Docker Compose (Recommended) - Docker and Docker Compose ### Local Development - Java 17 or higher - Maven 3.6+ - [Ollama](https://ollama.ai/) running locally with a compatible model Loading @@ -20,20 +24,44 @@ An AI-powered agent service for the OpenSlice (ETSI OSL) ecosystem. This Spring ## Quick Start ### 1. Start Required Services ### Option 1: Docker Compose (Recommended) Start the entire stack with a single command: ```bash docker-compose up -d ``` This starts: - **Ollama** on port 11434 - **ActiveMQ/Artemis** on ports 61616 and 8161 - **Ask Agent** on port 8080 **Start Ollama:** All services are configured to communicate automatically. View logs with: ```bash docker-compose logs -f ``` Stop all services with: ```bash docker-compose down ``` ### Option 2: Local Development **1. Start Required Services** Start Ollama: ```bash ollama run qwen3:8b ``` **Start ActiveMQ/Artemis:** Start ActiveMQ/Artemis (follow your installation instructions): ```bash # Follow your ActiveMQ/Artemis installation instructions # Default configuration expects broker at tcp://localhost:61616 ``` ### 2. Build and Run **2. Build and Run** ```bash # Build the project Loading Loading @@ -113,6 +141,31 @@ mvn package The executable JAR will be in `target/` directory. ### Build Docker Image ```bash docker build -t osl-ask-agent:latest . ``` Uses a two-stage build for optimal image size. ### Docker Compose Management ```bash # Start services docker-compose up -d # View logs docker-compose logs -f # Stop services docker-compose down # Remove volumes (clean slate) docker-compose down -v # Rebuild services docker-compose up -d --build ``` ### Changing AI Model Edit `application.yaml`: Loading @@ -120,6 +173,14 @@ Edit `application.yaml`: spring.ai.ollama.chat.options.model: llama3:8b # or any Ollama model ``` Or override via environment variable: ```bash export SPRING_AI_OLLAMA_CHAT_OPTIONS_MODEL=llama3:8b mvn spring-boot:run ``` When using Docker Compose, edit the `docker-compose.yml` and redeploy. ### Adding Custom Tools Create a `@Component` that implements `ToolCallbackProvider` - it will be automatically discovered and injected into ChatController. Loading
docker-compose.yml 0 → 100644 +42 −0 Original line number Diff line number Diff line version: '3.8' services: ollama: image: ollama/ollama:latest container_name: osl-ollama ports: - "11434:11434" environment: - OLLAMA_HOST=0.0.0.0:11434 volumes: - ollama_data:/root/.ollama healthcheck: test: ["CMD", "curl", "-f", "http://localhost:11434/api/tags"] interval: 10s timeout: 5s retries: 5 start_period: 30s ask-agent: build: context: . dockerfile: Dockerfile container_name: osl-ask-agent ports: - "8080:8080" environment: - SPRING_ACTIVEMQ_BROKERURL=tcp://activemq:61616 - SPRING_AI_OLLAMA_BASE_URL=http://ollama:11434 - SPRING_ACTIVEMQ_USER=artemis - SPRING_ACTIVEMQ_PASSWORD=artemis - LOGGING_LEVEL_ROOT=INFO - LOGGING_LEVEL_ORG_ETSI_OSL=DEBUG healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"] interval: 30s timeout: 3s retries: 3 start_period: 10s volumes: ollama_data: