diff --git a/provider/search-gc/docs/gc/README.md b/provider/search-gc/docs/gc/README.md index 1c247d548d2873b769ab1c0e57e248d59fc312e8..fbcd6ed14a2104bfbe1bf8c2bae08e990238c9ab 100644 --- a/provider/search-gc/docs/gc/README.md +++ b/provider/search-gc/docs/gc/README.md @@ -37,24 +37,30 @@ Must have: Defined in default application property file but possible to override: -| name | value | description | sensitive? | source | -|-------------------------------------|-----------------------------------------------------------------|---------------------------------------------------------------------------------------|------------|--------------------------------------------------------------| -| `LOG_PREFIX` | `service` | Logging prefix | no | - | -| `SERVER_SERVLET_CONTEXPATH` | `/api/search/v2/` | Servlet context path | no | - | -| `AUTHORIZE_API` | ex `https://entitlements.com/entitlements/v1` | Entitlements API endpoint | no | output of infrastructure deployment || `REDIS_SEARCH_HOST` | ex `records-changed` | Redis host for search | no | | -| `REDIS_SEARCH_PORT` | ex `6379` | Redis port for search | no | | -| `REDIS_SEARCH_PASSWORD` | ex `*****` | Redis search host password | yes | | -| `REDIS_SEARCH_WITH_SSL` | ex `true` or `false` | Redis search host ssl config | no | | -| `REDIS_SEARCH_EXPIRATION` | ex `30` | Redis search cache expiration in seconds | no | | -| `GOOGLE_APPLICATION_CREDENTIALS` | ex `/path/to/directory/service-key.json` | Service account credentials, you only need this if running locally | yes | <https://console.cloud.google.com/iam-admin/serviceaccounts> | -| `SECURITY_HTTPS_CERTIFICATE_TRUST` | ex `false` | Elastic client connection uses TrustSelfSignedStrategy(), if it is 'true' | false | output of infrastructure deployment | -| `PARTITION_API` | ex `http://localhost:8080/api/partition/v1` | Partition service endpoint | no | output of infrastructure deployment | -| `POLICY_API` | ex `http://localhost:8080/api/policy/v1/` | Policy service endpoint | no | output of infrastructure deployment | -| `POLICY_ID` | ex `search` | policyId from ex `http://localhost:8080/api/policy/v1/policies`. Look at `POLICY_API` | no | - | -| `SERVICE_POLICY_ENABLED` | ex `false` | Enable or Disable an integration with Policy Service | no | output of infrastructure deployment | -| `INDEXER_HOST` | ex `https://os-indexer-dot-opendes.appspot.com/api/indexer/v2/` | Indexer API endpoint | no | output of infrastructure deployment | -| `MANAGEMENT_ENDPOINTS_WEB_BASE` | ex `/` | Web base for Actuator | no | - | -| `MANAGEMENT_SERVER_PORT` | ex `8081` | Port for Actuator | no | - | +| name | value | description | sensitive? | source | +|------------------------------------|-----------------------------------------------------------------|---------------------------------------------------------------------------------------|------------|--------------------------------------------------------------| +| `LOG_PREFIX` | `service` | Logging prefix | no | - | +| `SERVER_SERVLET_CONTEXPATH` | `/api/search/v2/` | Servlet context path | no | - | +| `AUTHORIZE_API` | ex `https://entitlements.com/entitlements/v1` | Entitlements API endpoint | no | output of infrastructure deployment || `REDIS_SEARCH_HOST` | ex `records-changed` | Redis host for search | no | | +| `REDIS_SEARCH_HOST` | ex `127.0.0.1` | Redis host for search cache | no | | +| `REDIS_SEARCH_PORT` | ex `6379` | Redis port for search | no | | +| `REDIS_SEARCH_PASSWORD` | ex `*****` | Redis search host password | yes | | +| `REDIS_SEARCH_WITH_SSL` | ex `true` or `false` | Redis search host ssl config | no | | +| `REDIS_SEARCH_EXPIRATION` | ex `30` | Redis search cache expiration in seconds | no | | +| `REDIS_GROUP_HOST` | ex `127.0.0.1` | Redis host for search groups cache | no | | +| `REDIS_GROUP_PORT` | ex `6379` | Redis port for search group cache | no | | +| `REDIS_GROUP_PASSWORD` | ex `*****` | Redis search groups host password | yes | | +| `REDIS_GROUP_WITH_SSL` | ex `true` or `false` | Redis search groups host ssl config | no | | +| `REDIS_GROUP_EXPIRATION` | ex `30` | Redis search groups cache expiration in seconds | no | | +| `GOOGLE_APPLICATION_CREDENTIALS` | ex `/path/to/directory/service-key.json` | Service account credentials, you only need this if running locally | yes | <https://console.cloud.google.com/iam-admin/serviceaccounts> | +| `SECURITY_HTTPS_CERTIFICATE_TRUST` | ex `false` | Elastic client connection uses TrustSelfSignedStrategy(), if it is 'true' | false | output of infrastructure deployment | +| `PARTITION_API` | ex `http://localhost:8080/api/partition/v1` | Partition service endpoint | no | output of infrastructure deployment | +| `POLICY_API` | ex `http://localhost:8080/api/policy/v1/` | Policy service endpoint | no | output of infrastructure deployment | +| `POLICY_ID` | ex `search` | policyId from ex `http://localhost:8080/api/policy/v1/policies`. Look at `POLICY_API` | no | - | +| `SERVICE_POLICY_ENABLED` | ex `false` | Enable or Disable an integration with Policy Service | no | output of infrastructure deployment | +| `INDEXER_HOST` | ex `https://os-indexer-dot-opendes.appspot.com/api/indexer/v2/` | Indexer API endpoint | no | output of infrastructure deployment | +| `MANAGEMENT_ENDPOINTS_WEB_BASE` | ex `/` | Web base for Actuator | no | - | +| `MANAGEMENT_SERVER_PORT` | ex `8081` | Port for Actuator | no | - | These variables define service behavior, and are used to switch between `Reference` or `Google Cloud` environments, their overriding and usage in mixed mode was not tested. Usage of spring profiles is preferred. diff --git a/provider/search-gc/src/main/java/org/opengroup/osdu/search/provider/gcp/cache/CacheConfig.java b/provider/search-gc/src/main/java/org/opengroup/osdu/search/provider/gcp/cache/CacheConfig.java index bbf3ef91c57370d9f0671d3766e3b95bcb876919..aaa23c6d13d7083b77179a44765a254595942d5a 100644 --- a/provider/search-gc/src/main/java/org/opengroup/osdu/search/provider/gcp/cache/CacheConfig.java +++ b/provider/search-gc/src/main/java/org/opengroup/osdu/search/provider/gcp/cache/CacheConfig.java @@ -44,11 +44,20 @@ public class CacheConfig { private final RedisCacheBuilder<String, ClusterSettings> clusterSettingsCacheBuilder; private final RedisCacheBuilder<String, CursorSettings> cursorSettingsCacheBuilderBuilder; private final RedisCacheBuilder<String, SearchAfterSettings> searchAfterSettingsCacheBuilderBuilder; + private final RedisCacheBuilder<String, Groups> groupsRedisCacheBuilder; private final RedisCacheBuilder<String, Map> fieldTypeMappingCacheBuilder; @Bean public ICache<String, Groups> groupCache(GcpSearchConfigurationProperties appProperties) { - return new GcGroupCache(); + return groupsRedisCacheBuilder.buildRedisCache( + appProperties.getRedisGroupHost(), + appProperties.getRedisGroupPort(), + appProperties.getRedisGroupPassword(), + appProperties.getRedisGroupExpiration(), + appProperties.getRedisGroupWithSsl(), + String.class, + Groups.class + ); } @Bean diff --git a/provider/search-gc/src/main/java/org/opengroup/osdu/search/provider/gcp/cache/GcGroupCache.java b/provider/search-gc/src/main/java/org/opengroup/osdu/search/provider/gcp/cache/GcGroupCache.java deleted file mode 100644 index 9be4d0d57161441039033aa1036941b6a710797e..0000000000000000000000000000000000000000 --- a/provider/search-gc/src/main/java/org/opengroup/osdu/search/provider/gcp/cache/GcGroupCache.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2020-2023 Google LLC - * Copyright 2020-2023 EPAM Systems, Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.opengroup.osdu.search.provider.gcp.cache; - -import org.opengroup.osdu.core.common.cache.ICache; -import org.opengroup.osdu.core.common.model.entitlements.Groups; - -// Group cache is used in common part. According to the current Google Cloud architecture, we don't -// use cache. Thus, methods are empty. -public class GcGroupCache implements ICache<String, Groups> { - @Override - public void put(String s, Groups o) { - // do nothing - } - - @Override - public Groups get(String s) { - return null; - } - - @Override - public void delete(String s) { - // do nothing - } - - @Override - public void clearAll() { - // do nothing - } -} diff --git a/provider/search-gc/src/main/java/org/opengroup/osdu/search/provider/gcp/config/GcpSearchConfigurationProperties.java b/provider/search-gc/src/main/java/org/opengroup/osdu/search/provider/gcp/config/GcpSearchConfigurationProperties.java index e57550a785ceb9f43b6997fc9ec9b81d381964e7..4dc691089fec0b8ea25f75c56c6d6c892ed5d779 100644 --- a/provider/search-gc/src/main/java/org/opengroup/osdu/search/provider/gcp/config/GcpSearchConfigurationProperties.java +++ b/provider/search-gc/src/main/java/org/opengroup/osdu/search/provider/gcp/config/GcpSearchConfigurationProperties.java @@ -37,4 +37,8 @@ public class GcpSearchConfigurationProperties extends SearchConfigurationPropert private String redisSearchPassword; private Integer redisSearchExpiration = 60 * 60; private Boolean redisSearchWithSsl = false; + + private String redisGroupPassword; + private Integer redisGroupExpiration = 30; + private Boolean redisGroupWithSsl = false; } diff --git a/search-core-plus/docs/baremetal/README.md b/search-core-plus/docs/baremetal/README.md index 8d7640b8ddb862f67a42bbb3c0b394ccb6a425c2..8da2da6de74a551fdaa7a6fa7bd743118f53371c 100644 --- a/search-core-plus/docs/baremetal/README.md +++ b/search-core-plus/docs/baremetal/README.md @@ -41,11 +41,16 @@ Defined in default application property file but possible to override: | `LOG_PREFIX` | `service` | Logging prefix | no | - | | `SERVER_SERVLET_CONTEXPATH` | `/api/search/v2/` | Servlet context path | no | - | | `AUTHORIZE_API` | ex `https://entitlements.com/entitlements/v1` | Entitlements API endpoint | no | output of infrastructure deployment | -| `REDIS_SEARCH_HOST` | ex `records-changed` | Redis host for search | no | | +| `REDIS_SEARCH_HOST` | ex `127.0.0.1` | Redis host for search cache | no | | | `REDIS_SEARCH_PORT` | ex `6379` | Redis port for search | no | | -| `REDIS_SEARCH_PASSWORD` | ex `127.0.0.1` | Redis search host password | yes | | +| `REDIS_SEARCH_PASSWORD` | ex `*****` | Redis search host password | yes | | | `REDIS_SEARCH_WITH_SSL` | ex `true` or `false` | Redis search host ssl config | no | | | `REDIS_SEARCH_EXPIRATION` | ex `30` | Redis search cache expiration in seconds | no | | +| `REDIS_GROUP_HOST` | ex `127.0.0.1` | Redis host for search groups cache | no | | +| `REDIS_GROUP_PORT` | ex `6379` | Redis port for search group cache | no | | +| `REDIS_GROUP_PASSWORD` | ex `*****` | Redis search groups host password | yes | | +| `REDIS_GROUP_WITH_SSL` | ex `true` or `false` | Redis search groups host ssl config | no | | +| `REDIS_GROUP_EXPIRATION` | ex `30` | Redis search groups cache expiration in seconds | no | | | `SECURITY_HTTPS_CERTIFICATE_TRUST` | ex `false` | Elastic client connection uses TrustSelfSignedStrategy(), if it is 'true' | false | output of infrastructure deployment | | `PARTITION_API` | ex `http://localhost:8080/api/partition/v1` | Partition service endpoint | no | output of infrastructure deployment | | `POLICY_API` | ex `http://localhost:8080/api/policy/v1/` | Policy service endpoint | no | output of infrastructure deployment | diff --git a/search-core-plus/pom.xml b/search-core-plus/pom.xml index 87ca09923c70298f2fcc31a4d2ea1d6faf4e7568..dc3b2e276625875af7c00a1a22cd6260e5531863 100644 --- a/search-core-plus/pom.xml +++ b/search-core-plus/pom.xml @@ -37,8 +37,9 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <failOnMissingWebXml>false</failOnMissingWebXml> <project.main.basedir>${project.parent.basedir}</project.main.basedir> - <core-plus.version>0.26.0</core-plus.version> + <core-plus.version>0.27.1</core-plus.version> </properties> + <dependencies> <dependency> <groupId>org.opengroup.osdu</groupId> @@ -61,11 +62,6 @@ <artifactId>search-core</artifactId> <version>0.28.0-SNAPSHOT</version> </dependency> - <dependency> - <groupId>org.opengroup.osdu</groupId> - <artifactId>os-core-common</artifactId> - <version>${osdu.oscorecommon.version}</version> - </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-junit-jupiter</artifactId> diff --git a/search-core-plus/src/main/java/org/opengroup/osdu/search/cache/CacheConfig.java b/search-core-plus/src/main/java/org/opengroup/osdu/search/cache/CacheConfig.java index 81d6a8d509ab98d73248ceb57fab416298f25f19..bfbd369fea6e8cd9ef010457d8029eb6bc8a1a83 100644 --- a/search-core-plus/src/main/java/org/opengroup/osdu/search/cache/CacheConfig.java +++ b/search-core-plus/src/main/java/org/opengroup/osdu/search/cache/CacheConfig.java @@ -40,11 +40,20 @@ public class CacheConfig { private final RedisCacheBuilder<String, ClusterSettings> clusterSettingsCacheBuilder; private final RedisCacheBuilder<String, CursorSettings> cursorSettingsCacheBuilderBuilder; private final RedisCacheBuilder<String, SearchAfterSettings> searchAfterSettingsCacheBuilderBuilder; + private final RedisCacheBuilder<String, Groups> groupsRedisCacheBuilder; private final RedisCacheBuilder<String, Map> fieldTypeMappingCacheBuilder; @Bean public ICache<String, Groups> groupCache(CorePlusSearchConfigurationProperties appProperties) { - return new GroupCache(); + return groupsRedisCacheBuilder.buildRedisCache( + appProperties.getRedisGroupHost(), + appProperties.getRedisGroupPort(), + appProperties.getRedisGroupPassword(), + appProperties.getRedisGroupExpiration(), + appProperties.getRedisGroupWithSsl(), + String.class, + Groups.class + ); } @Bean diff --git a/search-core-plus/src/main/java/org/opengroup/osdu/search/cache/GroupCache.java b/search-core-plus/src/main/java/org/opengroup/osdu/search/cache/GroupCache.java deleted file mode 100644 index b28f01a5c75136012b6cd55de762e81d736583c6..0000000000000000000000000000000000000000 --- a/search-core-plus/src/main/java/org/opengroup/osdu/search/cache/GroupCache.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2020-2024 Google LLC - * Copyright 2020-2024 EPAM Systems, Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.opengroup.osdu.search.cache; - -import org.opengroup.osdu.core.common.cache.ICache; -import org.opengroup.osdu.core.common.model.entitlements.Groups; - -// Group cache is used in common part. According to the current Core Plus architecture, we don't -// use cache. Thus, methods are empty. -public class GroupCache implements ICache<String, Groups> { - - @Override - public void put(String s, Groups o) { - // do nothing - } - - @Override - public Groups get(String s) { - return null; - } - - @Override - public void delete(String s) { - // do nothing - } - - @Override - public void clearAll() { - // do nothing - } -} diff --git a/search-core-plus/src/main/java/org/opengroup/osdu/search/config/CorePlusSearchConfigurationProperties.java b/search-core-plus/src/main/java/org/opengroup/osdu/search/config/CorePlusSearchConfigurationProperties.java index c9577d96ec7d284651fc7168d833c6ddb1984ff2..0aab2242d32f1f5a24f8ba868f9d1b1d4a9f3f78 100644 --- a/search-core-plus/src/main/java/org/opengroup/osdu/search/config/CorePlusSearchConfigurationProperties.java +++ b/search-core-plus/src/main/java/org/opengroup/osdu/search/config/CorePlusSearchConfigurationProperties.java @@ -36,4 +36,8 @@ public class CorePlusSearchConfigurationProperties extends SearchConfigurationPr private String redisSearchPassword; private Integer redisSearchExpiration = 60 * 60; private Boolean redisSearchWithSsl = false; + + private String redisGroupPassword; + private Integer redisGroupExpiration = 30; + private Boolean redisGroupWithSsl = false; } diff --git a/search-core-plus/src/main/resources/application.properties b/search-core-plus/src/main/resources/application.properties index 6cc58896796210e94cd267cf22dbb1c17fc3b1c0..f21247af4d0f377b8a57e1bde0dc2ffd8da5010b 100644 --- a/search-core-plus/src/main/resources/application.properties +++ b/search-core-plus/src/main/resources/application.properties @@ -82,7 +82,7 @@ propertyResolver.strategy=partition partition-auth-enabled=false # autocomplete feature flag name -featureFlag.strategy=systemPartition +featureFlag.strategy=appProperty featureFlag.autocomplete.enabled=false SYSTEM_PARTITION_ID=system