fly deployment
This commit is contained in:
parent
1009f856be
commit
91cb9311fa
|
@ -0,0 +1,2 @@
|
|||
.env
|
||||
config.toml
|
|
@ -2452,6 +2452,7 @@ dependencies = [
|
|||
"itertools 0.10.5",
|
||||
"jsonrpsee-types",
|
||||
"once_cell",
|
||||
"openssl",
|
||||
"reqwest 0.12.4",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
|
@ -2856,6 +2857,15 @@ version = "0.1.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-src"
|
||||
version = "300.2.3+3.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5cff92b6f71555b61bb9315f7c64da3ca43d87531622120fea0195fc761b4843"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.102"
|
||||
|
@ -2864,6 +2874,7 @@ checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2"
|
|||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"openssl-src",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
|
|
|
@ -3,6 +3,10 @@ name = "mangorpc-latency-tester"
|
|||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[[bin]]
|
||||
name = "mangorpc-latency-tester"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
solana-sdk = "1.17.31"
|
||||
solana-rpc-client-api = "1.17.31"
|
||||
|
@ -37,3 +41,4 @@ solana-program = "1.17.31"
|
|||
solana-transaction-status = "1.17.31"
|
||||
once_cell = "1.19.0"
|
||||
chrono = "0.4.38"
|
||||
openssl = { version = "0.10.59", features = ["vendored"] }
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
FROM rust:latest as base
|
||||
WORKDIR /usr/src/myapp
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
RUN cargo fetch
|
||||
COPY src ./src
|
||||
RUN cargo install --path . --bin mangorpc-latency-tester
|
||||
FROM debian:bookworm-slim as run
|
||||
RUN apt-get update && apt-get -y install ca-certificates libc6 libssl3 libssl-dev openssl
|
||||
COPY --from=0 /usr/local/cargo/bin/mangorpc-latency-tester /usr/local/bin/mangorpc-latency-tester
|
||||
CMD ["mangorpc-latency-tester", "watch-measure-send-transaction", "--watch-interval-seconds", "21600"]
|
11
README.md
11
README.md
|
@ -67,3 +67,14 @@ cargo run watch-measure-send-transaction -- --watch-interval 600
|
|||
```
|
||||
|
||||
![example discord message](discord1.png)
|
||||
|
||||
## deployment on fly
|
||||
|
||||
install flyctl then...
|
||||
|
||||
- `fly apps create`
|
||||
- `fly secrets set --config fly.toml KEY="value"` for .env vars
|
||||
- `fly deploy --config fly.toml --ha=false --remote-only`
|
||||
- `fly status` for status
|
||||
- `fly logs` for logs
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
app = "cks-tx-tester"
|
||||
primary_region = "ams"
|
||||
kill_signal = "SIGTERM"
|
||||
kill_timeout = 60
|
||||
|
||||
[build]
|
||||
dockerfile = "./Dockerfile"
|
||||
ignorefile = ".dockerignore"
|
||||
|
||||
[deploy]
|
||||
strategy = "immediate"
|
||||
|
||||
[[vm]]
|
||||
size = "performance-2x"
|
||||
memory = "4GB"
|
||||
cpus = 2
|
||||
cpu_kind = "performance"
|
|
@ -51,8 +51,11 @@ fn setup_logging() {
|
|||
|
||||
pub fn parse_user_key(raw: String) -> Result<Keypair> {
|
||||
let byte_strs: Vec<&str> = raw.split(',').collect();
|
||||
let bytes: Result<Vec<u8>, _> = byte_strs.iter().map(|s| s.parse::<u8>()).collect();
|
||||
let user = Keypair::from_bytes(&bytes?)?;
|
||||
let bytes: Vec<u8> = byte_strs
|
||||
.iter()
|
||||
.map(|s| s.parse::<u8>().expect("parses u8"))
|
||||
.collect::<Vec<_>>();
|
||||
let user = Keypair::from_bytes(&bytes)?;
|
||||
|
||||
Ok(user)
|
||||
}
|
||||
|
|
|
@ -164,6 +164,7 @@ async fn send_and_confirm_self_transfer_tx(
|
|||
atomic_slot: Arc<AtomicU64>,
|
||||
label: String,
|
||||
rpc_client: Arc<RpcClient>,
|
||||
test_client: Arc<RpcClient>,
|
||||
recent_blockhash: Hash,
|
||||
priority_fee: u64,
|
||||
lamports: u64,
|
||||
|
@ -182,10 +183,10 @@ async fn send_and_confirm_self_transfer_tx(
|
|||
let tx = Transaction::new(&[&user], message, recent_blockhash);
|
||||
|
||||
let slot_sent = atomic_slot.load(Ordering::Relaxed);
|
||||
let signature = rpc_client.send_and_confirm_transaction(&tx).await?;
|
||||
sleep(Duration::from_secs(5)).await;
|
||||
let signature = test_client.send_transaction(&tx).await?;
|
||||
sleep(Duration::from_secs(60)).await;
|
||||
let slot_confirmed = rpc_client
|
||||
.get_transaction(&signature, UiTransactionEncoding::Json)
|
||||
.get_transaction(&signature, UiTransactionEncoding::Base64)
|
||||
.await?
|
||||
.slot;
|
||||
|
||||
|
@ -227,6 +228,7 @@ pub async fn watch_measure_txs(
|
|||
}
|
||||
|
||||
let rpc_client = RpcClient::new(rpc_url);
|
||||
let rpc_client = Arc::new(rpc_client);
|
||||
|
||||
let mut interval = time::interval(Duration::from_secs(watch_interval_seconds));
|
||||
let mut slot_diffs_by_label: HashMap<String, Vec<u64>> = HashMap::new();
|
||||
|
@ -245,8 +247,9 @@ pub async fn watch_measure_txs(
|
|||
let mut sig_futs = Vec::new();
|
||||
let c_by_l = clients_by_label.clone();
|
||||
for (i, (label, client)) in c_by_l.iter().enumerate() {
|
||||
let rpc_client = Arc::clone(&rpc_client);
|
||||
let label = label.clone();
|
||||
let rpc_client = Arc::clone(client);
|
||||
let test_client = Arc::clone(client);
|
||||
let user = Arc::clone(&user);
|
||||
let a_slot = Arc::clone(&atomic_slot);
|
||||
let fut = send_and_confirm_self_transfer_tx(
|
||||
|
@ -254,6 +257,7 @@ pub async fn watch_measure_txs(
|
|||
a_slot,
|
||||
label,
|
||||
rpc_client,
|
||||
test_client,
|
||||
recent_blockhash,
|
||||
priority_fee,
|
||||
i as u64,
|
||||
|
|
Loading…
Reference in New Issue