Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/actions/sync-files/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ runs:
using: 'composite'
steps:
- name: Prepare config file
if: inputs.type == 'config'
if: inputs.type == 'config' || inputs.type == 'config_asimov' || inputs.type == 'config_bradbury'
shell: bash
run: |
# For config type, handle special case:
Expand Down Expand Up @@ -92,7 +92,7 @@ runs:
shell: bash
run: |
# Use prepared source for config/docker_compose types, otherwise use original source
if [[ "${{ inputs.type }}" == "config" ]] && [[ -n "$CONFIG_SOURCE" ]]; then
if [[ "${{ inputs.type }}" == "config" || "${{ inputs.type }}" == "config_asimov" || "${{ inputs.type }}" == "config_bradbury" ]] && [[ -n "$CONFIG_SOURCE" ]]; then
SOURCE_PATH="$CONFIG_SOURCE"
elif [[ "${{ inputs.type }}" == "docker_compose" ]] && [[ -n "$DOCKER_COMPOSE_SOURCE" ]]; then
SOURCE_PATH="$DOCKER_COMPOSE_SOURCE"
Expand All @@ -109,7 +109,7 @@ runs:
"${{ inputs.exclude_files }}"

- name: Cleanup config temp directory
if: inputs.type == 'config' && always()
if: (inputs.type == 'config' || inputs.type == 'config_asimov' || inputs.type == 'config_bradbury') && always()
shell: bash
run: |
if [[ -n "$TEMP_CONFIG_DIR" ]] && [[ -d "$TEMP_CONFIG_DIR" ]]; then
Expand Down
22 changes: 19 additions & 3 deletions .github/workflows/sync-docs-from-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
needs: prepare
strategy:
matrix:
sync_type: [changelog, config, docker_compose, api_gen, api_debug, api_ops]
sync_type: [changelog, config, config_asimov, config_bradbury, docker_compose, api_gen, api_debug, api_ops]
fail-fast: false
steps:
- name: Checkout documentation repository
Expand All @@ -101,7 +101,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install yq for YAML sanitization
if: matrix.sync_type == 'config' || matrix.sync_type == 'docker_compose'
if: matrix.sync_type == 'config' || matrix.sync_type == 'config_asimov' || matrix.sync_type == 'config_bradbury' || matrix.sync_type == 'docker_compose'
run: |
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq
Expand All @@ -115,6 +115,8 @@ jobs:
sparse-checkout: |
docs
configs/node/config.yaml.example
configs/node/asimov.yaml.example
configs/node/bradbury.yaml.example
release/docker-compose.yaml
sparse-checkout-cone-mode: true
path: source-repo
Expand All @@ -136,6 +138,18 @@ jobs:
echo "target_path=content/validators/config.yaml" >> $GITHUB_OUTPUT
echo "filter_pattern=.*" >> $GITHUB_OUTPUT
;;
"config_asimov")
echo "title=Config File (Asimov)" >> $GITHUB_OUTPUT
echo "source_path=source-repo/configs/node/asimov.yaml.example" >> $GITHUB_OUTPUT
echo "target_path=content/validators/asimov.yaml" >> $GITHUB_OUTPUT
echo "filter_pattern=.*" >> $GITHUB_OUTPUT
;;
"config_bradbury")
echo "title=Config File (Bradbury)" >> $GITHUB_OUTPUT
echo "source_path=source-repo/configs/node/bradbury.yaml.example" >> $GITHUB_OUTPUT
echo "target_path=content/validators/bradbury.yaml" >> $GITHUB_OUTPUT
echo "filter_pattern=.*" >> $GITHUB_OUTPUT
;;
"docker_compose")
echo "title=Docker Compose File" >> $GITHUB_OUTPUT
echo "source_path=source-repo/release/docker-compose.yaml" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -474,11 +488,13 @@ jobs:
echo "" >> $GITHUB_STEP_SUMMARY

# Process each sync type report
for sync_type in changelog config docker_compose api_gen api_debug api_ops; do
for sync_type in changelog config config_asimov config_bradbury docker_compose api_gen api_debug api_ops; do
# Get proper title
case "$sync_type" in
"changelog") title="📝 Changelog Sync" ;;
"config") title="⚙️ Config File Sync" ;;
"config_asimov") title="⚙️ Config File Sync (Asimov)" ;;
"config_bradbury") title="⚙️ Config File Sync (Bradbury)" ;;
"docker_compose") title="🐳 Docker Compose Sync" ;;
"api_gen") title="🔧 API Gen Methods Sync" ;;
"api_debug") title="🐛 API Debug Methods Sync" ;;
Expand Down
4 changes: 4 additions & 0 deletions content/validators/asimov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Asimov Phase 5 network consensus configuration
consensus:
consensusaddress: "0xe66B434bc83805f380509642429eC8e43AE9874a"
genesis: 17326
4 changes: 4 additions & 0 deletions content/validators/bradbury.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Bradbury Phase 1 network consensus configuration
consensus:
consensusaddress: "0x8aCE036C8C3C5D603dB546b031302FCf149648E8"
genesis: 501711
14 changes: 11 additions & 3 deletions pages/validators/monitoring.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ CENTRAL_LOKI_PASSWORD=your-logs-password
# Node identification
NODE_ID=validator-001
VALIDATOR_NAME=MyValidator
NETWORK_NAME=asimov-phase5

