mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
awsdeploy.sh can now deploy N servers or N clients
This commit is contained in:
parent
19819b880f
commit
d8a0765a2a
@ -74,15 +74,16 @@ python launch_ec2_nodes.py --tag $TAG --nodes $NUM_NODES
|
||||
chmod +x add2known_hosts.sh
|
||||
./add2known_hosts.sh
|
||||
|
||||
# (Re)create the RethinkDB configuration file conf/rethinkdb.conf
|
||||
python create_rethinkdb_conf.py
|
||||
|
||||
# Rollout base packages (dependencies) needed before
|
||||
# storage backend (RethinkDB) and BigchainDB can be rolled out
|
||||
fab install_base_software
|
||||
|
||||
# Rollout storage backend (RethinkDB) and start it
|
||||
fab install_rethinkdb
|
||||
if [ "$WHAT_TO_DEPLOY" == "servers" ]; then
|
||||
# (Re)create the RethinkDB configuration file conf/rethinkdb.conf
|
||||
python create_rethinkdb_conf.py
|
||||
# Rollout storage backend (RethinkDB) and start it
|
||||
fab install_rethinkdb
|
||||
fi
|
||||
|
||||
# Rollout BigchainDB (but don't start it yet)
|
||||
if [ "$BRANCH" == "pypi" ]; then
|
||||
@ -102,36 +103,46 @@ fi
|
||||
|
||||
# Configure BigchainDB on all nodes
|
||||
|
||||
# The idea is to send a bunch of locally-created configuration
|
||||
# files out to each of the instances / nodes.
|
||||
if [ "$WHAT_TO_DEPLOY" == "servers" ]; then
|
||||
# The idea is to send a bunch of locally-created configuration
|
||||
# files out to each of the instances / nodes.
|
||||
|
||||
# Assume a set of $NUM_NODES BigchaindB config files
|
||||
# already exists in the confiles directory.
|
||||
# One can create a set using a command like
|
||||
# ./make_confiles.sh confiles $NUM_NODES
|
||||
# (We can't do that here now because this virtual environment
|
||||
# is a Python 2 environment that may not even have
|
||||
# bigchaindb installed, so bigchaindb configure can't be called)
|
||||
# Assume a set of $NUM_NODES BigchaindB config files
|
||||
# already exists in the confiles directory.
|
||||
# One can create a set using a command like
|
||||
# ./make_confiles.sh confiles $NUM_NODES
|
||||
# (We can't do that here now because this virtual environment
|
||||
# is a Python 2 environment that may not even have
|
||||
# bigchaindb installed, so bigchaindb configure can't be called)
|
||||
|
||||
# Transform the config files in the confiles directory
|
||||
# to have proper keyrings, api_endpoint values, etc.
|
||||
python clusterize_confiles.py confiles $NUM_NODES
|
||||
# Transform the config files in the confiles directory
|
||||
# to have proper keyrings, api_endpoint values, etc.
|
||||
python clusterize_confiles.py confiles $NUM_NODES
|
||||
|
||||
# Send one of the config files to each instance
|
||||
for (( HOST=0 ; HOST<$NUM_NODES ; HOST++ )); do
|
||||
CONFILE="bcdb_conf"$HOST
|
||||
echo "Sending "$CONFILE
|
||||
fab set_host:$HOST send_confile:$CONFILE
|
||||
done
|
||||
# Send one of the config files to each instance
|
||||
for (( HOST=0 ; HOST<$NUM_NODES ; HOST++ )); do
|
||||
CONFILE="bcdb_conf"$HOST
|
||||
echo "Sending "$CONFILE
|
||||
fab set_host:$HOST send_confile:$CONFILE
|
||||
done
|
||||
|
||||
# Initialize BigchainDB (i.e. Create the RethinkDB database,
|
||||
# the tables, the indexes, and genesis glock). Note that
|
||||
# this will only be sent to one of the nodes, see the
|
||||
# definition of init_bigchaindb() in fabfile.py to see why.
|
||||
fab init_bigchaindb
|
||||
# Initialize BigchainDB (i.e. Create the RethinkDB database,
|
||||
# the tables, the indexes, and genesis glock). Note that
|
||||
# this will only be sent to one of the nodes, see the
|
||||
# definition of init_bigchaindb() in fabfile.py to see why.
|
||||
fab init_bigchaindb
|
||||
|
||||
# Start BigchainDB on all the nodes using "screen"
|
||||
fab start_bigchaindb
|
||||
# Start BigchainDB on all the nodes using "screen"
|
||||
fab start_bigchaindb
|
||||
else
|
||||
# Deploying clients
|
||||
# The only thing to configure on clients is the api_endpoint
|
||||
# It should be the public DNS name of a BigchainDB server
|
||||
fab send_client_confile:client_confile
|
||||
|
||||
# Start sending load from the clients to the servers
|
||||
fab start_bigchaindb_load
|
||||
fi
|
||||
|
||||
# cleanup
|
||||
rm add2known_hosts.sh
|
||||
|
15
deploy-cluster-aws/fabfile.py
vendored
15
deploy-cluster-aws/fabfile.py
vendored
@ -146,6 +146,15 @@ def send_confile(confile):
|
||||
run('bigchaindb show-config')
|
||||
|
||||
|
||||
@task
|
||||
@parallel
|
||||
def send_client_confile(confile):
|
||||
put(confile, 'tempfile')
|
||||
run('mv tempfile ~/.bigchaindb')
|
||||
print('For this node, bigchaindb show-config says:')
|
||||
run('bigchaindb show-config')
|
||||
|
||||
|
||||
# Initialize BigchainDB
|
||||
# i.e. create the database, the tables,
|
||||
# the indexes, and the genesis block.
|
||||
@ -164,6 +173,12 @@ def start_bigchaindb():
|
||||
sudo('screen -d -m bigchaindb -y start &', pty=False)
|
||||
|
||||
|
||||
@task
|
||||
@parallel
|
||||
def start_bigchaindb_load():
|
||||
sudo('screen -d -m bigchaindb load &', pty=False)
|
||||
|
||||
|
||||
# Install and run New Relic
|
||||
@task
|
||||
def install_newrelic():
|
||||
|
Loading…
x
Reference in New Issue
Block a user