Skip to content

Commit

Permalink
tilt: m1 flag
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-gray committed Nov 29, 2024
1 parent 02cdf9e commit 0cfabbc
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
12 changes: 12 additions & 0 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ update_settings(max_parallel_updates = 10)
# Runtime configuration
config.define_bool("ci", False, "We are running in CI")
config.define_bool("manual", False, "Set TRIGGER_MODE_MANUAL by default")
config.define_bool("m1", False, "Build Solana from source for m1 arm64")

config.define_string("num", False, "Number of guardian nodes to run")

Expand Down Expand Up @@ -100,6 +101,7 @@ btc = cfg.get("btc", False)
redis = cfg.get('redis', ci)
generic_relayer = cfg.get("generic_relayer", ci)
query_server = cfg.get("query_server", ci)
m1 = cfg.get("m1", False)

if ci:
guardiand_loglevel = cfg.get("guardiand_loglevel", "warn")
Expand Down Expand Up @@ -485,6 +487,16 @@ if solana or pythnet:

# solana local devnet

dockerfile = "solana/Dockerfile.test-validator"
if m1:
dockerfile = "solana/Dockerfile.test-validator.m1"

docker_build(
ref = "solana-test-validator",
context = "solana",
dockerfile = dockerfile
)

k8s_yaml_with_ns("devnet/solana-devnet.yaml")

k8s_resource(
Expand Down
4 changes: 2 additions & 2 deletions devnet/solana-devnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ spec:
terminationGracePeriodSeconds: 1
containers:
- name: devnet
image: solana-contract
image: solana-test-validator
command:
- /root/.local/share/solana/install/active_release/bin/solana-test-validator
- solana-test-validator
- --bpf-program
- Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o
- /opt/solana/deps/bridge.so
Expand Down
1 change: 1 addition & 0 deletions solana/Dockerfile.test-validator
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM solana-contract
36 changes: 36 additions & 0 deletions solana/Dockerfile.test-validator.m1
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM solana-contract
FROM --platform=linux/arm64/v8 ubuntu:20.04@sha256:4489868cec4ea83f1e2c8e9f493ac957ec1451a63428dbec12af2894e6da4429

RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y curl wget libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang cmake make libprotobuf-dev protobuf-compiler

# --default-toolchain must match https://github.com/anza-xyz/agave/blob/v2.0.17/rust-toolchain.toml
# alternatively, this could do something like the following
# RUN source solana/ci/rust-version.sh && \
# curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain "$rust_stable"
# RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "1.78.0" && . $HOME/.cargo/env && rustup component add rustfmt
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "1.73.0" && . $HOME/.cargo/env && rustup component add rustfmt

ENV PATH=/root/.cargo/bin:$PATH

WORKDIR /build

# version 2.0.17 is incompatible with the existing devnet_setup.sh
# ENV solana_version=2.0.17
ENV solana_version=1.17.29

RUN wget https://github.com/anza-xyz/agave/archive/refs/tags/v${solana_version}.tar.gz

RUN tar -xf v${solana_version}.tar.gz

WORKDIR /build/agave-${solana_version}

# the full build OOMed with 24GB RAM allocated to Docker, so use --validator-only to slim it down and speed it up
# except that the following command apparently didn't build solana-test-validator
# RUN ./scripts/cargo-install-all.sh . --validator-only
# so just explicitly build solana-test-validator
RUN ./cargo build --profile release --bin solana-test-validator
RUN mkdir bin && cp target/release/solana-test-validator bin/solana-test-validator

ENV PATH=/build/agave-${solana_version}/bin:$PATH

COPY --from=solana-contract /opt/solana/deps/ /opt/solana/deps/

0 comments on commit 0cfabbc

Please sign in to comment.