You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/09/01 20:18:58 UTC

couchdb commit: updated refs/heads/master to ec4b673

Repository: couchdb
Updated Branches:
  refs/heads/master d2dc02de9 -> ec4b673f6


Improve and document Docker test cluster setup


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/ec4b673f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/ec4b673f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/ec4b673f

Branch: refs/heads/master
Commit: ec4b673f6eb878716cfe75f113da9c2594d12938
Parents: d2dc02d
Author: Robert Newson <rn...@apache.org>
Authored: Mon Sep 1 16:48:38 2014 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Mon Sep 1 18:12:31 2014 +0100

----------------------------------------------------------------------
 DEVELOPERS | 25 +++++++++++++++++++++++++
 Dockerfile | 40 +++++++++++++++++++++++++---------------
 Makefile   | 10 ++++++++--
 3 files changed, 58 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/ec4b673f/DEVELOPERS
----------------------------------------------------------------------
diff --git a/DEVELOPERS b/DEVELOPERS
index 8874463..20d1a70 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -142,6 +142,31 @@ Generate a coverage report by running:
 
 Please report any problems to the developer's mailing list.
 
+Testing a cluster
+-----------------
+
+We use Docker (https://docker.io) to safely run a local three node
+cluster.
+
+Assuming you have Docker installed and running;
+
+
+    make docker-image
+
+This will create a docker image (tagged 'couchdb/dev-cluster') capable
+of running a joined three node cluster.
+
+To start it up;
+
+    make docker-start
+
+A three node cluster shoud now be running (you can now use `docker ps`
+to find the exposed ports of the nodes).
+
+To stop it;
+
+   make docker-stop
+
 Releasing
 ---------
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/ec4b673f/Dockerfile
----------------------------------------------------------------------
diff --git a/Dockerfile b/Dockerfile
index bc5a6e8..c563652 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,33 +1,43 @@
-FROM debian:latest
+FROM debian:wheezy
 MAINTAINER Robert Newson <rn...@apache.org>
 ENV DEBIAN_FRONTEND noninteractive
 
-# Install prereqs
+# Configure backports
 RUN echo "deb http://http.debian.net/debian wheezy-backports main" >> /etc/apt/sources.list
 RUN apt-get -qq update
-RUN apt-get -y install build-essential git libmozjs185-dev libicu-dev erlang-nox erlang-dev python wget
 
-# Set up user for the builds
-RUN useradd -m couchdb
+# Install prereqs
+RUN apt-get --no-install-recommends -y install \
+    build-essential \
+    ca-certificates \
+    curl \
+    erlang-dev \
+    erlang-nox \
+    git \
+    libicu-dev \
+    libmozjs185-dev \
+    python
 
 # Build rebar
-USER couchdb
-WORKDIR /home/couchdb
-
-RUN wget https://github.com/rebar/rebar/archive/2.5.0.tar.gz
-RUN tar xzf 2.5.0.tar.gz
-WORKDIR /home/couchdb/rebar-2.5.0
+RUN useradd -m rebar
+USER rebar
+WORKDIR /home/rebar
+RUN curl -L https://github.com/rebar/rebar/archive/2.5.0.tar.gz | tar zxf -
+WORKDIR /home/rebar/rebar-2.5.0
 RUN ./bootstrap
 USER root
 RUN cp rebar /usr/local/bin/
+RUN chmod 755 /usr/local/bin/rebar
 
 # Build couchdb
+RUN useradd -m couchdb
+RUN mkdir -p /home/couchdb
+ADD . /home/couchdb
+USER root
+RUN chown -R couchdb:couchdb /home/couchdb
 USER couchdb
 WORKDIR /home/couchdb
 
-RUN git clone https://git-wip-us.apache.org/repos/asf/couchdb.git
-WORKDIR /home/couchdb/couchdb
-
 # We don't to be so strict for simple testing.
 RUN sed -i'' '/require_otp_vsn/d' rebar.config.script
 
@@ -39,4 +49,4 @@ RUN ./configure
 RUN make
 
 EXPOSE 15984 25984 35984 15986 25986 35986
-ENTRYPOINT ["/home/couchdb/couchdb/dev/run"]
+ENTRYPOINT ["/home/couchdb/dev/run"]

http://git-wip-us.apache.org/repos/asf/couchdb/blob/ec4b673f/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index b323d58..71c147e 100644
--- a/Makefile
+++ b/Makefile
@@ -54,8 +54,14 @@ install.mk:
 	@echo "No install.mk found. Run ./configure"
 	@exit 1
 
-docker:
-	@docker build --no-cache --rm -t couchdb/dev-cluster .
+docker-image:
+	@docker build --rm -t couchdb/dev-cluster .
+
+docker-start:
+	@docker run -d -P -t couchdb/dev-cluster > .docker-id
+
+docker-stop:
+	@docker stop `cat .docker-id`
 
 eunit:
 	@rebar eunit skip_deps=meck,mochiweb,lager