Skip to content

Instantly share code, notes, and snippets.

@christopherwxyz
Created August 2, 2023 15:30
Show Gist options
  • Select an option

  • Save christopherwxyz/7884b27825f8c3577d947d9f4ce7f2be to your computer and use it in GitHub Desktop.

Select an option

Save christopherwxyz/7884b27825f8c3577d947d9f4ce7f2be to your computer and use it in GitHub Desktop.

Revisions

  1. christopherwxyz created this gist Aug 2, 2023.
    109 changes: 109 additions & 0 deletions hubble-gce-deployment.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,109 @@
    # Set the GCP project and zone where you want to create the instance
    PROJECT_ID={YOUR_PROJECT_ID} # e.g. hubble-123456
    ZONE={YOUR_ZONE_ID} # e.g. us-central1-a

    # Create the GCE instance
    gcloud compute instances create hubble-instance \
    --project=${PROJECT_ID} \
    --zone=${ZONE} \
    --image-family=debian-10 \
    --image-project=debian-cloud \
    --machine-type=e2-standard-2 \
    --boot-disk-size=20GB \
    --boot-disk-type=pd-standard \
    --tags=http-server,https-server

    # Create disks
    gcloud compute disks create hubble-hub-data-disk \
    --project=${PROJECT_ID} \
    --zone=${ZONE} \
    --size=50GB

    gcloud compute disks create hubble-rocks-data-disk \
    --project=${PROJECT_ID} \
    --zone=${ZONE} \
    --size=100GB

    # Attach disks to the instance
    gcloud compute instances attach-disk hubble-instance \
    --project=${PROJECT_ID} \
    --zone=${ZONE} \
    --disk=hubble-hub-data-disk \
    --device-name=hubble-hub-data

    gcloud compute instances attach-disk hubble-instance \
    --project=${PROJECT_ID} \
    --zone=${ZONE} \
    --disk=hubble-rocks-data-disk \
    --device-name=hubble-rocks-data


    # SSH into the instance
    gcloud compute ssh hubble-instance \
    --project=${PROJECT_ID} \
    --zone=${ZONE}

    # Create mount points
    sudo mkdir /mnt/hubble-hub-data
    sudo mkdir /mnt/hubble-rocks-data

    # Format them
    sudo mkfs.ext4 /dev/sdb
    sudo mkfs.ext4 /dev/sdc

    # Mount disks ... you may need to change the device names. You can check them with `lsblk`.
    sudo mount /dev/sdb /mnt/hubble-hub-data
    sudo mount /dev/sdc /mnt/hubble-rocks-data

    # You might need to set permissions for the volumes.
    # If 755 doesn't work, the 777 golden hammer will.
    sudo chmod -R 755 /mnt/hubble-hub-data
    sudo chmod -R 755 /mnt/hubble-rocks-data


    # Docker Compose below. Save to its own docker-compose.yml.
    version: '3.9'

    services:
    hubble:
    image: farcasterxyz/hubble:latest
    ports:
    - '2282:2282'
    - '2283:2283'
    - '2284:2284'
    environment:
    - IDENTITY_B64=<YOUR_IDENTITY_FILE_IN_B64>
    command:
    [
    "node",
    "build/cli.js",
    "start",
    "--gossip-port",
    "2282",
    "--rpc-port",
    "2283",
    "--eth-rpc-url",
    "<YOUR_ETH_RPC_URL>",
    "--eth-mainnet-rpc-url",
    "<YOUR_MAINNET_RPC_URL>",
    "--network",
    "2",
    "--db-name",
    "hubble",
    "--process-file-prefix",
    "hubble",
    "--gossip-metrics-enabled",
    "-b",
    "/dns/testnet1.farcaster.xyz/tcp/2282"
    ]
    volumes:
    - ./apps/hubble/.hub:/home/node/app/apps/hubble/.hub
    - ./apps/hubble/.rocks:/home/node/app/apps/hubble/.rocks
    logging:
    driver: "gcplogs"
    options:
    gcp-log-cmd: "true"


    # Run it in a detached state.
    docker compose up hubble -d