Skip to content

Use latest custom stack approach, fix demo project and IT #43

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

Merged
merged 2 commits into from
Jun 3, 2024
Merged
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
23 changes: 10 additions & 13 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,47 +45,44 @@ jobs:
continue-on-error: true
strategy:
matrix:
os: [ windows ]
os: [ macos ]
steps:
- name: Setup Chrome
uses: browser-actions/setup-chrome@v1.3.0
uses: browser-actions/setup-chrome@v1.5.0
with:
chrome-version: stable
- if: runner.os == 'Linux'
run: chrome --version
- if: runner.os == 'macOS'
run: chromium --version
run: '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version'
- if: runner.os == 'Windows'
run: (Get-Item (Get-Command chrome).Source).VersionInfo.ProductVersion
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache local Maven repository
uses: actions/cache@v3
uses: actions/cache@v4
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
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'
architecture: x64
java-version: 21
- name: Install NodeJS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
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 -D skipTests -D maven.javadoc.skip=true -D license.skip=true -U
- name: Integration tests
run: mvn verify -P integration-tests
run: mvn clean install -P integration-tests
- name: Upload selenide screenshots
uses: actions/upload-artifact@v3.1.3
uses: actions/upload-artifact@v4.3.1
if: always()
with:
retention-days: 1
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,46 +43,44 @@ jobs:
continue-on-error: true
strategy:
matrix:
os: [ windows ]
os: [ macos ]
steps:
- name: Setup Chrome
uses: browser-actions/setup-chrome@v1.3.0
uses: browser-actions/setup-chrome@v1.5.0
with:
chrome-version: stable
- if: runner.os == 'Linux'
run: chrome --version
- if: runner.os == 'macOS'
run: chromium --version
run: '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version'
- if: runner.os == 'Windows'
run: (Get-Item (Get-Command chrome).Source).VersionInfo.ProductVersion
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache local Maven repository
uses: actions/cache@v3
uses: actions/cache@v4
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
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 21
- name: Install NodeJS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
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 -D skipTests -D maven.javadoc.skip=true -D license.skip=true -U
- name: Integration tests
run: mvn verify -P integration-tests
run: mvn clean install -P integration-tests
- name: Upload selenide screenshots
uses: actions/upload-artifact@v3.1.3
uses: actions/upload-artifact@v4.3.1
if: always()
with:
retention-days: 1
Expand Down
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,42 @@ It is good for exploration about the different features and their applicability

#### Docker

- Build image locally (if you have local changes)
```
docker build application/. --tag ghcr.io/dirigiblelabs/custom-stack:latest
```
- Run directly the released image
```
docker pull ghcr.io/dirigiblelabs/custom-stack:latest
docker run --name custom-stack --rm -p 8080:8080 ghcr.io/dirigiblelabs/custom-stack:latest
```

- For Apple's M1: provide `--platform=linux/arm64` for better performance
**Note:** for Apple's M1: provide `--platform=linux/arm64` for better performance

#### Build

```
mvn clean install
```
##### Maven Profiles

| Profile Name | Description |
|-------------------|---------------------------------------------|
| tests | Run unit and integration tests |
| unit-tests | Run unit tests |
| integration-tests | Run integration tests |
| quick-build | Build project quickly by skipping all tests |


#### Run

```
java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED -jar application/target/custom-stack-application-*.jar
java -jar application/target/custom-stack-application-*.jar
```

#### Debug

```
java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 -jar application/target/custom-stack-application-*.jar
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 -jar application/target/custom-stack-application-*.jar
```

#### Web
Expand Down Expand Up @@ -160,4 +173,4 @@ export class ExampleClient {
return response;
}
}
```
```
5 changes: 4 additions & 1 deletion application/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM amazoncorretto:22-alpine
FROM amazoncorretto:21-alpine

VOLUME /tmp

Expand All @@ -7,4 +7,7 @@ RUN npm i -g esbuild
RUN npm i -g typescript

