diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 578321e..1dbd636 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index a9c065c..5a23ee6 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -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 diff --git a/README.md b/README.md index 9d2314e..8ae4f92 100644 --- a/README.md +++ b/README.md @@ -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 @@ -160,4 +173,4 @@ export class ExampleClient { return response; } } -``` \ No newline at end of file +``` diff --git a/application/Dockerfile b/application/Dockerfile index 19f14ed..cff0907 100644 --- a/application/Dockerfile +++ b/application/Dockerfile @@ -1,4 +1,4 @@ -FROM amazoncorretto:22-alpine +FROM amazoncorretto:21-alpine VOLUME /tmp @@ -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"] diff --git a/application/pom.xml b/application/pom.xml index 11f42f9..fb2b787 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -19,12 +19,10 @@ io.dirigible.samples custom-stack-apis - 1.0.0-SNAPSHOT io.dirigible.samples custom-stack-branding - 1.0.0-SNAPSHOT uk.org.okapibarcode @@ -67,26 +65,6 @@ org.eclipse.dirigible dirigible-components-group-engines pom - - - javax.validation - validation-api - - - javax.servlet - javax.servlet-api - - - org.apache.cxf - cxf-rt-frontend-jaxrs - - - org.apache.cxf - - cxf-spring-boot-starter-jaxrs - - - org.eclipse.dirigible @@ -137,13 +115,6 @@ spring-boot-starter-validation - - com.codeborne - selenide - 7.3.1 - test - - org.postgresql @@ -156,59 +127,33 @@ com.sap.cloud.db.jdbc ngdbc - ${ngdbc.version} net.snowflake snowflake-jdbc - ${snowflake.version} org.eclipse.dirigible dirigible-tests-framework - - - - org.springframework.boot - spring-boot-maven-plugin - - io.dirigible.samples.CustomStackApplication - - - - - repackage - - - - - - pl.project13.maven - git-commit-id-plugin - ${git-commit-id-plugin.version} - - - get-the-git-infos - - revision - - - - - ../.git - - - + src/main/resources true + + + + org.springframework.boot + spring-boot-maven-plugin + + + diff --git a/application/src/main/resources/application-keycloak.properties b/application/src/main/resources/application-keycloak.properties index 0bc7094..1b63062 100644 --- a/application/src/main/resources/application-keycloak.properties +++ b/application/src/main/resources/application-keycloak.properties @@ -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 \ No newline at end of file +spring.security.oauth2.client.provider.keycloak.user-name-attribute=preferred_username diff --git a/application/src/main/resources/application-oauth.properties b/application/src/main/resources/application-oauth.properties new file mode 100644 index 0000000..ddc4b76 --- /dev/null +++ b/application/src/main/resources/application-oauth.properties @@ -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} diff --git a/application/src/main/resources/application.properties b/application/src/main/resources/application.properties index bb3303f..41eedb4 100644 --- a/application/src/main/resources/application.properties +++ b/application/src/main/resources/application.properties @@ -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 \ No newline at end of file +spring.quartz.jdbc.initialize-schema=always diff --git a/application/src/main/resources/logback.xml b/application/src/main/resources/logback.xml index fff8657..5c45eab 100644 --- a/application/src/main/resources/logback.xml +++ b/application/src/main/resources/logback.xml @@ -1,5 +1,6 @@ + - %d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%thread{8}] %logger{36} - %msg%n + %d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%thread{8}] [%tenant] %logger{36} - %msg%n - + ${LOGS_DIR}/dirigible-core-${date}.log - %date %level [%thread] %logger{10} [%file:%line] %msg%n + %date %level [%thread] [%tenant] %logger{10} [%file:%line] %msg%n - + ${LOGS_DIR}/dirigible-apps-${date}.log - %date %level [%thread] %logger{10} [%file:%line] %msg%n + %date %level [%thread] [%tenant] %logger{10} [%file:%line] %msg%n - + ${LOGS_DIR}/dirigible-base-${date}.log - %date %level [%thread] %logger{10} [%file:%line] %msg%n + %date %level [%thread] [%tenant] %logger{10} [%file:%line] %msg%n - + @@ -124,8 +150,7 @@ org.springdoc - springdoc-openapi-ui - ${org.springdoc.openapi.ui.version} + springdoc-openapi-starter-webmvc-ui @@ -138,21 +163,13 @@ org.webjars webjars-locator - ${webjars-locator} - org.apache.olingo + com.codbex.olingo olingo-odata2-lib - ${olingo.version} pom - - - javax.ws.rs - javax.ws.rs-api - - @@ -171,172 +188,149 @@ pom import + + io.dirigible.samples + custom-stack-apis + ${project.version} + + + io.dirigible.samples + custom-stack-branding + ${project.version} + + + + + pl.project13.maven + git-commit-id-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + ${skipTests} + + + + org.apache.maven.plugins + maven-failsafe-plugin + ${maven-failsafe-plugin.version} + + ${skipITs} + ${project.build.outputDirectory} + + + + + integration-test + verify + + + + + + pl.project13.maven + git-commit-id-plugin + ${maven-git-commit-id-plugin.version} + + + get-the-git-infos + + revision + + + + + ../.git + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${maven.compiler.source} + ${maven.compiler.target} + true + lines,vars,source + + + + org.springframework.boot + spring-boot-maven-plugin + ${maven-spring-boot-plugin.version} + + + + repackage + + + + + + + + - default - - true - + tests + + false + false + + + + unit-tests + + false + true + + + + integration-tests + + false + true + - - org.jacoco - jacoco-maven-plugin - ${jacoco.version} - - - prepare-agent - - prepare-agent - - - - - - - SOURCEFILE - - *src/test/* - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven.compiler.plugin.version} + maven-surefire-plugin - ${maven.compiler.source} - ${maven.compiler.target} - true - lines,vars,source + true + + quick-build + + true + true + + - - custom stack - - UTF-8 - - 10.4.1 - - 17 - 17 - 17 - - 3.3.0 - 3.2.0 - src/main/resources/META-INF/dirigible - 3.13.0 - 2.22.2 - 1.13.0 - branch - 2.11.0 - 1.15 - 3.12.0 - 1.3 - 1.10.0 - 2.10.1 - 4.11.0 - 1.3 - 1.8.0 - 4.10.0 - 1.7.36 - 1.7.12 - 1.4.5 - 2.9.0 - - 42.7.0 - 2.20.17 - 3.16.0 - - 5.17.3 - 1.0 - 9.4.48.v20220622 - 9.4.2 - 1.1.0 - 6.8.0 - 2.3.0 - 2.3.3 - 2.1.5 - 4.3 - 2.2.3 - 6.4.0.202211300538-r - 1.6.4 - 2.0.13 - 3.3.1 - 4.9.10 - 3.12.11 - 3.1.2 - 4.16.1 - 1.9.0 - 1.13.0 - 11.1.42 - 0.24.4 - 1.8.2 - 1.6.5 - 5.1.0 - 0.33.0 - 2.3.6 - 3.3.12 - 3.6.0 - 1.0.8r1250 - 3.3.7 - 4.6.7 - 2.6.1 - 1.8.2 - 4.7.0 - 4.8.154 - 1.22 - 1.17.6 - 1.17.6 - 1.17.6 - 5.16.0 - 7.7.1 - 0.7.5 - 0.5.4 - 2.7.10 - 3.0.0 - - 5.3.24 - 0.51 - - 20.0.2 - 5.0.1 - 1.7 - 2.3.2 - 0.9.5.5 - 22.3.1 - 31.1-jre - 72.1 - 3.2.2 - 4.4 - 2.3 - 3.0.45.202211090110 - 0.64.0 - 2.3.1 - 1.12.386 - 1.17.6 - 3.11.3 - 4.3.1 - 3.3.1 - 6.2.1 - 1.1 - 0.8.12 - - 3.0.2 - 1.7.0 - 1.6.9 - - none - -