diff --git a/Dockerfile-all-in-one b/Dockerfile-all-in-one index 185253f3..94135ca5 100644 --- a/Dockerfile-all-in-one +++ b/Dockerfile-all-in-one @@ -1,4 +1,4 @@ -FROM alpine:latest + FROM alpine:latest LABEL maintainer "dev@bigchaindb.com" ARG TM_VERSION=0.22.8 @@ -54,6 +54,5 @@ VOLUME /data/db /data/configdb /tendermint EXPOSE 27017 28017 9984 9985 26656 26657 26658 -COPY pkg/scripts/all-in-one.bash /usr/src/app/ WORKDIR $HOME -ENTRYPOINT ["/usr/src/app/all-in-one.bash"] +ENTRYPOINT ["/usr/src/app/pkg/scripts/all-in-one.bash"] diff --git a/docs/server/source/appendices/all-in-one-bigchaindb.md b/docs/server/source/appendices/all-in-one-bigchaindb.md new file mode 100644 index 00000000..1ada5415 --- /dev/null +++ b/docs/server/source/appendices/all-in-one-bigchaindb.md @@ -0,0 +1,84 @@ +# Run BigchainDB with all-in-one Docker + +**NOT for Production Use** + +For those who like using Docker and wish to experiment with BigchainDB in +non-production environments, we currently maintain a BigchainDB all-in-one +Docker image and a +`Dockerfile-all-in-one` that can be used to build an image for `bigchaindb`. + +This image contains all the services required for a BigchainDB node i.e. + +- BigchainDB Server +- MongoDB +- Tendermint + +*We understand that it is an anti-pattern to run multiple services inside a docker.* +*This image is to help quick deployment for early adopters* + +## Prerequisite(s) +- [Docker](https://docs.docker.com/engine/installation/) + +## Pull and Run the Image from Docker Hub + +With Docker installed, you can proceed as follows. + +In a terminal shell, pull the latest version of the BigchainDB all-in-one Docker image using: +```text +$ docker pull bigchaindb/bigchaindb:all-in-one + +$ docker run \ + --detach \ + --name bigchaindb \ + --publish 9984:9984 \ + --publish 9985:9985 \ + --publish 27017:27017 \ + --publish 26657:26657 \ + --volume $HOME/bigchaindb_docker/mongodb/data/db:/data/db \ + --volume $HOME/bigchaindb_docker/mongodb/data/configdb:/data/configdb \ + --volume $HOME/bigchaindb_docker/tendermint:/tendermint \ + bigchaindb/bigchaindb:all-in-one +``` + +Let's analyze that command: + +* `docker run` tells Docker to run some image +* `--detach` run the container in the background +* `publish 9984:9984` map the host port `9984` to the container port `9984` + (the BigchainDB API server) + * `9985` BigchainDB Websocket server + * `27017` Default port for MongoDB + * `26657` Tendermint RPC server +* `--volume "$HOME/bigchaindb_docker/mongodb:/data"` map the host directory + `$HOME/bigchaindb_docker/mongodb` to the container directory `/data`; + this allows us to have the data persisted on the host machine, + you can read more in the [official Docker + documentation](https://docs.docker.com/engine/tutorials/dockervolumes) + * `$HOME/bigchaindb_docker/tendermint:/tendermint` to persist Tendermint data. +* `bigchaindb/bigchaindb:all-in-one` the image to use. All the options after the container name are passed on to the entrypoint inside the container. + +## Verify + +```text +$ docker ps | grep bigchaindb +``` + +Send your first transaction using [BigchainDB drivers](../drivers-clients/index.html). + + +## Building Your Own Image + +Assuming you have Docker installed, you would proceed as follows. + +In a terminal shell: +```text +git clone git@github.com:bigchaindb/bigchaindb.git +cd bigchaindb/ +``` + +Build the Docker image: +```text +docker build --file Dockerfile-all-in-one --tag . +``` + +Now you can use your own image to run BigchainDB all-in-one container. diff --git a/docs/server/source/appendices/index.rst b/docs/server/source/appendices/index.rst index 033a84d2..b26b3e1c 100755 --- a/docs/server/source/appendices/index.rst +++ b/docs/server/source/appendices/index.rst @@ -15,3 +15,4 @@ Appendices firewall-notes ntp-notes licenses + all-in-one-bigchaindb diff --git a/pkg/scripts/all-in-one.bash b/pkg/scripts/all-in-one.bash index 6cdeb3c9..e28444fa 100755 --- a/pkg/scripts/all-in-one.bash +++ b/pkg/scripts/all-in-one.bash @@ -2,11 +2,13 @@ # MongoDB configuration [ "$(stat -c %U /data/db)" = mongodb ] || chown -R mongodb /data/db -nohup mongod > /tmp/mongodb_log_$(date +%Y%m%d_%H%M%S) 2>&1 & + +# BigchainDB configuration +bigchaindb-monit-config + +nohup mongod > "$HOME/.bigchaindb-monit/logs/mongodb_log_$(date +%Y%m%d_%H%M%S)" 2>&1 & # Tendermint configuration tendermint init -# BigchainDB configuration -bigchaindb-monit-config monit -d 5 -I -B