Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring admin #3157

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
722cbc5
initial commit
iliyan-velichkov Dec 11, 2023
888c2de
add httpclient versions
iliyan-velichkov Dec 11, 2023
0067c4a
use jakarta packages
iliyan-velichkov Dec 11, 2023
060436c
adapt spring security
iliyan-velichkov Dec 11, 2023
97e4844
fix mail client
iliyan-velichkov Dec 11, 2023
95cbc2a
disable odata module for now
iliyan-velichkov Dec 11, 2023
b3e37d6
more adaptations
iliyan-velichkov Dec 11, 2023
e8a2737
disable odata
iliyan-velichkov Dec 11, 2023
9a0c6b4
more adaptations
iliyan-velichkov Dec 11, 2023
b70e84c
use newer interface
iliyan-velichkov Dec 11, 2023
8222340
minor fixes
iliyan-velichkov Dec 11, 2023
5a9cf0d
remove plugin versions
iliyan-velichkov Dec 11, 2023
c547dfe
fix EncryptionBeanPostProcessor
iliyan-velichkov Dec 11, 2023
5f2c19b
remove dep versions
iliyan-velichkov Dec 11, 2023
b8f8c70
disable odata
iliyan-velichkov Dec 11, 2023
fd81ac9
camel 3.21.2
iliyan-velichkov Dec 11, 2023
394c9ba
fix activemq dependencies version
iliyan-velichkov Dec 12, 2023
9187527
adapt Camel
iliyan-velichkov Dec 12, 2023
53bda24
adapt tests
iliyan-velichkov Dec 12, 2023
25b971d
add synchronized
iliyan-velichkov Dec 12, 2023
310fc3e
dummy KeycloakSecurityConfiguration
iliyan-velichkov Dec 12, 2023
a009298
fix integration tests
iliyan-velichkov Dec 12, 2023
e0cd9f6
fix javadoc plugin issue
iliyan-velichkov Dec 12, 2023
2ec8909
use migrated olingo dependency
iliyan-velichkov Dec 14, 2023
a99af45
Update README.md
iliyan-velichkov Dec 14, 2023
ac0ab12
fix startup errors
iliyan-velichkov Dec 15, 2023
07726e8
centralized plugins management
iliyan-velichkov Dec 15, 2023
4658ef8
maven compiler plugin centralized config
iliyan-velichkov Dec 15, 2023
189a173
maven-compiler-plugin in parent
iliyan-velichkov Dec 15, 2023
159535a
centralized formatter-maven-plugin
iliyan-velichkov Dec 15, 2023
c9dac53
set fixed plugins version
iliyan-velichkov Dec 15, 2023
43d257f
improve logging
iliyan-velichkov Dec 15, 2023
7afb67f
use olingo from the codbex fork repo
iliyan-velichkov Dec 17, 2023
799bb97
fix javadoc error
iliyan-velichkov Dec 17, 2023
1f686ac
integration tests on ubuntu as well
iliyan-velichkov Dec 17, 2023
998a988
Update pull-request.yml
iliyan-velichkov Dec 17, 2023
a094956
remove provided scopes
iliyan-velichkov Dec 18, 2023
cec41db
add keycloak conifugations
iliyan-velichkov Dec 18, 2023
9b2a662
rebase
iliyan-velichkov Dec 18, 2023
4c63065
remove dependencyManagement
iliyan-velichkov Dec 18, 2023
b12bef7
fix javadoc generation
iliyan-velichkov Dec 18, 2023
7834e6f
native images support
iliyan-velichkov Dec 19, 2023
da82f72
fix OData
iliyan-velichkov Dec 19, 2023
a726694
javax replacements
iliyan-velichkov Dec 19, 2023
e6cc74f
pom cleanup
iliyan-velichkov Dec 19, 2023
26b9f75
fix cxf conflict
iliyan-velichkov Dec 19, 2023
036ab8b
Spring Boot Admin Integration
iliyan-velichkov Nov 27, 2023
e79f346
adapt to the changes from master
iliyan-velichkov Nov 27, 2023
e3d7d39
install Spring Boot Admin using profile
iliyan-velichkov Nov 28, 2023
d80baa9
exclude SpringBootAdminIT from the tests by default
iliyan-velichkov Nov 28, 2023
29e484c
add spring boot job to workflows
iliyan-velichkov Nov 28, 2023
cdc16ea
adapt SpringBootAdminIT
iliyan-velichkov Nov 28, 2023
19f75bb
fix spring boot admin profile
iliyan-velichkov Nov 28, 2023
8c8fdb2
fix spring boot itests
iliyan-velichkov Nov 28, 2023
c88f09d
fix spring admin versions
iliyan-velichkov Dec 5, 2023
b6ad3a4
fix merge issues
iliyan-velichkov Dec 7, 2023
4672b20
fix more merge issues
iliyan-velichkov Dec 7, 2023
f2a861a
remove versions
iliyan-velichkov Dec 19, 2023
9345a10
rename role
iliyan-velichkov Dec 19, 2023
62a3cbb
protect actuator endpoints
iliyan-velichkov Dec 19, 2023
fffd052
fix integration tests execution
iliyan-velichkov Dec 19, 2023
e6b582b
clean context after SecurityIT
iliyan-velichkov Dec 19, 2023
9c502a9
@DirtiesContext on parent level
iliyan-velichkov Dec 19, 2023
7b73e96
merge
iliyan-velichkov Dec 21, 2023
3cbd342
fix merge issues
iliyan-velichkov Dec 21, 2023
f348e8b
Merge branch 'eclipse:master' into spring-admin
iliyan-velichkov Dec 28, 2023
b2e5a6c
Merge remote-tracking branch 'origin/master' into spring-admin
iliyan-velichkov Jan 3, 2024
730f081
fix HtmlElementType
iliyan-velichkov Jan 4, 2024
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
57 changes: 57 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ jobs:
run: npm i -g typescript
- name: Maven Build
run: mvn -T 1C clean install -D maven.test.skip=true -D skipTests -D maven.javadoc.skip=true -D license.skip=true -U
- if: runner.os == 'Windows'
run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
- name: Integration tests
run: mvn -f tests/pom.xml verify -P integration-tests
- name: Upload selenide screenshots
Expand All @@ -94,3 +96,58 @@ jobs:
retention-days: 1
name: selenide-screenshots
path: tests/build/reports/tests

integration-tests-spring-boot:
runs-on: ${{ matrix.os }}-latest
continue-on-error: true
strategy:
matrix:
os: [windows]
steps:
- name: Setup Chrome
uses: browser-actions/[email protected]
with:
chrome-version: stable
- if: runner.os == 'Linux'
run: chrome --version
- if: runner.os == 'macOS'
run: chromium --version
- if: runner.os == 'Windows'
run: (Get-Item (Get-Command chrome).Source).VersionInfo.ProductVersion
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Set up JDK Corretto 21
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '21'
architecture: x64
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install esbuild
run: npm i -g esbuild
- name: Install TypeScript compiler
run: npm i -g typescript
- name: Maven Build
run: mvn -T 1C clean install -P spring-boot-admin -D maven.test.skip=true -D skipTests -D maven.javadoc.skip=true -D license.skip=true -U
- if: runner.os == 'Windows'
run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
- name: Integration tests
run: mvn -f tests/pom.xml verify -P integration-tests-spring-boot-admin -D spring.profiles.active=spring-boot-admin
- name: Upload selenide screenshots
uses: actions/[email protected]
if: always()
with:
retention-days: 1
name: selenide-screenshots-spring-boot
path: tests/build/reports/tests

55 changes: 55 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ jobs:
run: npm i -g typescript
- name: Maven Build
run: mvn -T 1C clean install -D maven.test.skip=true -D skipTests -D maven.javadoc.skip=true -D license.skip=true -U
- if: runner.os == 'Windows'
run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
- name: Integration tests
run: mvn -f tests/pom.xml verify -P integration-tests
- name: Upload selenide screenshots
Expand All @@ -92,3 +94,56 @@ jobs:
retention-days: 1
name: selenide-screenshots
path: tests/build/reports/tests

