Commit 38b9ba49 authored by Alok Joshi's avatar Alok Joshi
Browse files

use Redis cache for Schema

parent 1f8af028
Pipeline #12242 failed with stage
in 2 minutes and 8 seconds
......@@ -13,7 +13,7 @@
# limitations under the License.
global:
replicaCount: 1
replicaCount: 2
image:
repository: community.opengroup.org:5555/osdu/platform/system/storage
......
......@@ -39,6 +39,7 @@ az keyvault secret show --vault-name $KEY_VAULT_NAME --name $KEY_VAULT_SECRET_NA
| name | value | description | sensitive? | source |
| --- | --- | --- | --- | --- |
| `runtime.env.local` | false (set to `true` when running locally) | Var to check if app is running locally | no | - |
| `LOG_PREFIX` | `storage` | Logging prefix | no | - |
| `server.servlet.contextPath` | `/api/storage/v2/` | Servlet context path | no | - |
| `AUTHORIZE_API` | ex `https://foo-entitlements.azurewebsites.net/entitlements/v1` | Entitlements API endpoint | no | output of infrastructure deployment |
......@@ -49,7 +50,7 @@ az keyvault secret show --vault-name $KEY_VAULT_NAME --name $KEY_VAULT_SECRET_NA
| `azure.activedirectory.client-id` | `********` | AAD client application ID | yes | output of infrastructure deployment |
| `azure.activedirectory.AppIdUri` | `api://${azure.activedirectory.client-id}` | URI for AAD Application | no | -- |
| `azure.activedirectory.session-stateless` | `true` | Flag run in stateless mode (needed by AAD dependency) | no | -- |
| `cosmosdb_database` | ex `dev-osdu-r2-db` | Cosmos database for storage documents | no | output of infrastructure deployment |
| `cosmosdb_database` | ex `osdu-db` | Cosmos database for storage documents | no | output of infrastructure deployment |
| `azure.storage.enable-https` | `true` | Used by spring boot starter library | no | - |
| `servicebus_topic_name` | `recordstopic` | Topic for async messaging | no | output of infrastructure deployment |
| `azure.application-insights.instrumentation-key` | `********` | API Key for App Insights | yes | output of infrastructure deployment |
......
......@@ -81,7 +81,7 @@
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-core-common</artifactId>
<version>0.3.12</version>
<version>0.3.16</version>
<exclusions>
<exclusion>
<artifactId>elasticsearch</artifactId>
......
// Copyright © Microsoft Corporation
//
// 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.storage.provider.azure.cache;
import org.opengroup.osdu.core.common.cache.RedisCache;
import org.opengroup.osdu.core.common.model.storage.Schema;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import javax.inject.Named;
@Component
@ConditionalOnProperty(value = "runtime.env.local", havingValue = "false", matchIfMissing = true)
public class SchemaRedisCache extends RedisCache<String, Schema> {
public SchemaRedisCache(
final @Named("REDIS_HOST") String host,
final @Named("REDIS_PORT") int port,
final @Named("REDIS_PASSWORD") String password,
final @Named("REDIS_TIMEOUT") int timeout)
{
super(host, port, password, timeout, String.class, Schema.class);
}
}
\ No newline at end of file
......@@ -16,11 +16,13 @@ package org.opengroup.osdu.storage.provider.azure.cache;
import org.opengroup.osdu.core.common.model.storage.Schema;
import org.opengroup.osdu.core.common.cache.VmCache;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
@Component
public class SchemaCache extends VmCache<String, Schema> {
public SchemaCache() {
@ConditionalOnProperty(value = "runtime.env.local", havingValue = "true")
public class SchemaVmCache extends VmCache<String, Schema> {
public SchemaVmCache() {
super(5 * 60, 1000);
}
}
......@@ -14,6 +14,8 @@
package org.opengroup.osdu.storage.provider.azure.di;
import com.azure.security.keyvault.secrets.SecretClient;
import org.opengroup.osdu.azure.KeyVaultFacade;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
......@@ -55,4 +57,35 @@ public class AzureBootstrapConfig {
public String cosmosDBName() {
return cosmosDBName;
}
@Value("${redis.port:6380}")
public int redisPort;
@Bean
@Named("REDIS_PORT")
public int getRedisPort() {
return redisPort;
}
@Value("${redis.timeout:3600}")
public int redisTimeout;
@Bean
@Named("REDIS_TIMEOUT")
public int getRedisTimeout() {
return redisTimeout;
}
@Bean
@Named("REDIS_HOST")
public String redisHost(SecretClient kv) {
return KeyVaultFacade.getSecretWithValidation(kv, "redis-hostname");
}
@Bean
@Named("REDIS_PASSWORD")
public String redisPassword(SecretClient kv) {
return KeyVaultFacade.getSecretWithValidation(kv, "redis-password");
}
}
\ No newline at end of file
......@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
runtime.env.local=false
LOG_PREFIX=storage
server.servlet.contextPath=/api/storage/v2/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment