mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Merge remote-tracking branch 'origin/master' into add-release_eips-script
This commit is contained in:
commit
f5ab5b0230
@ -12,7 +12,17 @@ If you want to file a bug report, suggest a feature, or ask a code-related quest
|
||||
|
||||
## How to Contribute Code or Documentation
|
||||
|
||||
### Step 0 - Prepare and Familiarize Yourself
|
||||
### Step 0 - Decide on an Issue to Resolve, or Create One
|
||||
|
||||
We want you to feel like your contributions (pull requests) are welcome, but if you contribute something unnecessary, unwanted, or perplexing, then your experience may be unpleasant. Your pull request may sit gathering dust as everyone scratches their heads wondering what to do with it.
|
||||
|
||||
To prevent that situation, we ask that all pull requests should resolve, address, or fix an existing issue. If there is no existing issue, then you should create one first. That way there can be commentary and discussion first, and you can have a better idea of what to expect when you create a corresponding pull request.
|
||||
|
||||
When you submit a pull request, please mention the issue (or issues) that it resolves, e.g. "Resolves #123".
|
||||
|
||||
Exception: hotfixes and minor changes don't require a pre-existing issue, but please write a thorough pull request description.
|
||||
|
||||
### Step 1 - Prepare and Familiarize Yourself
|
||||
|
||||
To contribute code or documentation, you need a [GitHub account](https://github.com/signup/free).
|
||||
|
||||
@ -23,16 +33,13 @@ Familiarize yourself with how we do coding and documentation in the BigchainDB p
|
||||
* the GitHub Flow (workflow)
|
||||
* [GitHub Guide: Understanding the GitHub Flow](https://guides.github.com/introduction/flow/)
|
||||
* [Scott Chacon's blog post about GitHub Flow](http://scottchacon.com/2011/08/31/github-flow.html)
|
||||
* Note that we call the main branch `develop` rather than `master`
|
||||
* [semantic versioning](http://semver.org/)
|
||||
|
||||
Note: We have a slight variation on the GitHub Flow: we call the default branch `develop` rather than `master`.
|
||||
|
||||
### Step 1 - Fork bigchaindb on GitHub
|
||||
### Step 2 - Fork bigchaindb on GitHub
|
||||
|
||||
In your web browser, go to [the BigchainDB repository on GitHub](https://github.com/bigchaindb/bigchaindb) and click the `Fork` button in the top right corner. This creates a new Git repository named `bigchaindb` in _your_ GitHub account.
|
||||
|
||||
### Step 2 - Clone Your Fork
|
||||
### Step 3 - Clone Your Fork
|
||||
|
||||
(This only has to be done once.) In your local terminal, use Git to clone _your_ `bigchaindb` repository to your local computer. Also add the original GitHub bigchaindb/bigchaindb repository as a remote named `upstream` (a convention):
|
||||
```text
|
||||
@ -41,16 +48,37 @@ cd bigchaindb
|
||||
git add upstream git@github.com:bigchaindb/bigchaindb.git
|
||||
```
|
||||
|
||||
### Step 3 - Fetch and Merge the Latest from `upstream/develop`
|
||||
### Step 4 - Fetch and Merge the Latest from `upstream/master`
|
||||
|
||||
Switch to the `develop` branch locally, fetch all `upstream` branches, and merge the just-fetched `upstream/develop` branch with the local `develop` branch:
|
||||
Switch to the `master` branch locally, fetch all `upstream` branches, and merge the just-fetched `upstream/master` branch with the local `master` branch:
|
||||
```text
|
||||
git checkout develop
|
||||
git checkout master
|
||||
git fetch upstream
|
||||
git merge upstream/develop
|
||||
git merge upstream/master
|
||||
```
|
||||
|
||||
### Step 4 - Create a New Branch for Each Bug/Feature
|
||||
### Step 5 - Install the Python module and the CLI
|
||||
|
||||
In order to use and run the source you just cloned from your fork, you need to install BigchainDB on your computer.
|
||||
The core of BigchainDB is a Python module you can install using the standard [Python packaging tools](http://python-packaging-user-guide.readthedocs.org/en/latest/).
|
||||
We highly suggest you use `pip` and `virtualenv` to manage your local development.
|
||||
If you need more information on how to do that, refer to the *Python Packaging User Guide* to [install `pip`](http://python-packaging-user-guide.readthedocs.org/en/latest/installing/#requirements-for-installing-packages) and to [create your first `virtualenv`](http://python-packaging-user-guide.readthedocs.org/en/latest/installing/#creating-virtual-environments).
|
||||
|
||||
Once you have `pip` installed and (optionally) you are in a virtualenv, go to the root of the repository (i.e. where the `setup.py` file is), and type:
|
||||
```bash
|
||||
$ pip install -e .[dev]
|
||||
```
|
||||
|
||||
This will install the BigchainDB Python module, the CLI, and all the dependencies useful for contributing to the development of BigchainDB.
|
||||
How? Let's split the command down into its components:
|
||||
- `pip` is the Python command to install packages
|
||||
- `install` tells pip to use the *install* action
|
||||
- `-e` installs a project in [editable mode](https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs)
|
||||
- `.` installs what's in the current directory
|
||||
- `[dev]` adds some [extra requirements](https://pythonhosted.org/setuptools/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies) to the installation. (If you are curious, open `setup.py` and look for `dev` in the `extras_require` section.)
|
||||
|
||||
|
||||
### Step 6 - Create a New Branch for Each Bug/Feature
|
||||
|
||||
If your new branch is to **fix a bug** identified in a specific GitHub Issue with number `ISSNO`, then name your new branch `bug/ISSNO/short-description-here`. For example, `bug/67/fix-leap-year-crash`.
|
||||
|
||||
@ -61,7 +89,7 @@ Otherwise, please give your new branch a short, descriptive, all-lowercase name.
|
||||
git checkout -b new-branch-name
|
||||
```
|
||||
|
||||
### Step 5 - Make Edits, git add, git commit
|
||||
### Step 7 - Make Edits, git add, git commit
|
||||
|
||||
With your new branch checked out locally, make changes or additions to the code or documentation. Remember to:
|
||||
|
||||
@ -79,27 +107,27 @@ git commit -m "Short description of new or changed things"
|
||||
You will want to merge changes from upstream (i.e. the original repository) into your new branch from time to time, using something like:
|
||||
```text
|
||||
git fetch upstream
|
||||
git merge upstream/develop
|
||||
git merge upstream/master
|
||||
```
|
||||
|
||||
Once you're done commiting a set of new things and you're ready to submit them for inclusion, please be sure to run all the tests (as per the instructions at the end of our [Python Style Guide](PYTHON_STYLE_GUIDE.md)).
|
||||
|
||||
If your addition or change is substantial, then please add a line or two to the [CHANGELOG.md file](https://github.com/bigchaindb/bigchaindb/blob/develop/CHANGELOG.md), following the guidelines given at the top of that file.
|
||||
If your addition or change is substantial, then please add a line or two to the [CHANGELOG.md file](https://github.com/bigchaindb/bigchaindb/blob/master/CHANGELOG.md), following the guidelines given at the top of that file.
|
||||
|
||||
(When you submit your pull request [following the instructions below], we run all the tests automatically, so we will see if some are failing. If you don't know why some tests are failing, you can still submit your pull request, but be sure to note the failing tests and to ask for help with resolving them.)
|
||||
|
||||
### Step 6 - Push Your New Branch to origin
|
||||
### Step 8 - Push Your New Branch to origin
|
||||
|
||||
Make sure you've commited all the additions or changes you want to include in your pull request. Then push your new branch to origin (i.e. _your_ remote bigchaindb repository).
|
||||
```text
|
||||
git push origin new-branch-name
|
||||
```
|
||||
|
||||
### Step 7 - Create a Pull Request
|
||||
### Step 9 - Create a Pull Request
|
||||
|
||||
Go to the GitHub website and to _your_ remote bigchaindb repository (i.e. something like https://github.com/your-user-name/bigchaindb).
|
||||
|
||||
See [GitHub's documentation on how to initiate and send a pull request](https://help.github.com/articles/using-pull-requests/). Note that the destination repository should be `bigchaindb/bigchaindb` and the destination branch will be `develop` (usually, and if it's not, then we can change that if necessary).
|
||||
See [GitHub's documentation on how to initiate and send a pull request](https://help.github.com/articles/using-pull-requests/). Note that the destination repository should be `bigchaindb/bigchaindb` and the destination branch will be `master` (usually, and if it's not, then we can change that if necessary).
|
||||
|
||||
If this is the first time you've submitted a pull request to BigchainDB, then you must read and accept the Contributor License Agreement (CLA) before we can merge your contributions. That can be found at [https://www.bigchaindb.com/cla](https://www.bigchaindb.com/cla).
|
||||
|
||||
@ -115,4 +143,4 @@ Someone will then merge your branch or suggest changes. If we suggsest changes,
|
||||
* [BigchainDB Licenses](./LICENSES.md)
|
||||
* [Contributor License Agreement](https://www.bigchaindb.com/cla)
|
||||
|
||||
(Note: GitHub automatically links to CONTRIBUTING.md when a contributor creates an Issue or opens a Pull Request.)
|
||||
(Note: GitHub automatically links to CONTRIBUTING.md when a contributor creates an Issue or opens a Pull Request.)
|
||||
|
@ -55,12 +55,27 @@ x = 'name: {}; score: {}'.format(name, n)
|
||||
we use the `format()` version. The [official Python documentation says](https://docs.python.org/2/library/stdtypes.html#str.format), "This method of string formatting is the new standard in Python 3, and should be preferred to the % formatting described in String Formatting Operations in new code."
|
||||
|
||||
|
||||
## Writing (Python) Tests
|
||||
## Writing and Running (Python) Unit Tests
|
||||
|
||||
We write unit tests for our Python code using the [pytest](http://pytest.org/latest/) framework.
|
||||
|
||||
All tests go in the `bigchaindb/tests` directory or one of its subdirectories. You can use the tests already in there as templates or examples.
|
||||
|
||||
The BigchainDB Documentation has a [section explaining how to run all unit tests](http://bigchaindb.readthedocs.org/en/develop/running-unit-tests.html).
|
||||
You can run all unit tests using:
|
||||
```text
|
||||
py.test -v
|
||||
```
|
||||
|
||||
or, if that doesn't work, try:
|
||||
```text
|
||||
python -m pytest -v
|
||||
```
|
||||
|
||||
or:
|
||||
```text
|
||||
python setup.py test
|
||||
```
|
||||
|
||||
If you want to learn about all the things you can do with pytest, see [the pytest documentation](http://pytest.org/latest/).
|
||||
|
||||
**Automated testing of pull requests.** We use [Travis CI](https://travis-ci.com/), so that whenever someone creates a new BigchainDB pull request on GitHub, Travis CI gets the new code and does _a bunch of stuff_. You can find out what we tell Travis CI to do in [the `.travis.yml` file](.travis.yml): it tells Travis CI how to install BigchainDB, how to run all the tests, and what to do "after success" (e.g. run `codecov`). (We use [Codecov](https://codecov.io/) to get a rough estimate of our test coverage.)
|
||||
|
22
README.md
22
README.md
@ -1,19 +1,21 @@
|
||||
[](https://gitter.im/bigchaindb/bigchaindb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://pypi.python.org/pypi/BigchainDB)
|
||||
[](https://travis-ci.org/bigchaindb/bigchaindb)
|
||||
[](https://codecov.io/github/bigchaindb/bigchaindb?branch=master)
|
||||
[](https://bigchaindb.readthedocs.org/en/stable/)
|
||||
|
||||
|
||||
# BigchainDB
|
||||
|
||||
A scalable blockchain database. [The whitepaper](https://www.bigchaindb.com/whitepaper/) explains what that means.
|
||||
|
||||
[](https://gitter.im/bigchaindb/bigchaindb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://pypi.python.org/pypi/BigchainDB)
|
||||
[](https://travis-ci.org/bigchaindb/bigchaindb)
|
||||
[](https://codecov.io/github/bigchaindb/bigchaindb?branch=develop)
|
||||
[](http://bigchaindb.readthedocs.org/en/develop/?badge=develop)
|
||||
|
||||
## Quick Start
|
||||
|
||||
### [Install and Run BigchainDB Server](http://bigchaindb.readthedocs.org/en/develop/installing-server.html)
|
||||
### [Run BigchainDB with Docker](http://bigchaindb.readthedocs.org/en/develop/installing-server.html#run-bigchaindb-with-docker)
|
||||
### [The Python Server API by Example](http://bigchaindb.readthedocs.org/en/develop/python-server-api-examples.html)
|
||||
### [The Python Driver API by Example](http://bigchaindb.readthedocs.org/en/develop/python-driver-api-examples.html)
|
||||
### [Install and Run BigchainDB Server](http://bigchaindb.readthedocs.org/en/master/installing-server.html)
|
||||
### [Run BigchainDB with Docker](http://bigchaindb.readthedocs.org/en/master/installing-server.html#run-bigchaindb-with-docker)
|
||||
### [The Python Server API by Example](http://bigchaindb.readthedocs.org/en/master/python-server-api-examples.html)
|
||||
### [The Python Driver API by Example](http://bigchaindb.readthedocs.org/en/master/python-driver-api-examples.html)
|
||||
|
||||
## Links for Everyone
|
||||
* [BigchainDB.com](https://www.bigchaindb.com/) - the main BigchainDB website, including newsletter signup
|
||||
@ -24,7 +26,7 @@ A scalable blockchain database. [The whitepaper](https://www.bigchaindb.com/whit
|
||||
* [Google Group](https://groups.google.com/forum/#!forum/bigchaindb)
|
||||
|
||||
## Links for Developers
|
||||
* [Documentation](http://bigchaindb.readthedocs.org/en/develop/#) - for developers
|
||||
* [Documentation](http://bigchaindb.readthedocs.org/en/master/) - for developers
|
||||
* [CONTRIBUTING.md](CONTRIBUTING.md) - how to contribute
|
||||
* [Community guidelines](CODE_OF_CONDUCT.md)
|
||||
* [Open issues](https://github.com/bigchaindb/bigchaindb/issues)
|
||||
|
@ -1,5 +1,5 @@
|
||||
codecov:
|
||||
branch: develop # the branch to show by default
|
||||
branch: master # the branch to show by default
|
||||
|
||||
# The help text for bot says:
|
||||
# "the username that will consume any oauth requests
|
||||
@ -29,4 +29,4 @@ coverage:
|
||||
|
||||
comment:
|
||||
layout: "header, diff, changes, sunburst, suggestions"
|
||||
behavior: default
|
||||
behavior: default
|
||||
|
@ -8,7 +8,7 @@ from __future__ import unicode_literals
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
from hostlist import hosts_dev
|
||||
from hostlist import public_dns_names
|
||||
|
||||
# cwd = current working directory
|
||||
old_cwd = os.getcwd()
|
||||
@ -22,7 +22,7 @@ shutil.copy2('rethinkdb.conf.template', 'rethinkdb.conf')
|
||||
# Append additional lines to rethinkdb.conf
|
||||
with open('rethinkdb.conf', 'a') as f:
|
||||
f.write('## The host:port of a node that RethinkDB will connect to\n')
|
||||
for public_dns_name in hosts_dev:
|
||||
for public_dns_name in public_dns_names:
|
||||
f.write('join=' + public_dns_name + ':29015\n')
|
||||
|
||||
os.chdir(old_cwd)
|
||||
|
@ -1,27 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" Generating genesis block
|
||||
"""
|
||||
|
||||
from __future__ import with_statement, unicode_literals
|
||||
|
||||
from fabric import colors as c
|
||||
from fabric.api import *
|
||||
from fabric.api import local, puts, settings, hide, abort, lcd, prefix
|
||||
from fabric.api import run, sudo, cd, get, local, lcd, env, hide
|
||||
from fabric.api import task, parallel
|
||||
from fabric.contrib import files
|
||||
from fabric.contrib.files import append, exists
|
||||
from fabric.contrib.console import confirm
|
||||
from fabric.contrib.project import rsync_project
|
||||
from fabric.operations import run, put
|
||||
from fabric.context_managers import settings
|
||||
from fabric.decorators import roles
|
||||
from fabtools import *
|
||||
|
||||
env.user = 'ubuntu'
|
||||
env.key_filename = 'pem/bigchaindb.pem'
|
||||
|
||||
@task
|
||||
def init_bigchaindb():
|
||||
run('bigchaindb -y start &', pty = False)
|
117
deploy-cluster-aws/fabfile.py
vendored
117
deploy-cluster-aws/fabfile.py
vendored
@ -1,47 +1,58 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""A fabfile with functionality to prepare, install, and configure
|
||||
bigchaindb, including its storage backend.
|
||||
"""A Fabric fabfile with functionality to prepare, install, and configure
|
||||
BigchainDB, including its storage backend (RethinkDB).
|
||||
"""
|
||||
|
||||
from __future__ import with_statement, unicode_literals
|
||||
|
||||
import requests
|
||||
from time import *
|
||||
import os
|
||||
from datetime import datetime, timedelta
|
||||
import json
|
||||
from pprint import pprint
|
||||
|
||||
from fabric import colors as c
|
||||
from fabric.api import *
|
||||
from fabric.api import local, puts, settings, hide, abort, lcd, prefix
|
||||
from fabric.api import run, sudo, cd, get, local, lcd, env, hide
|
||||
from fabric.api import sudo, env
|
||||
from fabric.api import task, parallel
|
||||
from fabric.contrib import files
|
||||
from fabric.contrib.files import append, exists
|
||||
from fabric.contrib.console import confirm
|
||||
from fabric.contrib.project import rsync_project
|
||||
from fabric.contrib.files import sed
|
||||
from fabric.operations import run, put
|
||||
from fabric.context_managers import settings
|
||||
from fabric.decorators import roles
|
||||
from fabtools import *
|
||||
|
||||
from hostlist import hosts_dev
|
||||
from hostlist import public_dns_names
|
||||
|
||||
env.hosts = hosts_dev
|
||||
env.roledefs = {
|
||||
"role1": hosts_dev,
|
||||
"role2": [hosts_dev[0]],
|
||||
}
|
||||
env.roles = ["role1"]
|
||||
# Ignore known_hosts
|
||||
# http://docs.fabfile.org/en/1.10/usage/env.html#disable-known-hosts
|
||||
env.disable_known_hosts = True
|
||||
|
||||
# What remote servers should Fabric connect to? With what usernames?
|
||||
env.user = 'ubuntu'
|
||||
env.hosts = public_dns_names
|
||||
|
||||
# SSH key files to try when connecting:
|
||||
# http://docs.fabfile.org/en/1.10/usage/env.html#key-filename
|
||||
env.key_filename = 'pem/bigchaindb.pem'
|
||||
|
||||
newrelic_license_key = 'you_need_a_real_license_key'
|
||||
|
||||
|
||||
######################################################################
|
||||
|
||||
# base software rollout
|
||||
# DON'T PUT @parallel
|
||||
@task
|
||||
def set_hosts(hosts):
|
||||
"""A helper function to change env.hosts from the
|
||||
command line.
|
||||
|
||||
Args:
|
||||
hosts (str): 'one_node' or 'two_nodes'
|
||||
|
||||
Example:
|
||||
fab set_hosts:one_node init_bigchaindb
|
||||
"""
|
||||
if hosts == 'one_node':
|
||||
env.hosts = public_dns_names[:1]
|
||||
elif hosts == 'two_nodes':
|
||||
env.hosts = public_dns_names[:2]
|
||||
else:
|
||||
raise ValueError('Invalid input to set_hosts.'
|
||||
' Expected one_node or two_nodes.'
|
||||
' Got {}'.format(hosts))
|
||||
|
||||
|
||||
# Install base software
|
||||
@task
|
||||
@parallel
|
||||
def install_base_software():
|
||||
@ -59,7 +70,7 @@ def install_base_software():
|
||||
python3-pip ipython3 sysstat s3cmd')
|
||||
|
||||
|
||||
# RethinkDB
|
||||
# Install RethinkDB
|
||||
@task
|
||||
@parallel
|
||||
def install_rethinkdb():
|
||||
@ -67,7 +78,7 @@ def install_rethinkdb():
|
||||
with settings(warn_only=True):
|
||||
# preparing filesystem
|
||||
sudo("mkdir -p /data")
|
||||
# Locally mounted storage (m3.2xlarge, aber auch c3.xxx)
|
||||
# Locally mounted storage (m3.2xlarge, but also c3.xxx)
|
||||
try:
|
||||
sudo("umount /mnt")
|
||||
sudo("mkfs -t ext4 /dev/xvdb")
|
||||
@ -91,27 +102,48 @@ def install_rethinkdb():
|
||||
sudo('chown -R rethinkdb:rethinkdb /data')
|
||||
# copy config file to target system
|
||||
put('conf/rethinkdb.conf',
|
||||
'/etc/rethinkdb/instances.d/instance1.conf', mode=0600, use_sudo=True)
|
||||
'/etc/rethinkdb/instances.d/instance1.conf',
|
||||
mode=0600,
|
||||
use_sudo=True)
|
||||
# initialize data-dir
|
||||
sudo('rm -rf /data/*')
|
||||
# finally restart instance
|
||||
sudo('/etc/init.d/rethinkdb restart')
|
||||
|
||||
|
||||
# bigchaindb deployment
|
||||
# Install BigchainDB (from PyPI)
|
||||
@task
|
||||
@parallel
|
||||
def install_bigchaindb():
|
||||
sudo('python3 -m pip install bigchaindb')
|
||||
|
||||
|
||||
# startup all nodes of bigchaindb in cluster
|
||||
# Configure BigchainDB
|
||||
@task
|
||||
@parallel
|
||||
def start_bigchaindb_nodes():
|
||||
def configure_bigchaindb():
|
||||
run('bigchaindb -y configure', pty=False)
|
||||
|
||||
|
||||
# Initialize BigchainDB
|
||||
# i.e. create the database, the tables,
|
||||
# the indexes, and the genesis block.
|
||||
# (This only needs to be run on one node.)
|
||||
# Call using:
|
||||
# fab set_hosts:one_node init_bigchaindb
|
||||
@task
|
||||
def init_bigchaindb():
|
||||
run('bigchaindb init', pty=False)
|
||||
|
||||
|
||||
# Start BigchainDB using screen
|
||||
@task
|
||||
@parallel
|
||||
def start_bigchaindb():
|
||||
sudo('screen -d -m bigchaindb -y start &', pty=False)
|
||||
|
||||
|
||||
# Install and run New Relic
|
||||
@task
|
||||
def install_newrelic():
|
||||
with settings(warn_only=True):
|
||||
@ -119,18 +151,18 @@ def install_newrelic():
|
||||
# sudo('apt-key adv --keyserver hkp://subkeys.pgp.net --recv-keys 548C16BF')
|
||||
sudo('apt-get update')
|
||||
sudo('apt-get -y --force-yes install newrelic-sysmond')
|
||||
sudo('nrsysmond-config --set license_key=c88af00c813983f8ee12e9b455aa13fde1cddaa8')
|
||||
sudo('nrsysmond-config --set license_key=' + newrelic_license_key)
|
||||
sudo('/etc/init.d/newrelic-sysmond restart')
|
||||
|
||||
|
||||
###############################
|
||||
# Security / FirewallStuff next
|
||||
###############################
|
||||
###########################
|
||||
# Security / Firewall Stuff
|
||||
###########################
|
||||
|
||||
@task
|
||||
def harden_sshd():
|
||||
"""Security harden sshd."""
|
||||
|
||||
"""Security harden sshd.
|
||||
"""
|
||||
# Disable password authentication
|
||||
sed('/etc/ssh/sshd_config',
|
||||
'#PasswordAuthentication yes',
|
||||
@ -147,7 +179,8 @@ def harden_sshd():
|
||||
def disable_root_login():
|
||||
"""Disable `root` login for even more security. Access to `root` account
|
||||
is now possible by first connecting with your dedicated maintenance
|
||||
account and then running ``sudo su -``."""
|
||||
account and then running ``sudo su -``.
|
||||
"""
|
||||
sudo('passwd --lock root')
|
||||
|
||||
|
||||
@ -172,7 +205,7 @@ def set_fw():
|
||||
|
||||
|
||||
#########################################################
|
||||
# some helper-functions to handle bad behavior of cluster
|
||||
# Some helper-functions to handle bad behavior of cluster
|
||||
#########################################################
|
||||
|
||||
# rebuild indexes
|
||||
|
@ -166,26 +166,31 @@ for i, instance in enumerate(instances_with_tag):
|
||||
format(instance.instance_id))
|
||||
|
||||
# Get a list of the pubic DNS names of the instances_with_tag
|
||||
hosts_dev = []
|
||||
public_dns_names = []
|
||||
for instance in instances_with_tag:
|
||||
public_dns_name = getattr(instance, 'public_dns_name', None)
|
||||
if public_dns_name is not None:
|
||||
hosts_dev.append(public_dns_name)
|
||||
public_dns_names.append(public_dns_name)
|
||||
|
||||
# Write a shellscript to add remote keys to ~/.ssh/known_hosts
|
||||
print('Preparing shellscript to add remote keys to known_hosts')
|
||||
with open('add2known_hosts.sh', 'w') as f:
|
||||
f.write('#!/bin/bash\n')
|
||||
for public_dns_name in hosts_dev:
|
||||
for public_dns_name in public_dns_names:
|
||||
f.write('ssh-keyscan ' + public_dns_name + ' >> ~/.ssh/known_hosts\n')
|
||||
|
||||
# Create a file named hostlist.py containing hosts_dev.
|
||||
# Create a file named hostlist.py containing public_dns_names.
|
||||
# If a hostlist.py already exists, it will be overwritten.
|
||||
print('Writing hostlist.py')
|
||||
with open('hostlist.py', 'w') as f:
|
||||
f.write('# -*- coding: utf-8 -*-\n')
|
||||
f.write('"""A list of the public DNS names of all the nodes in this\n')
|
||||
f.write('BigchainDB cluster/federation.\n')
|
||||
f.write('"""\n')
|
||||
f.write('\n')
|
||||
f.write('from __future__ import unicode_literals\n')
|
||||
f.write('hosts_dev = {}\n'.format(hosts_dev))
|
||||
f.write('\n')
|
||||
f.write('public_dns_names = {}\n'.format(public_dns_names))
|
||||
|
||||
# Wait
|
||||
wait_time = 45
|
||||
|
@ -55,27 +55,33 @@ chmod +x 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
|
||||
# Rollout base packages (dependencies) needed before
|
||||
# storage backend (RethinkDB) and BigchainDB can be rolled out
|
||||
fab install_base_software
|
||||
|
||||
# rollout storage backend (rethinkdb)
|
||||
# Rollout storage backend (RethinkDB) and start it
|
||||
fab install_rethinkdb
|
||||
|
||||
# rollout bigchaindb
|
||||
# Rollout BigchainDB (but don't start it yet)
|
||||
fab install_bigchaindb
|
||||
|
||||
# generate genesis block
|
||||
# HORST is the last public_dns_name listed in conf/rethinkdb.conf
|
||||
# For example:
|
||||
# ec2-52-58-86-145.eu-central-1.compute.amazonaws.com
|
||||
HORST=`tail -1 conf/rethinkdb.conf|cut -d: -f1|cut -d= -f2`
|
||||
fab -H $HORST -f fab_prepare_chain.py init_bigchaindb
|
||||
# Configure BigchainDB on all nodes
|
||||
fab configure_bigchaindb
|
||||
|
||||
# initiate sharding
|
||||
fab start_bigchaindb_nodes
|
||||
# TODO Get public keys from all nodes
|
||||
# using e.g. bigchaindb export-pubkey
|
||||
|
||||
# TODO Add list of public keys to keyring of all nodes
|
||||
# using e.g. bigchaindb import-pubkey
|
||||
|
||||
# Send a "bigchaindb init" command to one node
|
||||
# to initialize the BigchainDB database
|
||||
# i.e. create the database, the tables,
|
||||
# the indexes, and the genesis block.
|
||||
fab set_hosts:one_node init_bigchaindb
|
||||
|
||||
# Start BigchainDB on all the nodes using "screen"
|
||||
fab start_bigchaindb
|
||||
|
||||
# cleanup
|
||||
rm add2known_hosts.sh
|
||||
|
||||
# DONE
|
||||
|
@ -68,23 +68,18 @@ Note: You can use `pip` to upgrade the `bigchaindb` package to the latest versio
|
||||
|
||||
### How to Install BigchainDB from Source
|
||||
|
||||
BigchainDB (i.e. both the Server and the officially-supported drivers) is in its early stages and being actively developed on its [GitHub repository](https://github.com/bigchaindb/bigchaindb). Contributions are highly appreciated. If you want to help with development, then you'll want to install BigchainDB from source. Here's how.
|
||||
If you want to install BitchainDB from source because you want to contribute code (i.e. as a BigchainDB developer), then please see the instructions in [the `CONTRIBUTING.md` file](https://github.com/bigchaindb/bigchaindb/blob/master/CONTRIBUTING.md).
|
||||
|
||||
First, clone the public repository:
|
||||
Otherwise, clone the public repository:
|
||||
```text
|
||||
$ git clone git@github.com:bigchaindb/bigchaindb.git
|
||||
```
|
||||
|
||||
Install from the source:
|
||||
and then install from source:
|
||||
```text
|
||||
$ python setup.py install
|
||||
```
|
||||
|
||||
If you want to update BigchainDB to reflect the latest local source code changes, you can use:
|
||||
```text
|
||||
$ pip install -e .
|
||||
```
|
||||
|
||||
### How to Install BigchainDB on a VM with Vagrant
|
||||
|
||||
One of our community members ([@Mec-Is](https://github.com/Mec-iS)) wrote [a page about how to install BigchainDB on a VM with Vagrant](https://gist.github.com/Mec-iS/b84758397f1b21f21700).
|
||||
|
@ -7,4 +7,4 @@ BigchainDB is a scalable blockchain database. You can read about its motivations
|
||||
3. Developers of BigchainDB driver software (SDKs used to develop client software).
|
||||
4. App developers who are developing client apps to talk to one or more live, operational BigchainDB clusters. They would use one of the BigchainDB drivers.
|
||||
|
||||
If you're curious about what's in our roadmap, see [the ROADMAP.md file](https://github.com/bigchaindb/bigchaindb/blob/develop/ROADMAP.md) and [the list of open issues](https://github.com/bigchaindb/bigchaindb/issues). If you want to request a feature, file a bug report, or make a pull request, see [the CONTRIBUTING.md file](https://github.com/bigchaindb/bigchaindb/blob/develop/CONTRIBUTING.md).
|
||||
If you're curious about what's in our roadmap, see [the ROADMAP.md file](https://github.com/bigchaindb/bigchaindb/blob/master/ROADMAP.md) and [the list of open issues](https://github.com/bigchaindb/bigchaindb/issues). If you want to request a feature, file a bug report, or make a pull request, see [the CONTRIBUTING.md file](https://github.com/bigchaindb/bigchaindb/blob/master/CONTRIBUTING.md).
|
||||
|
@ -1,3 +1,3 @@
|
||||
# Licenses
|
||||
|
||||
Information about how the BigchainDB code and documentation are licensed can be found in [the LICENSES.md file](https://github.com/bigchaindb/bigchaindb/blob/develop/LICENSES.md) (in the root directory of the repository).
|
||||
Information about how the BigchainDB code and documentation are licensed can be found in [the LICENSES.md file](https://github.com/bigchaindb/bigchaindb/blob/master/LICENSES.md) (in the root directory of the repository).
|
||||
|
@ -4,6 +4,6 @@ You can find a list of all BigchainDB releases and release notes on GitHub at:
|
||||
|
||||
[https://github.com/bigchaindb/bigchaindb/releases](https://github.com/bigchaindb/bigchaindb/releases)
|
||||
|
||||
The [CHANGELOG.md file](https://github.com/bigchaindb/bigchaindb/blob/develop/CHANGELOG.md) contains much the same information, but it also has notes about what to expect in the _next_ release.
|
||||
The [CHANGELOG.md file](https://github.com/bigchaindb/bigchaindb/blob/master/CHANGELOG.md) contains much the same information, but it also has notes about what to expect in the _next_ release.
|
||||
|
||||
We also have [a roadmap document in ROADMAP.md](https://github.com/bigchaindb/bigchaindb/blob/develop/ROADMAP.md).
|
||||
We also have [a roadmap document in ROADMAP.md](https://github.com/bigchaindb/bigchaindb/blob/master/ROADMAP.md).
|
||||
|
@ -2,29 +2,21 @@
|
||||
|
||||
Once you've installed BigchainDB Server, you may want to run all the unit tests. This section explains how.
|
||||
|
||||
First of all, if you installed BigchainDB Server using `pip` (i.e. by getting the package from PyPI), then you didn't install the tests. Before you can run all the unit tests, you must [install BigchainDB from source](installing-server.html#how-to-install-bigchaindb-from-source).
|
||||
First of all, if you installed BigchainDB Server using `pip` (i.e. by getting the package from PyPI), then you didn't install the tests. **Before you can run all the unit tests, you must [install BigchainDB from source](installing-server.html#how-to-install-bigchaindb-from-source).**
|
||||
|
||||
To run all the unit tests, first make sure you have RethinkDB running:
|
||||
|
||||
```text
|
||||
$ rethinkdb
|
||||
```
|
||||
|
||||
then in another terminal, do:
|
||||
|
||||
```text
|
||||
$ py.test -v
|
||||
$ python setup.py test
|
||||
```
|
||||
|
||||
If the above command doesn't work (e.g. maybe you are running in a conda virtual environment), try:
|
||||
```text
|
||||
$ python -m pytest -v
|
||||
```
|
||||
|
||||
(We write our unit tests using the [pytest](http://pytest.org/latest/) framework.)
|
||||
|
||||
You can also run all unit tests via `setup.py`, using:
|
||||
```text
|
||||
$ python setup.py test
|
||||
```
|
||||
(Aside: How does the above command work? The documentation for [pytest-runner](https://pypi.python.org/pypi/pytest-runner) explains. We use [pytest](http://pytest.org/latest/) to write all unit tests.)
|
||||
|
||||
### Using docker-compose to Run the Tests
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user