Skip to content

Instantly share code, notes, and snippets.

@arno01
Last active October 5, 2022 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arno01/4ff3a5cf90a856a2f2ab207ecbe367ec to your computer and use it in GitHub Desktop.
Save arno01/4ff3a5cf90a856a2f2ab207ecbe367ec to your computer and use it in GitHub Desktop.
$ cat deploy.yaml
---
version: "2.0"

# Issues:
# - needs 1:1 port mapping
# - needs vm.max_map_count = 1000000
#
# Links:
# https://docs.solana.com/running-validator/validator-reqs
# https://docs.solana.com/running-validator/validator-start
# https://docs.solana.com/clusters
# https://github.com/solana-labs/solana/releases
# https://hub.docker.com/r/solanalabs/solana/tags

services:
  solana:
    image: solanalabs/solana:v1.8.14
    command:
      - "sh"
      - "-c"
    args:
      - 'mkdir -p /opt/solana;
        apt-get update;
        apt-get install -y --no-install-recommends -- curl ca-certificates zstd procps;
        cp /usr/bin/solana-run.sh /usr/bin/fetch-spl.sh /usr/bin/spl-genesis-args.sh /opt/solana/;
        sed -i -e "s/solana-genesis/echo solana-genesis/g" /opt/solana/solana-run.sh;
        bash -x /opt/solana/solana-run.sh'
    expose:
      # gossip (default: 8001/tcp)
      - port: 8001
        as: 8001
        proto: tcp
        to:
          - global: true
      # jsonrpc over http (default: 8899/tcp)
      # Then, use this RPC: solana config set --url http://<uri>
      - port: 8899
        as: 80
        proto: tcp
        to:
          - global: true
      # jsonrpc over websockets
      - port: 8900
        as: 8900
        proto: tcp
        to:
          - global: true
      # (TCP) --dynamic-port-range 8010-8022 - p2p protocols (gossip, turbine, repair, etc)
      - port: 8010
        as: 8010
        proto: tcp
        to:
          - global: true
      - port: 8011
        as: 8011
        proto: tcp
        to:
          - global: true
      - port: 8012
        as: 8012
        proto: tcp
        to:
          - global: true
      - port: 8013
        as: 8013
        proto: tcp
        to:
          - global: true
      - port: 8014
        as: 8014
        proto: tcp
        to:
          - global: true
      - port: 8015
        as: 8015
        proto: tcp
        to:
          - global: true
      - port: 8016
        as: 8016
        proto: tcp
        to:
          - global: true
      - port: 8017
        as: 8017
        proto: tcp
        to:
          - global: true
      - port: 8018
        as: 8018
        proto: tcp
        to:
          - global: true
      - port: 8019
        as: 8019
        proto: tcp
        to:
          - global: true
      - port: 8020
        as: 8020
        proto: tcp
        to:
          - global: true
      - port: 8021
        as: 8021
        proto: tcp
        to:
          - global: true
      - port: 8022
        as: 8022
        proto: tcp
        to:
          - global: true
      # (UDP) --dynamic-port-range 8010-8022 - p2p protocols (gossip, turbine, repair, etc)
      - port: 8010
        as: 8010
        proto: udp
        to:
          - global: true
      - port: 8011
        as: 8011
        proto: udp
        to:
          - global: true
      - port: 8012
        as: 8012
        proto: udp
        to:
          - global: true
      - port: 8013
        as: 8013
        proto: udp
        to:
          - global: true
      - port: 8014
        as: 8014
        proto: udp
        to:
          - global: true
      - port: 8015
        as: 8015
        proto: udp
        to:
          - global: true
      - port: 8016
        as: 8016
        proto: udp
        to:
          - global: true
      - port: 8017
        as: 8017
        proto: udp
        to:
          - global: true
      - port: 8018
        as: 8018
        proto: udp
        to:
          - global: true
      - port: 8019
        as: 8019
        proto: udp
        to:
          - global: true
      - port: 8020
        as: 8020
        proto: udp
        to:
          - global: true
      - port: 8021
        as: 8021
        proto: udp
        to:
          - global: true
      - port: 8022
        as: 8022
        proto: udp
        to:
          - global: true
    env:
      - HOME=/opt/solana
      - SOLANA_RUN_SH_CLUSTER_TYPE=mainnet-beta
      - |
        SOLANA_RUN_SH_VALIDATOR_ARGS=
        --known-validator 7Np41oeYqPefeNQEHSv1UDhYrehxin3NStELsSKCT4K2
        --known-validator GdnSyH3YtwcxFvQrVVJMm1JhTS4QVX7MFsX56uJLUfiZ
        --known-validator DE1bawNcRJB9rVm3buyMVfr8mBEoyyu73NBovf2oXJsJ
        --known-validator CakcnaRDHka2gXyfbEd2d3xsvkJkqsLw2akB3zsN1D2S
        --only-known-rpc
        --entrypoint entrypoint.mainnet-beta.solana.com:8001
        --entrypoint entrypoint2.mainnet-beta.solana.com:8001
        --entrypoint entrypoint3.mainnet-beta.solana.com:8001
        --entrypoint entrypoint4.mainnet-beta.solana.com:8001
        --entrypoint entrypoint5.mainnet-beta.solana.com:8001
        --dynamic-port-range 8010-8022
        --minimal-snapshot-download-speed 31457280
        --wal-recovery-mode skip_any_corrupted_record
        --limit-ledger-size 50000000
        --no-port-check
        --no-poh-speed-test
        --expected-genesis-hash 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d
    # --public-rpc-address andy-solana-rpc.ingress.edgenet-1.ewr1.aksh.pw:80
    params:
      storage:
        data:
          mount: /opt/solana

