Skip to content
Permalink
Browse files
Add Dockerfile for CouchDB 2.0 production
Unlike the 2.0-dev build, which results in a fully-connected 3 node
cluster inside the container, this Dockerfile builds a minimal Erlang
release using reltool, installs that release into /opt/couchdb, and
runs just the one single Erlang VM. Orchestrating a cluster of these is
out of scope.

closes #52
closes #56
  • Loading branch information
kocolosk authored and klaemo committed Jun 28, 2016
1 parent 8db81f5 commit efff00e2d3deee38a016b99ee03a956d5cbc6c72
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 0 deletions.
@@ -0,0 +1,84 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

FROM debian:jessie

MAINTAINER Clemens Stolle klaemo@apache.org

ENV COUCHDB_VERSION master


RUN groupadd -r couchdb && useradd -d /opt/couchdb -g couchdb couchdb

# Download dependencies
RUN apt-get update -y -qq && apt-get install -y --no-install-recommends \
apt-transport-https \
build-essential \
ca-certificates \
curl \
erlang-dev \
erlang-nox \
erlang-reltool \
git \
haproxy \
libcurl4-openssl-dev \
libicu-dev \
libmozjs185-dev \
openssl \
python \
&& curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
&& echo 'deb https://deb.nodesource.com/node_4.x jessie main' > /etc/apt/sources.list.d/nodesource.list \
&& echo 'deb-src https://deb.nodesource.com/node_4.x jessie main' >> /etc/apt/sources.list.d/nodesource.list \
&& apt-get update -y -qq && apt-get install -y nodejs \
&& npm install -g grunt-cli \
# Acquire and configure CouchDB source code
&& cd /usr/src \
&& git clone --depth 1 https://git-wip-us.apache.org/repos/asf/couchdb.git \
&& cd couchdb \
&& git checkout $COUCHDB_VERSION \
&& ./configure \
--disable-docs \
--databasedir /var/lib/couchdb \
--viewindexdir /var/lib/couchdb \
# Build the release and install into /opt
&& make build \
&& mv /usr/src/couchdb/rel/couchdb /opt/ \
&& mkdir -p /var/lib/couchdb \
&& chown -R couchdb:couchdb /opt/couchdb /var/lib/couchdb \
# Cleanup build detritus
&& apt-get purge -y \
binutils \
build-essential \
cpp \
erlang-dev \
git \
libicu-dev \
make \
nodejs \
perl \
&& apt-get autoremove -y && apt-get clean \
&& apt-get install -y libicu52 --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* /usr/lib/node_modules /usr/src/couchdb

# Now override some of the configuration
COPY local.ini /opt/couchdb/etc/
COPY vm.args /opt/couchdb/etc/
RUN chown couchdb:couchdb /opt/couchdb/etc/*

VOLUME ["/var/lib/couchdb"]
USER couchdb
EXPOSE 5984
EXPOSE 4369
EXPOSE 9100
WORKDIR /opt/couchdb

ENTRYPOINT ["/opt/couchdb/bin/couchdb"]
@@ -0,0 +1,21 @@
% Licensed under the Apache License, Version 2.0 (the "License"); you may not
% use this file except in compliance with the License. You may obtain a copy of
% the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
% License for the specific language governing permissions and limitations under
% the License.
%
{package_author_name, "The Apache Software Foundation"}.
{prefix, "."}.
{data_dir, "/var/lib/couchdb"}.
{view_index_dir, "/var/lib/couchdb"}.
{log_file, ""}.
{fauxton_root, "./share/www"}.
{user, "couchdb"}.
{cluster_port, 5984}.
{backend_port, 5986}.
@@ -0,0 +1,8 @@
; CouchDB Configuration Settings

; Custom settings should be made in this file. They will override settings
; in default.ini, but unlike changes made to default.ini, this file won't be
; overwritten on server upgrade.

[chttpd]
bind_address = any
@@ -0,0 +1,28 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# Ensure that the Erlang VM listens on a known port
-kernel inet_dist_listen_min 9100
-kernel inet_dist_listen_max 9100

# Tell kernel and SASL not to log anything
-kernel error_logger silent
-sasl sasl_error_logger false

# Use kernel poll functionality if supported by emulator
+K true

# Start a pool of asynchronous IO threads
+A 16

# Comment this line out to enable the interactive Erlang shell on startup
+Bd -noinput

0 comments on commit efff00e

Please sign in to comment.