diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 694dcc597..8537e9ede 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -36,7 +36,6 @@ jobs: SERVICE_PASSWORD: ${{ secrets.SERVICE_PASSWORD }} MONGODB_DATABASE: ${{ secrets.MONGODB_DATABASE }} GH_TOKEN: ${{ secrets.GH_TOKEN }} - MARKETPLACE_INSTALLATION_URL: ${{ secrets.MARKETPLACE_INSTALLATION_URL }} run: | sed -i "s/^MONGODB_INITDB_ROOT_USERNAME=.*$/MONGODB_INITDB_ROOT_USERNAME=$ROOT_USERNAME/" $ENV_FILE sed -i "s/^MONGODB_INITDB_ROOT_PASSWORD=.*$/MONGODB_INITDB_ROOT_PASSWORD=$ROOT_PASSWORD/" $ENV_FILE @@ -45,7 +44,6 @@ jobs: sed -i "s/^SERVICE_MONGODB_USER=.*$/SERVICE_MONGODB_USER=$SERVICE_USERNAME/" $ENV_FILE sed -i "s/^SERVICE_MONGODB_PASSWORD=.*$/SERVICE_MONGODB_PASSWORD=$SERVICE_PASSWORD/" $ENV_FILE sed -i "s/^MARKET_GITHUB_TOKEN=.*$/MARKET_GITHUB_TOKEN=$GH_TOKEN/" $ENV_FILE - sed -i "s/^MARKETPLACE_INSTALLATION_URL=.*$/MARKETPLACE_INSTALLATION_URL=$MARKETPLACE_INSTALLATION_URL/" $ENV_FILE - name: Build and bring up containers without cache working-directory: ./marketplace-build diff --git a/marketplace-build/docker-compose.yml b/marketplace-build/docker-compose.yml index 5cf4f924e..71682a2fd 100644 --- a/marketplace-build/docker-compose.yml +++ b/marketplace-build/docker-compose.yml @@ -34,13 +34,14 @@ services: service: container_name: marketplace-service restart: always + volumes: + - /home/axonivy/marketplace/data/market-installations.json:/home/data/market-installation.json environment: - MONGODB_HOST=${SERVICE_MONGODB_HOST} - MONGODB_DATABASE=${SERVICE_MONGODB_DATABASE} - MONGODB_USERNAME=${SERVICE_MONGODB_USER} - MONGODB_PASSWORD=${SERVICE_MONGODB_PASSWORD} - MARKET_GITHUB_TOKEN=${MARKET_GITHUB_TOKEN} - - MARKETPLACE_INSTALLATION_URL=${MARKETPLACE_INSTALLATION_URL} build: context: ../marketplace-service dockerfile: Dockerfile diff --git a/marketplace-build/release/docker-compose.yml b/marketplace-build/release/docker-compose.yml index 983c94622..dfc95f0fb 100644 --- a/marketplace-build/release/docker-compose.yml +++ b/marketplace-build/release/docker-compose.yml @@ -25,13 +25,13 @@ services: service: image: ghcr.io/axonivy-market/marketplace-service:latest restart: always + volumes: + - /home/axonivy/marketplace/data/market-installations.json:/home/data/market-installation.json environment: - MONGODB_HOST=${SERVICE_MONGODB_HOST} - MONGODB_DATABASE=${SERVICE_MONGODB_DATABASE} - MONGODB_USERNAME=${SERVICE_MONGODB_USER} - MONGODB_PASSWORD=${SERVICE_MONGODB_PASSWORD} - MARKET_GITHUB_TOKEN=${MARKET_GITHUB_TOKEN} - - MARKETPLACE_INSTALLATION_URL=${MARKETPLACE_INSTALLATION_URL} - volumes: mongodata: \ No newline at end of file diff --git a/marketplace-build/release/sprint-compose.yml b/marketplace-build/release/sprint-compose.yml index 85b42f243..ff273c945 100644 --- a/marketplace-build/release/sprint-compose.yml +++ b/marketplace-build/release/sprint-compose.yml @@ -25,13 +25,14 @@ services: service: image: ghcr.io/axonivy-market/marketplace-service:sprint restart: always + volumes: + - /home/axonivy/marketplace/data/market-installations.json:/home/data/market-installation.json environment: - MONGODB_HOST=${SERVICE_MONGODB_HOST} - MONGODB_DATABASE=${SERVICE_MONGODB_DATABASE} - MONGODB_USERNAME=${SERVICE_MONGODB_USER} - MONGODB_PASSWORD=${SERVICE_MONGODB_PASSWORD} - MARKET_GITHUB_TOKEN=${MARKET_GITHUB_TOKEN} - - MARKETPLACE_INSTALLATION_URL=${MARKETPLACE_INSTALLATION_URL} volumes: mongodata: \ No newline at end of file diff --git a/marketplace-service/src/main/java/com/axonivy/market/controller/ProductDetailsController.java b/marketplace-service/src/main/java/com/axonivy/market/controller/ProductDetailsController.java index b57f80e0f..2d89ffd0c 100644 --- a/marketplace-service/src/main/java/com/axonivy/market/controller/ProductDetailsController.java +++ b/marketplace-service/src/main/java/com/axonivy/market/controller/ProductDetailsController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; - +import org.springframework.web.bind.annotation.CrossOrigin; import java.util.List; import static com.axonivy.market.constants.RequestMappingConstants.PRODUCT_DETAILS; @@ -40,7 +40,8 @@ public ResponseEntity findProductDetailsByVersion(@PathVaria return new ResponseEntity<>(detailModelAssembler.toModel(productDetail, tag), HttpStatus.OK); } - @Operation(summary = "increase installation count by 1", description = "increase installation count by 1") + @Operation(summary = "increase installation count by 1", description = "update installation count when click download product files by users") + @CrossOrigin(originPatterns = "*") @PutMapping("/installationcount/{key}") public ResponseEntity syncInstallationCount(@PathVariable("key") String key) { int result = productService.updateInstallationCountForProduct(key); diff --git a/marketplace-service/src/main/resources/application.properties b/marketplace-service/src/main/resources/application.properties index 17f6ab518..b2fd17582 100644 --- a/marketplace-service/src/main/resources/application.properties +++ b/marketplace-service/src/main/resources/application.properties @@ -8,7 +8,7 @@ server.forward-headers-strategy=framework springdoc.api-docs.path=/api-docs springdoc.swagger-ui.path=/swagger-ui.html market.cors.allowed.origin.maxAge=3600 -synchronized.installation.counts.path=${MARKETPLACE_INSTALLATION_URL} +synchronized.installation.counts.path=/home/data/market-installation.json market.github.token=${MARKET_GITHUB_TOKEN} logging.level.org.springframework.security=DEBUG spring.security.oauth2.client.registration.github.client-id= diff --git a/marketplace-service/src/test/java/com/axonivy/market/service/SchedulingTasksTest.java b/marketplace-service/src/test/java/com/axonivy/market/service/SchedulingTasksTest.java index d436cf72e..0407a7f75 100644 --- a/marketplace-service/src/test/java/com/axonivy/market/service/SchedulingTasksTest.java +++ b/marketplace-service/src/test/java/com/axonivy/market/service/SchedulingTasksTest.java @@ -10,8 +10,8 @@ import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.verify; -@SpringBootTest(properties = { "MARKETPLACE_INSTALLATION_URL=marketplace-installation.json", "MONGODB_USERNAME=user", - "MONGODB_PASSWORD=password", "MONGODB_HOST=mongoHost", "MONGODB_DATABASE=product" }) +@SpringBootTest(properties = { "MONGODB_USERNAME=user", "MONGODB_PASSWORD=password", "MONGODB_HOST=mongoHost", + "MONGODB_DATABASE=product" }) class SchedulingTasksTest { @SpyBean