You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2017/04/25 12:38:18 UTC
[couchdb-docker] 06/39: Improve CouchDB 2.0 production image
This is an automated email from the ASF dual-hosted git repository.
garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-docker.git
commit a9cb1dd50907b07b7c0f6da80e485ceaf5b8971f
Author: Chris Foster <ch...@gmail.com>
AuthorDate: Fri Jun 17 12:11:35 2016 -0700
Improve CouchDB 2.0 production image
- properly use /opt/couchdb/data for the volume
- remove an unneeded couchdb.config file
- EXPOSE ports all on one line
- rename it to 2.0-single, since it's not actually production
closes #56
---
2.0-prod/couchdb.config | 21 ------------------
{2.0-prod => 2.0-single}/Dockerfile | 43 +++++++++++++++++++------------------
{2.0-prod => 2.0-single}/local.ini | 0
{2.0-prod => 2.0-single}/vm.args | 0
README.md | 34 ++++++++++++++++++++++++++---
5 files changed, 53 insertions(+), 45 deletions(-)
diff --git a/2.0-prod/couchdb.config b/2.0-prod/couchdb.config
deleted file mode 100644
index 7c0fa6b..0000000
--- a/2.0-prod/couchdb.config
+++ /dev/null
@@ -1,21 +0,0 @@
-% 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}.
diff --git a/2.0-prod/Dockerfile b/2.0-single/Dockerfile
similarity index 73%
rename from 2.0-prod/Dockerfile
rename to 2.0-single/Dockerfile
index fb998c7..9aabbb1 100644
--- a/2.0-prod/Dockerfile
+++ b/2.0-single/Dockerfile
@@ -14,13 +14,13 @@ FROM debian:jessie
MAINTAINER Clemens Stolle klaemo@apache.org
-ENV COUCHDB_VERSION master
-
-
-RUN groupadd -r couchdb && useradd -d /opt/couchdb -g couchdb couchdb
+# Pin to an arbitrary commit for a deterministic build
+# Once CouchDB has an actual 2.0 tag, we can use that
+ENV COUCHDB_VERSION 1b38ccd
# Download dependencies
-RUN apt-get update -y -qq && apt-get install -y --no-install-recommends \
+RUN apt-get update -y -qq \
+ && apt-get install -y --no-install-recommends \
apt-transport-https \
build-essential \
ca-certificates \
@@ -38,23 +38,19 @@ RUN apt-get update -y -qq && apt-get install -y --no-install-recommends \
&& 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 \
+ && apt-get update -y -qq \
+ && apt-get install -y nodejs \
&& npm install -g grunt-cli \
-# Acquire and configure CouchDB source code
+ # Acquire 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
+ # Build the release and install into /opt
+ && ./configure --disable-docs \
&& 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
+ # Cleanup build detritus
&& apt-get purge -y \
binutils \
build-essential \
@@ -69,16 +65,21 @@ RUN apt-get update -y -qq && apt-get install -y --no-install-recommends \
&& 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
+# Add configuration
COPY local.ini /opt/couchdb/etc/
COPY vm.args /opt/couchdb/etc/
-RUN chown couchdb:couchdb /opt/couchdb/etc/*
-VOLUME ["/var/lib/couchdb"]
+# Add CouchDB user account
+RUN groupadd -r couchdb \
+ && useradd -d /opt/couchdb -g couchdb couchdb
+
+# Setup directory permissions
+RUN mkdir -p /opt/couchdb/data \
+ && chown -R couchdb:couchdb /opt/couchdb/
+
USER couchdb
-EXPOSE 5984
-EXPOSE 4369
-EXPOSE 9100
WORKDIR /opt/couchdb
+EXPOSE 5984 4369 9100
+VOLUME ["/opt/couchdb/data"]
ENTRYPOINT ["/opt/couchdb/bin/couchdb"]
diff --git a/2.0-prod/local.ini b/2.0-single/local.ini
similarity index 100%
rename from 2.0-prod/local.ini
rename to 2.0-single/local.ini
diff --git a/2.0-prod/vm.args b/2.0-single/vm.args
similarity index 100%
rename from 2.0-prod/vm.args
rename to 2.0-single/vm.args
diff --git a/README.md b/README.md
index a27e258..e798786 100644
--- a/README.md
+++ b/README.md
@@ -13,8 +13,9 @@ If you're looking for a CouchDB with SSL support you can check out [klaemo/couch
- `1`, `1.6`, `1.6.1`, `latest`: CouchDB 1.6.1
- `1-couchperuser`, `1.6-couchperuser`, `1.6.1-couchperuser`: CouchDB 1.6.1 with couchperuser plugin
-- `2.0-dev`: CouchDB 2.0 master (development version)
-- `2.0-dev-docs`: CouchDB 2.0 master (development version) with documentation
+- `2.0-dev`: CouchDB 2.0 master (development version) with preconfigured dev cluster
+- `2.0-dev-docs`: CouchDB 2.0 master (development version) with preconfigured dev cluster and documentation
+- `2.0-single`: CouchDB 2.0 master (development version)
## Features
@@ -57,7 +58,32 @@ This build includes the `couchperuser` plugin.
## Run (dev)
-Available on the docker registry as [klaemo/couchdb:2.0-dev](https://index.docker.io/u/klaemo/couchdb/)
+Available on the docker registry as [klaemo/couchdb:2.0-single](https://index.docker.io/u/klaemo/couchdb/).
+This is a developer preview of the upcoming CouchDB 2.0 release. A data volume
+is exposed on `/opt/couchdb/data`, and the node's port is exposed on `5984`.
+
+Please note that CouchDB no longer autocreates system tables for you, so you will
+have to create `_global_changes`, `_metadata`, `_replicator` and `_users` manually.
+The node will also start in [admin party mode](http://guide.couchdb.org/draft/security.html#party)!
+
+```bash
+# expose it to the world on port 5984 and use your current directory as the CouchDB Database directory
+[sudo] docker run -p 5984:5984 -v $(pwd):/opt/couchdb/data klaemo/couchdb:2.0-single
+18:54:48.780 [info] Application lager started on node nonode@nohost
+18:54:48.780 [info] Application couch_log_lager started on node nonode@nohost
+18:54:48.780 [info] Application couch_mrview started on node nonode@nohost
+18:54:48.780 [info] Application couch_plugins started on node nonode@nohost
+[...]
+```
+
+Once running, you can visit the new admin interface at `http://dockerhost:5984/_utils/`
+
+### In a developer cluster
+
+Available on the docker registry as [klaemo/couchdb:2.0-dev](https://index.docker.io/u/klaemo/couchdb/).
+This build demonstrates the CouchDB clustering features by creating a local
+cluster of a default three nodes inside the container, with a proxy in front.
+This is great for testing clustering in your local environment.
```bash
# expose the cluster to the world
@@ -125,6 +151,8 @@ and then build and run
[sudo] docker run -d -p 5984:5984 -v ~/couchdb:/usr/local/var/lib/couchdb you/awesome-couchdb
```
+For the `2.0-single` image, configuration is stored at `/opt/couchdb/etc/`.
+
## Feedback, Issues, Contributing
**Please use Github issues for any questions, bugs, feature requests. :)**
--
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.