Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ services:
build:
context: .
dockerfile: pipeline/Dockerfile
target: dev
image: pipeline-app
container_name: pipeline-app
environment:
Expand Down
4 changes: 4 additions & 0 deletions monitoring/docker-compose-monitoring-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ services:
condition: service_started

pipeline-app:
build:
context: .
dockerfile: pipeline/Dockerfile
target: monitoring
environment:
OTEL_EXPORTER_OTLP_ENDPOINT: http://alloy:4317
OTEL_EXPORTER_OTLP_PROTOCOL: grpc
Expand Down
5 changes: 4 additions & 1 deletion pipeline/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ build/
.vscode/*

## Don't Ignore Templates
!.vscode/*.template
!.vscode/*.template

### SQLite local dev database ###
*.db
4 changes: 2 additions & 2 deletions pipeline/.vscode/launch.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"projectName": "pipeline",
"console": "internalConsole",
"env": {
"SPRING_PROFILES_ACTIVE": "default,h2InMemory"
"SPRING_PROFILES_ACTIVE": "default,sqlite"
}
},
{
Expand All @@ -20,7 +20,7 @@
"projectName": "pipeline",
"console": "internalConsole",
"env": {
"SPRING_PROFILES_ACTIVE": "basicAuth,h2InMemory"
"SPRING_PROFILES_ACTIVE": "basicAuth,sqlite"
}
}
]
Expand Down
27 changes: 23 additions & 4 deletions pipeline/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@
#
# Build stage
# Dev build stage
#
FROM maven:3.9.6-eclipse-temurin-17 AS build
WORKDIR /home/app
COPY pipeline/pom.xml .
COPY pipeline/src ./src
COPY apis/protobuf /home/apis/protobuf
RUN mvn clean package -DskipTests

#
# Monitoring build stage
#
FROM maven:3.9.6-eclipse-temurin-17 AS build-monitoring
WORKDIR /home/app
COPY pipeline/pom.xml .
COPY pipeline/src ./src
COPY apis/protobuf /home/apis/protobuf
RUN mvn clean package -DskipTests -Pmonitoring

#
# Runtime stage
# Dev runtime target
#
FROM eclipse-temurin:17-jdk-jammy
FROM eclipse-temurin:17-jdk-jammy AS dev
WORKDIR /app
COPY --from=build /home/app/target/pipeline*.jar app.jar
COPY --from=build /home/app/target/agents/opentelemetry-javaagent.jar otel-agent.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]

#
# Monitoring runtime target
#
FROM eclipse-temurin:17-jdk-jammy AS monitoring
WORKDIR /app
COPY --from=build-monitoring /home/app/target/pipeline*.jar app.jar
COPY --from=build-monitoring /home/app/target/agents/opentelemetry-javaagent.jar otel-agent.jar
EXPOSE 8080
ENTRYPOINT ["java", "-javaagent:otel-agent.jar", "-jar", "app.jar"]
11 changes: 8 additions & 3 deletions pipeline/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,15 @@
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.47.2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-community-dialects</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down Expand Up @@ -318,7 +323,7 @@
<configuration>
<profiles>
<profile>default</profile>
<profile>h2InMemory</profile>
<profile>sqlite</profile>
</profiles>
</configuration>
<executions>
Expand Down
25 changes: 11 additions & 14 deletions pipeline/src/main/resources/application-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,23 @@

spring:
datasource:
url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
driverClassName: org.h2.Driver
username: sa
url: jdbc:sqlite:file::memory:?cache=shared
driver-class-name: org.sqlite.JDBC
username:
password:

jpa:
hibernate:
ddl-auto: create-drop
show-sql: false
database-platform: org.hibernate.dialect.H2Dialect

h2:
console:
enabled: true
path: /h2-console
database-platform: org.hibernate.community.dialect.SQLiteDialect

autoconfigure:
exclude:
- org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration
- org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration
security:
oauth2:
resourceserver:
jwt:
issuer-uri: https://mock-issuer.test
jwk-set-uri: https://mock-jwk-set-uri.test

feature-flags:
provider:
Expand Down
14 changes: 5 additions & 9 deletions pipeline/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,16 @@ spring:
spring:
config:
activate:
on-profile: h2InMemory
on-profile: sqlite
datasource:
url: jdbc:h2:mem:mydb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
driverClassName: org.h2.Driver
username: sa
url: jdbc:sqlite:./pipeline.db
driver-class-name: org.sqlite.JDBC
username:
password:
jpa:
hibernate:
ddl-auto: update
show-sql: false
database-platform: org.hibernate.dialect.H2Dialect
h2:
console:
enabled: true
path: /h2-console
database-platform: org.hibernate.community.dialect.SQLiteDialect


Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;

Expand All @@ -29,16 +28,7 @@
*/
@SpringBootTest
@AutoConfigureMockMvc
@ActiveProfiles("demo")
@TestPropertySource(properties = {
"spring.security.oauth2.resourceserver.jwt.issuer-uri=https://mock-issuer.test",
"spring.security.oauth2.resourceserver.jwt.jwk-set-uri=https://mock-jwk-set-uri.test",
"spring.datasource.url=jdbc:h2:mem:testdb",
"spring.datasource.driverClassName=org.h2.Driver",
"spring.datasource.username=sa",
"spring.datasource.password=",
"spring.jpa.hibernate.ddl-auto=create-drop"
})
@ActiveProfiles("test")
class SecurityConfigTest {

@Autowired
Expand Down
Loading