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