# Copyright BigchainDB GmbH and BigchainDB contributors
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0

## Note: data values do NOT have to be base64-encoded in this file.

## vars is common environment variables for this BigchaindB node
apiVersion: v1
kind: ConfigMap
metadata:
  name: vars
  namespace: default
data:
  # node-fqdn is the DNS name registered for your HTTPS certificate.
  node-fqdn: "bdb.example.com"

  # node-frontend-port is the port number on which this node's services
  # are available to external clients.
  node-frontend-port: "443"

  # node-health-check-port is the port number on which an external load
  # balancer can check the status/liveness of the external/public server.
  # In our deployment, Kubernetes sends 'livenessProbes' to this port and
  # interprets a successful response as a 'healthy' service.
  node-health-check-port: "8888"

  # node-dns-server-ip is the IP of the DNS server. A Kubernetes deployment
  # always has a DNS server (kube-dns).
  node-dns-server-ip: "<IP address of node's DNS server, e.g. 10.0.0.10>"

  # mdb-instance-name is the name of the MongoDB instance in this Kubernetes cluster.
  mdb-instance-name: "<name of the mdb instance>"

  # ngx-instance-name is the name of the NGINX instance in this Kubernetes cluster.
  ngx-instance-name: "<name of the nginx instance>"

  # openresty-instance-name is the name of the OpenResty instance in this
  # Kubernetes cluster.
  openresty-instance-name: "<name of the openresty instance>"

  # bdb-instance-name is the name of the BigchainDB instance in this Kubernetes cluster.
  bdb-instance-name: "<name of the bdb instance>"

  # mdb-mon-instance-name is the name of the MongoDB Monitoring Agent instance
  # in this Kubernetes cluster.
  mdb-mon-instance-name: "<name of the mdb monitoring agent instance>"

  # ngx-mdb-instance-name is the FQDN of the MongoDB instance in this
  # Kubernetes cluster.
  ngx-mdb-instance-name: "<name of the mdb instance>.default.svc.cluster.local"

  # ngx-openresty-instance-name is the FQDN of the OpenResty instance in this
  # Kubernetes cluster.
  ngx-openresty-instance-name: "<name of the openresty instance>.default.svc.cluster.local"

  # ngx-bdb-instance-name is the FQDN of the BigchainDB instance in this
  # Kubernetes cluster.
  ngx-bdb-instance-name: "<name of the bdb instance>.default.svc.cluster.local"

  # mongodb-backend-port is the port on which MongoDB is actually
  # available/listening for requests.
  mongodb-backend-port: "27017"

  # TODO: Change `openresty` to `apicast`
  # openresty-backend-port is the port number on which OpenResty is listening
  # for requests. This is used by the NGINX instance to forward the requests to
  # the right port, and by OpenResty instance to bind to the correct port to
  # receive requests from NGINX instance.
  openresty-backend-port: "8080"

  # BigchainDB configuration parameters
  # Refer https://docs.bigchaindb.com/projects/server/en/latest/server-reference/configuration.html

  # bigchaindb-api-port is the port number on which BigchainDB is listening
  # for HTTP requests.
  bigchaindb-api-port: "9984"

  # bigchaindb-server-bind is the socket where BigchainDB binds for API
  # requests.
  bigchaindb-server-bind: "0.0.0.0:9984"

  # bigchaindb-ws-port and bigchaindb-ws-interface form the socket where
  # BigchainDB binds for Websocket connections.
  bigchaindb-ws-port: "9985"
  bigchaindb-ws-interface: "0.0.0.0"

  # bigchaindb-database-name is the database collection used by BigchainDB with
  # the MongoDB backend.
  bigchaindb-database-name: "bigchain"

  # bigchaindb-wsserver-advertised-scheme is the protocol used to access the
  # WebSocket API in BigchainDB; can be 'ws' or 'wss' (default).
  bigchaindb-wsserver-advertised-scheme: "wss"

  # Optional: Optimize storage engine(wired tiger)
  # cache size. e.g. (2048MB, 2GB, 1TB), otherwise
  # it will use the default cache size; i.e. max((50% RAM - 1GB), 256MB)
  storage-engine-cache-size: ""

  # POST API authorization mode [threescale | secrete-token]
  authorization-mode: "threescale"

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: bdb-config
  namespace: default
data:
  # BigchainDB instance authentication user name
  bdb-user: "<user name>"

  # bigchaindb-database-maxtries is the maximum number of times that BigchainDB
  # will try to establish a connection with the database backend.
  # If it is set to 0, then it will try forever.
  bigchaindb-database-maxtries: "3"

  # bigchaindb-database-connection-timeout is the maximum number of
  # milliseconds that BigchainDB will wait before closing the connection while
  # connecting to the database backend.
  bigchaindb-database-connection-timeout: "5000"

  # bigchaindb-log-level is the log level used to log to the console.
  bigchaindb-log-level: "debug"

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: tendermint-config
  namespace: default
data:
  # bdb-persistent-peers is the list of all the peers in the network.
  bdb-persistent-peers: "<',' separated list of all tendermint peers in the network>"

  # bdb-validators is the list of all validators in the network.
  bdb-validators: "<',' separated list of all validators in the network>"

  # bdb-validator-power is the validators voting power, make sure the order and
  # the number of nodes in tm-validator-power and tm-validators is the same.
  bdb-validator-power: "<',' separated list of validator power of each node in the network>"

  # bdb-genesis-time is the official time of blockchain start.
  # example: 0001-01-01T00:00:00Z
  bdb-genesis-time: "<timestamp of blockchain start>"

  # bdb-chain-id is the ID of the blockchain. Must be unique for every blockchain.
  # example: test-chain-KPI1Ud
  bdb-chain-id: "<ID of the blockchain>"

  # bdb-abci-port is used by Tendermint Core for ABCI traffic. BigchainDB nodes
  # use that internally.
  bdb-abci-port: "26658"

  # bdb-p2p-port is used by Tendermint Core to communicate with
  # other peers in the network. This port is accessible publicly.
  bdb-p2p-port: "26656"

  # bdb-rpc-port is used by Tendermint Core to rpc. BigchainDB nodes
  # use this port internally.
  bbd-rpc-port: "26657"

  # bdb-pub-key-access is the port number used to host/publish the
  # public key of the tendemrint node in this cluster.
  bdb-pub-key-access: "9986"

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: mdb-config
  namespace: default
data:
  # User name for MongoDB adminuser
  mdb-admin-username: "<mongodb admin username>"

  # MongoDB monitoring agent authentication user name
  mdb-mon-user: "<mongodb monitoring agent username>"
