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
|
chmod +x add2known_hosts.sh
|
||||||
./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
|
# Rollout base packages (dependencies) needed before
|
||||||
# storage backend (RethinkDB) and BigchainDB can be rolled out
|
# storage backend (RethinkDB) and BigchainDB can be rolled out
|
||||||
fab install_base_software
|
fab install_base_software
|
||||||
|
|
||||||
# Rollout storage backend (RethinkDB) and start it
|
if [ "$WHAT_TO_DEPLOY" == "servers" ]; then
|
||||||
fab install_rethinkdb
|
# (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)
|
# Rollout BigchainDB (but don't start it yet)
|
||||||
if [ "$BRANCH" == "pypi" ]; then
|
if [ "$BRANCH" == "pypi" ]; then
|
||||||
@ -102,36 +103,46 @@ fi
|
|||||||
|
|
||||||
# Configure BigchainDB on all nodes
|
# Configure BigchainDB on all nodes
|
||||||
|
|
||||||
# The idea is to send a bunch of locally-created configuration
|
if [ "$WHAT_TO_DEPLOY" == "servers" ]; then
|
||||||
# files out to each of the instances / nodes.
|
# 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
|
# Assume a set of $NUM_NODES BigchaindB config files
|
||||||
# already exists in the confiles directory.
|
# already exists in the confiles directory.
|
||||||
# One can create a set using a command like
|
# One can create a set using a command like
|
||||||
# ./make_confiles.sh confiles $NUM_NODES
|
# ./make_confiles.sh confiles $NUM_NODES
|
||||||
# (We can't do that here now because this virtual environment
|
# (We can't do that here now because this virtual environment
|
||||||
# is a Python 2 environment that may not even have
|
# is a Python 2 environment that may not even have
|
||||||
# bigchaindb installed, so bigchaindb configure can't be called)
|
# bigchaindb installed, so bigchaindb configure can't be called)
|
||||||
|
|
||||||
# Transform the config files in the confiles directory
|
# Transform the config files in the confiles directory
|
||||||
# to have proper keyrings, api_endpoint values, etc.
|
# to have proper keyrings, api_endpoint values, etc.
|
||||||
python clusterize_confiles.py confiles $NUM_NODES
|
python clusterize_confiles.py confiles $NUM_NODES
|
||||||
|
|
||||||
# Send one of the config files to each instance
|
# Send one of the config files to each instance
|
||||||
for (( HOST=0 ; HOST<$NUM_NODES ; HOST++ )); do
|
for (( HOST=0 ; HOST<$NUM_NODES ; HOST++ )); do
|
||||||
CONFILE="bcdb_conf"$HOST
|
CONFILE="bcdb_conf"$HOST
|
||||||
echo "Sending "$CONFILE
|
echo "Sending "$CONFILE
|
||||||
fab set_host:$HOST send_confile:$CONFILE
|
fab set_host:$HOST send_confile:$CONFILE
|
||||||
done
|
done
|
||||||
|
|
||||||
# Initialize BigchainDB (i.e. Create the RethinkDB database,
|
# Initialize BigchainDB (i.e. Create the RethinkDB database,
|
||||||
# the tables, the indexes, and genesis glock). Note that
|
# the tables, the indexes, and genesis glock). Note that
|
||||||
# this will only be sent to one of the nodes, see the
|
# this will only be sent to one of the nodes, see the
|
||||||
# definition of init_bigchaindb() in fabfile.py to see why.
|
# definition of init_bigchaindb() in fabfile.py to see why.
|
||||||
fab init_bigchaindb
|
fab init_bigchaindb
|
||||||
|
|
||||||
# Start BigchainDB on all the nodes using "screen"
|
# Start BigchainDB on all the nodes using "screen"
|
||||||
fab start_bigchaindb
|
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
|
# cleanup
|
||||||
rm add2known_hosts.sh
|
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')
|
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
|
# Initialize BigchainDB
|
||||||
# i.e. create the database, the tables,
|
# i.e. create the database, the tables,
|
||||||
# the indexes, and the genesis block.
|
# the indexes, and the genesis block.
|
||||||
@ -164,6 +173,12 @@ def start_bigchaindb():
|
|||||||
sudo('screen -d -m bigchaindb -y start &', pty=False)
|
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
|
# Install and run New Relic
|
||||||
@task
|
@task
|
||||||
def install_newrelic():
|
def install_newrelic():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user