From ad87ac955a17f465d8f6335bf8138fb0f18f0b9f Mon Sep 17 00:00:00 2001 From: jkoberg Date: Thu, 7 Dec 2023 11:59:03 +0100 Subject: [PATCH] configure services individually Signed-off-by: jkoberg --- .drone.star | 2 -- services/frontend/pkg/config/defaults/defaultconfig.go | 1 + services/gateway/pkg/config/config.go | 4 ++-- services/gateway/pkg/config/defaults/defaultconfig.go | 3 +++ services/graph/pkg/config/defaults/defaultconfig.go | 2 +- services/proxy/pkg/config/defaults/defaultconfig.go | 2 +- services/settings/pkg/config/defaults/defaultconfig.go | 1 + services/storage-system/pkg/config/defaults/defaultconfig.go | 1 + services/storage-users/pkg/config/defaults/defaultconfig.go | 5 ++++- 9 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.drone.star b/.drone.star index 19bd4934f..faa2eb964 100644 --- a/.drone.star +++ b/.drone.star @@ -1919,8 +1919,6 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on = "OCIS_EVENTS_ENABLE_TLS": False, "MICRO_REGISTRY": "natsjs", "MICRO_REGISTRY_ADDRESS": "127.0.0.1:9233", - "OCIS_CACHE_STORE": "nats-js-kv", - "OCIS_CACHE_STORE_NODES": "127.0.0.1:9233", } if deploy_type == "": diff --git a/services/frontend/pkg/config/defaults/defaultconfig.go b/services/frontend/pkg/config/defaults/defaultconfig.go index a99acce7b..d4cb02c57 100644 --- a/services/frontend/pkg/config/defaults/defaultconfig.go +++ b/services/frontend/pkg/config/defaults/defaultconfig.go @@ -112,6 +112,7 @@ func DefaultConfig() *config.Config { HomeNamespace: "/users/{{.Id.OpaqueId}}", AdditionalInfoAttribute: "{{.Mail}}", StatCacheType: "nats-js-kv", + StatCacheNodes: []string{"127.0.0.1:9233"}, StatCacheDatabase: "cache-stat", StatCacheTTL: 300 * time.Second, ListOCMShares: true, diff --git a/services/gateway/pkg/config/config.go b/services/gateway/pkg/config/config.go index 81e596e43..b9393ca02 100644 --- a/services/gateway/pkg/config/config.go +++ b/services/gateway/pkg/config/config.go @@ -85,12 +85,12 @@ type StorageRegistry struct { // Cache holds cache config type Cache struct { - StatCacheStore string // TODO: enable configuring this again // `yaml:"stat_cache_store" env:"OCIS_CACHE_STORE;GATEWAY_STAT_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'ocmem', 'etcd', 'redis', 'redis-sentinel', 'nats-js', 'noop'. See the text description for details."` + StatCacheStore string // NOTE: The stat cache is not working atm. Hence we block configuring it StatCacheNodes []string `yaml:"stat_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_STAT_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details."` StatCacheDatabase string `yaml:"stat_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use."` StatCacheTTL time.Duration `yaml:"stat_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_STAT_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."` StatCacheSize int `yaml:"stat_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_STAT_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default."` - ProviderCacheStore string // `yaml:"provider_cache_store" env:"OCIS_CACHE_STORE;GATEWAY_PROVIDER_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'ocmem', 'etcd', 'redis', 'redis-sentinel', 'nats-js', 'noop'. See the text description for details."` + ProviderCacheStore string `yaml:"provider_cache_store" env:"OCIS_CACHE_STORE;GATEWAY_PROVIDER_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'ocmem', 'etcd', 'redis', 'redis-sentinel', 'nats-js', 'noop'. See the text description for details."` ProviderCacheNodes []string `yaml:"provider_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_PROVIDER_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details."` ProviderCacheDatabase string `yaml:"provider_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use."` ProviderCacheTTL time.Duration `yaml:"provider_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_PROVIDER_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."` diff --git a/services/gateway/pkg/config/defaults/defaultconfig.go b/services/gateway/pkg/config/defaults/defaultconfig.go index 4700efb58..ac55a8946 100644 --- a/services/gateway/pkg/config/defaults/defaultconfig.go +++ b/services/gateway/pkg/config/defaults/defaultconfig.go @@ -41,11 +41,14 @@ func DefaultConfig() *config.Config { Cache: config.Cache{ StatCacheStore: "noop", // NOTE: stat cache not working StatCacheDatabase: "ocis", + StatCacheNodes: []string{"127.0.0.1:9233"}, StatCacheTTL: 300 * time.Second, ProviderCacheStore: "noop", + ProviderCacheNodes: []string{"127.0.0.1:9233"}, ProviderCacheDatabase: "cache-providers", ProviderCacheTTL: 300 * time.Second, CreateHomeCacheStore: "nats-js-kv", + CreateHomeCacheNodes: []string{"127.0.0.1:9233"}, CreateHomeCacheDatabase: "cache-createhome", CreateHomeCacheTTL: 300 * time.Second, }, diff --git a/services/graph/pkg/config/defaults/defaultconfig.go b/services/graph/pkg/config/defaults/defaultconfig.go index 10e823059..77acf8084 100644 --- a/services/graph/pkg/config/defaults/defaultconfig.go +++ b/services/graph/pkg/config/defaults/defaultconfig.go @@ -97,8 +97,8 @@ func DefaultConfig() *config.Config { }, Cache: &config.Cache{ Store: "nats-js-kv", + Nodes: []string{"127.0.0.1:9233"}, Database: "cache-roles", - Table: "roles", TTL: time.Hour * 336, }, Events: config.Events{ diff --git a/services/proxy/pkg/config/defaults/defaultconfig.go b/services/proxy/pkg/config/defaults/defaultconfig.go index b2b24baef..bac52f0c2 100644 --- a/services/proxy/pkg/config/defaults/defaultconfig.go +++ b/services/proxy/pkg/config/defaults/defaultconfig.go @@ -44,8 +44,8 @@ func DefaultConfig() *config.Config { SkipUserInfo: false, UserinfoCache: &config.Cache{ Store: "nats-js-kv", + Nodes: []string{"127.0.0.1:9233"}, Database: "cache-userinfo", - Table: "userinfo", TTL: time.Second * 10, }, JWKS: config.JWKS{ diff --git a/services/settings/pkg/config/defaults/defaultconfig.go b/services/settings/pkg/config/defaults/defaultconfig.go index 1e33bb0ec..030ce4344 100644 --- a/services/settings/pkg/config/defaults/defaultconfig.go +++ b/services/settings/pkg/config/defaults/defaultconfig.go @@ -58,6 +58,7 @@ func DefaultConfig() *config.Config { SystemUserIDP: "internal", Cache: &config.Cache{ Store: "nats-js-kv", + Nodes: []string{"127.0.0.1:9233"}, Database: "settings-cache", FileTable: "settings_files", DirectoryTable: "settings_dirs", diff --git a/services/storage-system/pkg/config/defaults/defaultconfig.go b/services/storage-system/pkg/config/defaults/defaultconfig.go index a5645dc8c..df911bd45 100644 --- a/services/storage-system/pkg/config/defaults/defaultconfig.go +++ b/services/storage-system/pkg/config/defaults/defaultconfig.go @@ -53,6 +53,7 @@ func DefaultConfig() *config.Config { }, FileMetadataCache: config.Cache{ Store: "nats-js-kv", + Nodes: []string{"127.0.0.1:9233"}, Database: "cache-filemetadata", TTL: 24 * 60 * time.Second, }, diff --git a/services/storage-users/pkg/config/defaults/defaultconfig.go b/services/storage-users/pkg/config/defaults/defaultconfig.go index 08b605d5f..6644431e6 100644 --- a/services/storage-users/pkg/config/defaults/defaultconfig.go +++ b/services/storage-users/pkg/config/defaults/defaultconfig.go @@ -94,17 +94,20 @@ func DefaultConfig() *config.Config { EnableTLS: false, }, StatCache: config.StatCache{ - Store: "noop", + Store: "nats-js-kv", + Nodes: []string{"127.0.0.1:9233"}, Database: "ocis", TTL: 300 * time.Second, }, FilemetadataCache: config.FilemetadataCache{ Store: "nats-js-kv", + Nodes: []string{"127.0.0.1:9233"}, Database: "cache-filemetadata", TTL: 24 * 60 * time.Second, }, IDCache: config.IDCache{ Store: "nats-js-kv", + Nodes: []string{"127.0.0.1:9233"}, Database: "ids-storage-users", TTL: 24 * 60 * time.Second, },