integration-tests-spring-boot:
runs-on: ${{ matrix.os }}-latest
continue-on-error: true
strategy:
matrix:
os: [windows]
steps:
- name: Setup Chrome
uses: browser-actions/[email protected]
with:
chrome-version: stable
- if: runner.os == 'Linux'
run: chrome --version
- if: runner.os == 'macOS'
run: chromium --version
- if: runner.os == 'Windows'
run: (Get-Item (Get-Command chrome).Source).VersionInfo.ProductVersion
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Set up JDK Corretto 21
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 21
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install esbuild
run: npm i -g esbuild
- name: Install TypeScript compiler
run: npm i -g typescript
- name: Maven Build
run: mvn -T 1C clean install -P spring-boot-admin -D maven.test.skip=true -D skipTests -D maven.javadoc.skip=true -D license.skip=true -U
- if: runner.os == 'Windows'
run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
- name: Integration tests
run: mvn -f tests/pom.xml verify -P integration-tests-spring-boot-admin -D spring.profiles.active=spring-boot-admin
- name: Upload selenide screenshots
uses: actions/[email protected]
if: always()
with:
retention-days: 1
name: selenide-screenshots-spring-boot
path: tests/build/reports/tests
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ The project started as an internal SAP initiative to address the extension and a
- [Run](#run)
- [Standalone](#standalone)
- [Docker](#docker)
- [Native image](#native-image)
- [Code formatting](#code-formatting)
- [Native image](#native-image)
- [Code formatting](#code-formatting)
- [Spring Boot Admin](#spring-boot-admin)
- [Additional Information](#additional-information)
- [License](#license)
- [Contributors](#contributors)
Expand Down Expand Up @@ -258,6 +259,15 @@ To format the code using Maven execute the following in the root dir of the proj

mvn formatter:format

### Spring Boot Admin
If you want to enable [Spring Boot Admin](https://docs.spring-boot-admin.com/current/) for the Dirigible project, you need to build the project with maven profile `spring-boot-admin` and then activate spring profile `spring-boot-admin`.
To do this, you have to execute the following commands:
```
mvn -T 1C clean install -P spring-boot-admin -D maven.test.skip=true -D skipTests -D maven.javadoc.skip=true -D license.skip=true

java -jar -Dspring.profiles.active=spring-boot-admin build/application/target/dirigible-application-*-executable.jar
```

### CMS with AWS S3

Eclipse Dirigible's Document perspective can be used with [AWS S3](https://aws.amazon.com/s3/), providing you CMS with S3's cloud storage.
Expand Down Expand Up @@ -297,7 +307,6 @@ If you prefer working with a test environment you can use [LocalStack](https://w
- Start `LocalStack` using - `localstack start -d`
- Set up the environment variables, mainly `DIRIGIBLE_S3_PROVIDER=localstack`, exposed by Eclipse Dirigible


## Additional Information

### License
Expand Down
32 changes: 31 additions & 1 deletion build/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>${spring.admin.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

<dependencyManagement>
Expand Down Expand Up @@ -290,4 +296,28 @@
<parent.pom.folder>../../</parent.pom.folder>
</properties>

</project>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>spring-boot-admin</id>
<dependencies>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>${spring.admin.version}</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>${spring.admin.version}</version>
</dependency>
</dependencies>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;
import de.codecentric.boot.admin.server.config.EnableAdminServer;

@EnableAdminServer
@EnableJpaAuditing
@EnableJpaRepositories
@SpringBootApplication
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
spring.boot.admin.context-path=spring-admin
spring.boot.admin.ui.title=${spring.application.name} Admin
spring.boot.admin.ui.brand=<img src="/services/web/resources/images/dirigible.svg"><span>Eclipse Dirigible Admin</span>

spring.boot.admin.client.url=http://localhost:${server.port}/spring-admin
spring.boot.admin.client.username=${DIRIGIBLE_SPRING_ADMIN_USERNAME:admin}
spring.boot.admin.client.password=${DIRIGIBLE_SPRING_ADMIN_PASSWORD:admin}
spring.boot.admin.client.instance.metadata.user.name=${spring.boot.admin.client.username}
spring.boot.admin.client.instance.metadata.user.password=${spring.boot.admin.client.password}
8 changes: 8 additions & 0 deletions build/application/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
spring.application.name=Eclipse Dirigible

spring.main.allow-bean-definition-overriding=true

server.error.include-message=always
server.port=8080

spring.servlet.multipart.enabled=true
spring.servlet.multipart.file-size-threshold=2KB
Expand All @@ -20,4 +24,8 @@ management.metrics.mongo.connectionpool.enabled=false
spring.devtools.restart.poll-interval=6s
spring.devtools.restart.quiet-period=5s

management.endpoints.web.exposure.include=camelroutes,mappings,caches,configprops,camelroutes,metrics,threaddump,heapdump,loggers,health,quartz,scheduledtasks,env,beans,conditions,info
management.endpoints.health.show-details=always

cxf.path=/odata/v2

4 changes: 3 additions & 1 deletion build/application/src/main/resources/dirigible.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ DIRIGIBLE_DATABASE_PROVIDER=local
DIRIGIBLE_JAVASCRIPT_HANDLER_CLASS_NAME=org.eclipse.dirigible.graalium.handler.GraaliumJavascriptHandler
DIRIGIBLE_GRAALIUM_ENABLE_DEBUG=true
DIRIGIBLE_HOME_URL=services/web/ide/
DIRIGIBLE_DATABASE_NAMES_CASE_SENSITIVE=true
DIRIGIBLE_DATABASE_NAMES_CASE_SENSITIVE=true
DIRIGIBLE_SPRING_ADMIN_USERNAME=admin
DIRIGIBLE_SPRING_ADMIN_PASSWORD=admin
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2023 SAP SE or an SAP affiliate company and Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v2.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and Eclipse Dirigible
* contributors SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.dirigible.components.base.http.access;

public enum DirigibleRole {

DEVELOPER(RoleNames.DEVELOPER), OPERATOR(RoleNames.OPERATOR);

private final String roleName;

DirigibleRole(String roleName) {
this.roleName = roleName;
}

public String getName() {
return roleName;
}

@SuppressWarnings("hiding")
public static class RoleNames {
public static final String OPERATOR = "Operator";
public static final String DEVELOPER = "Developer";

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class HttpSecurityURIConfigurator {
"/services/js/resources-core/**", //
"/services/js/resources-core/**", //
"/services/integrations/**", //
"/actuator/**"};
"/actuator/health"};

private static final String[] AUTHENTICATED_PATTERNS = {//
"/services/**", //
Expand All @@ -51,6 +51,10 @@ public class HttpSecurityURIConfigurator {
"/services/ide/**", //
"/websockets/ide/**"};

private static final String[] OPERATOR_PATTERNS = {//
"/spring-admin/**", //
"/actuator/**"};

/**
* Configure.
*
Expand All @@ -68,7 +72,11 @@ public static void configure(HttpSecurity http) throws Exception {

// "Developer" role required
.requestMatchers(DEVELOPER_PATTERNS)
.hasRole("Developer")
.hasRole(DirigibleRole.DEVELOPER.getName())

// Spring Boot Admin
.requestMatchers(OPERATOR_PATTERNS)
.hasRole(DirigibleRole.OPERATOR.getName())

// Deny all other requests
.anyRequest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import org.apache.commons.codec.binary.Base64;
import org.eclipse.dirigible.components.base.http.access.DirigibleRole;
import org.eclipse.dirigible.components.base.http.access.HttpSecurityURIConfigurator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
Expand Down Expand Up @@ -51,7 +52,7 @@ InMemoryUserDetailsManager userDetailsService() {
String password = org.eclipse.dirigible.commons.config.Configuration.get("DIRIGIBLE_BASIC_PASSWORD", "YWRtaW4="); // admin
UserDetails user = User.withUsername(new String(new Base64().decode(username.getBytes()), StandardCharsets.UTF_8).trim())
.password("{noop}" + new String(new Base64().decode(password.getBytes()), StandardCharsets.UTF_8).trim())
.roles("DEVELOPER", "OPERATOR")
.roles(DirigibleRole.DEVELOPER.getName(), DirigibleRole.OPERATOR.getName())
.build();
return new InMemoryUserDetailsManager(user);
}
Expand Down
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@
<license-maven-plugin.version>4.3</license-maven-plugin.version>

<spring.boot.version>3.2.0</spring.boot.version>
<spring.admin.version>3.1.8</spring.admin.version>

<org.springdoc.openapi.ui.version>1.7.0</org.springdoc.openapi.ui.version>
<c3p0.version>0.9.5.5</c3p0.version>
<graalvm.version>23.1.1</graalvm.version>
Expand Down Expand Up @@ -736,5 +738,4 @@
</dependency>
</dependencies>
</dependencyManagement>

</project>
</project>
Loading
Loading