profiles:
  compute:
    solana:
      resources:
        cpu:
          units: 16
        memory:
          size: 256Gi
        storage:
          - name: data
            size: 1024Gi
            attributes:
              persistent: true
              class: beta2
  placement:
    westcoast:
      attributes:
        region: us-west
        host: akash
        organization: akash.network
      pricing:
        solana:
          denom: uakt
          amount: 100000

deployment:
  solana:
    westcoast:
      profile: solana
      count: 1
@arno01
Copy link
Author

arno01 commented Feb 5, 2022

vm.max_map_count needs to be jacked up to 1000000.

[2022-02-05T10:38:20.211949304Z INFO  solana_runtime::append_vec] memory map error: Err(Os { code: 12, kind: Other, message: "Cannot allocate memory" }). This may be because vm.max_map_count is not set correctly.

@arno01
Copy link
Author

arno01 commented Feb 5, 2022

Solana validator runs without vm.max_map_count related errors with own genesis on Akash v0.15, to do so remove the following lines from the above SDL manifest:

  • sed -i -e "s/solana-genesis/echo solana-genesis/g" /opt/solana/solana-run.sh; <<< so that genesis file gets created
  • all --known-validator
  • all --entrypoint

Then you can use it, knowing its endpoint uri which you can query upon akash provider lease-status ...:

$ docker run --rm -ti --entrypoint bash solanalabs/solana:v1.8.14
root@b5cfd11a5bc6:/# solana config set --url http://ndmuk4niqhasb84r8phiro3teo.ingress.edgenet-2.ewr1.aksh.pw
Config File: /root/.config/solana/cli/config.yml
RPC URL: http://ndmuk4niqhasb84r8phiro3teo.ingress.edgenet-2.ewr1.aksh.pw 
WebSocket URL: ws://ndmuk4niqhasb84r8phiro3teo.ingress.edgenet-2.ewr1.aksh.pw/ (computed)
Keypair Path: /root/.config/solana/id.json 
Commitment: confirmed 

root@b5cfd11a5bc6:/# solana --version
solana-cli 1.8.14 (src:9c01d90c; feat:1006352700)

root@b5cfd11a5bc6:/# solana cluster-version
1.8.14

root@b5cfd11a5bc6:/# solana supply
Total: 1000000003.9185048 SOL
Circulating: 683635170.3717778 SOL
Non-Circulating: 316364833.5467271 SOL

root@b5cfd11a5bc6:~# solana epoch-info

Block height: 2299
Slot: 2299
Epoch: 0
Transaction Count: 2299
Epoch Slot Range: [0..432000)
Epoch Completed Percent: 0.532%
Epoch Completed Slots: 2299/432000 (429701 remaining)
Epoch Completed Time: 16m 5s/2days 2h 16m 49s (2days 2h 44s remaining)

root@b5cfd11a5bc6:/# solana validators
  Identity                                      Vote Account                            Commission  Last Vote       Root Slot    Skip Rate  Credits  Version  Active Stake
  F3GzzUtZ5pki9oRWr9uUkHqS6WQHGGJMsCKyXeU31pFA  EAxKWihLR5PzJk5absZha4g1vCn1pD4kZekuRU9L5Toe  100%      1594 (  0)      1563 (  0)   0.00%     1564   1.8.14  0.49771712 SOL (100.00%)

Average Stake-Weighted Skip Rate: 0.00%
Average Unweighted Skip Rate:     0.00%

Active Stake: 0.49771712 SOL

Stake By Version:
1.8.14   -    1 current validators (100.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment