diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fc42e1..d44da3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,14 +31,14 @@ on: jobs: build-ci: - name: Build Template + name: Build ADempiere Processors Service runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Java JDK 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-package: 'jdk' @@ -46,11 +46,11 @@ jobs: architecture: x64 - name: Build with Gradle - uses: gradle/gradle-build-action@v2 - env: - GITHUB_DEPLOY_USER: "${{ github.actor }}" - GITHUB_DEPLOY_TOKEN: "${{ secrets.DEPLOY_TOKEN }}" - GITHUB_DEPLOY_REPOSITORY: ${{ secrets.DEPLOY_REPOSITORY }} + uses: gradle/actions/setup-gradle@v3 with: gradle-version: 8.0.2 arguments: build + env: + GITHUB_DEPLOY_USER: ${{ github.actor }} + GITHUB_DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }} + GITHUB_DEPLOY_REPOSITORY: ${{ secrets.DEPLOY_REPOSITORY }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 75071da..a599842 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,14 +13,14 @@ jobs: # Build dist application adempiere-processors-service build-app: - name: Build dist Template + name: Build ADempiere Processors Service runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Java JDK 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-package: 'jdk' @@ -28,7 +28,7 @@ jobs: architecture: x64 - name: Build with Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: gradle-version: 8.0.2 arguments: createRelease @@ -37,26 +37,32 @@ jobs: GITHUB_DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }} GITHUB_DEPLOY_REPOSITORY: ${{ secrets.DEPLOY_REPOSITORY }} + - name: Upload descriptor file artifact + uses: actions/upload-artifact@v4 + with: + name: adempiere-processors-service.dsc + path: build/descriptors/adempiere-processors-service.dsc + - name: Upload dist app zip artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: adempiere-processors-service.zip path: build/release/adempiere-processors-service.zip - name: Upload dist app zip.MD5 artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: adempiere-processors-service.zip.MD5 path: build/release/adempiere-processors-service.zip.MD5 - name: Upload dist app tar artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: adempiere-processors-service.tar path: build/release/adempiere-processors-service.tar - name: Upload dist app tar.MD5 artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: adempiere-processors-service.tar.MD5 path: build/release/adempiere-processors-service.tar.MD5 @@ -70,7 +76,14 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - name: Download all artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 + + - name: Upload Descriptor + uses: skx/github-action-publish-binaries@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: adempiere-processors-service.dsc/adempiere-processors-service.dsc - name: Upload zip uses: skx/github-action-publish-binaries@master diff --git a/build.gradle b/build.gradle index 1ef5528..e470889 100644 --- a/build.gradle +++ b/build.gradle @@ -5,12 +5,18 @@ plugins { id 'application' id 'visual-studio' } + group 'com.nikhilm' + sourceCompatibility = 1.11 + def grpcVersion = '1.62.2' +def protobufVersion = '3.25.3' def baseVersion = '3.9.4' def baseGroupId = 'io.github.adempiere' def privateDependencyBaseVersion = "adempiere-3.9.4" +def descriptorFile = "adempiere-processors-service.dsc" + startScripts.enabled = false ext { @@ -29,23 +35,26 @@ jar { } repositories { + mavenLocal() mavenCentral() - mavenLocal() maven { - url = System.getenv("GITHUB_DEPLOY_REPOSITORY") ?: System.properties['deploy.repository'] ?: 'https://maven.pkg.github.com' - credentials { - username = System.getenv("GITHUB_DEPLOY_USER") ?: System.properties['deploy.user'] - password = System.getenv("GITHUB_DEPLOY_TOKEN") ?: System.properties['deploy.token'] + // Adempiere GitHub Organization + url = findProperty("deployRepository") ?: System.properties['deploy.repository'] ?: System.getenv("GITHUB_DEPLOY_REPOSITORY") ?: 'https://maven.pkg.github.com' + credentials { + // project property, system properrty, enviroment variable + username = findProperty("deployUsername") ?: System.properties['deploy.user'] ?: System.getenv("GITHUB_DEPLOY_USER") + password = findProperty("deployToken") ?: System.properties['deploy.token'] ?: System.getenv("GITHUB_DEPLOY_TOKEN") } } } + protobuf { protoc { - artifact = "com.google.protobuf:protoc:3.12.0" + artifact = "com.google.protobuf:protoc:${protobufVersion}" } plugins { grpc { - artifact = 'io.grpc:protoc-gen-grpc-java:1.34.1' + artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" } } generateProtoTasks { @@ -53,25 +62,26 @@ protobuf { grpc {} } all().configureEach { task -> - // If true, will generate a descriptor_set.desc file under - // task.outputBaseDir. Default is false. - // See --descriptor_set_out in protoc documentation about what it is. - task.generateDescriptorSet = true + // If true, will generate a descriptor_set.desc file under + // task.outputBaseDir. Default is false. + // See --descriptor_set_out in protoc documentation about what it is. + task.generateDescriptorSet = true - // Allows to override the default for the descriptor set location - task.descriptorSetOptions.path = - "${projectDir}/build/descriptors/adempiere-processors-service-service.pb" + // Allows to override the default for the descriptor set location + task.descriptorSetOptions.path = "${projectDir}/build/descriptors/${descriptorFile}" + // task.descriptorSetOptions.path = "${projectDir}/build/descriptors/adempiere-processors-service.dsc" - // If true, the descriptor set will contain line number information - // and comments. Default is false. - task.descriptorSetOptions.includeSourceInfo = true + // If true, the descriptor set will contain line number information + // and comments. Default is false. + task.descriptorSetOptions.includeSourceInfo = true - // If true, the descriptor set will contain all transitive imports and - // is therefore self-contained. Default is false. - task.descriptorSetOptions.includeImports = true - } - } + // If true, the descriptor set will contain all transitive imports and + // is therefore self-contained. Default is false. + task.descriptorSetOptions.includeImports = true + } + } } + sourceSets { main { java { @@ -81,6 +91,22 @@ sourceSets { } } } + +// Copy proto descriptor another folder +allprojects { + task copyDescriptor(type: Copy) { + from "${projectDir}/build/descriptors/${descriptorFile}" + into "${projectDir}/docker-compose/envoy/definitions" + // rename { "${descriptorFile}" } + } + + tasks.matching { + it.name.startsWith('compileJava') + }.each { task -> + task.finalizedBy copyDescriptor + } +} + task AdempiereProcessorServer(type: CreateStartScripts) { mainClass = javaMainClass applicationName = 'adempiere-processors-service-server' @@ -114,15 +140,16 @@ dependencies { '*.jar' ] ) - implementation "io.grpc:grpc-netty-shaded:${grpcVersion}" - implementation "io.grpc:grpc-alts:${grpcVersion}" - implementation "io.netty:netty-handler:4.1.107.Final" - implementation "io.grpc:grpc-protobuf:${grpcVersion}" - implementation "io.grpc:grpc-stub:${grpcVersion}" - implementation "io.grpc:grpc-netty:${grpcVersion}" - // https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java - implementation 'com.google.protobuf:protobuf-java:3.25.3' - implementation 'com.google.protobuf:protobuf-java-util:3.25.3' + implementation "io.grpc:grpc-netty-shaded:${grpcVersion}" + implementation "io.grpc:grpc-alts:${grpcVersion}" + implementation "io.netty:netty-handler:4.1.107.Final" + implementation "io.grpc:grpc-protobuf:${grpcVersion}" + implementation "io.grpc:grpc-stub:${grpcVersion}" + implementation "io.grpc:grpc-netty:${grpcVersion}" + // https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java + implementation "com.google.protobuf:protobuf-java:${protobufVersion}" + implementation "com.google.protobuf:protobuf-java-util:${protobufVersion}" + implementation "io.jsonwebtoken:jjwt-api:0.12.6" implementation "io.jsonwebtoken:jjwt-impl:0.12.6" implementation "io.jsonwebtoken:jjwt-jackson:0.12.6" @@ -130,7 +157,8 @@ dependencies { //implementation 'com.sun.xml.bind:jaxb-impl:3.0.0-M4' //implementation 'com.sun.xml.bind:jaxb-core:3.0.0-M4' //implementation 'javax.activation:activation:1.1.1' - implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.0' + implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.0' + // ADempiere Core implementation "${baseGroupId}:base:${baseVersion}" implementation "${baseGroupId}:adempiere-grpc-utils:1.4.8" diff --git a/docker-compose/.env b/docker-compose/.env index d66b39b..482edf8 100644 --- a/docker-compose/.env +++ b/docker-compose/.env @@ -10,7 +10,7 @@ POSTGRES_PORT="5432" POSTGRES_VOLUME="adempiere-processor.volume_postgres" # ADempiere gRPC Server -ADEMPIERE_PROCESSOR_IMAGE="openls/adempiere-processors-service:alpine-1.0.2" +ADEMPIERE_PROCESSOR_IMAGE="openls/adempiere-processors-service:alpine-1.0.4" ADEMPIERE_PROCESSOR_HOST="adempiere-processor.processor" # Networks @@ -32,4 +32,4 @@ RUNDECK_IMAGE="rundeck/rundeck:4.12.0" RUNDECK_HOST="adempiere-processor.rundeck" RUNDECK_PORT=4440 RUNDECK_REALM_SETTING="./rundeck/realm.properties" -RUNDECK_USER_POLICIES="./rundeck/user.aclpolicy" \ No newline at end of file +RUNDECK_USER_POLICIES="./rundeck/user.aclpolicy" diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index 30bee15..8b676c1 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -22,7 +22,7 @@ services: POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} networks: - shared_network - + adempiere.processor: image: ${ADEMPIERE_PROCESSOR_IMAGE} container_name: ${ADEMPIERE_PROCESSOR_HOST} @@ -75,7 +75,7 @@ services: container_name: ${ENVOY_NAME} volumes: - ./envoy/envoy.yaml:/etc/envoy/envoy.yaml:ro - - ./envoy/definitions/adempiere-processors-service-service.pb:/data/adempiere-processors-service-service.pb:ro + - ./envoy/definitions/adempiere-processors-service.dsc:/data/adempiere-processors-service.dsc:ro depends_on: - adempiere.processor ports: @@ -83,10 +83,11 @@ services: networks: - shared_network + networks: shared_network: name: ${ADEMPIERE_NETWORK} - + volumes: volume_postgres: name: ${POSTGRES_VOLUME} diff --git a/docker-compose/envoy/definitions/adempiere-processors-service-service.pb b/docker-compose/envoy/definitions/adempiere-processors-service.dsc similarity index 65% rename from docker-compose/envoy/definitions/adempiere-processors-service-service.pb rename to docker-compose/envoy/definitions/adempiere-processors-service.dsc index cab8149..98238b2 100644 Binary files a/docker-compose/envoy/definitions/adempiere-processors-service-service.pb and b/docker-compose/envoy/definitions/adempiere-processors-service.dsc differ diff --git a/docker-compose/envoy/envoy.yaml b/docker-compose/envoy/envoy.yaml index d49c7f7..756e2f1 100644 --- a/docker-compose/envoy/envoy.yaml +++ b/docker-compose/envoy/envoy.yaml @@ -1,6 +1,6 @@ static_resources: listeners: - - name: adempiere_grpc_server + - name: adempiere_processor_proxy address: socket_address: { address: 0.0.0.0, @@ -12,7 +12,12 @@ static_resources: typed_config: "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager stat_prefix: grpc_json + access_log: + - name: envoy.access_loggers.stdout + typed_config: + "@type": type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StdoutAccessLog codec_type: AUTO + stream_idle_timeout: 900s route_config: name: local_route virtual_hosts: @@ -23,14 +28,14 @@ static_resources: prefix: "/" } route: { - cluster: adempiere-grpc-server, - timeout: 60s + cluster: adempiere_processor_cluster, + timeout: 900s } http_filters: - name: envoy.filters.http.grpc_json_transcoder typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.grpc_json_transcoder.v3.GrpcJsonTranscoder - proto_descriptor: "/data/adempiere-processors-service-service.pb" + proto_descriptor: "/data/adempiere-processors-service.dsc" services: - processor.Processors print_options: @@ -39,12 +44,13 @@ static_resources: always_print_enums_as_ints: false preserve_proto_field_names: true convert_grpc_status: true + ignore_unknown_query_parameters: true - name: envoy.filters.http.router typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router clusters: - - name: adempiere-grpc-server + - name: adempiere_processor_cluster type: LOGICAL_DNS lb_policy: ROUND_ROBIN dns_lookup_family: V4_ONLY @@ -54,7 +60,7 @@ static_resources: explicit_http_config: http2_protocol_options: {} load_assignment: - cluster_name: adempiere-grpc-server + cluster_name: adempiere_processor_cluster endpoints: - lb_endpoints: - endpoint: @@ -64,4 +70,4 @@ static_resources: # If you're running an older version of Docker, please use "docker.for.mac.localhost" instead. # Reference: https://docs.docker.com/docker-for-mac/release-notes/#docker-community-edition-18030-ce-mac59-2018-03-26 address: adempiere.processor # for local testing change for your ip - port_value: 50059 \ No newline at end of file + port_value: 50059