RandAO

Guide to setting up your randomness provider

System Requirements

  • CPU: 2-core
  • RAM: 4 GiB
  • Internet Connection: Reliable

Install Dependenci

  1. Install Docker:
    sudo apt update -y && sudo apt upgrade -y
    for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
    
    sudo apt-get update
    sudo apt-get install ca-certificates curl gnupg
    sudo install -m 0755 -d /etc/apt/keyrings
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
    sudo chmod a+r /etc/apt/keyrings/docker.gpg
    
    echo \
      "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
      "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
      sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    
    sudo apt update -y && sudo apt upgrade -y
    
    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    
    # Test Docker
    sudo docker run hello-world
    
    sudo systemctl enable docker
    sudo systemctl restart docker
  2. Create Directories:
    mkdir randao
                cd randao

Set Up Environment

  1. Create .env:
    nano .env
  2. Paste this and replace wallet:
    DB_USER=myuser
    DB_PASSWORD=mypassword
    DB_NAME=mydatabase
    DOCKER_NETWORK=backend
    WALLET_JSON = '{
      "kty": "RSA",
      "e": "test",
      "n": "test",
      "d": "test",
      "p": "test",
      "q": "test",
      "dp": "test",
      "dq": "test",
      "qi": "test"
    }'

Configure docker-compose.yml

  1. Create docker-compose.yml:
    nano docker-compose.yml
  2. Paste this:
    services:
      postgres:
        image: postgres:13-alpine
        environment:
          POSTGRES_USER: ${DB_USER:-myuser}
          POSTGRES_PASSWORD: ${DB_PASSWORD:-mypassword}
          POSTGRES_DB: ${DB_NAME:-mydatabase}
        ports:
          - "5431:5432"
        networks:
          - backend
        volumes:
          - pgdata:/var/lib/postgresql/data
        healthcheck:
          test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-myuser} -d ${DB_NAME:-mydatabase}"]
          interval: 10s
          timeout: 5s
          retries: 5
    
      orchestrator:
        image: randao/orchestrator:v0.4.68
        depends_on:
          postgres:
            condition: service_healthy
        environment:
          DB_HOST: postgres
          DB_PORT: 5432
          DB_USER: ${DB_USER:-myuser}
          DB_PASSWORD: ${DB_PASSWORD:-mypassword}
          DB_NAME: ${DB_NAME:-mydatabase}
          PATH_TO_WALLET: /app/wallet.json  # Path inside the container
          WALLET_JSON: ${WALLET_JSON}
          DOCKER_NETWORK: backend  # Passing the network name
        networks:
          - backend
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock  # Mount Docker socket
          - ./wallet.json:/app/wallet.json  # Mount wallet.json into the container
    
    networks:
      backend:
        name: backend  # This will set the network name explicitly
        driver: bridge
    
    volumes:
      pgdata:
        driver: local
  3. Start your Provider:
    docker-compose up -d