main.yaml
Overview
main.yaml is a configuration file primarily used to define environment variables and settings for the deployment and operation of a node-based service, potentially in a distributed or blockchain-related system. It specifies runtime parameters such as logging behavior, authentication tokens, container images, timeouts, and node configuration files. This file functions as a centralized source of configuration values that other deployment scripts, orchestration tools, or container runtime environments consume to initialize and manage the node services consistently.
File Structure and Key Entries
The file is structured as a YAML document with key-value pairs and lists that set parameters influencing system behavior and deployment details.
Logging Configuration
LOG_ROTATE_AMOUNT: 20
Defines the number of log files to retain when log rotation occurs.LOG_ROTATE_SIZE: 5G
Specifies the maximum size of a log file before rotation is triggered (5 gigabytes).LOG_ROTATE_SPEC: "/2 "
A cron-style schedule string indicating that log rotation should run every 2 minutes.
These parameters are critical for managing the size and lifecycle of log files to prevent storage overflow and maintain logs for troubleshooting and auditing.
Node and System Execution Parameters
NODE_BINARY: node
Specifies the executable command for running the node service, here set tonode(likely a Node.js binary).FAIL_FAST: yes
A flag indicating that the system should terminate immediately upon encountering critical failures.STAKING_TIME: 60
Possibly indicates a staking duration or timeout in seconds related to blockchain or consensus mechanisms.NUMACTL: no
Indicates whether NUMA control (Non-Uniform Memory Access optimization) should be used; here it is disabled.DISABLE_STAKING: no
Flag to enable or disable staking functionality.NUMBERED_SERVICES: yes
Possibly toggles the use of numbered service instances.
OpenTelemetry and Authentication
OTEL_MY_HOST_NAME: "{{ inventory_hostname }}"
Uses an inventory hostname variable for OpenTelemetry trace naming or metrics tagging.EXT_MESSAGE_AUTH_REQUIRED: no
Indicates whether external message authentication is required.AUTH_TOKEN: some-secret-auth-token
A secret token used for authentication purposes, presumably for internal or external API calls.
Container Images
AEROSPIKE_IMAGE: "aerospike/aerospike-server:8.1.0.1"
Specifies the container image for the Aerospike database server.LOGROTATE_IMAGE: "stakater/logrotate:3.13.0"
Specifies the container image used to perform log rotation tasks.
These image specifications facilitate containerized deployments, ensuring the correct version of services are used.
Commit and Test Metadata
COMMIT_HASH: commit_unknown
Placeholder for the current commit hash, useful for debugging and traceability.TEST_NAME: test_unknown
Placeholder for the name of the current test, if any.
Timing and Timeout Settings
MIN_TIME_BETWEEN_STATE_PUBLISH_DIRECTIVES: 1200s
Minimum interval between publishing state directives, likely to throttle state update frequency.NODE_JOINING_TIMEOUT: 600s
Timeout in seconds for a node to join the network.WAIT_FOR_NODE_STOP_SECS: 600
Time to wait for a node to stop gracefully.NODE_STOP_TEST_OUTER_TAIL: 5000
Configures how much of the node stop log tail to capture or analyze.NODE_STOP_TEST_INNER_TAIL: 5
Additional tail lines for detailed node stop logs.
Node Configuration Files
NODE_CONFIGS:
A list containing node configuration filenames, including:blockchain.conf.jsonzerostate
These files are likely loaded by the node service at startup to configure blockchain parameters and initial state.
Other Flags and Lists
OTHER_KEYS: []
An empty list placeholder for any additional keys or configuration entries.PREPARE_HOST: yes
Indicates whether the host environment should be prepared before starting the node, such as installing dependencies or setting up directories.
Usage Examples
This file is typically referenced or loaded by:
Container orchestration tools (e.g., Kubernetes, Docker Compose) through environment variable injection.
Deployment scripts that parse this YAML to configure the node runtime environment.
Log rotation jobs or cron jobs that use the specified
LOG_ROTATE_SPEC,LOG_ROTATE_SIZE, andLOG_ROTATE_AMOUNT.Authentication middleware or services that leverage
AUTH_TOKENandEXT_MESSAGE_AUTH_REQUIRED.
Example snippet to load environment variables in a bash script:
export NODE_BINARY=node
export FAIL_FAST=yes
export AUTH_TOKEN=some-secret-auth-token
# ... other exports
Interaction with Other System Components
Containerized services: The specified container images (
AEROSPIKE_IMAGEandLOGROTATE_IMAGE) are pulled and run to provide database and log maintenance capabilities, interfacing with the node service.Node service: Uses the
NODE_CONFIGSfiles as input configuration and respects timing parameters for network joining and state publishing.Logging subsystem: Controlled by the log rotation parameters and executed via the specified logrotate container image.
Authentication services: Use the
AUTH_TOKENand flags to secure message transmission.
Implementation Details and Algorithms
No complex algorithms are implemented within this YAML file itself; it is purely declarative. However, key operational behaviors are implied:
Log rotation scheduling uses a cron-style expression (
LOG_ROTATE_SPEC) to trigger the log rotation container, which manages log file sizes and counts according toLOG_ROTATE_SIZEandLOG_ROTATE_AMOUNT.Fail-fast behavior (
FAIL_FAST) suggests that the node or orchestrator monitors critical errors and terminates processes immediately to avoid cascading failures.Node joining and state publish timeouts are used as thresholds within node lifecycle management processes, possibly triggering retries or alerts.
Mermaid Diagram
flowchart TD
subgraph NodeService
NODE_BINARY[node]
NODE_CONFIGS["blockchain.conf.json\nzerostate"]
STAKING_TIME
FAIL_FAST
DISABLE_STAKING
NUMBERED_SERVICES
end
subgraph Logging
LOGROTATE_IMAGE[Logrotate Container]
LOG_ROTATE_SPEC[Rotate Schedule]
LOG_ROTATE_SIZE[Max Log Size]
LOG_ROTATE_AMOUNT[Log Retention Count]
end
subgraph Authentication
AUTH_TOKEN[Auth Token]
EXT_MESSAGE_AUTH_REQUIRED[Auth Required Flag]
end
subgraph ContainerImages
AEROSPIKE_IMAGE[Aerospike Container]
LOGROTATE_IMAGE
end
subgraph Timing
NODE_JOINING_TIMEOUT
MIN_TIME_BETWEEN_STATE_PUBLISH_DIRECTIVES
WAIT_FOR_NODE_STOP_SECS
end
NodeService -->|Uses| NODE_CONFIGS
NodeService -->|Uses| AUTH_TOKEN
NodeService -->|Interacts with| AEROSPIKE_IMAGE
Logging --> LOGROTATE_IMAGE
Logging --> LOG_ROTATE_SPEC
Logging --> LOG_ROTATE_SIZE
Logging --> LOG_ROTATE_AMOUNT
Authentication --> AUTH_TOKEN
Authentication --> EXT_MESSAGE_AUTH_REQUIRED
NodeService --> Timing
This diagram illustrates the main configuration groupings and their relationships within main.yaml. The node service depends on configuration files, authentication settings, and container images. Logging is managed separately but related via the logrotate container image and scheduling parameters. Timing settings influence node lifecycle management.