Guest User

Untitled

a guest
Feb 28th, 2023
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 27.00 KB | None | 0 0
  1. (define-module (skylar services)
  2.   #:use-module (skylar packages)
  3.   #:use-module (gnu services)
  4.   #:use-module (gnu services configuration)
  5.   #:use-module (gnu services shepherd)
  6.   #:use-module (guix gexp)
  7.   #:export (gotosocial-configuration
  8.         gotosocial-service-type))
  9.  
  10. (define (yaml-serialize field-name value)
  11.   #~(string-append #$field-name ": " #$value))
  12.  
  13. (define (gts-serialize-string field-name value)
  14.   (yaml-serialize field-name (string-append  "\"" value "\"")))
  15. (define (gts-serialize-boolean field-name value)
  16.   (yaml-serialize field-name (if value "true" "false")))
  17. (define (gts-serialize-integer field-name value)
  18.   (yaml-serialize field-name (number->string value)))
  19. (define (gts-serialize-list-of-strings field-name value)
  20.   (yaml-serialize field-name (apply string-append
  21.                     (map (lambda (s) (string-append "\n  - \"" s "\""))
  22.                      value))))
  23.  
  24. (define-configuration gotosocial-configuration
  25.   (log-level
  26.    (string "info")
  27.    "String. Log level to use throughout the application. Must be lower-case.
  28. Options: @code{[\"trace\",\"debug\",\"info\",\"warn\",\"error\",\"fatal\"]}")
  29.   (log-db-queries
  30.    (boolean #f)
  31.    "Boolean. Log database queries when log-level is set to debug or trace. This setting produces verbose logs, so it's better to only enable it when you're trying to track an issue down.
  32. Default: #f")
  33.   (application-name
  34.    (string "gotosocial")
  35.    "String. Application to use internally.
  36. Examples: @code{[\"My Application\", \"gotosocial\"]}
  37. Default: \"gotosocial\"")
  38.   (landing-page-user
  39.    (string "")
  40.    "String. The user that will be shown instead of the landing page. An empty string means that the landing page will be shown.
  41. Example: \"admin\"
  42. Default: \"\"")
  43.   (host
  44.    (string "localhost")
  45.    "String. Hostname this server will be reachable at. Defaults to localhost for local testing, but you should @emph{definitely} change this when running for real, or your server won't work at all.
  46. DO NOT change this after your server has already run once, or you will break things!
  47. Examples: [\"gts.example.org\", \"some.server.com\"]
  48. Default: \"localhost\"")
  49.   (account-domain
  50.    (string "")
  51.    "String. Domain to use when federating profiles. This is useful when you want your server to be at eg., \"gts.example.org\", but you want the domain on accounts to be \"example.org\" because it looks better or is just shorter/easier to remember.
  52.  
  53. To make this setting work properly, you need to redirect requests at \"example.org/.well-known/webfinger\" to \"gts.example.org/.well-known/webfinger\" so that GtS can handle them properly.
  54.  
  55. You should also redirect requests at \"example.org/.well-known/nodeinfo\" in the same way. An empty string (ie., not set) means that the same value as 'host' will be used.
  56.  
  57. DO NOT change this after your server has already run once, or you will break things!
  58.  
  59. Please read the appropriate section of the installation guide before you go messing around with this setting: @{url https://docs.gotosocial.org/installation_guide/advanced/#can-i-host-my-instance-at-fediexampleorg-but-have-just-exampleorg-in-my-username}
  60.  
  61. Examples: [\"example.org\",\"server.com\"]
  62. Default: \"\"")
  63.   (protocol
  64.    (string "https")
  65.    "String. Protocol to use for the server. Only change to http for local testing!
  66. This should be the protocol part of the URI that your server is actually reachable on. So even if you're running GoToSocial behind a reverse proxy that handles SSL certificates for you, instead of using built-in letsencrypt, it should still be https.
  67. Options: [\"http\",\"https\"]
  68. Default: \"https\"")
  69.   (bind-address
  70.    (string "0.0.0.0")
  71.    "String. Address to bind the GoToSocial server to. This can be an IPv4 address or an IPv6 address (surrounded in square brackets), or a hostname. The default value will bind to all interfaces, which makes the server accessible by other machines. For most setups there is no need to change this.
  72. If you are using GoToSocial in a reverse proxy setup with the proxy running on the same machine, you will want to set this to \"localhost\" or an equivalent, so that the proxy can't be bypassed.
  73. Examples: [\"0.0.0.0\", \"172.128.0.16\", \"localhost\", \"[::]\", \"[2001:db8::fed1]\"]
  74. Default: \"0.0.0.0\"")
  75.   (port
  76.    (integer 8080)
  77.    "Int. Listen port for the GoToSocial webserver + API. If you're running behind a reverse proxy and/or in a docker, container, just set this to whatever you like (or leave the default), and make sure it's forwarded properly.
  78. If you are running with built-in letsencrypt enabled, and running GoToSocial directly on a host machine, you will probably want to set this to 443 (standard https port), unless you have other services already using that port.
  79. This *MUST NOT* be the same as the letsencrypt port specified below, unless letsencrypt is turned off.
  80. Examples: [443, 6666, 8080]
  81. Default: 8080")
  82.   (trusted-proxies
  83.    (list-of-strings '("127.0.0.1/32" "::1"))
  84.    "List of strings. CIDRs or IP addresses of proxies that should be trusted when determining real client IP from behind a reverse proxy.
  85. If you're running inside a Docker container behind Traefik or Nginx, for example, add the subnet of your docker network, or the gateway of the docker network, and/or the address of the reverse proxy (if it's not running on the host network).
  86. Example: [\"127.0.0.1/32\", \"172.20.0.1\"]
  87. vDefault: [\"127.0.0.1/32\", \"::1\"] (localhost ipv4 + ipv6)")
  88.   (db-type
  89.    (string "postgres")
  90.    "String. Database type.
  91. Options: [\"postgres\", \"sqlite\"]
  92. Default: \"postgres\"")
  93.   (db-address
  94.    (string "")
  95.    "String. Database address or parameters.
  96.  
  97. For Postgres, this should be the address or socket at which the database can be reached.
  98.  
  99. For Sqlite, this should be the path to your sqlite database file. Eg., /opt/gotosocial/sqlite.db. If the file doesn't exist at the specified path, it will be created. If just a filename is provided (no directory) then the database will be created in the same directory as the GoToSocial binary.
  100.  
  101. If address is set to :memory: then an in-memory database will be used (no file). WARNING: :memory: should NOT BE USED except for testing purposes.
  102.  
  103. Examples: [\"localhost\",\"my.db.host\",\"127.0.0.1\",\"192.111.39.110\",\":memory:\", \"sqlite.db\"]
  104. Default: \"\"")
  105.   (db-port
  106.    (integer 5432)
  107.    "Integer. Port for database connection.
  108. Default: 5432")
  109.   (db-user
  110.    (string "")
  111.    "String. Username for the database connection.
  112. Examples: [\"mybduser\", \"postgres\", \"gotosocial\"]
  113. Default: \"\"")
  114.   (db-password
  115.    (string "")
  116.    "String. Password to use for the database connection.
  117. Default: \"\"")
  118.   (db-database
  119.    (string "gotosocial")
  120.    "String. Name of the database to use within the provided database type.
  121. Default: \"gotosocial\"")
  122.   (db-tls-mode
  123.    (string "disable")
  124.    "String. Disable, enable, or require SSL/TLS connection to the database.
  125. If \"disable\" then no TLS connection will be attempted.
  126. If \"enable\" then TLS will be tried, but the database certificate won't be checked (for self-signed certs).
  127. If \"require\" then TLS will be required to make a connection, and a valid certificate must be presented.
  128. Default: \"disable\"")
  129.   (db-tls-ca-cert
  130.    (string "")
  131.    "String. Path to a CA certificate on the host machine for db certificate validation. If this is left empty, just the host certificates will be used. If filled in, the certificate will be loaded and added to host certificates.")
  132.   (db-max-open-conns-multiplier
  133.    (integer 8)
  134.    "Integer. Number to multiply by CPU count to set permitted total of open database connections (in-use and idle).
  135. You can use this setting to tune your database connection behavior, though most admins won't need to touch it.
  136.  
  137. Example values for multiplier 8:
  138.  
  139. 1 cpu = 08 open connections
  140. 2 cpu = 16 open connections
  141. 4 cpu = 32 open connections
  142.  
  143. Example values for multiplier 4:
  144.  
  145. 1 cpu = 04 open connections
  146. 2 cpu = 08 open connections
  147. 4 cpu = 16 open connections
  148.  
  149. 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.
  150.  
  151. If you set the multiplier to less than 1, only one open connection will be used regardless of cpu count.
  152.  
  153. PLEASE NOTE!!: This setting currently only applies for Postgres. SQLite will always use 1 connection regardless pof what is set here. This behavior will change in future when we implement better SQLITE_BUSY handling.
  154. See @url{https://github.com/superseriousbusiness/gotosocial/issues/1407 for more details.}
  155.  
  156. Examples: [16, 8, 10, 2]
  157. Default: 8")
  158.   (db-sqlite-journal-mode
  159.    (string "WAL")
  160.    "String. SQLite journaling mode. SQLite only -- unused otherwise. If set to empty string, the sqlite default will be used. See: @url{https://www.sqlite.org/pragma.html#pragma_journal_mode}
  161. Examples: [\"DELETE\", \"TRUNCATE\", \"PERSIST\", \"MEMORY\", \"WAL\", \"OFF\"]
  162. Default: \"WAL\"")
  163.   (db-sqlite-synchronous
  164.    (string "NORMAL")
  165.    "String. SQLite synchronous mode. SQLite only -- unused otherwise. If set to empty string, the sqlite default will be used. See: @url{https://www.sqlite.org/pragma.html#pragma_synchronous}
  166. Examples: [\"OFF\", \"NORMAL\", \"FULL\", \"EXTRA\"]
  167. Default: \"NORMAL\"")
  168.   (db-sqlite-cache-size
  169.    (string "8MiB")
  170.    "String describing a valid byte size. SQLite cache size. SQLite only -- unused otherwise. If set to empty string or zero, the sqlite default (2MiB) will be used.
  171. See: @url{https://sqlite.org/pragma.html#pragma_cache_size}
  172. Examples: [\"0\", \"2MiB\", \"8MiB\", \"64MiB\"]
  173. Default: \"8MiB\"")
  174.   (db-sqlite-busy-timeout
  175.    (string "5m")
  176.    "Duration. SQlite busy timeout. SQLite only -- unused otherwise. If set to empty string or zero, the sqlite default will be used. See: @url{https://www.sqlite.org/pragma.html#pragma_busy_timeout}
  177. Examples: [\"0s\", \"1s\", \"30s\", \"1m\", \"5m\"]
  178. Default: \"5m\"")
  179.   ;;
  180.   ;; TODO: database cache
  181.   ;;
  182.   (web-template-base-dir
  183.    (string "./web/template/")
  184.    "String. Directory from which gotosocial will attempt to load html templates (.tmpl files).
  185. Default: \"./web/template/\"")
  186.   (web-asset-base-dir
  187.    (string "./web/assets/")
  188.    "String. Directory from which gotosocial will attempt to serve static web assets (images, scripts.
  189. Defualt: \"./web/assets/\"")
  190.   (instance-expose-peers
  191.    (boolean #f)
  192.    "Boolean. Allow unauthenticated users to make queries to /api/v1/instance/peers?filter=open in order to see a list of instances that this instance 'peers' with. Even if set to 'false', then authenticated users (members of the instance) will still be able to query the endpoint.
  193. Default: #f")
  194.   (instance-expose-suspended
  195.    (boolean #f)
  196.    "Boolean. Allow unauthenticated users to make queries to /api/v1/instance/peers?filter=suspended in order to see a list of instances that this instance blocks/suspends. This will also allow unauthenticated users to see the list through the web UI. Even if set to 'false', then authenticated users (members of the instance) will still be able to query the endpoint.
  197. Default: #f")
  198.   (instance-expose-suspended-web
  199.    (boolean #f)
  200.    "Boolean. Allow unauthenticated users to view /about/suspended, showing the HTML rendered list of instances that this instance blocks/suspends.
  201. Default: #f")
  202.   (instance-expose-public-timeline
  203.    (boolean #f)
  204.    "Boolean. Allow unauthenticated users to make queries to /api/v1/timelines/public in order to see a list of public posts on this server. Even if set to 'false', then authenticated users (members of this instance) will still be able to query the endpoint.
  205. Default: #f")
  206.   (instance-deliver-to-shared-inboxes
  207.    (boolean #t)
  208.    "Boolean. This flag tweaks whether GoToSocial will deliver ActivityPub messages to the shared inbox of a recipient, if one is available, instead of delivering each message to each actor who should receive a message individually.
  209.  
  210. Shared inbox delivery can significantly reduce network load when delivering to multiple recipients share an inbox (eg., on large Mastodon instances).
  211.  
  212. See: @url{https://www.w3.org/TR/activitypub/#shared-inbox-delivery}
  213.  
  214. Default: #t")
  215.   (accounts-registration-open
  216.    (boolean #t)
  217.    "Boolean. Do we want people to be able to just submit sign up requests, or do we want invite only?
  218. Default: #t")
  219.   (accounts-approval-required
  220.    (boolean #t)
  221.    "Boolean. Do sign up requests require approval from an admin/moderator before an account can sign in/use the server?
  222. Default: #t")
  223.   (accounts-reason-required
  224.    (boolean #t)
  225.    "Boolean. Are sign up requests required to submit a reason for the request (eg., an explanation of why they want to join the instance)?
  226. Default: #t")
  227.   (accounts-allow-custom-css
  228.    (boolean #f)
  229.    "Boolean. Allow accounts on this instance to set custom CSS for their profile pages and statuses. Enabling this setting will allow accounts to upload custom CSS via the /user settings page, which will then be rendered on the web view of the account's profile and statuses.
  230.  
  231. For instances with public sign ups, it is **HIGHLY RECOMMENDED** to leave this setting on 'false', since setting it to true allows malicious accounts to make their profile pages misleading, unusable or even dangerous to visitors. In other words, you should only enable this setting if you trust the users on your instance not to produce harmful CSS.
  232.  
  233. Regardless of what this value is set to, any uploaded CSS will not be federated to other instances, it will only be shown on profiles and statuses on *this* instance.
  234.  
  235. Default: #f")
  236.   (media-image-max-size
  237.    (integer 10485760)
  238.    "Integer. Maximum allowed upload size in bytes.
  239. Default: 10485760 -- aka 10MB")
  240.   (media-video-max-size
  241.    (integer 41943040)
  242.    "Integer. Maximum allowed video upload size in bytes.
  243. Default: 41943040 -- aka 40MB")
  244.   (media-description-min-chars
  245.    (integer 0)
  246.    "Integer. Minimum amount of characters required as an image or video description.
  247. Default: 0 (not required)")
  248.   (media-description-max-chars
  249.    (integer 500)
  250.    "Integer. maximum amount of characters permitted in an image or video description.
  251. Default: 500")
  252.   (media-remote-cache-days
  253.    (integer 30)
  254.    "Integer. Number of days to cache media from remote instances before they are removed from the cache. A job will run every day at midnight to clean up any remote media older than the given amount of days.
  255.  
  256. When remote media is removed from the cache, it is deleted from storage but the database entries for the media are kept so that it can be fetched again if requested by a user.
  257.  
  258. If this is set to 0, then media from remote instances will be cached indefinitely.
  259. Examples: [30, 60, 7, 0]
  260. Default: 30")
  261.   (media-emoji-local-max-size
  262.    (integer 51200)
  263.    "Integer. Max size in bytes of emojis uploaded to this instance via the admin API. The default is the same as the Mastodon size limit for emojis (50kb), which allows for good interoperability. Raising this limit may cause issues with federation of your emojis to other instances, so beware.
  264. Default: 51200")
  265.   (media-emoji-remote-max-size
  266.    (integer 102400)
  267.    "Int. Max size in bytes of emojis to download from other instances. By default this is 100kb, or twice the size of the default for media-emoji-local-max-size. 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.
  268. Default: 102400")
  269.   (storage-backend
  270.    (string "local")
  271.    "String. Type of storage backend to use for user-created uploads (videos, images, etc).
  272. Examples: [\"local\", \"s3\"]
  273. Default: \"local\" (storage on local disk")
  274.   (storage-local-base-path
  275.    (string "/gotosocial/storage")
  276.    "String. Directory to use as a base path for storing files. Make sure whatever user/group gotosocial is running as has permission to access this directory, and create new subdirectories and files within it.
  277. Only required when running with the local storage backend.
  278. Examples: [\"/home/gotosocial/storage\", \"/opt/gotosocial/datastorage\"]
  279. Default: \"/gotosocial/storage\"")
  280.   (storage-s3-endpoint
  281.    (string "")
  282.    "String. API endpoint of the S3 compatible service. Only required when running with the s3 storage backend.
  283. Default: \"\"")
  284.   (storage-s3-proxy
  285.    (boolean #f)
  286.    "Boolean. If data stored in S3 should be proxied through GoToSocial instead of redirecting to a presigned URL.
  287. Default: #f")
  288.   (storage-s3-use-ssl
  289.    (boolean #t)
  290.    "Boolean. Use SSL for S3 connections. Only set to #f when testing locally.
  291. Default: #t")
  292.   (storage-s3-access-key
  293.    (string "")
  294.    "String. Access 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.
  295. Default: \"\"")
  296.   (storage-s3-secret-key
  297.    (string "")
  298.    "String. Secret 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.
  299. Default: \"\"")
  300.   (storage-s3-bucket
  301.    (string "")
  302.    "String. Name of the storage bucket. If you have already encoded your bucket name in the storage-s3-endpoint, this value will be used as a directory containing your data. This bucket must exist prior to starting GoToSocial. Only required when running with the s3 storage backend.
  303. Default: \"\"")
  304.   (statuses-max-chars
  305.    (integer 5000)
  306.    "Integer. Maximum amount of characters permitted for a new status. Note that going way higher than the default might break federation.
  307. Default: 5000")
  308.   (statuses-cw-max-chars
  309.    (integer 100)
  310.    "Integer. Maximum amount of characters allowed in the CW/subject header of a status. Note that going way higher than the default might break federation.
  311. Default: 100")
  312.   (statuses-poll-max-options
  313.    (integer 6)
  314.    "Integer. Maximum amount of options to permit when creating a new poll. Note that going way higher than the default might break federation.
  315. Default: 6")
  316.   (statuses-poll-option-max-chars
  317.    (integer 50)
  318.    "Integer. Maximum amount of characters to permit per poll option when creating a new poll. Note that going way higher than the default might break federation.
  319. Default: 50")
  320.   (statuses-media-max-files
  321.    (integer 6)
  322.    "Integer. Maximum amount of media files that can be attached to a new status. Note that going way higher than the default might break federation.
  323. Default: 6")
  324.   (letsencrypt-enabled
  325.    (boolean #f)
  326.    "Boolean. Whether or not letsencrypt should be enabled for the server. If false, the rest of the letsencrypt settings will be ignored. If you serve GoToSocial behind a reverse proxy like nginx or traefik, leave this turned off. If you don't, then turn it on so that you can use https.
  327.  
  328. Default: #f")
  329.   (letsencrypt-port
  330.    (integer 80)
  331.    "Int. Port to listen for letsencrypt certificate challenges on. If letsencrypt is enabled, this port must be reachable or you won't be able to obtain certs. If letsencrypt is disabled, this port will not be used.
  332. This *must not* be the same as the webserver/API port specified above.
  333. Default: 80")
  334.   (letsencrypt-cert-dir
  335.    (string "/gotosocial/storage/certs")
  336.    "String. Directory in which to store LetsEncrypt certificates. It is a good move to make this a sub-path within your storage directory, as it makes backup easier, but you might wish to move them elsewhere if they're also accessed by other services.
  337. In any case, make sure GoToSocial has permissions to write to / read from this directory.
  338. Default: \"/gotosocial/storage/certs\"")
  339.   (letsencrypt-email-address
  340.    (string "")
  341.    "String. Email address to use when registering LetsEncrypt certs. Most likely, this will be the email address of the instance administrator. LetsEncrypt will send notifications about expiring certificates etc to this address.
  342. Default: \"\"")
  343.   (oidc-enabled
  344.    (boolean #f)
  345.    "Boolean. Enable authentication with external OIDC provider. If set to true, then the other OIDC options must be set as well. If this is set to false, then the standard internal oauth flow will be used, where users sign in to GtS with username/password.
  346. Default: #f")
  347.   (oidc-idp-name
  348.    (string "")
  349.    "String. Name of the oidc idp (identity provider). This will be shown to users when they log in.
  350. Examples: [\"Google\", \"Dex\", \"Auth0\"]
  351. Default: \"\"")
  352.   (oidc-skip-verification
  353.    (boolean #f)
  354.    "Boolean. Skip the normal verification flow of tokens returned from the OIDC provider, ie. don't check the expiry or signature. This should only be used in debugging or testing, never ever in a production environment as it's extremely unsafe!
  355. Default: #f")
  356.   (oidc-issuer
  357.    (string "")
  358.    "String. OIDC issuer URI. This is where GtS will redirect users to for login. Typicallythis will look like a standard web URL.
  359. Default: \"\"")
  360.   (oidc-client-id
  361.    (string "")
  362.    "String. The ID for this client as registered with the OIDC provider.
  363. Default: \"\"")
  364.   (oidc-client-secret
  365.    (string "")
  366.    "String. The secret for this client as registered with the OIDC provider.
  367. Default: \"\"")
  368.   (oidc-scopes
  369.    (list-of-strings '("openid" "email" "profile" "groups"))
  370.    "List of strings. Scopes to request from the OIDC provider. The returned values will be used to populate users created in GtS as a result of the authentication flow. 'openid' and 'email' are required. 'profile' is used to extract a username for the newly created user. 'groups' is optional and can be used to determine if a user is an admin (if they're in the group 'admin' or 'admins').
  371. Default: [\"openid\", \"email\", \"profile\", \"groups\"]")
  372.   (oidc-link-existing
  373.    (boolean #f)
  374.    "Boolean. Link OIDC authenticated users to existing ones based on their email address. This is mostly intended for migration purposes if you were running previous versions of GTS which only correlated users with their email address. Should be set to false for most usecases.
  375. Default: #f")
  376.   (smtp-host
  377.    (string "")
  378.    "String. The hostname of the smtp server you want to use. If this is not set, smtp will not be used to send emails, and you can ignore the other settings.
  379. Default: \"\"")
  380.   (smtp-port
  381.    (integer 0)
  382.    "Integer. Port to use to connect to the smtp server.
  383. Default: 0")
  384.   (smtp-username
  385.    (string "")
  386.    "String. username to use when authenticating with the smtp server. This should have been provided to you by your smtp host. This is often, but not always, an email address.
  387. Default: \"\"")
  388.   (smtp-password
  389.    (string "")
  390.    "String. Password to use when authenticating with the smtp host. This should have been provided to you by your smtp host.
  391. Default: \"\"")
  392.   (smtp-from
  393.    (string "")
  394.    "String. 'From' address for sent emails.
  395. Default: \"\"")
  396.   (syslog-enabled
  397.    (boolean #f)
  398.    "Boolean. Enable the syslog logging hook. Logs will be mirrored to the convigured destination.
  399. Default: #f")
  400.   (syslog-protocol
  401.    (string "udp")
  402.    "String. Protocol to use directing logs to syslog. Leave empty to connect to local syslog.
  403. Default: \"udp\"")
  404.   (syslog-address
  405.    (string "localhost:514")
  406.    "String. Address:port to send syslog logs to. Leave empty to connect to local syslog.
  407. Default: \"localhost:514\"")
  408.   (advanced-cookies-samesite
  409.    (string "lax")
  410.    "String. Value of the SameSite attribute of cookies set by GoToSocial. Defaults to 'lax' to ensure that the OIDC flow does not break, which is fine in most cases. If you want to harden your instance against CSRF attacks and don't mind if some login-related things might break, you can set this to 'strict' instead.
  411.  
  412. For an overview of what this does, see: @url{https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite}
  413.  
  414. Options: [\"lax\", \"strict\"]
  415. Default: \"lax\"")
  416.   (advanced-rate-limit-requests
  417.    (integer 300)
  418.    "Integer. Amount of requests to permit per router grouping from a single IP address within a span of 5 minutes. If this amount is exceeded, a 429 HTTP error code will be returned.
  419.  
  420. If you find yourself adjusting this limit because it's regularly being exceeded, you should first verify that your settings for `trusted-proxies` (above) are correct. In many cases, when the rate limit is exceeded it is because your instance sees all incoming requests as coming from the *same IP address* (you can verify this by looking at the client IPs in your instance logs). If this is the case, try adding that IP address to your `trusted-proxies` *BEFORE* you go adjusting this rate limit setting!
  421.  
  422. If you set this to 0 or less, rate limiting will be disabled entirely.
  423.  
  424. Default: 300")
  425.   (advanced-throttling-multiplier
  426.    (integer 8)
  427.    "Integer. 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 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.
  428.  
  429. Open request limit is available CPUs * multiplier; backlog queue limit is limit * multiplier.
  430.  
  431. Example values for multiplier 8:
  432.  
  433. 1 cpu = 08 open, 064 backlog
  434. 2 cpu = 16 open, 128 backlog
  435. 4 cpu = 32 open, 256 backlog
  436.  
  437. Example values for multiplier 4:
  438.  
  439. 1 cpu = 04 open, 016 backlog
  440. 2 cpu = 08 open, 032 backlog
  441. 4 cpu = 16 open, 064 backlog
  442.  
  443. 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.
  444.  
  445. If you set this to 0 or less, http request throttling will be disabled entirely.
  446.  
  447. Default: 8")
  448.   (prefix gts-))
  449.  
  450. (define (gotosocial-serialize-configuration configuration)
  451.   (mixed-text-file
  452.    "gotosocial.yaml"
  453.    (serialize-configuration configuration gotosocial-configuration-fields)))
  454.  
  455. (define (gotosocial-shepherd-service config)
  456.   (shepherd-service
  457.    (documentation "Run GoToSocial.")
  458.    (provision '(gotosocial))
  459.    (requirement '(user-processes))
  460.    (start #~(make-forkexec-constructor
  461.          (list #$(file-append gotosocial "/bin/gotosocial")
  462.            "--config-path" #$(gotosocial-serialize-configuration config))))
  463.    (stop #~(make-kill-destructor))))
  464.  
  465. (define gotosocial-service-type
  466.   (service-type
  467.    (name 'gotosocial)
  468.    (extensions
  469.     (list (service-extension shepherd-root-service-type
  470.                  (compose list gotosocial-shepherd-service))))
  471.    (default-value (gotosocial-configuration))
  472.    (description "Runs GoToSocial, a lightweight ActivityPub server.")))
  473.  
  474. =============
  475.          (service gotosocial-service-type
  476.               (gotosocial-configuration
  477.                (protocol "http")))
  478. =============
  479.  
  480. Backtrace:
  481.            7 (primitive-load "/gnu/store/h5xlrgv8hg90nnaak7n669v5plx?")
  482. In ice-9/ports.scm:
  483.    433:17  6 (call-with-output-file _ _ #:binary _ #:encoding _)
  484. In ice-9/eval.scm:
  485.     159:9  5 (_ #(#(#<directory (guile-user) 7ffff5fdbc80>) #<outp?>))
  486.     155:9  4 (_ #(#(#<directory (guile-user) 7ffff5fdbc80>) #<outp?>))
  487.    173:39  3 (_ #(#(#<directory (guile-user) 7ffff5fdbc80>) #<outp?>))
  488.     163:9  2 (_ #(#(#<directory (guile-user) 7ffff5fdbc80>) #<outp?>))
  489.    223:20  1 (proc #(#(#<directory (guile-user) 7ffff5fdbc80>) #<o?>))
  490. In unknown file:
  491.            0 (%resolve-variable (7 . log-level) #<directory (guile-u?>)
  492.  
  493. ERROR: In procedure %resolve-variable:
  494. Unbound variable: log-level
  495.  
Add Comment
Please, Sign In to add comment