Deploying a Hyperchain with a docker based ae node

Hi!!

Almost finished the deployment of a ae pinned hyperchain following the instructions at Introduction - Aeternity node documentation , thanks for putting all together @Ploetzly !!

I struggled a bit because the fact that when installed my ae node I used docker, so I was not finding the folders to copy the hyperchain config files in my ae node directory. I called aengel to the rescue and it not only helped me deploy but made a nice summary of our convo until i succeded, so any one that has installed the aeternity node using docker can play around with Hyperchains.

Here is the guide to follow when it comes to copying the hyperchain config files to the node directory.

Instructions for Setting Up a Hyperchain Node Using Docker

Overview

This section provides specific instructions for setting up a Hyperchain node when the æternity node is installed via Docker. It covers how to copy required configuration files (aeternity.yaml, hc_test_accounts.json, hc_test_contracts.json) into the Docker container, address common issues, and successfully start the node.


Prerequisites

  1. A fully operational Docker container running the æternity node.
    • Ports 3013 (API) and 3113 (Hyperchain) should be exposed.
    • Verify your container with:
      docker ps
      
  2. Hyperchain configuration files generated using the hyperchain-starter-kit:
    • aeternity.yaml
    • hc_test_accounts.json
    • hc_test_contracts.json
    • These files should be located in the ./hc_test/nodeConfig directory of the hyperchain-starter-kit.

Steps

Step 1: Verify the Docker Container

Confirm your container is running and healthy:

docker ps

Expected output:

bash

CONTAINER ID   IMAGE                 COMMAND                  CREATED      STATUS                PORTS                                                                               NAMES
355682ca7080   aeternity/aeternity   "bin/aeternity conso…"   7 days ago   Up X minutes (healthy)   0.0.0.0:3013->3013/tcp, 0.0.0.0:3113->3113/tcp   aeternity-node

Take note of the container name (e.g., aeternity-node).


Step 2: Create Required Directories in the Container

Access the Docker container and create the necessary directories for the configuration files:

bash

docker exec -it aeternity-node /bin/bash

Inside the container:

bash

mkdir -p /home/aeternity/config
mkdir -p /home/aeternity/data/aecore

Verify the directories:

bash

ls -l /home/aeternity/config
ls -l /home/aeternity/data/aecore

Exit the container:

bash

exit

Step 3: Copy Configuration Files into the Container

From your host machine, copy the configuration files into the container:

  1. Copy aeternity.yaml:

bash

docker cp ./hc_test/nodeConfig/aeternity.yaml aeternity-node:/home/aeternity/config/aeternity.yaml
  1. Copy hc_test_accounts.json:

bash

docker cp ./hc_test/nodeConfig/hc_test_accounts.json aeternity-node:/home/aeternity/data/aecore/hc_test_accounts.json
  1. Copy hc_test_contracts.json:

bash

docker cp ./hc_test/nodeConfig/hc_test_contracts.json aeternity-node:/home/aeternity/data/aecore/hc_test_contracts.json

Step 4: Fix File Permissions

The copied files may have root ownership, which prevents the æternity node from accessing them. To fix this:

  1. Access the container as the root user:

bash

docker exec -it --user root aeternity-node /bin/bash
  1. Change ownership of the files to the aeternity user:
  • For aeternity.yaml:

bash

chown aeternity:aeternity /home/aeternity/config/aeternity.yaml
  • For hc_test_accounts.json and hc_test_contracts.json:

bash

chown aeternity:aeternity /home/aeternity/data/aecore/hc_test_accounts.json
chown aeternity:aeternity /home/aeternity/data/aecore/hc_test_contracts.json
  1. Exit the container:

bash

exit

Step 5: Restart the Container

Restart the Docker container to apply the changes:

bash

docker restart aeternity-node

Step 6: Verify the Node

Once the container restarts, verify the node and Hyperchain APIs:

  1. Check the node status:

bash

curl http://localhost:3013/v2/status
  • Look for "synced": true in the response.
  1. Check the Hyperchain status:

bash

curl http://localhost:3113/v2/hyperchain/status

Troubleshooting

  • Sync Progress Stuck or APIs Unresponsive:
    • Monitor the logs for syncing or errors:

bash

docker logs aeternity-node
  • Wait for the node to fully sync before using Hyperchain APIs.
  • File Copy Issues:
    • Ensure the source files (aeternity.yaml, hc_test_accounts.json, hc_test_contracts.json) exist in ./hc_test/nodeConfig/.
  • Port Inaccessibility:
    • Check if the necessary ports are open:

bash

sudo ufw allow 3013/tcp
sudo ufw allow 3113/tcp
5 Likes

cool! :+1: :+1: :+1:

4 Likes

Hey, nice guide! You should mention: The starter kit is here: GitHub - aeternity/hyperchain-starter-kit: Tools to create your own hyperchain currently, you need to run $ npm install and , to follow the example, run $ npm run dev generate hc_test

3 Likes

Hello, all the steps related to installing the configuration files can be simplified to:

docker run -it -p 3013:3013 \
    -v ${PWD}/hc_test/nodeConfig/aeternity.yaml:/home/aeternity/.aeternity/aeternity/aeternity.yaml \
    -v ${PWD}/hc_test/nodeConfig/hc_test_accounts.json:/home/aeternity/node/data/aecore/hc_test_accounts.json \
    -v ${PWD}/hc_test/nodeConfig/hc_test_contracts.json:/home/aeternity/node/data/aecore/hc_test_contracts.json \
    aeternity/aeternity:v7.3.0-rc3

That assumes unix-like system.

3 Likes

I just followed the guide here to create the configuration aeternity/docs/hyperchains.md at master · aeternity/aeternity · GitHub

then pre-created the mapped folders and put the respective files there, used the a docker-compose.yml for the setup

services:
  testnet:
    image: aeternity/aeternity:v7.3.0-rc3
    restart: unless-stopped
    volumes:
      - ./config:/home/aeternity/.aeternity/aeternity
      - ./aecore:/home/aeternity/node/data/aecore
      - ./log:/home/aeternity/node/log
      - ./data:/home/aeternity/node/data/mnesia
    ports:
      - 3013:3013
      - 3015:3015
3 Likes

there is no such API endpoint btw.

3 Likes

Very cool @aelex - most curious on the rest of your path until its ready, maybe you can continue to share?

3 Likes