Last active
September 4, 2020 02:14
-
-
Save Someguy123/570088fbbb0b6f8929c1da226cb99033 to your computer and use it in GitHub Desktop.
Hive Testnet Auto-deploy Script by Someguy123. `curl -fsSL https://gist.githubusercontent.com/Someguy123/570088fbbb0b6f8929c1da226cb99033/raw/hivetestnet.sh | bash`
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
# The Caddyfile is an easy way to configure your Caddy web server. | |
# | |
# Unless the file starts with a global options block, the first | |
# uncommented line is always the address of your site. | |
# | |
# To use your own domain name (with automatic HTTPS), first make | |
# sure your domain's A/AAAA DNS records are properly pointed to | |
# this machine's public IP, then replace the line below with your | |
# domain name. | |
:80 | |
# Jussi Reverse Proxy | |
reverse_proxy localhost:8080 | |
# Set this path to your site's directory. | |
#root * /usr/share/caddy | |
# Enable the static file server. | |
#file_server | |
# Or serve a PHP site through php-fpm: | |
# php_fastcgi localhost:9000 | |
# Refer to the Caddy docs for more information: | |
# https://caddyserver.com/docs/caddyfile |
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
##### | |
# P2P | |
##### | |
p2p-endpoint = 0.0.0.0:2001 | |
p2p-max-connections = 1000 | |
##### | |
# SHARED MEM | |
##### | |
shared-file-size = 4G | |
shared-file-dir = /shm/ | |
shared-file-full-threshold = 9500 | |
shared-file-scale-rate = 1000 | |
flush = 1000 | |
##### | |
# SEEDS | |
##### | |
p2p-seed-node = 134.209.41.170:2001 # Inertia Seed | |
p2p-seed-node = sgbox.someguy123.net:2030 # Someguy123 (Privex SE) | |
p2p-seed-node = se1.hive.moe:2001 # Someguy123 (Privex SE) | |
p2p-seed-node = se2.hive.moe:2001 # Someguy123 (Privex SE) | |
p2p-seed-node = se3.hive.moe:2001 # Someguy123 (Privex SE) | |
p2p-seed-node = se4.hive.moe:2001 # Someguy123 (Privex SE) | |
p2p-seed-node = ams1.hive.moe:2001 # Someguy123 (Vultr AMS) | |
p2p-seed-node = jp1.hive.moe:2001 # Someguy123 (Vultr Tokyo, JP) | |
p2p-seed-node = aus1.hive.moe:2001 # Someguy123 (Vultr Sydney, Australia) | |
p2p-seed-node = us-west1.hive.moe:2001 # Someguy123 (Vultr San Francisco, CA, USA) | |
p2p-seed-node = us-cent1.hive.moe:2001 # Someguy123 (Vultr Dallas, TX, USA) | |
p2p-seed-node = us-east1.hive.moe:2001 # Someguy123 (Vultr New Jersey, NY, USA) | |
p2p-seed-node = tor1.hive.moe:2001 # Someguy123 (Vultr Toronto, Canada) | |
p2p-seed-node = fin1.hive.moe:2001 # Someguy123 (Hetzner Helsinki, Finland) | |
p2p-seed-node = fin2.hive.moe:2001 # Someguy123 (Hetzner Helsinki, Finland) | |
p2p-seed-node = de1.hive.moe:2001 # Someguy123 (Hetzner Falkenstein, Germany) | |
p2p-seed-node = de2.hive.moe:2001 # Someguy123 (Hetzner Nuremburg, Germany) | |
p2p-seed-node = de3.hive.moe:2001 # Someguy123 (Hetzner Nuremburg, Germany) | |
p2p-seed-node = de4.hive.moe:2001 # Someguy123 (Hetzner Nuremburg, Germany) | |
p2p-seed-node = de4.hive.moe:2001 # Someguy123 (Hetzner Nuremburg, Germany) | |
##### | |
# RPC | |
##### | |
webserver-http-endpoint = 0.0.0.0:8091 | |
webserver-ws-endpoint = 0.0.0.0:8090 | |
##### | |
# PLUGINS | |
##### | |
plugin = witness condenser_api network_broadcast_api database_api block_api | |
plugin = account_by_key account_by_key_api | |
##### | |
# WITNESS | |
##### | |
# witness = "someguy123" | |
# private-key = 5xxxxxxx | |
##### | |
# OTHER | |
##### | |
bucket-size = [15,60,300,3600,86400] | |
history-per-size = 5760 | |
enable-stale-production = false | |
required-participation = 33 | |
log-appender = {"appender":"stderr","stream":"std_error"} | |
log-appender = {"appender":"p2p","file":"logs/p2p/p2p.log"} | |
log-logger = {"name":"default","level":"debug","appender":"stderr"} | |
log-logger = {"name":"p2p","level":"warn","appender":"p2p"} |
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
##### | |
# P2P | |
##### | |
p2p-endpoint = 0.0.0.0:2001 | |
p2p-max-connections = 1000 | |
##### | |
# SHARED MEM | |
##### | |
shared-file-size = 8G | |
shared-file-dir = /shm/ | |
shared-file-full-threshold = 9500 | |
shared-file-scale-rate = 1000 | |
flush = 1000 | |
##### | |
# SEEDS | |
##### | |
p2p-seed-node = 134.209.41.170:2001 # Inertia Seed | |
p2p-seed-node = sgbox.someguy123.net:2030 # Someguy123 (Privex SE) | |
p2p-seed-node = se1.hive.moe:2001 # Someguy123 (Privex SE) | |
p2p-seed-node = se2.hive.moe:2001 # Someguy123 (Privex SE) | |
p2p-seed-node = se3.hive.moe:2001 # Someguy123 (Privex SE) | |
p2p-seed-node = se4.hive.moe:2001 # Someguy123 (Privex SE) | |
p2p-seed-node = ams1.hive.moe:2001 # Someguy123 (Vultr AMS) | |
p2p-seed-node = jp1.hive.moe:2001 # Someguy123 (Vultr Tokyo, JP) | |
p2p-seed-node = aus1.hive.moe:2001 # Someguy123 (Vultr Sydney, Australia) | |
p2p-seed-node = us-west1.hive.moe:2001 # Someguy123 (Vultr San Francisco, CA, USA) | |
p2p-seed-node = us-cent1.hive.moe:2001 # Someguy123 (Vultr Dallas, TX, USA) | |
p2p-seed-node = us-east1.hive.moe:2001 # Someguy123 (Vultr New Jersey, NY, USA) | |
p2p-seed-node = tor1.hive.moe:2001 # Someguy123 (Vultr Toronto, Canada) | |
p2p-seed-node = fin1.hive.moe:2001 # Someguy123 (Hetzner Helsinki, Finland) | |
p2p-seed-node = fin2.hive.moe:2001 # Someguy123 (Hetzner Helsinki, Finland) | |
p2p-seed-node = de1.hive.moe:2001 # Someguy123 (Hetzner Falkenstein, Germany) | |
p2p-seed-node = de2.hive.moe:2001 # Someguy123 (Hetzner Nuremburg, Germany) | |
p2p-seed-node = de3.hive.moe:2001 # Someguy123 (Hetzner Nuremburg, Germany) | |
p2p-seed-node = de4.hive.moe:2001 # Someguy123 (Hetzner Nuremburg, Germany) | |
p2p-seed-node = de4.hive.moe:2001 # Someguy123 (Hetzner Nuremburg, Germany) | |
##### | |
# RPC | |
##### | |
webserver-http-endpoint = 0.0.0.0:8091 | |
webserver-ws-endpoint = 0.0.0.0:8090 | |
##### | |
# PLUGINS | |
##### | |
plugin = witness condenser_api network_broadcast_api database_api block_api | |
plugin = account_by_key account_by_key_api | |
plugin = account_history_rocksdb account_history_rocksdb | |
plugin = reputation reputation_api | |
plugin = market_history market_history_api | |
plugin = transaction_status transaction_status_api | |
##### | |
# WITNESS | |
##### | |
# witness = "someguy123" | |
# private-key = 5xxxxxxx | |
##### | |
# OTHER | |
##### | |
bucket-size = [15,60,300,3600,86400] | |
history-per-size = 5760 | |
enable-stale-production = false | |
required-participation = 33 | |
log-appender = {"appender":"stderr","stream":"std_error"} | |
log-appender = {"appender":"p2p","file":"logs/p2p/p2p.log"} | |
log-logger = {"name":"default","level":"debug","appender":"stderr"} | |
log-logger = {"name":"p2p","level":"warn","appender":"p2p"} |
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 | |
: ${BASE_URL="https://gist.githubusercontent.com/Someguy123/570088fbbb0b6f8929c1da226cb99033/raw"} | |
: ${IMAGE="master-testnet"} | |
: ${CONFIG_INI="${BASE_URL}/config.ini"} | |
: ${FULL_CONFIG_INI="${BASE_URL}/config_full.ini"} | |
: ${JUSSI_SCRIPT="${BASE_URL}/install_jussi.sh"} | |
: ${FULL_NODE=0} | |
: ${INSTALL_JUSSI=0} | |
: ${DOWNLOAD_STATE=1} | |
: ${INSTALL_DIR="/root/hive-docker"} | |
: ${DATADIR="${INSTALL_DIR}/data"} | |
: ${BC_DIR="${DATADIR}/witness_node_data_dir/blockchain"} | |
: ${SHM_DIR="${DATADIR}/shm"} | |
: ${T_SRC="http://files.privex.io/blockchains/hivetestnet"} | |
# if your server is in the US, vultr's object storage might be faster | |
# T_SRC="https://testnet.ewr1.vultrobjects.com" | |
: ${T_SRC_RSYNC="rsync://files.privex.io/blockchains/hivetestnet"} | |
echo -e "\n==============================================================================\n" | |
echo -e " Someguy123's Hive Testnet Quick-Install\n" | |
echo -e " https://peakd.com/@someguy123\n" | |
echo -e " https://github.com/Someguy123\n" | |
echo -e "\n==============================================================================\n" | |
sleep 1 | |
echo -e "\n >> Installing apt packages ...\n" | |
apt update -y | |
apt install -y jq curl wget git zsh rsync | |
######################## someguy-scripts ######################## | |
echo -e "\n >> Installing someguy-scripts ...\n" | |
curl -fsS https://cdn.privex.io/github/someguy-scripts/dist/lite.sh | bash | |
######################## steem-peers ######################## | |
echo -e "\n >> Installing steem-peers ...\n" | |
git clone https://github.com/Someguy123/steem-peers.git /root/steem-peers | |
echo -e "\n > Installing Python dependencies required for steem-peers ...\n" | |
cd /root/steem-peers | |
pip3 install -r requirements.txt | |
echo -e "\n > Downloading GeoIP files (required for steem-peers) ...\n" | |
mkdir -p /usr/share/GeoIP/ &>/dev/null | |
rsync -avh --progress "rsync://files.privex.io/cdn/extras/GeoIP/*.mmdb" "/usr/share/GeoIP/" | |
######################## Clone hive-docker + install config ######################## | |
echo -e "\n >> Cloning hive-docker ...\n" | |
git clone https://github.com/Someguy123/hive-docker.git "$INSTALL_DIR" | |
if (( FULL_NODE )); then | |
echo -e "\n [...] FULL_NODE is true. Using full node config.ini instead of witness/seed config.\n" | |
CONFIG_INI="$FULL_CONFIG_INI" | |
fi | |
echo -e "\n >> Installing basic testnet config.ini with seeds: ${CONFIG_INI}\n" | |
curl -fsSL "$CONFIG_INI" | tee "${INSTALL_DIR}/data/witness_node_data_dir/config.ini" | |
mkdir -p "$DATADIR" &> /dev/null | |
mkdir -p "$SHM_DIR" &> /dev/null | |
mkdir -p "$BC_DIR" &> /dev/null | |
######################## Block Log + SHM Downloader ######################## | |
apt install -y liblz4-tool | |
if (( DOWNLOAD_STATE )); then | |
if (( FULL_NODE )); then | |
echo -e "\n !!! FULL_NODE is true. Appending /full to T_SRC and T_SRC_RSYNC for full node state files.\n" | |
T_SRC="${T_SRC}/full" | |
T_SRC_RSYNC="${T_SRC_RSYNC}/full" | |
fi | |
echo -e "\n >> Downloading block log from: ${T_SRC}/block_log.lz4\n" | |
curl -fsSL "${T_SRC}/block_log.lz4" | lz4 -d - "${BC_DIR}/block_log" | |
echo -e "\n >> Downloading block index from: ${T_SRC}/block_log.index\n" | |
wget --progress=bar -O "${BC_DIR}/block_log.index" "${T_SRC}/block_log.index" | |
echo -e "\n >> Downloading shared memory from: ${T_SRC}/shared_memory.bin.lz4\n" | |
curl -fsSL "${T_SRC}/shared_memory.bin.lz4" | lz4 -v -d - "${SHM_DIR}/shared_memory.bin" | |
echo -e "\n >> Trimming empty blocks using fallocate to make file sparse again: ${SHM_DIR}/shared_memory.bin\n" | |
fallocate -v -d "${SHM_DIR}/shared_memory.bin" | |
if (( FULL_NODE )); then | |
echo -e "\n >> Downloading account history rocksdb from: ${T_SRC_RSYNC}/account-history-rocksdb-storage\n" | |
rsync -avh --progress --sparse "${T_SRC_RSYNC}/account-history-rocksdb-storage" "${BC_DIR}/account-history-rocksdb-storage" | |
fi | |
else | |
echo -e " [!!!] Not downloading block log or shared memory as DOWNLOAD_STATE is <= 0" | |
fi | |
######################## install docker + hive-docker ######################## | |
echo -e "\n >> Installing Docker ...\n" | |
curl -fsSL https://get.docker.com | bash | |
echo -e "\n >> Installing Hive Docker image: ${IMAGE} ...\n" | |
cd "$INSTALL_DIR" | |
./run.sh install "$IMAGE" | |
######################## generate .env file ######################## | |
echo -e "\n >> Creating .env file ...\n" | |
cat > .env <<EOF | |
DKR_RUN_BIN=hived | |
DKR_RUN_ARGS=("--restart" "always") | |
DATADIR=${DATADIR} | |
SHM_DIR=${SHM_DIR} | |
PORTS=2001,8090,8091 | |
EOF | |
######################## systemd service ######################## | |
echo -e "\n >> Installing hive.service systemd service ...\n" | |
#cat > /etc/systemd/system/hive.service <<EOF | |
#[Unit] | |
#Description=Hive | |
#After=docker.service | |
#[Service] | |
#ExecStart=${INSTALL_DIR}/run.sh start | |
#ExecStop=${INSTALL_DIR}/run.sh stop | |
#WorkingDirectory=${INSTALL_DIR} | |
#User=root | |
#Type=oneshot | |
#[Install] | |
#WantedBy=multi-user.target | |
#EOF | |
#echo -e "\n >> Enabling hive.service systemd service ...\n" | |
#systemctl daemon-reload | |
#systemctl enable hive.service | |
#echo -e "\n >> Starting hive.service systemd service ...\n" | |
#systemctl start hive | |
echo -e "\n >> Starting hive ...\n" | |
cd "$INSTALL_DIR" | |
./run.sh start | |
echo -e "\n >> Waiting a few seconds for hive to start ...\n" | |
sleep 2 | |
######################## hive is installed. docker ps + logs ######################## | |
echo -e "\n >> Docker ps output ...\n" | |
docker ps | |
echo -e "\n >> Docker logs ...\n" | |
docker logs -t --tail=20 seed | |
echo -e "\n [+++] Finished installing Hive testnet ...\n" | |
######################## install jussi if required ######################## | |
if (( INSTALL_JUSSI )); then | |
echo -e "\n [...] INSTALL_JUSSI is true - installing Jussi and Caddy ...\n" | |
curl -fsSL "$JUSSI_SCRIPT" | bash | |
echo -e "\n [+++] Finished Installing Jussi ...\n" | |
fi | |
######################## ALL DONE. ######################## | |
echo -e "\n ++++++ FINISHED ++++++\n" | |
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 | |
: ${JUSSI_REMOTE="https://gist.githubusercontent.com/Someguy123/570088fbbb0b6f8929c1da226cb99033/raw/jussi.json"} | |
: ${CADDY_REMOTE="https://gist.githubusercontent.com/Someguy123/570088fbbb0b6f8929c1da226cb99033/raw/Caddyfile"} | |
: ${JUSSI_CONF="/jussi/config.json"} | |
: ${CADDY_CONF="/etc/caddy/Caddyfile"} | |
: ${DOCKER_NAME="seed"} | |
JUSSI_DIR=$(dirname "$JUSSI_CONF") | |
echo -e "\n==============================================================================\n" | |
echo -e " Someguy123's Jussi + Caddy Quick-Install\n" | |
echo -e " https://peakd.com/@someguy123\n" | |
echo -e " https://github.com/Someguy123\n" | |
echo -e "\n==============================================================================\n" | |
sleep 1 | |
echo -e "\n [...] Creating dir: ${JUSSI_DIR}\n" | |
mkdir -pv "$JUSSI_DIR" | |
echo -e "\n [...] Downloading Jussi config ${JUSSI_REMOTE} -> ${JUSSI_CONF}\n" | |
curl -fsSL "$JUSSI_REMOTE" > "$JUSSI_CONF" | |
echo -e "\n [...] Downloading Jussi image: someguy123/jussi:latest\n" | |
docker pull someguy123/jussi:latest | |
echo -e "\n [...] Starting Jussi using config ${JUSSI_CONF} - linking to container: ${DOCKER_NAME}\n" | |
docker run -itd --link "$DOCKER_NAME" --restart=always --name jussi -h jussi -v "${JUSSI_CONF}:/app/DEV_config.json" -p 8080:8080 someguy123/jussi:latest | |
echo -e "\n [...] Installing Caddy ...\n" | |
echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" | tee -a /etc/apt/sources.list.d/caddy-fury.list | |
apt update -y | |
apt install -y caddy | |
echo -e "\n [...] Installing Caddy config pointing to Jussi: ${CADDY_REMOTE} -> ${CADDY_CONF} \n" | |
curl -fsSL "$CADDY_REMOTE" > "$CADDY_CONF" | |
echo -e "\n [...] Enabling and restarting Caddy\n" | |
systemctl enable caddy | |
systemctl restart caddy | |
echo -e "\n [+++] FINISHED\n" |
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
{ | |
"limits": { | |
"blacklist_accounts":["non-steemit"] | |
}, | |
"upstreams":[ | |
{ | |
"name":"steemd", | |
"translate_to_appbase":true, | |
"urls":[ | |
["steemd","http://seed:8091"] | |
], | |
"ttls":[ | |
["steemd",3], | |
["steemd.login_api",-1], | |
["steemd.network_broadcast_api",-1], | |
["steemd.follow_api",10], | |
["steemd.market_history_api",1], | |
["steemd.database_api",3], | |
["steemd.database_api.get_block",-2], | |
["steemd.database_api.get_block_header",-2], | |
["steemd.database_api.get_content",1], | |
["steemd.database_api.get_state",1], | |
["steemd.database_api.get_state.params=['/trending']",30], | |
["steemd.database_api.get_state.params=['trending']",30], | |
["steemd.database_api.get_state.params=['/hot']",30], | |
["steemd.database_api.get_state.params=['/welcome']",30], | |
["steemd.database_api.get_state.params=['/promoted']",30], | |
["steemd.database_api.get_state.params=['/created']",10], | |
["steemd.database_api.get_dynamic_global_properties",1] | |
], | |
"timeouts":[ | |
["steemd",5], | |
["steemd.network_broadcast_api",0] | |
] | |
}, | |
{ | |
"name":"appbase", | |
"urls":[ | |
["appbase","http://seed:8091"] | |
], | |
"ttls":[ | |
["appbase", 3], | |
["appbase.block_api",-2], | |
["appbase.database_api",1], | |
["appbase.login_api",-1], | |
["appbase.network_broadcast_api", -1], | |
["appbase.follow_api", 10], | |
["appbase.market_history_api", 1], | |
["appbase.condenser_api", 3], | |
["appbase.condenser_api.get_block", -2], | |
["appbase.condenser_api.get_block_header", -2], | |
["appbase.condenser_api.get_content", 1], | |
["appbase.condenser_api.get_state", 1], | |
["appbase.condenser_api.get_state.params=['/trending']", 30], | |
["appbase.condenser_api.get_state.params=['trending']", 30], | |
["appbase.condenser_api.get_state.params=['/hot']", 30], | |
["appbase.condenser_api.get_state.params=['/welcome']", 30], | |
["appbase.condenser_api.get_state.params=['/promoted']", 30], | |
["appbase.condenser_api.get_state.params=['/created']", 10], | |
["appbase.condenser_api.get_dynamic_global_properties", 3] | |
], | |
"timeouts":[ | |
["appbase", 3], | |
["appbase.network_broadcast_api",0], | |
["appbase.chain_api.push_block", 0], | |
["appbase.chain_api.push_transaction", 0], | |
["appbase.condenser_api.broadcast_block", 0], | |
["appbase.condenser_api.broadcast_transaction", 0], | |
["appbase.condenser_api.broadcast_transaction_synchronous", 0], | |
["appbase.condenser_api.get_account_history", 20], | |
["appbase.condenser_api.get_account_votes", 20], | |
["appbase.condenser_api.get_ops_in_block.params=[2889020,false]", 20], | |
["appbase.account_history_api.get_ops_in_block.params={\"block_num\":2889020,\"only_virtual\":false}", 20] | |
] | |
}, | |
{ | |
"name": "hive", | |
"urls": [ | |
["hive", "http://seed:8091"] | |
], | |
"ttls": [ | |
["hive", -1] | |
], | |
"timeouts": [ | |
["hive", 30] | |
] | |
}, | |
{ | |
"name": "bridge", | |
"translate_to_appbase": false, | |
"urls": [ | |
["bridge","http://seed:8091"] | |
], | |
"ttls": [ | |
["bridge",-1] | |
], | |
"timeouts": [ | |
["bridge",30] | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment