jkrek17 / Ergo

ergo node setup files
2 stars 1 forks source link

Ergo Node Docker Setup

This repository contains Docker configuration files to run an Ergo Node. It provides a streamlined way to set up and run an Ergo node using Docker containers with persistent blockchain data.

Prerequisites

Quick Start

  1. Clone this repository:

    git clone https://github.com/your-username/ergo-node-docker.git
    cd ergo-node-docker
  2. Copy the example environment file and edit it with your settings:

    cp .env.example .env
  3. Edit the .env file with your preferred settings:

    VERSION=5.0.24                                    # Ergo node version
    NODE_NAME='YOUR NODE NAME HERE - NO QUOTES'       # Your node name
    API_KEY_PASSWORD='YOUR PASSWORD HERE - NO QUOTES' # API key password
    JAVA_OPTS=-Xmx4g                                 # Java memory options
    ENABLE_LITE_NODE=false                           # Enable/disable lite node
    ENABLE_EXTRA_INDEX=false                         # Enable/disable extra indexing
  4. Build and start the node:

    docker-compose up -d

Configuration

Environment Variables

Ports

The node exposes the following ports:

Persistent Storage

The node uses a named Docker volume ergo-data to store the blockchain data. This ensures:

Directory Structure

.
├── .env                    # Environment configuration
├── docker-compose.yml      # Docker Compose configuration
├── Dockerfile             # Docker image definition
├── entrypoint.sh          # Container entrypoint script
├── ergo.conf.template     # Ergo node configuration template
└── README.md             # This file

Usage

Starting the Node

docker-compose up -d

Viewing Logs

docker-compose logs -f

Stopping the Node

docker-compose down
# Note: Do NOT use 'docker-compose down -v' as it will delete your blockchain data

Updating the Node

  1. Update the VERSION in your .env file
  2. Rebuild and restart the container:
    docker-compose down
    docker-compose build --no-cache
    docker-compose up -d

Data Management

Volume Information

# List volumes
docker volume ls

# Inspect volume
docker volume inspect ergo-data

# Check volume size
docker system df -v | grep ergo-data

Backup Procedure

# Stop the container first
docker-compose down

# Create backup
docker run --rm -v ergo-data:/source -v $(pwd):/backup alpine tar czf /backup/ergo-data-backup.tar.gz -C /source .

Restore Procedure

# Stop the container first
docker-compose down

# Restore from backup
docker run --rm -v ergo-data:/target -v $(pwd):/backup alpine sh -c "cd /target && tar xzf /backup/ergo-data-backup.tar.gz"

Delete Data (Caution!)

# This will delete all blockchain data - you'll need to resync!
docker volume rm ergo-data

Maintenance

Regular Maintenance Tasks

  1. Monitor disk space usage:

    docker system df -v
  2. Check logs for errors:

    docker-compose logs --tail=100
  3. Keep your node version updated

  4. Regularly backup your data volume

Monitoring

You can monitor your node's status through:

Security Considerations

Troubleshooting

Common Issues

  1. Container fails to start

    • Check logs: docker-compose logs
    • Verify environment variables in .env
    • Ensure Docker has enough disk space
  2. Node not syncing

    • Check network connectivity
    • Verify ports 9030 and 9053 are accessible
    • Check available disk space: docker system df
  3. Out of memory

    • Adjust JAVA_OPTS in .env file
    • Ensure host has enough free memory
  4. Volume Issues

    • Check volume exists: docker volume ls
    • Inspect volume: docker volume inspect ergo-data
    • Verify volume permissions

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments