1
0
mirror of https://github.com/bigchaindb/bigchaindb.git synced 2024-06-30 13:42:00 +02:00

Auto-generate server tag for AWS nodes

This commit is contained in:
troymc 2016-05-03 16:04:28 +02:00
parent 443589bb67
commit a250c6b35a
2 changed files with 17 additions and 22 deletions

View File

@ -4,32 +4,27 @@
# if any command has a non-zero exit status
set -e
function printErr()
{
echo "usage: ./awsdeploy_servers.sh <tag> <number_of_nodes_in_cluster> <pypi_or_branch>"
echo "No argument $1 supplied"
}
USAGE="usage: ./awsdeploy_servers.sh <number_of_nodes_in_cluster> <pypi_or_branch>"
# Auto-generate the tag to apply to all nodes in the cluster
TAG="bcdb-"`date +%m-%d@%H:%M`
echo "TAG = "$TAG
if [ -z "$1" ]; then
printErr "<tag>"
echo $USAGE
echo "No first argument <number_of_nodes_in_cluster> was specified"
exit 1
else
NUM_NODES=$1
fi
if [ -z "$2" ]; then
printErr "<number_of_nodes_in_cluster>"
exit 1
fi
TAG=$1
NUM_NODES=$2
# If they don't include a third argument (<pypi_or_branch>)
# If they don't include a second argument (<pypi_or_branch>)
# then assume BRANCH = "pypi" by default
if [ -z "$3" ]; then
echo "No third argument was specified, so BigchainDB will be installed from PyPI"
if [ -z "$2" ]; then
echo "No second argument was specified, so BigchainDB will be installed from PyPI"
BRANCH="pypi"
else
BRANCH=$3
BRANCH=$2
fi
# Check for AWS private key file (.pem file)

View File

@ -103,22 +103,22 @@ You can look inside those files if you're curious. In step 2, they'll be modifie
Step 2 is to launch the nodes ("instances") on AWS, to install all the necessary software on them, configure the software, run the software, and more.
Here's an example of how one could launch a BigchainDB cluster of three (3) nodes tagged `wrigley` on AWS:
Here's an example of how one could launch a BigchainDB cluster of three (3) nodes on AWS:
```text
# in a Python 2.5-2.7 virtual environment where fabric, boto3, etc. are installed
cd bigchaindb
cd deploy-cluster-aws
./awsdeploy_servers.sh wrigley 3 pypi
./awsdeploy_servers.sh 3 pypi
```
The `pypi` on the end means that it will install the latest (stable) `bigchaindb` package from the [Python Package Index (PyPI)](https://pypi.python.org/pypi). That is, on each node, BigchainDB is installed using `pip install bigchaindb`.
`awsdeploy_servers.sh` is a Bash script which calls some Python and Fabric scripts. The usage is:
```text
./awsdeploy_servers.sh <tag> <number_of_nodes_in_cluster> <pypi_or_branch>
./awsdeploy_servers.sh <number_of_nodes_in_cluster> <pypi_or_branch>
```
The first two arguments are self-explanatory. The third argument can be `pypi` or the name of a local Git branch (e.g. `master` or `feat/3752/quote-asimov-on-tuesdays`). If you don't include a third argument, then `pypi` will be assumed by default.
The first argument is the number of nodes to deploy. The second argument can be `pypi` or the name of a local Git branch (e.g. `master` or `feat/3752/quote-asimov-on-tuesdays`). If you don't include a second argument, then `pypi` will be assumed by default.
If you're curious what the `awsdeploy_servers.sh` script does, the source code has lots of explanatory comments, so it's quite easy to read. Here's a link to the latest version on GitHub: [`awsdeploy_servers.sh`](https://github.com/bigchaindb/bigchaindb/blob/master/deploy-cluster-aws/awsdeploy_servers.sh)