# Usually defaults are fine
NODE_METRICS_ENDPOINT=host.docker.internal:9153
Expand Down Expand Up @@ -165,6 +166,7 @@ alloy:
# Single node configuration
- NODE_ID=${NODE_ID:-local}
- VALIDATOR_NAME=${VALIDATOR_NAME:-default}
- NETWORK_NAME=${NETWORK_NAME:-asimov-phase5}
- NODE_METRICS_ENDPOINT=${NODE_METRICS_ENDPOINT:-host.docker.internal:9153}

# Multi-node configuration
Expand Down Expand Up @@ -237,6 +239,12 @@ discovery.relabel "add_labels" {
replacement = "alloy"
}

// Add network label from environment variable
rule {
target_label = "network"
replacement = coalesce(sys.env("NETWORK_NAME"), "asimov-phase5")
}

// Add job label
rule {
target_label = "job"
Expand Down Expand Up @@ -278,16 +286,16 @@ loki.write "central" {
// Supports both single node and multi-node configurations
//
// Single Node Mode:
// Set NODE_METRICS_ENDPOINT, NODE_ID, VALIDATOR_NAME
// Set NODE_METRICS_ENDPOINT, NODE_ID, VALIDATOR_NAME, NETWORK_NAME
//
// Multi-Node Mode:
// Set SCRAPE_TARGETS_JSON with JSON array of target objects
// Example: [{"__address__":"host.docker.internal:9250","instance":"0x...","validator_name":"node-1"}]
// Example: [{"__address__":"host.docker.internal:9250","instance":"0x...","validator_name":"node-1","network":"testnet-asimov"}]
prometheus.scrape "genlayer_node" {
// Dynamic targets based on environment variable
// If SCRAPE_TARGETS_JSON is set, use it (multi-node mode)
// Otherwise, build single target from individual env vars (single node mode)
targets = encoding.from_json(coalesce(sys.env("SCRAPE_TARGETS_JSON"), string.format("[{\"__address__\":\"%s\",\"instance\":\"%s\",\"validator_name\":\"%s\"}]", coalesce(sys.env("NODE_METRICS_ENDPOINT"), "host.docker.internal:9153"), coalesce(sys.env("NODE_ID"), "local"), coalesce(sys.env("VALIDATOR_NAME"), "default"))))
targets = encoding.from_json(coalesce(sys.env("SCRAPE_TARGETS_JSON"), string.format("[{\"__address__\":\"%s\",\"instance\":\"%s\",\"validator_name\":\"%s\",\"network\":\"%s\"}]", coalesce(sys.env("NODE_METRICS_ENDPOINT"), "host.docker.internal:9153"), coalesce(sys.env("NODE_ID"), "local"), coalesce(sys.env("VALIDATOR_NAME"), "default"), coalesce(sys.env("NETWORK_NAME"), "asimov-phase5"))))

forward_to = [prometheus.relabel.metrics.receiver]

Expand Down
26 changes: 25 additions & 1 deletion pages/validators/setup-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ This is the main configuration file of your node. Without it, your node won't st

The file needs to be located at `configs/node/config.yaml`

You can use the following example configuration. **Note:** For most users, you will only need to modify the `genlayerchainrpcurl` and `genlayerchainwebsocketurl` values below.
You can use the following example configuration. **Note:** For most users, you will only need to modify the `genlayerchainrpcurl`, `genlayerchainwebsocketurl`, and the `consensus` section for your target network (see [Network-Specific Consensus Configuration](#network-specific-consensus-configuration) below).

```yaml copy
# rollup configuration
Expand Down Expand Up @@ -366,6 +366,30 @@ metrics:

```

#### Network-Specific Consensus Configuration

Set the `consensus` section in your `config.yaml` according to the network you want to join:

##### Testnet Asimov

```yaml copy
# Asimov Phase 5 network consensus configuration
consensus:
consensusaddress: "0xe66B434bc83805f380509642429eC8e43AE9874a"
genesis: 17326

```

##### Testnet Bradbury

```yaml copy
# Bradbury Phase 1 network consensus configuration
consensus:
consensusaddress: "0x8aCE036C8C3C5D603dB546b031302FCf149648E8"
genesis: 501711

```

#### Overriding Configuration with Environment Variables

Any configuration value in `config.yaml` can be overridden using environment variables with the prefix `GENLAYERNODE_`.
Expand Down
103 changes: 54 additions & 49 deletions scripts/update-config-in-setup-guide.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,71 +5,76 @@ const path = require('path');

/**
* Update the setup guide with the latest config from content/validators/config.yaml
* and network-specific consensus configs from content/validators/asimov.yaml and bradbury.yaml
*/
function updateConfigInSetupGuide() {
const configPath = path.join(process.cwd(), 'content/validators/config.yaml');
const asimovPath = path.join(process.cwd(), 'content/validators/asimov.yaml');
const bradburyPath = path.join(process.cwd(), 'content/validators/bradbury.yaml');
const setupGuidePath = path.join(process.cwd(), 'pages/validators/setup-guide.mdx');

if (!fs.existsSync(configPath)) {
console.error(`Config file ${configPath} does not exist`);
return;
}


if (!fs.existsSync(setupGuidePath)) {
console.error(`Setup guide file ${setupGuidePath} does not exist`);
return;
}

// Read the config.yaml content
const configContent = fs.readFileSync(configPath, 'utf8');

// Read the setup guide

let setupGuideContent = fs.readFileSync(setupGuidePath, 'utf8');

// Pattern to match the YAML config block
// Looks for the text before the yaml block, the yaml block itself, and the text after
// Note: The yaml block may have additional attributes like "copy" (```yaml copy)
// Uses [\s\S]*? to match any characters (including backticks in inline code) until the yaml block
const configPattern = /(You can use the following example configuration[\s\S]*?```yaml[^\n]*\n)([\s\S]*?)(\n```)/;

if (configPattern.test(setupGuideContent)) {
// Replace the config content while preserving the surrounding text
setupGuideContent = setupGuideContent.replace(
configPattern,
`$1${configContent}$3`
);

// Write the updated content back
fs.writeFileSync(setupGuidePath, setupGuideContent);
console.log(`Updated setup guide config at ${new Date().toISOString()}`);
} else {
console.error('Could not find config pattern in setup guide');

// Try a more general pattern as fallback
const fallbackPattern = /(```yaml\n)([\s\S]*?)(\n```)/;
const matches = setupGuideContent.match(fallbackPattern);

if (matches) {
// Check if this looks like the config block by looking for consensus addresses
if (matches[2].includes('contractmanageraddress') || matches[2].includes('consensus:')) {
setupGuideContent = setupGuideContent.replace(
fallbackPattern,
`$1${configContent}$3`
);
fs.writeFileSync(setupGuidePath, setupGuideContent);
console.log(`Updated setup guide config using fallback pattern at ${new Date().toISOString()}`);
} else {
console.error('Found YAML block but it does not appear to be the config block');
}

// Update main config block from config.yaml
if (fs.existsSync(configPath)) {
const configContent = fs.readFileSync(configPath, 'utf8');
const configPattern = /(You can use the following example configuration[\s\S]*?```yaml[^\n]*\n)([\s\S]*?)(\n```)/;

if (configPattern.test(setupGuideContent)) {
setupGuideContent = setupGuideContent.replace(
configPattern,
`$1${configContent}$3`
);
console.log(`Updated main config block at ${new Date().toISOString()}`);
} else {
console.error('Could not find any YAML block in setup guide');
console.error('Could not find main config pattern in setup guide');
}
}

// Update Asimov consensus config
if (fs.existsSync(asimovPath)) {
const asimovContent = fs.readFileSync(asimovPath, 'utf8');
const asimovPattern = /(##### Testnet Asimov\s*```yaml[^\n]*\n)([\s\S]*?)(\n```)/;

if (asimovPattern.test(setupGuideContent)) {
setupGuideContent = setupGuideContent.replace(
asimovPattern,
`$1${asimovContent}$3`
);
console.log(`Updated Asimov config block at ${new Date().toISOString()}`);
} else {
console.error('Could not find Asimov config pattern in setup guide');
}
}

// Update Bradbury consensus config
if (fs.existsSync(bradburyPath)) {
const bradburyContent = fs.readFileSync(bradburyPath, 'utf8');
const bradburyPattern = /(##### Testnet Bradbury\s*```yaml[^\n]*\n)([\s\S]*?)(\n```)/;

if (bradburyPattern.test(setupGuideContent)) {
setupGuideContent = setupGuideContent.replace(
bradburyPattern,
`$1${bradburyContent}$3`
);
console.log(`Updated Bradbury config block at ${new Date().toISOString()}`);
} else {
console.error('Could not find Bradbury config pattern in setup guide');
}
}

// Write the updated content back
fs.writeFileSync(setupGuidePath, setupGuideContent);
}

// Run the script
if (require.main === module) {
updateConfigInSetupGuide();
}

module.exports = { updateConfigInSetupGuide };
module.exports = { updateConfigInSetupGuide };
Loading