You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by klaemo <gi...@git.apache.org> on 2015/08/31 16:02:03 UTC
[GitHub] couchdb pull request: Update Dockerfile
GitHub user klaemo opened a pull request:
https://github.com/apache/couchdb/pull/340
Update Dockerfile
Hey there,
this PR brings the Dockerfile up to speed.
It allows developers to "quickly" (technically, it still takes a while :D) build and run couchdb master with the following commands:
```
docker build -t couchdb-master
docker run -i -t --rm couchdb-master
```
It'll build the documentation and fauxton as well, that's the reason for all the dependencies.
I intent to make further improvements in the future. For example, the haproxy integration doesn't work yet (no idea why, it works in my other repo) and I think we could even provide automated builds through Docker Hub, so people can just download and run a container based on the master branch for quick testing and the like (basically what I'm doing [here](https://github.com/klaemo/docker-couchdb/tree/master/2.0-dev)).
Feedback welcome :)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/klaemo/couchdb docker-dev-env
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/couchdb/pull/340.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #340
----
commit 4069464dd8d568e7f973e9c3910d8992aac0ccf6
Author: klaemo <kl...@apache.org>
Date: 2015-08-31T13:49:05Z
Update Dockerfile
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by klaemo <gi...@git.apache.org>.
Github user klaemo commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/340#discussion_r48360131
--- Diff: dev/docker-cli ---
@@ -0,0 +1,44 @@
+#!/bin/bash
+# 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.
+
+set -e
+
+if [ "$1" = 'build' ]; then
+ printf "Building \"couchdb-master\" docker image...\n\n"
+ # build docker image
+ docker build -t couchdb-master .
+
+ printf "\nBuilding CouchDB inside of docker container...\n\n"
+ # run build process inside of a container
+ exec docker run -it --rm -v $(pwd):/usr/src/couchdb couchdb-master build "${@:2}"
+fi
+
+if [ "$1" = 'run' ]; then
+ printf "Starting CouchDB inside of docker container. Please be patient...\n\n"
+
+ # create container with appropriate port mappings
+ COUCH_CONTAINER_ID="$(docker create -it \
+ -p 5984:5984 -p 15984:15984 -p 25984:25984 -p 35984:35984 \
+ -p 15986:15986 -p 25986:25986 -p 35986:35986 \
+ couchdb-master dev/run ${@:2})"
--- End diff --
I added the ports. I'm not familiar with `remsh`. :-/ I'm glad to add such a command, if you tell me what it needs to do :)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by klaemo <gi...@git.apache.org>.
Github user klaemo commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-165985470
@kxepal docker-cli starts the container in the foreground (not daemonized). So, once you exit out, it is stopped. It is a change from the previous behavior, but I think it makes sense.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-136397627
wow cool!
one thought: maybe the haproxy integration does not work as couchdb starts haproxy on it's own since https://github.com/apache/couchdb/commit/587646f1fec6f665f70c97c24f3eef95780b409a?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by snowch <gi...@git.apache.org>.
Github user snowch commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-137247741
Although haproxy was running, it wasn't logging. To get haproxy logging to /var/log/haproxy, I added the following to the global section of /usr/src/couchdb/rel/haproxy.cfg:
```
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
user haproxy
group haproxy
```
I copied the above settings from /etc/haproxy/haproxy.cfg.
Next I had to install and start rsyslog:
```
apt-get install rsyslog -y
/etc/init.d/rsyslog start
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-136685948
@klaemo just wanted to test before +1 it, i get:
```
(19:20:25) [robert@tequila-work] ~/apache/couchdb $ docker run -i -t --rm couchdb-master
[ * ] Setup environment ... ok
[ * ] Ensure CouchDB is built ... ok
[ * ] Prepare configuration files ... ok
[ * ] Start node node1 ... ok
[ * ] Start node node2 ... ok
[ * ] Start node node3 ... ok
[ * ] Check node at http://127.0.0.1:15984/ ... failed: [Errno socket error] [Errno 111] Connection refused
[ * ] Check node at http://127.0.0.1:25984/ ... failed: [Errno socket error] [Errno 111] Connection refused
[ * ] Check node at http://127.0.0.1:35984/ ... failed: [Errno socket error] [Errno 111] Connection refused
[ * ] Check node at http://127.0.0.1:15984/ ... failed: [Errno socket error] [Errno 111] Connection refused
[ * ] Check node at http://127.0.0.1:25984/ ... failed: [Errno socket error] [Errno 111] Connection refused
[ * ] Check node at http://127.0.0.1:35984/ ... failed: [Errno socket error] [Errno 111] Connection refused
[ * ] Check node at http://127.0.0.1:15984/ ... failed: [Errno socket error] [Errno 111] Connection refused
[ * ] Check node at http://127.0.0.1:25984/ ... failed: [Errno socket error] [Errno 111] Connection refused
[ * ] Check node at http://127.0.0.1:35984/ ... ^Cok
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-143758321
I think it should use bind instead of COPY. In this case it would always use the most recent version of the source. Also in this case you wouldn't need to rebuild docker image if you update the code. Basically whenever you update the code you would restart docker container instead for rebuilding the image.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb issue #340: Update Dockerfile
Posted by klaemo <gi...@git.apache.org>.
Github user klaemo commented on the issue:
https://github.com/apache/couchdb/pull/340
I don't think so. There doesn't seem that much interest in a dockerized CouchDB development environment in the community. Also I don't have the time to maintain it anymore.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb issue #340: Update Dockerfile
Posted by wohali <gi...@git.apache.org>.
Github user wohali commented on the issue:
https://github.com/apache/couchdb/pull/340
Hi @klaemo is this still a relevant PR?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/340#discussion_r48359064
--- Diff: dev/docker-cli ---
@@ -0,0 +1,44 @@
+#!/bin/bash
+# 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.
+
+set -e
+
+if [ "$1" = 'build' ]; then
--- End diff --
could you add `docker-cli help`?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/340#discussion_r48071451
--- Diff: Dockerfile ---
@@ -1,52 +1,52 @@
-FROM debian:wheezy
-MAINTAINER Robert Newson <rn...@apache.org>
-ENV DEBIAN_FRONTEND noninteractive
+# 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.
-# Configure backports
-RUN echo "deb http://http.debian.net/debian wheezy-backports main" >> /etc/apt/sources.list
-RUN apt-get -qq update
+FROM debian:jessie
-# Install prereqs
-RUN apt-get --no-install-recommends -y install \
+MAINTAINER Clemens Stolle klaemo@apache.org
+
+ENV COUCHDB_VERSION master
+
+RUN groupadd -r couchdb && useradd -d /usr/src/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 \
git \
+ haproxy \
libicu-dev \
libmozjs185-dev \
- python
-
-# Build rebar
-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
+ 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
+
+COPY . /usr/src/couchdb
-# We don't to be so strict for simple testing.
-RUN sed -i'' '/require_otp_vsn/d' rebar.config.script
+WORKDIR /usr/src/couchdb
+RUN ./configure --disable-docs && make couch
-# Expose nodes on external network interface
-RUN sed -i'' 's/bind_address = 127.0.0.1/bind_address = 0.0.0.0/' rel/overlay/etc/default.ini
+# permissions
+RUN chmod +x /usr/src/couchdb/dev/run && chown -R couchdb:couchdb /usr/src/couchdb
-# Build
-RUN ./configure
-RUN make couch
+USER couchdb
+EXPOSE 5984 15984 25984 35984 15986 25986 35986
--- End diff --
There is no way to `remsh` with this list of ports. Unless you add extra ports in command line or use `nsenter`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-165987119
Ah, then it's fine. +1 for me, however, I cannot check this ): @iilyak @janl ?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by klaemo <gi...@git.apache.org>.
Github user klaemo commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-136390637
It's possible, but I think that involves cloning the couchdb repo once more inside of the container.
Essentially, there are two ways I can think of:
1. Have the Dockerfile along side the src, `COPY` the (already cloned) src into the container and build that beast. It pretty much acts like a Makefile. In that case having the Dockerfile in a different repo wouldn't make much sense. The upside is cloning the repo only once and being aware of local changes the developer might have made.
2. Pull in the Dockerfile from `couchdb-docker`, clone the repo inside of the container and build. Downside: having to clone twice and it doesn't take local src changes into account because it always pulls from the remote (that's how https://github.com/klaemo/docker-couchdb/tree/master/2.0-dev works atm)
A combination of 1 and 2 is possible, but it seems weird to have the Dockerfile in a different repo if it depends on the source code being there.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-165985084
@klaemo Looks good, but why rename docker-stop to docker-clean? That assumes that I can start container, but cannot stop it (: Or docker-cli cannot do this?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by klaemo <gi...@git.apache.org>.
Github user klaemo commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-165982039
As suggested by @iilyak I added a docker helper script (`dev/docker-cli`), making it easier to orchestrate the docker build. It does the following at the moment:
```
# builds the docker image and then CouchDB
# inside of the corresponding container with "make couch"
dev/docker-cli build
# ...it also takes ./configure flags as arguments, for example:
dev/docker-cli build --skip-deps
# to build everything run:
dev/docker-cli build all
# to start a cluster with dev/run inside of a container:
dev/docker-cli run
# it passes its arguments to dev/run, for example:
dev/docker-cli run --with-haproxy
```
Let me know, if this makes sense!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by klaemo <gi...@git.apache.org>.
Github user klaemo commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/340#discussion_r48359902
--- Diff: dev/docker-cli ---
@@ -0,0 +1,44 @@
+#!/bin/bash
+# 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.
+
+set -e
+
+if [ "$1" = 'build' ]; then
--- End diff --
good idea. I'll to do that
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-165982302
@klaemo Nice!
Btw, have you thought about to update/change make commands? We have there some [commands](https://github.com/apache/couchdb/blob/master/Makefile#L171-L186) to operate with docker.
I think that we need a) remove these or b) upgrade for docker-cli in order to have one make command to rule everything around.
What do you think?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb issue #340: Update Dockerfile
Posted by gabrielmancini <gi...@git.apache.org>.
Github user gabrielmancini commented on the issue:
https://github.com/apache/couchdb/pull/340
i use in my local development, but i dont find de logs
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by klaemo <gi...@git.apache.org>.
Github user klaemo commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-165984587
Updated the Makefile to make use of `dev/docker-cli` for the following commands:
```
make docker-image
make docker-start
make docker-clean
```
@kxepal what do you think? :)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-165900234
You can use .gitignore as a starting point for .dockerignore.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-165899072
Please consider adding `.dockerignore` to ignore `dev/data` and other bulky things we don't need. Otherwise copying context on `docker build` would take longer.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by klaemo <gi...@git.apache.org>.
Github user klaemo commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-165982544
@kxepal Oh, I wasn't aware of those. I think I'll go with option b) and upgrade them to use docker-cli.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request #340: Update Dockerfile
Posted by wohali <gi...@git.apache.org>.
Github user wohali closed the pull request at:
https://github.com/apache/couchdb/pull/340
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb issue #340: Update Dockerfile
Posted by wohali <gi...@git.apache.org>.
Github user wohali commented on the issue:
https://github.com/apache/couchdb/pull/340
@klaemo Thanks. FYI we _are_ using Docker to build CouchDB in our Apache Jenkins CI environment. Details are over at the https://github.com/apache/couchdb-ci repository. Any comments you have are most welcome :)
Closing this one out.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/340#discussion_r48162204
--- Diff: Dockerfile ---
@@ -1,52 +1,52 @@
-FROM debian:wheezy
-MAINTAINER Robert Newson <rn...@apache.org>
-ENV DEBIAN_FRONTEND noninteractive
+# 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.
-# Configure backports
-RUN echo "deb http://http.debian.net/debian wheezy-backports main" >> /etc/apt/sources.list
-RUN apt-get -qq update
+FROM debian:jessie
-# Install prereqs
-RUN apt-get --no-install-recommends -y install \
+MAINTAINER Clemens Stolle klaemo@apache.org
+
+ENV COUCHDB_VERSION master
+
+RUN groupadd -r couchdb && useradd -d /usr/src/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 \
git \
+ haproxy \
libicu-dev \
libmozjs185-dev \
- python
-
-# Build rebar
-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
+ 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
+
+COPY . /usr/src/couchdb
-# We don't to be so strict for simple testing.
-RUN sed -i'' '/require_otp_vsn/d' rebar.config.script
+WORKDIR /usr/src/couchdb
+RUN ./configure --disable-docs && make couch
-# Expose nodes on external network interface
-RUN sed -i'' 's/bind_address = 127.0.0.1/bind_address = 0.0.0.0/' rel/overlay/etc/default.ini
+# permissions
+RUN chmod +x /usr/src/couchdb/dev/run && chown -R couchdb:couchdb /usr/src/couchdb
-# Build
-RUN ./configure
-RUN make couch
+USER couchdb
+EXPOSE 5984 15984 25984 35984 15986 25986 35986
--- End diff --
True but how you would do `observer:start()`?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-144113815
It is just an idea.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-144113688
I see following use cases for docker images:
1. Use docker to build couchdb on systems without building tools.
2. Use docker to run single node couchdb for testing.
3. Use docker to run cluster of couchdb nodes for testing.
4. Use docker to run couchdb in production.
I think `#4` is out of the scope.
For `#1` you would do
1.1. Write a build script (`dev/docker/build`) which does the build and COPY it into the image. Update PATH so build command could be found.
1.2. bind current directory to the docker container under any known location (`/usr/src/couchdb`)
1.3. pass name of the command to docker (`build` in this case).
I.e. `docker run -it -name 'db1' -d `pwd`:/usr/src/couchdb docker-image build`
For `#2` you would do
```
docker run -it -name 'db1' -e "name=db1" -d `pwd`/dev/data:/data -d `pwd`:/usr/src/couchdb -p 15984:5984 15986:5986 docker-image run
OR
docker run -it -name 'db1' -d `pwd`/dev/data:/data -d `pwd`:/usr/src/couchdb -p 15984:5984 15986:5986 docker-image run db1
```
For `#3` you could use `https://docs.docker.com/compose/`
OR you could use links manually
Since the commands are long we could have a helper CLI like:
```
dev/docker-cli run db1
dev/docker-cli run db2
dev/docker-cli run db3
dev/docker-cli run lb
dev/docker-cli run cluster # --- starts 3 nodes cluster
dev/docker-cli run cluster 10 # --- starts 10 nodes cluster
dev/docker-cli build
dev/docker-cli test
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by klaemo <gi...@git.apache.org>.
Github user klaemo commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-165845454
I simplified the Dockerfile. It is for local development and testing only. Please give it a spin.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by klaemo <gi...@git.apache.org>.
Github user klaemo commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/340#discussion_r48071818
--- Diff: Dockerfile ---
@@ -1,52 +1,52 @@
-FROM debian:wheezy
-MAINTAINER Robert Newson <rn...@apache.org>
-ENV DEBIAN_FRONTEND noninteractive
+# 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.
-# Configure backports
-RUN echo "deb http://http.debian.net/debian wheezy-backports main" >> /etc/apt/sources.list
-RUN apt-get -qq update
+FROM debian:jessie
-# Install prereqs
-RUN apt-get --no-install-recommends -y install \
+MAINTAINER Clemens Stolle klaemo@apache.org
+
+ENV COUCHDB_VERSION master
+
+RUN groupadd -r couchdb && useradd -d /usr/src/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 \
git \
+ haproxy \
libicu-dev \
libmozjs185-dev \
- python
-
-# Build rebar
-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
+ 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
+
+COPY . /usr/src/couchdb
-# We don't to be so strict for simple testing.
-RUN sed -i'' '/require_otp_vsn/d' rebar.config.script
+WORKDIR /usr/src/couchdb
+RUN ./configure --disable-docs && make couch
-# Expose nodes on external network interface
-RUN sed -i'' 's/bind_address = 127.0.0.1/bind_address = 0.0.0.0/' rel/overlay/etc/default.ini
+# permissions
+RUN chmod +x /usr/src/couchdb/dev/run && chown -R couchdb:couchdb /usr/src/couchdb
-# Build
-RUN ./configure
-RUN make couch
+USER couchdb
+EXPOSE 5984 15984 25984 35984 15986 25986 35986
--- End diff --
You can `docker exec` or `docker attach` into the container.
> Am 18.12.2015 um 22:22 schrieb iilyak <no...@github.com>:
>
> In Dockerfile:
>
> >
> > -# Build
> > -RUN ./configure
> > -RUN make couch
> > +USER couchdb
> > +EXPOSE 5984 15984 25984 35984 15986 25986 35986
> There is no way to remsh with this list of ports. Unless you add extra ports in command line or use nsenter.
>
> —
> Reply to this email directly or view it on GitHub.
>
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/340#discussion_r48359630
--- Diff: dev/docker-cli ---
@@ -0,0 +1,44 @@
+#!/bin/bash
+# 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.
+
+set -e
+
+if [ "$1" = 'build' ]; then
+ printf "Building \"couchdb-master\" docker image...\n\n"
+ # build docker image
+ docker build -t couchdb-master .
+
+ printf "\nBuilding CouchDB inside of docker container...\n\n"
+ # run build process inside of a container
+ exec docker run -it --rm -v $(pwd):/usr/src/couchdb couchdb-master build "${@:2}"
+fi
+
+if [ "$1" = 'run' ]; then
+ printf "Starting CouchDB inside of docker container. Please be patient...\n\n"
+
+ # create container with appropriate port mappings
+ COUCH_CONTAINER_ID="$(docker create -it \
+ -p 5984:5984 -p 15984:15984 -p 25984:25984 -p 35984:35984 \
+ -p 15986:15986 -p 25986:25986 -p 35986:35986 \
+ couchdb-master dev/run ${@:2})"
--- End diff --
If you would support remsh it would be nice if you add `docker-cli remsh` command.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by snowch <gi...@git.apache.org>.
Github user snowch commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-137177014
Seems to be working ok for me:
```
vagrant@vagrant-ubuntu-trusty-64:~/Repos/couchdb-klaemo$ docker run -i -t -P --rm couchdb-master --with-haproxy
[ * ] Setup environment ... ok
[ * ] Ensure CouchDB is built ... ok
[ * ] Prepare configuration files ... ok
[ * ] Start node node1 ... ok
[ * ] Start node node2 ... ok
[ * ] Start node node3 ... ok
[ * ] Check node at http://127.0.0.1:15984/ ... failed: [Errno socket error] [Errno 111] Connection refused
[ * ] Check node at http://127.0.0.1:25984/ ... ok
[ * ] Check node at http://127.0.0.1:35984/ ... ok
[ * ] Check node at http://127.0.0.1:15984/ ... ok
[ * ] Running cluster setup ... ok
[ * ] Developers cluster is set up at http://127.0.0.1:15984.
Admin username: root
Password: Dog2iOiA
Time to hack! ...
```
I also managed to run OK with haproxy. To start the container then access haproxy in the container from the docker host:
```
host$ COUCH_INSTANCE_ID=$(docker run -d -P couchdb-master --with-haproxy)
host$ COUCH_INSTANCE_IP=$(docker inspect --format='{{.NetworkSettings.IPAddress}}' $COUCH_DOCKER_ID)
host$ firefox ${COUCH_INSTANCE_IP}:5984
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by klaemo <gi...@git.apache.org>.
Github user klaemo commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-144117649
You make some good points. :) I'll give it some more thought. I'm currently on a short trip and don't have my computer with me, so I'll get back to it next week.
> Am 29.09.2015 um 18:37 schrieb iilyak <no...@github.com>:
>
> It is just an idea.
>
> —
> Reply to this email directly or view it on GitHub.
>
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-136381666
Is it possible to pull Dockerfile from `couchdb-docker`? Like `./configure --with docker && docker ...` and here we go?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/340#discussion_r48359055
--- Diff: dev/docker-cli ---
@@ -0,0 +1,44 @@
+#!/bin/bash
+# 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.
+
+set -e
+
+if [ "$1" = 'build' ]; then
+ printf "Building \"couchdb-master\" docker image...\n\n"
+ # build docker image
+ docker build -t couchdb-master .
+
+ printf "\nBuilding CouchDB inside of docker container...\n\n"
+ # run build process inside of a container
+ exec docker run -it --rm -v $(pwd):/usr/src/couchdb couchdb-master build "${@:2}"
+fi
+
+if [ "$1" = 'run' ]; then
+ printf "Starting CouchDB inside of docker container. Please be patient...\n\n"
+
+ # create container with appropriate port mappings
+ COUCH_CONTAINER_ID="$(docker create -it \
+ -p 5984:5984 -p 15984:15984 -p 25984:25984 -p 35984:35984 \
+ -p 15986:15986 -p 25986:25986 -p 35986:35986 \
+ couchdb-master dev/run ${@:2})"
--- End diff --
Would you mind adding `-p 4369:4369 -p 9100-9110:9100-9110"` for remsh to work?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by klaemo <gi...@git.apache.org>.
Github user klaemo commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-165899851
What would be such things? I'm not familiar with the couchdb code base.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by klaemo <gi...@git.apache.org>.
Github user klaemo commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-144028404
@iilyak I see what you're getting at, but you would need to recompile couchdb anyways when you change the source code. That's what the image does.
There are a few different use cases for the docker image.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: Update Dockerfile
Posted by klaemo <gi...@git.apache.org>.
Github user klaemo commented on the pull request:
https://github.com/apache/couchdb/pull/340#issuecomment-136686478
Weird, here's what I get:
```
$ docker run -i -t --rm couchdb-master
[ * ] Setup environment ... ok
[ * ] Ensure CouchDB is built ... ok
[ * ] Prepare configuration files ... ok
[ * ] Start node node1 ... ok
[ * ] Start node node2 ... ok
[ * ] Start node node3 ... ok
[ * ] Check node at http://127.0.0.1:15984/ ... failed: [Errno socket error] [Errno 111] Connection refused
[ * ] Check node at http://127.0.0.1:25984/ ... ok
[ * ] Check node at http://127.0.0.1:35984/ ... ok
[ * ] Check node at http://127.0.0.1:15984/ ... ok
[ * ] Running cluster setup ... ok
[ * ] Developers cluster is set up at http://127.0.0.1:15984.
Admin username: root
Password: kw9ZYQcx
Time to hack! ...
```
I'll take another look at it, though.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---