#!/usr/bin/env bash ################################### # RPC generator script # Converts a normal seed node into an RPC node with Jussi # (C) 2020 Privex Inc. # # Customise the nginx domain, Steem-in-a-box location, and plugin list by exporting # the vars MYDOM, SIAB, and PLUGINLIST - or just use the defaults if they're applicable :) # # Usage: # # # Become root. Don't do 'sudo bash' because it will lose your exported variables # sudo su - # # Export MYDOM / SIAB / PLUGINLIST if needed with custom settings # export MYDOM="seed.mydomain.com" SIAB="/root/steem-docker" # # Download and run the mkrpc script # curl -fsSL https://cdn.privex.io/extras/rpc/mkrpc.sh | bash # # : ${MYDOM="seed.example.org"} : ${SIAB="/hive"} : ${PLUGINLIST="witness condenser_api network_broadcast_api rc_api account_by_key database_api block_api"} if [ "$EUID" -ne 0 ]; then echo "ERROR: You must run this as root!" return 1 fi echo " >> Configuring steem at $SIAB ..." cd "$SIAB" # add block_api to the plugin list sed -Ei "s/^plugin.*/plugin = $PLUGINLIST/" data/witness_node_data_dir/config.ini echo " >> Restarting steem at $SIAB ..." # (re)start steem seed ./run.sh restart echo " >> Installing jussi (config at /jussi/config.json)..." # install jussi, and link it to the seed container mkdir /jussi &>/dev/null cd /jussi wget -q https://cdn.privex.io/extras/rpc/jussiconfig.json -O config.json docker kill jussi &>/dev/null docker rm jussi &>/dev/null docker run -itd --link seed --name jussi -h jussi --restart always -v "/jussi/config.json:/app/DEV_config.json" -p 8080:8080 someguy123/jussi:latest echo " >> Installing nginx..." # install nginx, plus my RPC config files apt-get update -y >/dev/null apt-get install -y nginx >/dev/null cd /etc/nginx/ echo " >> Configuring nginx..." rm sites-enabled/defaul* &>/dev/null mkdir snippets &>/dev/null rm snippets/rpc.conf sites-enabled/seed.conf &>/dev/null wget -q https://cdn.privex.io/extras/rpc/nginxseed.conf -O sites-enabled/seed.conf wget -q https://cdn.privex.io/extras/rpc/rpc.conf -O snippets/rpc.conf sed -Ei "s/seed.example.org/$MYDOM/" sites-enabled/seed.conf echo " >> Restarting nginx..." # now restart nginx systemctl restart nginx echo " ++ FINISHED"