From 8d92b2479f810bc5d20245361fa59339763a1495 Mon Sep 17 00:00:00 2001 From: firescry <49809580+firescry@users.noreply.github.com> Date: Wed, 12 Jul 2023 10:28:41 +0200 Subject: [PATCH] [bugfix] Align default values in the configuration file with the code (#1971) * Set default value of SMTPFrom to empty string This parameter should contain proper e-mail address (to be provided by user during configuration). * Update default values in example/config.yaml Default values and related comments in example/config.yaml are aligned with values defined in internal/config/defaults.go. Small improvements to foramting of config.yaml file. * Add default value for AdvancedThrottlingRetryAfter to internal/config/defaults.go AdvancedThrottlingRetryAfter was introduced in 70739d3 (superseriousbusiness/gotosocial#1466). * Update config.yaml snippets in documentation --- docs/configuration/advanced.md | 11 +++++++++-- docs/configuration/database.md | 4 ++-- docs/configuration/general.md | 14 +++++++++++++- docs/configuration/media.md | 4 ++-- docs/configuration/observability.md | 4 ---- docs/configuration/oidc.md | 5 ++--- docs/configuration/storage.md | 9 +++++---- docs/configuration/syslog.md | 2 +- docs/configuration/tls.md | 2 +- example/config.yaml | 27 +++++++++++++++++---------- internal/config/defaults.go | 5 +++-- 11 files changed, 55 insertions(+), 32 deletions(-) diff --git a/docs/configuration/advanced.md b/docs/configuration/advanced.md index 6bf57f869..07e3376d5 100644 --- a/docs/configuration/advanced.md +++ b/docs/configuration/advanced.md @@ -53,7 +53,7 @@ advanced-cookies-samesite: "lax" advanced-rate-limit-requests: 300 # Int. Amount of open requests to permit per CPU, per router grouping, before applying http -# request throttling. Any requests beyond the calculated limit are held in a backlog queue for +# request throttling. Any requests beyond the calculated limit are held in a backlog queue for # up to 30 seconds before either being processed or timing out. Requests that don't fit in the backlog # queue will have status 503 returned to them, and the header 'Retry-After' will be set to 30 seconds. # @@ -71,7 +71,7 @@ advanced-rate-limit-requests: 300 # 2 cpu = 08 open, 032 backlog # 4 cpu = 16 open, 064 backlog # -# A multiplier of 8 is a sensible default, but you may wish to increase this for instances +# A multiplier of 8 is a sensible default, but you may wish to increase this for instances # running on very performant hardware, or decrease it for instances using v. slow CPUs. # # If you set this to 0 or less, http request throttling will be disabled entirely. @@ -80,6 +80,13 @@ advanced-rate-limit-requests: 300 # Default: 8 advanced-throttling-multiplier: 8 +# Duration. Time period to use as the "retry-after" header value in response to throttled requests. +# Minimum resolution is 1 second. +# +# Examples: [30s, 10s, 5s, 1m] +# Default: "30s" +advanced-throttling-retry-after: "30s" + # Int. CPU multiplier for the amount of goroutines to spawn in order to send messages via ActivityPub. # Messages will be batched so that at most multiplier * CPU count messages will be sent out at once. # This can be tuned to limit concurrent POSTing to remote inboxes, preventing your instance CPU diff --git a/docs/configuration/database.md b/docs/configuration/database.md index 047b8c198..3e66b09fc 100644 --- a/docs/configuration/database.md +++ b/docs/configuration/database.md @@ -165,6 +165,6 @@ db-sqlite-cache-size: "8MiB" # If set to empty string or zero, the sqlite default will be used. # See: https://www.sqlite.org/pragma.html#pragma_busy_timeout # Examples: ["0s", "1s", "30s", "1m", "5m"] -# Default: "5s" -db-sqlite-busy-timeout: "5m" +# Default: "30m" +db-sqlite-busy-timeout: "30m" ``` diff --git a/docs/configuration/general.md b/docs/configuration/general.md index cf2bb5c30..285852afe 100644 --- a/docs/configuration/general.md +++ b/docs/configuration/general.md @@ -23,11 +23,21 @@ log-level: "info" # Default: false log-db-queries: false +# Bool. Include the client IP in the emitted log lines +# Options: [true, false] +# Default: true +log-client-ip: true + # String. Application name to use internally. # Examples: ["My Application","gotosocial"] # Default: "gotosocial" application-name: "gotosocial" +# String. The user that will be shown instead of the landing page. if no user is set, the landing page will be shown. +# Examples: "admin" +# Default: "" +landing-page-user: "" + # String. Hostname that this server will be reachable at. Defaults to localhost for local testing, # but you should *definitely* change this when running for real, or your server won't work at all. # DO NOT change this after your server has already run once, or you will break things! @@ -44,7 +54,9 @@ host: "localhost" # # You should also redirect requests at "example.org/.well-known/nodeinfo" in the same way. # -# You should also redirect requests at "example.org/.well-known/host-meta" in the same way. This endpoint is used by a number of clients to discover the API endpoint to use when the host and account domain are different. +# You should also redirect requests at "example.org/.well-known/host-meta" in the same way. This endpoint +# is used by a number of clients to discover the API endpoint to use when the host and account domain are +# different. # # An empty string (ie., not set) means that the same value as 'host' will be used. # diff --git a/docs/configuration/media.md b/docs/configuration/media.md index 880a2bc95..7bc3ad6ad 100644 --- a/docs/configuration/media.md +++ b/docs/configuration/media.md @@ -7,7 +7,7 @@ ##### MEDIA CONFIG ##### ######################## -# Config pertaining to user media uploads (videos, image, image descriptions). +# Config pertaining to media uploads (videos, image, image descriptions, emoji). # Int. Maximum allowed image upload size in bytes. # Examples: [2097152, 10485760] @@ -53,6 +53,6 @@ media-emoji-local-max-size: 51200 # This strikes a good balance between decent interoperability with instances that have # higher emoji size limits, and not taking up too much space in storage. # Examples: [51200, 102400] -# Default: 51200 +# Default: 102400 media-emoji-remote-max-size: 102400 ``` diff --git a/docs/configuration/observability.md b/docs/configuration/observability.md index ddd423be9..6c812a8fc 100644 --- a/docs/configuration/observability.md +++ b/docs/configuration/observability.md @@ -9,10 +9,6 @@ These settings let you tune and configure certain observability related behaviou ##### OBSERVABILITY SETTINGS ##### ################################## -# Bool. Enable generation/parsing of a request ID for each received HTTP Request. -# Default: true -request-id-enabled: true - # String. Header name to use to extract a request or trace ID from. Typically set by a # loadbalancer or proxy. # Default: "X-Request-Id" diff --git a/docs/configuration/oidc.md b/docs/configuration/oidc.md index de321a55e..b30cd8410 100644 --- a/docs/configuration/oidc.md +++ b/docs/configuration/oidc.md @@ -79,9 +79,8 @@ oidc-scopes: # Default: false oidc-link-existing: false -# Array of string. If the returned ID token contains a 'groups' claim that -# matches one of the groups in oidc-admin-groups, then this user will be granted -# admin rights on the GtS instance +# Array of string. If the returned ID token contains a 'groups' claim that matches one of the +# groups in oidc-admin-groups, then this user will be granted admin rights on the GtS instance # Default: [] oidc-admin-groups: [] ``` diff --git a/docs/configuration/storage.md b/docs/configuration/storage.md index 9808669f9..e8715f48a 100644 --- a/docs/configuration/storage.md +++ b/docs/configuration/storage.md @@ -24,11 +24,9 @@ storage-local-base-path: "/gotosocial/storage" # String. API endpoint of the S3 compatible service. # Only required when running with the s3 storage backend. -# -# If your endpoint contains the bucket name, all files will be put into a -# subdirectory with the name of `storage-s3-bucket` -# # Examples: ["minio:9000", "s3.nl-ams.scw.cloud", "s3.us-west-002.backblazeb2.com"] +# GoToSocial uses "DNS-style" when accessing buckets. +# If you are using Scaleways object storage, please remove the "bucket name" from the endpoint address # Default: "" storage-s3-endpoint: "" @@ -36,6 +34,7 @@ storage-s3-endpoint: "" # # Default: false storage-s3-proxy: false + # Bool. Use SSL for S3 connections. # # Only set this to 'false' when testing locally. @@ -49,12 +48,14 @@ storage-s3-use-ssl: true # Examples: ["AKIAJSIE27KKMHXI3BJQ","miniouser"] # Default: "" storage-s3-access-key: "" + # String. Secret key part of the S3 credentials. # Consider setting this value using environment variables to avoid leaking it via the config file # Only required when running with the s3 storage backend. # Examples: ["5bEYu26084qjSFyclM/f2pz4gviSfoOg+mFwBH39","miniopassword"] # Default: "" storage-s3-secret-key: "" + # String. Name of the storage bucket. # # If you have already encoded your bucket name in the storage-s3-endpoint, this diff --git a/docs/configuration/syslog.md b/docs/configuration/syslog.md index cf983e0b2..17adc95f6 100644 --- a/docs/configuration/syslog.md +++ b/docs/configuration/syslog.md @@ -32,7 +32,7 @@ syslog-enabled: false # String. Protocol to use when directing logs to syslog. Leave empty to connect to local syslog. # Options: ["udp", "tcp", ""] -# Default: "tcp" +# Default: "udp" syslog-protocol: "udp" # String. Address:port to send syslog logs to. Leave empty to connect to local syslog. diff --git a/docs/configuration/tls.md b/docs/configuration/tls.md index 79bc509eb..933d71e32 100644 --- a/docs/configuration/tls.md +++ b/docs/configuration/tls.md @@ -52,7 +52,7 @@ letsencrypt-email-address: "" ##### MANUAL TLS CONFIG ##### ############################## -# String. Path to a PEM-encoded file on disk that includes the certificate chain +# String. Path to a PEM-encoded file on disk that includes the certificate chain # and the public key # Examples: ["/gotosocial/storage/certs/chain.pem"] # Default: "" diff --git a/example/config.yaml b/example/config.yaml index 823a126b3..a56f4d35e 100644 --- a/example/config.yaml +++ b/example/config.yaml @@ -231,8 +231,8 @@ db-sqlite-cache-size: "8MiB" # If set to empty string or zero, the sqlite default will be used. # See: https://www.sqlite.org/pragma.html#pragma_busy_timeout # Examples: ["0s", "1s", "30s", "1m", "5m"] -# Default: "5s" -db-sqlite-busy-timeout: "5m" +# Default: "30m" +db-sqlite-busy-timeout: "30m" cache: # Cache configuration options: @@ -246,7 +246,7 @@ cache: #### VISIBILITY CACHES ###### ############################# # - # Configure Status and account + # Configure Status and account # visibility cache. visibility-max-size: 2000 @@ -265,7 +265,7 @@ cache: account-ttl: "30m" account-sweep-freq: "1m" - block-max-size: 100 + block-max-size: 1000 block-ttl: "30m" block-sweep-freq: "1m" @@ -289,6 +289,10 @@ cache: follow-request-ttl: "30m" follow-request-sweep-freq: "1m" + instance-max-size: 2000 + instance-ttl: "30m" + instance-sweep-freq: "1m" + list-max-size: 2000 list-ttl: "30m" list-sweep-freq: "1m" @@ -331,7 +335,7 @@ cache: webfinger-max-size: 250 webfinger-ttl: "24h" - webfinger-sweep-freq: "1m" + webfinger-sweep-freq: "15m" ###################### ##### WEB CONFIG ##### @@ -490,7 +494,7 @@ media-emoji-local-max-size: 51200 # This strikes a good balance between decent interoperability with instances that have # higher emoji size limits, and not taking up too much space in storage. # Examples: [51200, 102400] -# Default: 51200 +# Default: 102400 media-emoji-remote-max-size: 102400 ########################## @@ -515,7 +519,7 @@ storage-local-base-path: "/gotosocial/storage" # String. API endpoint of the S3 compatible service. # Only required when running with the s3 storage backend. # Examples: ["minio:9000", "s3.nl-ams.scw.cloud", "s3.us-west-002.backblazeb2.com"] -# GoToSocial uses "DNS-style" when accessing buckets. +# GoToSocial uses "DNS-style" when accessing buckets. # If you are using Scaleways object storage, please remove the "bucket name" from the endpoint address # Default: "" storage-s3-endpoint: "" @@ -524,6 +528,7 @@ storage-s3-endpoint: "" # # Default: false storage-s3-proxy: false + # Bool. Use SSL for S3 connections. # # Only set this to 'false' when testing locally. @@ -537,12 +542,14 @@ storage-s3-use-ssl: true # Examples: ["AKIAJSIE27KKMHXI3BJQ","miniouser"] # Default: "" storage-s3-access-key: "" + # String. Secret key part of the S3 credentials. # Consider setting this value using environment variables to avoid leaking it via the config file # Only required when running with the s3 storage backend. # Examples: ["5bEYu26084qjSFyclM/f2pz4gviSfoOg+mFwBH39","miniopassword"] # Default: "" storage-s3-secret-key: "" + # String. Name of the storage bucket. # # If you have already encoded your bucket name in the storage-s3-endpoint, this @@ -632,7 +639,7 @@ letsencrypt-email-address: "" ##### MANUAL TLS CONFIG ##### ############################## -# String. Path to a PEM-encoded file on disk that includes the certificate chain +# String. Path to a PEM-encoded file on disk that includes the certificate chain # and the public key # Examples: ["/gotosocial/storage/certs/chain.pem"] # Default: "" @@ -775,7 +782,7 @@ syslog-enabled: false # String. Protocol to use when directing logs to syslog. Leave empty to connect to local syslog. # Options: ["udp", "tcp", ""] -# Default: "tcp" +# Default: "udp" syslog-protocol: "udp" # String. Address:port to send syslog logs to. Leave empty to connect to local syslog. @@ -939,7 +946,7 @@ advanced-throttling-multiplier: 8 # Minimum resolution is 1 second. # # Examples: [30s, 10s, 5s, 1m] -# Default: 30s +# Default: "30s" advanced-throttling-retry-after: "30s" # Int. CPU multiplier for the amount of goroutines to spawn in order to send messages via ActivityPub. diff --git a/internal/config/defaults.go b/internal/config/defaults.go index 34e46b342..dc076bdc7 100644 --- a/internal/config/defaults.go +++ b/internal/config/defaults.go @@ -107,7 +107,7 @@ var Defaults = Configuration{ SMTPPort: 0, SMTPUsername: "", SMTPPassword: "", - SMTPFrom: "GoToSocial", + SMTPFrom: "", SMTPDiscloseRecipients: false, TracingEnabled: false, @@ -122,7 +122,8 @@ var Defaults = Configuration{ AdvancedCookiesSamesite: "lax", AdvancedRateLimitRequests: 300, // 1 per second per 5 minutes AdvancedThrottlingMultiplier: 8, // 8 open requests per CPU - AdvancedSenderMultiplier: 2, // 2 senders per CPU + AdvancedThrottlingRetryAfter: time.Second * 30, + AdvancedSenderMultiplier: 2, // 2 senders per CPU Cache: CacheConfiguration{ GTS: GTSCacheConfiguration{