ND Database api

This commit is contained in:
kansi 2018-01-15 17:45:12 +05:30
parent d6404ab7c3
commit 7e9b9d6efc
5 changed files with 33 additions and 2 deletions

View File

@ -0,0 +1,6 @@
FROM mongo:3.4.10
WORKDIR /
COPY mongo_entrypoint.sh mongo_entrypoint.sh
VOLUME /tmp/bigchain/mongodb /data/db
EXPOSE 27017
ENTRYPOINT ["/bin/sh", "-c", "./mongo_entrypoint.sh"]

View File

@ -0,0 +1,7 @@
FROM tendermint/tendermint:develop
WORKDIR /
COPY ./tnode1 /tendermint
COPY tendermint_entrypoint.sh tendermint_entrypoint.sh
VOLUME /tmp/bigchain/tendermint /tendermint_node_data
EXPOSE 46656 46657
ENTRYPOINT ["/bin/sh", "-c", "./tendermint_entrypoint.sh"]

View File

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

View File

@ -28,8 +28,8 @@ class Node():
pod.version = 'v1'
pod.kind = 'Pod'
pod.metadata = {"name": self.name}
pod.spec = {"containers": [{"name": "tendermint",
"image": "bdbt:v1"},
pod.spec = {"containers": [{"name": "tendermint", "image": "bdbt:v1"},
{"name": "mongodb", "image": "mongo:bdb"},
{"name": "bigchaindb",
"image": "busybox",
"command": ["sh", "-c", "echo Hello Kubernetes! && sleep 3600"]}]}
@ -91,6 +91,12 @@ class Node():
self._exec_command('tendermint', 'tendermint unsafe_reset_all')
self.start_tendermint()
def stop_db(self):
self._exec_command('mongodb', 'pkill mongod')
def start_db(self):
self._exec_command('mongodb', 'mongod', tty=True)
def _exec_command(self, container, command, stdout=True, tty=False):
try:
exec_command = ['/bin/bash', '-c', command]

View File

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