Last active
February 26, 2024 20:07
-
-
Save activescott/0465102ff8475ac13eae93da188ed2f4 to your computer and use it in GitHub Desktop.
rocket-pool/smarnode development scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Print usage | |
usage() { | |
echo "Usage: build-release.sh -v <version number>" | |
echo "This script builds the Smartnode builder image used to build the daemon binaries." | |
exit 0 | |
} | |
# ================= | |
# === Main Body === | |
# ================= | |
# Get the version | |
while getopts "admv:" FLAG; do | |
case "$FLAG" in | |
v) VERSION="$OPTARG" ;; | |
*) usage ;; | |
esac | |
done | |
if [ -z "$VERSION" ]; then | |
#usage | |
VERSION=$(date +"%Y-%m-%d-%H_%M_%S") | |
echo "No version specified, using $VERSION" | |
fi | |
echo -n "Building Docker image... " | |
docker build -t rocketpool/smartnode-builder:$VERSION -f docker/smartnode-builder . | |
docker tag rocketpool/smartnode-builder:$VERSION rocketpool/smartnode-builder:latest | |
#docker push rocketpool/smartnode-builder:$VERSION | |
#docker push rocketpool/smartnode-builder:latest | |
echo "done!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get the platform type and run the build script if possible | |
PLATFORM=$(uname -s) | |
if [ "$PLATFORM" = "Linux" ]; then | |
docker run -it --rm -v $PWD:/smartnode rocketpool/smartnode-builder:latest /smartnode/rocketpool-cli/build.sh | |
else | |
echo "Platform ${PLATFORM} is not supported by this script, please build the daemon manually." | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get the platform type and run the build script if possible | |
PLATFORM=$(uname -s) | |
if [ "$PLATFORM" = "Linux" ]; then | |
docker run -it --rm -v $PWD:/smartnode rocketpool/smartnode-builder:latest /smartnode/rocketpool/build.sh | |
else | |
echo "Platform ${PLATFORM} is not supported by this script, please build the daemon manually." | |
exit 1 | |
fi | |
last_exit_code=$? | |
if [ $last_exit_code -ne 0 ]; then | |
echo "Build failed." | |
exit $last_exit_code | |
fi | |
echo -n "Building Docker image... " | |
# TODO: Lame - somehow make sure version always comes from the same place: | |
VERSION=1.11.8-dev # must be same as `RocketPoolVersion` in shared/version.go | |
docker build -t rocketpool/smartnode:v$VERSION -f docker/rocketpool-dockerfile . | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
THISDIR=$(cd $(dirname "$0"); pwd) #this script's directory | |
# no lifecycle api so no curl ... | |
# curl -X POST http://debprime.local:9091/-/reload | |
$THISDIR/rp-docker.sh down prometheus && $THISDIR/rp-docker.sh up -d prometheus | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
THISDIR=$(cd $(dirname "$0"); pwd) #this script's directory | |
# Get the first argument and save it to container_name; fail if the argument wasn't provided | |
container_name=$1 | |
if [ -z "$container_name" ]; then | |
echo "Error: Container name not provided." | |
exit 1 | |
fi | |
# Check if container_name is valid; fail with an error if it's not | |
case $container_name in | |
mev-boost|grafana|watchtower|validator|exporter|eth1|api|node|prometheus|alertmanager|eth2) | |
;; | |
*) | |
echo "Error: Invalid container name." | |
exit 1 | |
;; | |
esac | |
$THISDIR/rp-docker.sh down $container_name | |
$THISDIR/rp-docker.sh up $container_name -d | |
echo "Tailing logs for $container_name. Press Ctrl+C to stop viewing..." | |
$THISDIR/rp-docker.sh logs -f $container_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# FYI: this csv be seen in `docker inspect rocketpool_eth1` | |
#docker_compose_files_csv=/home/scott/.rocketpool/runtime/api.yml,/home/scott/.rocketpool/override/api.yml,/home/scott/.rocketpool/runtime/node.yml,/home/scott/.rocketpool/override/node.yml,/home/scott/.rocketpool/runtime/watchtower.yml,/home/scott/.rocketpool/override/watchtower.yml,/home/scott/.rocketpool/runtime/validator.yml,/home/scott/.rocketpool/override/validator.yml,/home/scott/.rocketpool/runtime/eth1.yml,/home/scott/.rocketpool/override/eth1.yml,/home/scott/.rocketpool/runtime/eth2.yml,/home/scott/.rocketpool/override/eth2.yml,/home/scott/.rocketpool/runtime/grafana.yml,/home/scott/.rocketpool/override/grafana.yml,/home/scott/.rocketpool/runtime/exporter.yml,/home/scott/.rocketpool/override/exporter.yml,/home/scott/.rocketpool/runtime/prometheus.yml,/home/scott/.rocketpool/override/prometheus.yml,/home/scott/.rocketpool/runtime/mev-boost.yml,/home/scott/.rocketpool/override/mev-boost.yml | |
docker_compose_files_csv=$(docker inspect -f '{{ index .Config.Labels "com.docker.compose.project.config_files" }}' rocketpool_eth1) | |
# split the comma-delimited list into an array | |
IFS=',' read -ra docker_compose_files <<< "$docker_compose_files_csv" | |
# create the command arguments for the -f option | |
docker_compose_args=() | |
for file in "${docker_compose_files[@]}"; do | |
docker_compose_args+=("-f $file") | |
done | |
# use the command arguments with docker-compose | |
#docker compose "${docker_compose_args[@]}" | |
#echo "docker_compose_args: ${docker_compose_args[@]}" $@ | |
#exit 1 | |
COMPOSE_PROJECT_NAME=rocketpool docker compose --project-directory ~/.rocketpool ${docker_compose_args[@]} $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
THISDIR=$(cd $(dirname "$0"); pwd) #this script's directory | |
$THISDIR/rp-docker.sh exec -it prometheus wget -q node:9102/metrics -O - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment