Commit 1041df5f authored by Kostis Trantzas's avatar Kostis Trantzas
Browse files

Merge branch '2-implement-authorization-controller' into 'develop'

Implement authorization controller and Chat UI

See merge request !1
parents 5922d220 e62b8c08
Loading
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+40 −0
Original line number Diff line number Diff line
include:
  - project: osl/code/org.etsi.osl.main
    ref: main
    file: 
      - ci-templates/default.yml
      - ci-templates/build.yml
    rules:
      - if: '$CI_COMMIT_REF_NAME == "main"'
  
  - project: osl/code/org.etsi.osl.main
    ref: develop
    file: 
      - ci-templates/default.yml
      - ci-templates/build.yml
    rules:
      - if: '$CI_COMMIT_REF_NAME == "develop"'

  - project: osl/code/org.etsi.osl.main
    ref: $CI_COMMIT_REF_NAME
    file: 
      - ci-templates/default.yml
      - ci-templates/build.yml
    rules:
      - if: '$CI_COMMIT_REF_PROTECTED == "true" && $CI_COMMIT_REF_NAME != "main" && $CI_COMMIT_REF_NAME != "develop"'

  - project: osl/code/org.etsi.osl.main
    ref: develop
    file: 
      - ci-templates/default.yml
      - ci-templates/build_unprotected.yml
    rules:
      - if: '$CI_COMMIT_REF_NAME != "main" && $CI_COMMIT_REF_NAME != "develop" && $CI_COMMIT_REF_PROTECTED == "false"'

maven_build:
  extends: .maven_build

docker_build:
  extends: .docker_build
  needs:
    - maven_build
+13 −13
Original line number Diff line number Diff line
# Build stage
# ---------- Stage 1: Build ----------
FROM maven:3.9-eclipse-temurin-17 AS builder
WORKDIR /app

WORKDIR /build

# Copy pom.xml and download dependencies
# Copy pom.xml and download dependencies first (cache layer)
COPY pom.xml .
RUN mvn dependency:go-offline
RUN mvn dependency:go-offline -B

# Copy source code
# Copy the rest of the source code
COPY src ./src

# Build application
# Build the Spring Boot executable JAR
RUN mvn clean package -DskipTests

# Runtime stage
# ---------- Stage 2: Runtime ----------
FROM eclipse-temurin:17-jre-alpine

WORKDIR /app
# Create application directory
RUN mkdir -p /opt/openslice/lib/

# Copy built JAR from builder stage
COPY --from=builder /build/target/org.etsi.osl.mcp.backend-0.0.1-SNAPSHOT.jar app.jar
# Copy the built JAR from the builder stage
COPY --from=builder /app/target/org.etsi.osl.mcp.backend-0.0.1-SNAPSHOT.jar /opt/openslice/lib/app.jar

# Expose port
EXPOSE 11880

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
    CMD wget --no-verbose --tries=1 --spider http://localhost:11880/actuator/health || exit 1

# Run application
ENTRYPOINT ["java", "-jar", "app.jar"]
CMD ["java", "-jar", "/opt/openslice/lib/app.jar"]

ci_settings.xml

0 → 100644
+16 −0
Original line number Diff line number Diff line
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
  <servers>
    <server>
      <id>gitlab-maven</id>
      <configuration>
        <httpHeaders>
          <property>
            <name>Job-Token</name>
            <value>${CI_JOB_TOKEN}</value>
          </property>
        </httpHeaders>
      </configuration>
    </server>
  </servers>
</settings>
+32 −3
Original line number Diff line number Diff line
@@ -29,17 +29,46 @@ services:
    ports:
      - "11880:11880"
    environment:
      # Server Configuration
      SERVER_PORT: 11880
      SPRING_APPLICATION_NAME: osl-mcp-backend
      
      # AI Configuration
      SPRING_AI_OLLAMA_BASE_URL: http://ollama:11434
      SPRING_AI_MCP_CLIENT_STREAMABLE_HTTP_CONNECTIONS_OPENSLICE_SERVER_URL: http://mcp-server:13015
      SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_AUTHSERVER_ISSUER_URI: http://keycloak:8080/auth/realms/openslice
      SPRING_ACTIVEMQ_BROKERURL: tcp://activemq:61616
      SPRING_AI_OLLAMA_CHAT_MODEL:  gpt-oss:20b
      SPRING_AI_OLLAMA_CHAT_TEMPERATURE: 0.7
      
      # MCP Client Configuration
      SPRING_AI_MCP_CLIENT_TYPE: SYNC
      SPRING_AI_MCP_CLIENT_STREAMABLE_HTTP_CONNECTIONS_OPENSLICE_SERVER_URL: http://openslice-mcp:13015/sse
      
      # OAuth2/Keycloak Configuration
      SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI: http://keycloak:8080/auth/realms/openslice
      SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_KEYCLOAK_ISSUER_URI: http://keycloak:8080/auth/realms/openslice
      SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KEYCLOAK_CLIENT_ID: osapiWebClientId
      
      # ActiveMQ Configuration
      SPRING_ACTIVEMQ_BROKER_URL: tcp://anartemis:61616?jms.watchTopicAdvisories=false
      SPRING_ACTIVEMQ_USER: artemis
      SPRING_ACTIVEMQ_PASSWORD: artemis
      
      # Logging Configuration
      LOGGING_LEVEL_ROOT: INFO
      LOGGING_LEVEL_OSL: DEBUG
      LOGGING_LEVEL_SPRING_AI: DEBUG
    depends_on:
      - ollama
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:11880/actuator/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s

volumes:
  ollama_data:

networks:
  default:
    name: compose_back
    external: true
+12 −0
Original line number Diff line number Diff line
@@ -51,6 +51,14 @@
	
	
	<dependencies>
		<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-oauth2-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
        </dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
@@ -73,6 +81,10 @@
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
		
		<!-- security -->
		<dependency>
Loading