Skip to content

Commit

Permalink
chore: update b script (solana-labs#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
segfaultdoc authored Aug 18, 2022
1 parent 449779d commit 2b6a761
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 6 deletions.
45 changes: 42 additions & 3 deletions b
Original file line number Diff line number Diff line change
@@ -1,18 +1,57 @@
#!/usr/bin/env sh
# Build the relayer container
set -e

# dev or testnet
ENV=$1
ENV_FILE=./env/.env.${ENV}

TAG=$(git describe --match=NeVeRmAtCh --always --abbrev=8 --dirty)
ORG="jitolabs"

if [ -f "$ENV_FILE" ]; then
export $(cat "$ENV_FILE" | grep -v '#' | awk '/=/ {print $1}')
else
echo "Missing .env file"
exit 0
fi

# A little hacky, but .env files can't execute so this is the best we have for now
if [ "$ENV" = "dev" ]; then
if [ "$(uname)" = "Darwin" ]; then
RPC_SERVERS=http://docker.for.mac.localhost:8899
WEBSOCKET_SERVERS=ws://docker.for.mac.localhost:8900
BLOCK_ENGINE_AUTH_SERVICE_URL=http://docker.for.mac.localhost:${BLOCK_ENGINE_AUTH_SERVICE_PORT}
BLOCK_ENGINE_URL=http://docker.for.mac.localhost:${BLOCK_ENGINE_PORT}
elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then
RPC_SERVERS=http://172.17.0.1:8899
WEBSOCKET_SERVERS=ws://172.17.0.1:8900
BLOCK_ENGINE_AUTH_SERVICE_URL=http://172.17.0.1:${BLOCK_ENGINE_AUTH_SERVICE_PORT}
BLOCK_ENGINE_URL=http://172.17.0.1:${BLOCK_ENGINE_PORT}
else
echo "unsupported testing platform, exiting"
exit 1
fi
elif [ "$ENV" != "mainnet" ] && [ "$ENV" != "testnet" ]; then
echo "ERROR: must run ./b [dev | testnet | mainnet]"
exit 2
fi

COMPOSE_DOCKER_CLI_BUILD=1 \
DOCKER_BUILDKIT=1 \
RPC_SERVERS="${RPC_SERVERS}" \
WEBSOCKET_SERVERS="${WEBSOCKET_SERVERS}" \
BLOCK_ENGINE_URL="${BLOCK_ENGINE_URL}" \
BLOCK_ENGINE_AUTH_SERVICE_URL="${BLOCK_ENGINE_AUTH_SERVICE_URL}" \
TAG="${TAG}" \
ORG="${ORG}" \
docker compose --env-file ./env/.env.dev build --progress=plain
docker compose --env-file "${ENV_FILE}" build --progress=plain

COMPOSE_DOCKER_CLI_BUILD=1 \
DOCKER_BUILDKIT=1 \
RPC_SERVERS="${RPC_SERVERS}" \
WEBSOCKET_SERVERS="${WEBSOCKET_SERVERS}" \
BLOCK_ENGINE_URL="${BLOCK_ENGINE_URL}" \
BLOCK_ENGINE_AUTH_SERVICE_URL="${BLOCK_ENGINE_AUTH_SERVICE_URL}" \
TAG="${TAG}" \
ORG="${ORG}" \
docker compose --env-file ./env/.env.dev up --remove-orphans
docker compose --env-file "${ENV_FILE}" up --remove-orphans
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ services:
- WEBSOCKET_SERVERS=$WEBSOCKET_SERVERS
- SIGNING_KEY_PEM_PATH=$SIGNING_KEY_PEM_PATH
- VERIFYING_KEY_PEM_PATH=$VERIFYING_KEY_PEM_PATH
- BLOCK_ENGINE_AUTH_SERVICE_URL=$BLOCK_ENGINE_AUTH_SERVICE_URL
- BLOCK_ENGINE_URL=$BLOCK_ENGINE_URL
restart: on-failure
volumes:
- ./config/keys:/etc/keys
Expand Down
4 changes: 2 additions & 2 deletions env/.env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ TPU_FWD_PORT=8006
TPU_QUIC_PORT=8011
TPU_QUIC_FWD_PORT=8012
GRPC_BIND_PORT=42069
RPC_SERVERS="https://api.mainnet-beta.solana.com"
WEBSOCKET_SERVERS="wss://api.mainnet-beta.solana.com"
SIGNING_KEY_PEM_PATH=/etc/keys/signing_key.pem
VERIFYING_KEY_PEM_PATH=/etc/keys/verifying_key.pem
BLOCK_ENGINE_PORT=13335
BLOCK_ENGINE_AUTH_SERVICE_PORT=14444
11 changes: 11 additions & 0 deletions env/.env.testnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
TPU_PORT=8005
TPU_FWD_PORT=8006
TPU_QUIC_PORT=8011
TPU_QUIC_FWD_PORT=8012
GRPC_BIND_PORT=42069
SIGNING_KEY_PEM_PATH=/etc/keys/signing_key.pem
VERIFYING_KEY_PEM_PATH=/etc/keys/verifying_key.pem
BLOCK_ENGINE_URL=http://145.40.64.176:3000
BLOCK_ENGINE_AUTH_SERVICE_URL=http://136.144.58.40:14444
RPC_SERVERS=http://147.28.143.217:8899
WEBSOCKET_SERVERS=ws://147.28.143.217:8900
2 changes: 1 addition & 1 deletion packet_blaster/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"

[dependencies]
bincode = "1.3.3"
clap = { version = "3.2.11", features = ["derive"] }
clap = { version = "3.1.12", features = ["derive", "env"] }
env_logger = "0.9.0"
log = "0.4.17"
solana-client = "1.10.24"
Expand Down

0 comments on commit 2b6a761

Please sign in to comment.