diff --git a/build.gradle.kts b/build.gradle.kts index 201bc32..56dfb14 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -421,6 +421,12 @@ jib { environment = mapOf( // Disable Spring Boot Docker Compose support when running in container + // Docker Compose integration is disabled in the container image. + // It is only useful for local development (HTTP profile) where + // the host has Docker and a compose.yaml. Inside a container, + // Docker Compose cannot start sibling containers without a + // Docker socket mount, so it must be turned off. + // The application-stdio.properties also disables it for STDIO mode. "SPRING_DOCKER_COMPOSE_ENABLED" to "false", ) diff --git a/dev-docs/DEVELOPMENT.md b/dev-docs/DEVELOPMENT.md index 5ccc4c1..a9624c1 100644 --- a/dev-docs/DEVELOPMENT.md +++ b/dev-docs/DEVELOPMENT.md @@ -65,9 +65,12 @@ java -jar build/libs/solr-mcp-1.0.0-SNAPSHOT.jar #### HTTP Mode ```bash -./gradlew bootRun --args='--spring.profiles.active=http' +PROFILES=http ./gradlew bootRun ``` +Spring Boot Docker Compose will automatically start the services declared in `compose.yaml` +(Solr, ZooKeeper, and optionally LGTM for observability) before the application starts. + The server will start on http://localhost:8080 ### Environment Variables @@ -131,7 +134,7 @@ The [MCP Inspector](https://github.com/modelcontextprotocol/inspector) provides ```bash # Start the server in HTTP mode -./gradlew bootRun --args='--spring.profiles.active=http' +PROFILES=http ./gradlew bootRun # In another terminal, start MCP Inspector npx @modelcontextprotocol/inspector diff --git a/dev-docs/TROUBLESHOOTING.md b/dev-docs/TROUBLESHOOTING.md index c18f232..2e14db4 100644 --- a/dev-docs/TROUBLESHOOTING.md +++ b/dev-docs/TROUBLESHOOTING.md @@ -275,7 +275,7 @@ rm -rf .gradle 1. **Verify server is running in HTTP mode** ```bash - ./gradlew bootRun --args='--spring.profiles.active=http' + PROFILES=http ./gradlew bootRun ``` 2. **Check port is correct** @@ -408,7 +408,7 @@ If you're still having issues: ./gradlew bootRun 2>&1 | tee server.log # HTTP mode - Spring Boot logging -./gradlew bootRun --args='--spring.profiles.active=http' +PROFILES=http ./gradlew bootRun ``` ### Solr Logs diff --git a/security-docs/AUTH0_SETUP.md b/security-docs/AUTH0_SETUP.md index 1672621..4d1027d 100644 --- a/security-docs/AUTH0_SETUP.md +++ b/security-docs/AUTH0_SETUP.md @@ -287,15 +287,7 @@ OAUTH2_ISSUER_URI=https://your-tenant.auth0.com/ The application must run in `http` profile to enable OAuth2 security: ```bash -# Option 1: Using environment variable -export PROFILES=http -./gradlew bootRun - -# Option 2: Using Spring Boot argument -./gradlew bootRun --args='--spring.profiles.active=http' - -# Option 3: Using Gradle property -./gradlew bootRun -Dspring.profiles.active=http +PROFILES=http ./gradlew bootRun ``` ### Application Configuration Details diff --git a/src/main/resources/application-http.properties b/src/main/resources/application-http.properties index 12e2d94..95daa2e 100644 --- a/src/main/resources/application-http.properties +++ b/src/main/resources/application-http.properties @@ -2,6 +2,9 @@ spring.main.web-application-type=servlet spring.ai.mcp.server.type=sync spring.ai.mcp.server.protocol=stateless spring.ai.mcp.server.stdio=false +# Docker Compose integration: automatically start Solr and other services on bootRun. +# Spring Boot detects compose.yaml and starts declared services before the application context. +spring.docker.compose.enabled=true # OAuth2 Security Configuration # Configure the issuer URI for your OAuth2 authorization server # For Auth0: https:///.well-known/openid-configuration diff --git a/src/main/resources/application-stdio.properties b/src/main/resources/application-stdio.properties index f72e9e8..b8864df 100644 --- a/src/main/resources/application-stdio.properties +++ b/src/main/resources/application-stdio.properties @@ -7,3 +7,6 @@ spring.ai.mcp.server.stdio=true spring.autoconfigure.exclude=\ org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration +# Docker Compose integration is only useful in HTTP mode for local development. +# Disable it in STDIO mode to avoid startup delays and unexpected container management. +spring.docker.compose.enabled=false