Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self-documenting & simplified config yaml #388

Open
Cafe137 opened this issue Oct 14, 2022 · 1 comment
Open

Self-documenting & simplified config yaml #388

Cafe137 opened this issue Oct 14, 2022 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request issue

Comments

@Cafe137
Copy link
Collaborator

Cafe137 commented Oct 14, 2022

Configuration

Considerations:

  • Needs object and comment support (IMO yaml)
  • Make it very obvious what is enabled and disabled (explicit enabled: true, not a mix of env vars magically turning something on)
  • Self documenting: structured objects, descriptive names, helpful comments that explain the use case
  • Avoid reusing the same variable in multiple features
  • Defaults are visible
  • All features are laid out, no README.md digging

Refactoring

Separate stamp management features. Currently auto-topup and auto-dilute both purchase stamps. In code, implement strategy pattern to clean up and separate concerns. I don't think mutually exclusive features should exist, nor should a feature do partially what the other feature does.

New features

Ceilings

Some situations should require user interaction, e.g. when a stamp grows in depth too much, or if an operation is too costly. E.g. the example config of stamp.global.maxCost: 1 BZZ

Selective or inclusive stamp management

Currently we only consider stamps valid if they match the configured amount and depth. IMO we should extend it to either allow all, or mark stamps with the label property, and manage those in all modes.

Units in config

e.g. 10s, 2m, 80%, 1BZZ

Test configuration

e.g. gateway-proxy -t (nginx) should validate and print in a human friendly way what the configuration is

Deploy configuration on first run

  • Have a default path for it
  • Can be specified by -c or --config for cloud deployment
  • Not mandatory, (re)created with defaults when it does not exist upon launching, so no setup required to "just start" the app
@Cafe137 Cafe137 self-assigned this Oct 14, 2022
@bee-runner bee-runner bot added the issue label Oct 14, 2022
@Cafe137 Cafe137 added documentation Improvements or additions to documentation enhancement New feature or request labels Oct 18, 2022
@Cafe137
Copy link
Collaborator Author

Cafe137 commented Oct 26, 2022

V2

# [Connection to the Bee node]

bee:
  api: http://localhost:1633
  debugApi: http://localhost:1635

# [Server settings]

server:
  port: 3000
  # Required for the bzz.link feature.
  # TODO: #1 Explain bzz.link feature
  # TODO: #2 Do we really need it? Can't we just rely on subdomains?
  hostname: localhost
  # Require authentication header for all requests.
  # This effectively makes the gateway private.
  #
  # May be left empty to disable authentication.
  authSecret: ''
  # Possible values: debug | info | warn | error
  logLevel: info

# [Stamp management]

# Periodically checks for valid stamps.
#
# A stamp is considered valid, when it has enough TTL, capacity
# and its amount and depth parameters match with this config.

stamp:
  # Run periodical automatic postage stamp management job this often.
  checkFrequency: 60s

  # Possible values: hardcoded | autobuy | autoextend
  # May be left empty to disable postage stamp management.
  mode: ''

  # [Hardcoded mode settings]

  hardcoded:
    # Always use this batch ID
    batchId: ''

  # [Autobuy mode settings]

  autobuy:
    # If there are no valid stamps, purchase one with the following amount and depth
    amount: 20k
    depth: 22
    # Trigger purchase when TTL is below this.
    ttlThreshold: 15m
    # Trigger purchase when usage is above this.
    usageThreshold: 70%

  # [Autoextend mode settings]

  autoextend:
    # If there are no stamps to extend, purchase one with the following amount and depth
    defaultAmount: 20k
    defaultDepth: 22
    # Enable diluting the postage stamp to increase its depth and therefor capacity
    extendCapacity: true
    # Enable topping up the postage stamp to increase its amount and therefor TTL
    extendTtl: true
    # Extend stamp by this amount
    extendAmount: 20k
    # Trigger topup when TTL is below this.
    ttlThreshold: 15m
    # Trigger dilution when usage is above this.
    usageThreshold: 70%

# [Content reupload]

# Periodically checks reachability of locally pinned content.
#
# Reuploads when cannot be reached over the network
# Uses the Bee stewardship API.
#
# May be used to ensure self-hosted content stays online.
#
# TODO: "self-hosted" is probably a wrong term here
contentReupload:
  enabled: false
  reuploadFrequency: 6h

# [Miscellaneous features]

# Enables resolving CIDs in place of Swarm hashes.
#
# e.g. http://bah5acgzaxtfhomziqdigaikb3cfnotehagiuzyprlr6w7uo7lhl3f6ngyq7a.localhost:3000
# will convert the CID to Swarm hash
cid: true

# Enables resolving ENS domains in place of Swarm hashes.
#
# e.g. http://swarm.localhost:3000 will find bzz:// content at swarm.eth
ens: true

# Adds 'x-bee-node' HTTP header to all responses, which
# exposes the hash of the Bee node overlay address.
#
# Useful for identifying individual Bee nodes in a cluster
# without exposing identity.
exposeHashedIdentity: false

# Removes swarm-pin HTTP header from requests, in order
# to avoid filling up disk space by public requests.
#
# Useful when running as a public gateway.
removePinHeader: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request issue
Projects
None yet
Development

No branches or pull requests

1 participant