diff --git a/.github/workflows/check-node-docs-sync.yml b/.github/workflows/check-node-docs-sync.yml new file mode 100644 index 00000000..1e12b2ed --- /dev/null +++ b/.github/workflows/check-node-docs-sync.yml @@ -0,0 +1,46 @@ +name: Check Node Documentation Sync + +on: + pull_request: + branches: + - main + +jobs: + check-sync: + name: 'Verify Node Documentation is Synced' + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run documentation sync scripts + run: | + npm run node-generate-changelog + npm run node-update-setup-guide + npm run node-update-config + npm run node-update-docker-compose + npm run node-generate-api-docs + + - name: Check for uncommitted changes + run: | + if [[ -n "$(git status --porcelain)" ]]; then + echo "::error::Documentation is out of sync. Please run the sync scripts locally and commit the changes." + echo "" + echo "Files with uncommitted changes:" + git status --porcelain + echo "" + echo "Diff:" + git diff + exit 1 + else + echo "Documentation is in sync." + fi diff --git a/pages/validators/setup-guide.mdx b/pages/validators/setup-guide.mdx index 21020266..0109bd49 100644 --- a/pages/validators/setup-guide.mdx +++ b/pages/validators/setup-guide.mdx @@ -28,7 +28,7 @@ The wizard outputs all three addresses at the end. Save them - you'll need the V - **Node.js** (v18 or higher) - **GenLayer CLI** - Install the latest version: - ```bash + ```bash copy npm install -g genlayer ``` - **GEN tokens** - You need at least **42,000 GEN** for the minimum self-stake requirement @@ -37,7 +37,7 @@ The wizard outputs all three addresses at the end. Save them - you'll need the V The easiest way to create your validator wallet is using the interactive wizard: -```bash +```bash copy genlayer staking wizard ``` @@ -63,13 +63,13 @@ The wizard creates and exports an operator keystore file for you to transfer to After completing the wizard, verify your status: -```bash +```bash copy genlayer staking validator-info --validator 0xYourValidatorWallet... ``` ### Managing Your Validator -```bash +```bash copy # Add more stake genlayer staking validator-deposit --amount 1000gen @@ -124,49 +124,41 @@ See the [System Requirements](/validators/system-requirements) page for detailed You can use this command to list available versions: - ```sh - curl -s "https://storage.googleapis.com/storage/v1/b/gh-af/o?prefix=genlayer-node/bin/amd64" | grep -o '"name": *"[^"]*"' | sed -n 's/.*\/\(v[^/]*\)\/.*/\1/p' | sort -ru + ```sh copy + curl -s "https://storage.googleapis.com/storage/v1/b/gh-af/o?prefix=genlayer-node/bin/amd64" | grep -o '"name": *"[^"]*"' | sed -n 's/.*\/\(v[^/]*\)\/.*/\1/p' | sort -ru | grep -v "rc" | head -n 5 ``` You should see a list like this ```sh - v0.4.4 - v0.4.3 - v0.4.2 - v0.4.1 - v0.4.0 - v0.3.11 - v0.3.10 - v0.3.9 - ... - v0.3.2 - v0.3.1 - v0.3.0 - ... + v0.4.4 + v0.4.3 + v0.4.2 + v0.4.1 + v0.4.0 ``` Typically, you will want to run the latest version 2. Download the packaged application - ```sh + ```sh copy export version=v0.4.4 # set your desired version here wget https://storage.googleapis.com/gh-af/genlayer-node/bin/amd64/${version}/genlayer-node-linux-amd64-${version}.tar.gz ``` 3. Extract the node software - ```sh + ```sh copy mkdir -p ${version} tar -xzvf `genlayer-node-linux-amd64-${version}.tar.gz` -C `./${version}` ``` 4. Change the directory - ```sh + ```sh copy cd `./${version}` ``` 5. Run Genvm setup - ```sh + ```sh copy python3 ./third_party/genvm/bin/setup.py ``` It does following: @@ -188,7 +180,7 @@ 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. -```yaml +```yaml copy # rollup configuration rollup: genlayerchainrpcurl: "TODO: Set your GenLayer Chain ZKSync HTTP RPC URL here" # GenLayer Chain RPC URL @@ -325,7 +317,7 @@ Any configuration value in `config.yaml` can be overridden using environment var **Usage example:** -```sh +```sh copy # Override the RPC port export GENLAYERNODE_CONSENSUS_CONTRACTMAINADDRESS="0x..." @@ -350,7 +342,7 @@ The operator key is used by your node to sign blocks and perform validator dutie If you used `genlayer staking wizard`, it exported an operator keystore file. Transfer this file to your validator server and import it: -```sh +```sh copy ./bin/genlayernode account import \ --password "your node password" \ --passphrase "password you set when exporting from wizard" \ @@ -371,7 +363,7 @@ Account imported: You can also generate a new operator key directly on the server: -```sh +```sh copy ./bin/genlayernode account new -c $(pwd)/configs/node/config.yaml --setup --password "your secret password" ``` @@ -381,7 +373,7 @@ Then use this address when running the wizard on your local machine. To restore from a backup (e.g., after migrating to a new server): -```sh +```sh copy ./bin/genlayernode account import \ --password "your node password" \ --passphrase "your backup encryption passphrase" \ @@ -398,7 +390,7 @@ To restore from a backup (e.g., after migrating to a new server): After setting up your operator key, back it up securely: -```sh +```sh copy ./bin/genlayernode account export \ --password "your node password" \ --address "your operator address" \ @@ -432,7 +424,7 @@ Once you have configured everything, you are ready to start the node. Set the appropriate environment variable for your chosen LLM provider. See the [GenVM Configuration](/validators/genvm-configuration) page for details on LLM providers and obtaining API credits. - ```sh + ```sh copy # For Heurist export HEURISTKEY='your_heurist_api_key' @@ -447,14 +439,14 @@ Once you have configured everything, you are ready to start the node. 2. Run the WebDriver container - ```sh + ```sh copy docker compose up -d # Starts the WebDriver needed by the GenVM web module ``` 3. (Optional) Run two services (modules) in background (this is a crucial step for running _Intelligent_ contracts). This can be done automatically or manually. - To start them automatically in node configuration set `genvm.manage_modules` to `true` - To start them manually run - ```bash + ```bash copy ./third_party/genvm/bin/genvm-modules web & ./third_party/genvm/bin/genvm-modules llm & ``` @@ -468,7 +460,7 @@ Once you have configured everything, you are ready to start the node. To ensure your node is correctly configured, you can run the following command: - ```sh + ```sh copy ./bin/genlayernode doctor ``` @@ -480,7 +472,7 @@ Once you have configured everything, you are ready to start the node. 5. Run the node - ```sh + ```sh copy ./bin/genlayernode run -c $(pwd)/configs/node/config.yaml --password "your secret password" # The same password you used when creating the account ``` @@ -498,7 +490,7 @@ You can also run the GenLayer node using Docker and Docker Compose. 1. Create a `docker-compose.yaml` file with the following content: -```yaml +```yaml copy services: webdriver-container: container_name: genlayer-node-webdriver @@ -552,7 +544,7 @@ Create `genvm-module-web-docker.yaml` in the same directory as your `docker-comp - Copy the contents of `third_party/genvm/config/genvm-module-web.yaml` into `genvm-module-web-docker.yaml`. - Modify the `webdriver_host` configuration to use the service name `webdriver-container` instead of `localhost`: -```yaml +```yaml copy webdriver_host: http://webdriver-container:4444 ``` @@ -569,7 +561,7 @@ The key difference: This `.env` file serves two purposes: it configures Docker Compose variables (like `NODE_VERSION`, `NODE_PASSWORD`, ports) and can also include `GENLAYERNODE_*` variables to override node configuration values as described in [Overriding Configuration with Environment Variables](#overriding-configuration-with-environment-variables). -```env +```env copy # GenLayer Node Release Configuration # ============================================================================= @@ -610,7 +602,7 @@ or simply use the provided `docker-compose.yaml`, `.env.example` and the `genvm- To ensure your node is correctly configured, you can run the following command: -```sh +```sh copy source .env && docker run --rm --env-file ./.env \ -v ${NODE_CONFIG_PATH:-./configs/node/config.yaml}:/app/configs/node/config.yaml \ yeagerai/genlayer-node:${NODE_VERSION:-v0.4.0} \ @@ -619,7 +611,7 @@ source .env && docker run --rm --env-file ./.env \ 5. Start the services using Docker Compose: -```sh +```sh copy source .env && docker compose --profile node up -d ``` diff --git a/scripts/update-config-in-setup-guide.js b/scripts/update-config-in-setup-guide.js index cab78c8a..44519ea5 100755 --- a/scripts/update-config-in-setup-guide.js +++ b/scripts/update-config-in-setup-guide.js @@ -28,7 +28,9 @@ function updateConfigInSetupGuide() { // Pattern to match the YAML config block // Looks for the text before the yaml block, the yaml block itself, and the text after - const configPattern = /(You can use the following example configuration[^`]*```yaml\n)([\s\S]*?)(\n```)/; + // 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 diff --git a/scripts/update-docker-compose-in-setup-guide.js b/scripts/update-docker-compose-in-setup-guide.js index 12099cd2..65576091 100755 --- a/scripts/update-docker-compose-in-setup-guide.js +++ b/scripts/update-docker-compose-in-setup-guide.js @@ -29,7 +29,8 @@ function updateDockerComposeInSetupGuide() { // Pattern to match the docker-compose YAML block // Looks for the text before the yaml block, the yaml block itself, and the text after - const dockerComposePattern = /(Create a `docker-compose\.yaml` file with the following content:[^`]*```yaml\n)([\s\S]*?)(\n```)/; + // Note: The yaml block may have additional attributes like "copy" (```yaml copy) + const dockerComposePattern = /(Create a `docker-compose\.yaml` file with the following content:[^`]*```yaml[^\n]*\n)([\s\S]*?)(\n```)/; if (dockerComposePattern.test(setupGuideContent)) { // Replace the docker-compose content while preserving the surrounding text diff --git a/scripts/update-setup-guide-versions.js b/scripts/update-setup-guide-versions.js index d979cea5..063d170f 100644 --- a/scripts/update-setup-guide-versions.js +++ b/scripts/update-setup-guide-versions.js @@ -58,57 +58,18 @@ function updateSetupGuideVersions() { // Read the setup guide let setupGuideContent = fs.readFileSync(setupGuidePath, 'utf8'); - // Update the version list with abbreviated format - // Show all current minor version, then first 3 and last 3 of previous minor version with "..." in between + // Update the version list to match the curl command output + // The curl command uses: grep -v "rc" | head -n 5 + // So we filter out rc versions and show only 5 versions - // Parse version to get major.minor - const parseMinorVersion = (v) => { - const match = v.match(/v(\d+)\.(\d+)\.\d+/); - if (!match) return null; - return `${match[1]}.${match[2]}`; - }; + // Filter out testnet and rc versions for the display list (matches grep -v "rc") + const releaseVersions = versions.filter(v => !v.includes('testnet') && !v.includes('rc')); - // Filter out testnet versions for the display list - const releaseVersions = versions.filter(v => !v.includes('testnet')); + // Take only the first 5 versions (matches head -n 5) + const displayVersions = releaseVersions.slice(0, 5); - // Get the current minor version (from latest version) - const currentMinor = parseMinorVersion(latestVersion); - - // Get all versions from current minor version - const currentMinorVersions = releaseVersions.filter(v => parseMinorVersion(v) === currentMinor); - - // Get the previous minor version - const previousMinorVersions = releaseVersions.filter(v => { - const minor = parseMinorVersion(v); - return minor && minor !== currentMinor; - }); - - // Build the abbreviated list - const versionListItems = [ - ...currentMinorVersions.map(v => ` ${v}`) - ]; - - if (previousMinorVersions.length > 0) { - const first3 = previousMinorVersions.slice(0, 3); - const last3 = previousMinorVersions.slice(-3); - - // Add first 3 of previous minor - versionListItems.push(...first3.map(v => ` ${v}`)); - - // Add "..." if there are versions in between - if (previousMinorVersions.length > 6) { - versionListItems.push(' ...'); - } - - // Add last 3 of previous minor (avoid duplicates if list is small) - const last3Unique = last3.filter(v => !first3.includes(v)); - versionListItems.push(...last3Unique.map(v => ` ${v}`)); - - // Add trailing "..." to indicate older versions exist - versionListItems.push(' ...'); - } - - const versionListIndented = versionListItems.join('\n'); + // Build the version list (no indentation, matches actual curl output) + const versionListIndented = displayVersions.map(v => ` ${v}`).join('\n'); // Replace the version list (between "You should see a list like this" and "Typically you will want") const versionListPattern = /(You should see a list like this\s*\n\s*```sh\n)([\s\S]*?)(\n\s*```\s*\n\s*Typically,? you will want)/;