-
Notifications
You must be signed in to change notification settings - Fork 339
/
defaults.go
154 lines (123 loc) · 6.99 KB
/
defaults.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
package config
import (
"time"
"github.com/spf13/viper"
)
const (
DefaultListenAddress = "0.0.0.0:8000"
DefaultLoggingLevel = "INFO"
DefaultLoggingAuditLogLevel = "DEBUG"
BlockstoreTypeKey = "blockstore.type"
DefaultQuickstartUsername = "quickstart"
DefaultQuickstartKeyID = "AKIAIOSFOLQUICKSTART" //nolint:gosec
DefaultQuickstartSecretKey = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" // nolint:gosec
DefaultAuthAPIHealthCheckTimeout = 20 * time.Second
DefaultAuthSecret = "THIS_MUST_BE_CHANGED_IN_PRODUCTION" // #nosec
DefaultSigningSecretKey = "OVERRIDE_THIS_SIGNING_SECRET_DEFAULT" // #nosec
)
//nolint:mnd
func setDefaults(cfgType string) {
switch cfgType {
case QuickstartConfiguration:
viper.SetDefault("installation.user_name", DefaultQuickstartUsername)
viper.SetDefault("installation.access_key_id", DefaultQuickstartKeyID)
viper.SetDefault("installation.secret_access_key", DefaultQuickstartSecretKey)
viper.SetDefault("database.type", "local")
viper.SetDefault("auth.encrypt.secret_key", DefaultAuthSecret)
viper.SetDefault(BlockstoreTypeKey, "local")
case UseLocalConfiguration:
viper.SetDefault("database.type", "local")
viper.SetDefault("auth.encrypt.secret_key", DefaultAuthSecret)
viper.SetDefault(BlockstoreTypeKey, "local")
}
viper.SetDefault("installation.allow_inter_region_storage", true)
viper.SetDefault("blockstore.signing.secret_key", DefaultSigningSecretKey)
viper.SetDefault("listen_address", DefaultListenAddress)
viper.SetDefault("logging.format", "text")
viper.SetDefault("logging.level", DefaultLoggingLevel)
viper.SetDefault("logging.output", "-")
viper.SetDefault("logging.files_keep", 100)
viper.SetDefault("logging.audit_log_level", DefaultLoggingAuditLogLevel)
viper.SetDefault("logging.file_max_size_mb", (1<<10)*100) // 100MiB
viper.SetDefault("actions.enabled", true)
viper.SetDefault("actions.env.enabled", true)
viper.SetDefault("actions.env.prefix", "LAKEFSACTION_")
viper.SetDefault("auth.cache.enabled", true)
viper.SetDefault("auth.cache.size", 1024)
viper.SetDefault("auth.cache.ttl", 20*time.Second)
viper.SetDefault("auth.cache.jitter", 3*time.Second)
viper.SetDefault("auth.logout_redirect_url", "/auth/login")
viper.SetDefault("auth.login_duration", 7*24*time.Hour)
viper.SetDefault("auth.login_max_duration", 14*24*time.Hour)
viper.SetDefault("auth.ui_config.rbac", "simplified")
viper.SetDefault("auth.ui_config.login_failed_message", "The credentials don't match.")
viper.SetDefault("auth.ui_config.login_cookie_names", "internal_auth_session")
viper.SetDefault("auth.remote_authenticator.default_user_group", "Viewers")
viper.SetDefault("auth.remote_authenticator.request_timeout", 10*time.Second)
viper.SetDefault("auth.api.health_check_timeout", DefaultAuthAPIHealthCheckTimeout)
viper.SetDefault("auth.oidc.persist_friendly_name", false)
viper.SetDefault("auth.cookie_auth_verification.persist_friendly_name", false)
viper.SetDefault("blockstore.local.path", "~/lakefs/data/block")
viper.SetDefault("blockstore.s3.region", "us-east-1")
viper.SetDefault("blockstore.s3.max_retries", 5)
viper.SetDefault("blockstore.s3.discover_bucket_region", true)
viper.SetDefault("blockstore.s3.pre_signed_expiry", 15*time.Minute)
viper.SetDefault("blockstore.s3.web_identity.session_expiry_window", 5*time.Minute)
viper.SetDefault("blockstore.s3.disable_pre_signed_ui", true)
viper.SetDefault("committed.local_cache.size_bytes", 1*1024*1024*1024)
viper.SetDefault("committed.local_cache.dir", "~/lakefs/data/cache")
viper.SetDefault("committed.local_cache.max_uploaders_per_writer", 10)
viper.SetDefault("committed.local_cache.range_proportion", 0.9)
viper.SetDefault("committed.local_cache.metarange_proportion", 0.1)
viper.SetDefault("committed.block_storage_prefix", "_lakefs")
viper.SetDefault("committed.permanent.min_range_size_bytes", 0)
viper.SetDefault("committed.permanent.max_range_size_bytes", 20*1024*1024)
viper.SetDefault("committed.permanent.range_raggedness_entries", 50_000)
viper.SetDefault("committed.sstable.memory.cache_size_bytes", 400_000_000)
viper.SetDefault("gateways.s3.domain_name", "s3.local.lakefs.io")
viper.SetDefault("gateways.s3.region", "us-east-1")
viper.SetDefault("gateways.s3.verify_unsupported", true)
viper.SetDefault("blockstore.gs.s3_endpoint", "https://storage.googleapis.com")
viper.SetDefault("blockstore.gs.pre_signed_expiry", 15*time.Minute)
viper.SetDefault("blockstore.gs.disable_pre_signed_ui", true)
viper.SetDefault("stats.enabled", true)
viper.SetDefault("stats.address", "https://stats.lakefs.io")
viper.SetDefault("stats.flush_interval", 30*time.Second)
viper.SetDefault("stats.flush_size", 100)
viper.SetDefault("email_subscription.enabled", true)
viper.SetDefault("blockstore.azure.try_timeout", 10*time.Minute)
viper.SetDefault("blockstore.azure.pre_signed_expiry", 15*time.Minute)
viper.SetDefault("blockstore.azure.disable_pre_signed_ui", true)
viper.SetDefault("security.audit_check_interval", 24*time.Hour)
viper.SetDefault("security.audit_check_url", "https://audit.lakefs.io/audit")
viper.SetDefault("security.check_latest_version", true)
viper.SetDefault("security.check_latest_version_cache", time.Hour)
viper.SetDefault("ui.enabled", true)
viper.SetDefault("database.local.path", "~/lakefs/metadata")
viper.SetDefault("database.local.prefetch_size", 256)
viper.SetDefault("database.local.sync_writes", true)
viper.SetDefault("database.dynamodb.table_name", "kvstore")
viper.SetDefault("database.dynamodb.scan_limit", 1024)
viper.SetDefault("database.dynamodb.max_attempts", 10)
viper.SetDefault("database.postgres.max_open_connections", 25)
viper.SetDefault("database.postgres.max_idle_connections", 25)
viper.SetDefault("database.postgres.connection_max_lifetime", "5m")
viper.SetDefault("graveler.ensure_readable_root_namespace", true)
viper.SetDefault("graveler.repository_cache.size", 1000)
viper.SetDefault("graveler.repository_cache.expiry", 5*time.Second)
viper.SetDefault("graveler.repository_cache.jitter", 2*time.Second)
viper.SetDefault("graveler.commit_cache.size", 50_000)
viper.SetDefault("graveler.commit_cache.expiry", 10*time.Minute)
viper.SetDefault("graveler.commit_cache.jitter", 2*time.Second)
// MaxBatchDelay - 3ms was chosen as a max delay time for critical path queries.
// It trades off amount of queries per second (and thus effectiveness of the batching mechanism) with added latency.
// Since reducing # of expensive operations is only beneficial when there are a lot of concurrent requests,
//
// the sweet spot is probably between 1-5 milliseconds (representing 200-1000 requests/second to the data store).
//
// 3ms of delay with ~300 requests/second per resource sounds like a reasonable tradeoff.
viper.SetDefault("graveler.max_batch_delay", 3*time.Millisecond)
viper.SetDefault("ugc.prepare_interval", time.Minute)
viper.SetDefault("ugc.prepare_max_file_size", 20*1024*1024)
viper.SetDefault("usage_report.flush_interval", 5*time.Minute)
}