ND bigchaindb api

This commit is contained in:
kansi 2018-01-16 10:59:52 +05:30
parent 7e9b9d6efc
commit 9284038303
6 changed files with 67 additions and 5 deletions

31
Dockerfile.itest Normal file
View File

@ -0,0 +1,31 @@
FROM python:3.6
LABEL maintainer "dev@bigchaindb.com"
RUN apt-get update \
&& apt-get install -y net-tools \
&& pip install -U pip \
&& pip install pynacl \
&& apt-get autoremove \
&& apt-get clean
ENV PYTHONUNBUFFERED 0
ENV BIGCHAINDB_DATABASE_PORT 27017
ENV BIGCHAINDB_DATABASE_BACKEND localmongodb
ENV BIGCHAINDB_SERVER_BIND 0.0.0.0:9984
ENV BIGCHAINDB_WSSERVER_HOST 0.0.0.0
ENV BIGCHAINDB_WSSERVER_SCHEME ws
ENV BIGCHAINDB_WSSERVER_ADVERTISED_HOST 0.0.0.0
ENV BIGCHAINDB_WSSERVER_ADVERTISED_SCHEME ws
ENV BIGCHAINDB_START_TENDERMINT 0
ENV TENDERMINT_PORT 46657
RUN mkdir -p /usr/src/app
COPY . /usr/src/app/
WORKDIR /usr/src/app
RUN pip install --no-cache-dir .
RUN bigchaindb -y configure localmongodb
EXPOSE 46658
ENTRYPOINT ["/bin/sh", "-c", "./network_driver/bigchain_entrypoint.sh"]

View File

@ -0,0 +1,7 @@
#!/bin/sh
echo "Starting BigchainDB"
pkill bigchaindb
bigchaindb start &
sleep 3600

View File

@ -0,0 +1,10 @@
#!/bin/bash
# build mongodb image
docker build -t mongodb:bdb -f Dockerfile.mongo .
# build mongodb image
docker build -t tendermint:bdb -f Dockerfile.tendermint .
# build bigchaindb image
docker build -t bigchaindb:itest -f ../Dockerfile.itest .

View File

@ -1,6 +1,7 @@
#!/bin/sh
echo "Starting MonogoDB"
pkill mongod
mongod &
sleep 3600

View File

@ -28,11 +28,12 @@ class Node():
pod.version = 'v1'
pod.kind = 'Pod'
pod.metadata = {"name": self.name}
pod.spec = {"containers": [{"name": "tendermint", "image": "bdbt:v1"},
{"name": "mongodb", "image": "mongo:bdb"},
pod.spec = {"containers": [{"name": "mongodb",
"image": "mongodb:bdb-itest"},
{"name": "tendermint",
"image": "tendermint:bdb-itest"},
{"name": "bigchaindb",
"image": "busybox",
"command": ["sh", "-c", "echo Hello Kubernetes! && sleep 3600"]}]}
"image": "bigchaindb:bdb-itest"}]}
self.pod = pod
def start(self, return_after_running=True):
@ -97,6 +98,17 @@ class Node():
def start_db(self):
self._exec_command('mongodb', 'mongod', tty=True)
def start_bigchaindb(self):
self._exec_command('bigchaindb', 'bigchaindb start', tty=True)
def stop_bigchaindb(self):
self._exec_command('bigchaindb', 'pkill bigchaindb')
def reset_bigchaindb(self):
self.stop_bigchaindb()
self._exec_command('bigchaindb', 'bigchaindb -y drop')
self.start_bigchaindb()
def _exec_command(self, container, command, stdout=True, tty=False):
try:
exec_command = ['/bin/bash', '-c', command]

View File

@ -1,6 +1,7 @@
#!/bin/sh
echo "Starting Tendermint"
/go/bin/tendermint node --proxy_app=dummy &
pkill tendermint
/go/bin/tendermint node &
sleep 3600