COPY target/*.jar custom-stack.jar

EXPOSE 8080

ENTRYPOINT ["java", "--add-opens", "java.base/java.lang=ALL-UNNAMED", "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", "--add-opens", "java.base/java.nio=ALL-UNNAMED", "-jar", "/custom-stack.jar"]
73 changes: 9 additions & 64 deletions application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
<dependency>
<groupId>io.dirigible.samples</groupId>
<artifactId>custom-stack-apis</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.dirigible.samples</groupId>
<artifactId>custom-stack-branding</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>uk.org.okapibarcode</groupId>
Expand Down Expand Up @@ -67,26 +65,6 @@
<groupId>org.eclipse.dirigible</groupId>
<artifactId>dirigible-components-group-engines</artifactId>
<type>pom</type>
<exclusions>
<exclusion>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>
cxf-spring-boot-starter-jaxrs
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.dirigible</groupId>
Expand Down Expand Up @@ -137,13 +115,6 @@
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>

<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>7.3.1</version>
<scope>test</scope>
</dependency>

<!-- Drivers -->
<dependency>
<groupId>org.postgresql</groupId>
Expand All @@ -156,59 +127,33 @@
<dependency>
<groupId>com.sap.cloud.db.jdbc</groupId>
<artifactId>ngdbc</artifactId>
<version>${ngdbc.version}</version>
</dependency>
<dependency>
<groupId>net.snowflake</groupId>
<artifactId>snowflake-jdbc</artifactId>
<version>${snowflake.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.dirigible</groupId>
<artifactId>dirigible-tests-framework</artifactId>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>io.dirigible.samples.CustomStackApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>${git-commit-id-plugin.version}</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<dotGitDirectory>../.git</dotGitDirectory>
</configuration>
</plugin>
</plugins>

<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>

<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>

</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ spring.security.oauth2.client.registration.keycloak.client-id=${DIRIGIBLE_KEYCLO
spring.security.oauth2.client.registration.keycloak.scope=openid,profile,roles,microprofile-jwt,email,phone,web-origins,address,offline_access
spring.security.oauth2.client.registration.keycloak.authorization-grant-type=authorization_code

spring.security.oauth2.client.provider.keycloak.user-name-attribute=preferred_username
spring.security.oauth2.client.provider.keycloak.user-name-attribute=preferred_username
4 changes: 4 additions & 0 deletions application/src/main/resources/application-oauth.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
basic.enabled=false

spring.security.oauth2.client.registration.github.clientId=${GITHUB_CLIENT_ID}
spring.security.oauth2.client.registration.github.clientSecret=${GITHUB_CLIENT_SECRET}
22 changes: 4 additions & 18 deletions application/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,18 @@ spring.mvc.async.request-timeout=3600000

basic.enabled=${DIRIGIBLE_BASIC_ENABLED:true}

terminal.enabled=${DIRIGIBLE_TERMINAL_ENABLED:false}

keycloak.enabled=${DIRIGIBLE_KEYCLOAK_ENABLED:false}
keycloak.realm=${DIRIGIBLE_KEYCLOAK_REALM:null}
keycloak.auth-server-url=${DIRIGIBLE_KEYCLOAK_AUTH_SERVER_URL:null}
keycloak.ssl-required=${DIRIGIBLE_KEYCLOAK_SSL_REQUIRED:external}
keycloak.resource=${DIRIGIBLE_KEYCLOAK_CLIENT_ID:null}
keycloak.public-client=true
keycloak.principal-attribute=preferred_username
keycloak.confidential-port=${DIRIGIBLE_KEYCLOAK_CONFIDENTIAL_PORT:443}
keycloak.use-resource-role-mappings=true
terminal.enabled=${DIRIGIBLE_TERMINAL_ENABLED:true}

management.metrics.mongo.command.enabled=false
management.metrics.mongo.connectionpool.enabled=false

management.endpoints.jmx.exposure.include=*
management.endpoints.jmx.exposure.exclude=
cxf.path=/odata/v2

management.endpoints.web.exposure.include=*
management.endpoints.web.exposure.exclude=
management.endpoint.health.show-details=always

springdoc.api-docs.path=/api-docs

cxf.path=/odata/v2

# the following are used to force the Spring to create QUARTZ tables
# quartz properties are manged in quartz.properties don't try to add them here
spring.quartz.job-store-type=jdbc
spring.quartz.jdbc.initialize-schema=always
spring.quartz.jdbc.initialize-schema=always
Loading
Loading