From 17303b18b8813a184dadaacf63b10a419e476d07 Mon Sep 17 00:00:00 2001 From: Elijah Zupancic Date: Tue, 24 Mar 2015 19:02:10 -0700 Subject: [PATCH 1/3] Removed ulimit steps from Dockerfile because they aren't applied according to @cpuguy83. Signed-off-by: Elijah Zupancic --- docs/sources/examples/running_riak_service.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/sources/examples/running_riak_service.md b/docs/sources/examples/running_riak_service.md index 0b53234046..4945feff7c 100644 --- a/docs/sources/examples/running_riak_service.md +++ b/docs/sources/examples/running_riak_service.md @@ -60,7 +60,6 @@ After that, we install Riak and alter a few defaults: # Install Riak and prepare it to run RUN apt-get update && apt-get install -y riak RUN sed -i.bak 's/127.0.0.1/0.0.0.0/' /etc/riak/app.config - RUN echo "ulimit -n 4096" >> /etc/default/riak Then, we expose the Riak Protocol Buffers and HTTP interfaces, along with SSH: From 31c50411574b19cb81b5f88c0f8ca4bb4a2ead83 Mon Sep 17 00:00:00 2001 From: Elijah Zupancic Date: Tue, 24 Mar 2015 19:27:58 -0700 Subject: [PATCH 2/3] Removed references to creating an OpenSSH server. This method of accessing the Docker container is no longer needed now that the exec command is available. Signed-off-by: Elijah Zupancic --- docs/sources/examples/running_riak_service.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/sources/examples/running_riak_service.md b/docs/sources/examples/running_riak_service.md index 4945feff7c..7c00ab0cdc 100644 --- a/docs/sources/examples/running_riak_service.md +++ b/docs/sources/examples/running_riak_service.md @@ -31,17 +31,13 @@ After that, we install and setup a few dependencies: repository key - `lsb-release` helps us derive the Ubuntu release codename - - `openssh-server` allows us to login to - containers remotely and join Riak nodes to form a cluster - - `supervisor` is used manage the OpenSSH and Riak - processes + - `supervisor` is used manage the Riak processes # Install and setup project dependencies - RUN apt-get update && apt-get install -y curl lsb-release supervisor openssh-server + RUN apt-get update && apt-get install -y curl lsb-release supervisor - RUN mkdir -p /var/run/sshd RUN mkdir -p /var/log/supervisor RUN locale-gen en_US en_US.UTF-8 @@ -64,8 +60,8 @@ After that, we install Riak and alter a few defaults: Then, we expose the Riak Protocol Buffers and HTTP interfaces, along with SSH: - # Expose Riak Protocol Buffers and HTTP interfaces, along with SSH - EXPOSE 8087 8098 22 + # Expose Riak Protocol Buffers and HTTP interfaces + EXPOSE 8087 8098 Finally, run `supervisord` so that Riak and OpenSSH are started: From de45aacc322445924710fc12ad6e2d9832c27c6e Mon Sep 17 00:00:00 2001 From: Elijah Zupancic Date: Fri, 27 Mar 2015 11:18:40 -0700 Subject: [PATCH 3/3] Added updated working Riak Dockerfile and documentation. Signed-off-by: Elijah Zupancic --- .../examples/running_riak_service.Dockerfile | 31 +++++++++ docs/sources/examples/running_riak_service.md | 64 +++++++++---------- docs/sources/examples/supervisord.conf | 12 ++++ 3 files changed, 73 insertions(+), 34 deletions(-) create mode 100644 docs/sources/examples/running_riak_service.Dockerfile create mode 100644 docs/sources/examples/supervisord.conf diff --git a/docs/sources/examples/running_riak_service.Dockerfile b/docs/sources/examples/running_riak_service.Dockerfile new file mode 100644 index 0000000000..1051c1a42b --- /dev/null +++ b/docs/sources/examples/running_riak_service.Dockerfile @@ -0,0 +1,31 @@ +# Riak +# +# VERSION 0.1.1 + +# Use the Ubuntu base image provided by dotCloud +FROM ubuntu:trusty +MAINTAINER Hector Castro hector@basho.com + +# Install Riak repository before we do apt-get update, so that update happens +# in a single step +RUN apt-get install -q -y curl && \ + curl -sSL https://packagecloud.io/install/repositories/basho/riak/script.deb | sudo bash + +# Install and setup project dependencies +RUN apt-get update && \ + apt-get install -y supervisor riak=2.0.5-1 + +RUN mkdir -p /var/log/supervisor + +RUN locale-gen en_US en_US.UTF-8 + +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +# Configure Riak to accept connections from any host +RUN sed -i "s|listener.http.internal = 127.0.0.1:8098|listener.http.internal = 0.0.0.0:8098|" /etc/riak/riak.conf +RUN sed -i "s|listener.protobuf.internal = 127.0.0.1:8087|listener.protobuf.internal = 0.0.0.0:8087|" /etc/riak/riak.conf + +# Expose Riak Protocol Buffers and HTTP interfaces +EXPOSE 8087 8098 + +CMD ["/usr/bin/supervisord"] diff --git a/docs/sources/examples/running_riak_service.md b/docs/sources/examples/running_riak_service.md index 7c00ab0cdc..d5fcc547f2 100644 --- a/docs/sources/examples/running_riak_service.md +++ b/docs/sources/examples/running_riak_service.md @@ -15,47 +15,46 @@ Create an empty file called `Dockerfile`: Next, define the parent image you want to use to build your image on top of. We'll use [Ubuntu](https://registry.hub.docker.com/_/ubuntu/) (tag: -`latest`), which is available on [Docker Hub](https://hub.docker.com): +`trusty`), which is available on [Docker Hub](https://hub.docker.com): # Riak # - # VERSION 0.1.0 - + # VERSION 0.1.1 + # Use the Ubuntu base image provided by dotCloud - FROM ubuntu:latest + FROM ubuntu:trusty MAINTAINER Hector Castro hector@basho.com -After that, we install and setup a few dependencies: +After that, we install the curl which is used to download the repository setup +script and we download the setup script and run it. + + # Install Riak repository before we do apt-get update, so that update happens + # in a single step + RUN apt-get install -q -y curl && \ + curl -sSL https://packagecloud.io/install/repositories/basho/riak/script.deb | sudo bash + +Then we install and setup a few dependencies: - - `curl` is used to download Basho's APT - repository key - - `lsb-release` helps us derive the Ubuntu release - codename - `supervisor` is used manage the Riak processes + - `riak=2.0.5-1` is the Riak package coded to version 2.0.5 # Install and setup project dependencies - RUN apt-get update && apt-get install -y curl lsb-release supervisor + RUN apt-get update && \ + apt-get install -y supervisor riak=2.0.5-1 RUN mkdir -p /var/log/supervisor - + RUN locale-gen en_US en_US.UTF-8 - + COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf - RUN echo 'root:basho' | chpasswd +After that, we modify Riak's configuration: -Next, we add Basho's APT repository: - - RUN curl -sSL http://apt.basho.com/gpg/basho.apt.key | apt-key add -- - RUN echo "deb http://apt.basho.com $(lsb_release -cs) main" > /etc/apt/sources.list.d/basho.list - -After that, we install Riak and alter a few defaults: - - # Install Riak and prepare it to run - RUN apt-get update && apt-get install -y riak - RUN sed -i.bak 's/127.0.0.1/0.0.0.0/' /etc/riak/app.config + # Configure Riak to accept connections from any host + RUN sed -i "s|listener.http.internal = 127.0.0.1:8098|listener.http.internal = 0.0.0.0:8098|" /etc/riak/riak.conf + RUN sed -i "s|listener.protobuf.internal = 127.0.0.1:8087|listener.protobuf.internal = 0.0.0.0:8087|" /etc/riak/riak.conf Then, we expose the Riak Protocol Buffers and HTTP interfaces, along with SSH: @@ -63,8 +62,7 @@ with SSH: # Expose Riak Protocol Buffers and HTTP interfaces EXPOSE 8087 8098 -Finally, run `supervisord` so that Riak and OpenSSH -are started: +Finally, run `supervisord` so that Riak is started: CMD ["/usr/bin/supervisord"] @@ -79,16 +77,14 @@ Populate it with the following program definitions: [supervisord] nodaemon=true - - [program:sshd] - command=/usr/sbin/sshd -D - stdout_logfile=/var/log/supervisor/%(program_name)s.log - stderr_logfile=/var/log/supervisor/%(program_name)s.log - autorestart=true - + [program:riak] - command=bash -c ". /etc/default/riak && /usr/sbin/riak console" - pidfile=/var/log/riak/riak.pid + command=bash -c "/usr/sbin/riak console" + numprocs=1 + autostart=true + autorestart=true + user=riak + environment=HOME="/var/lib/riak" stdout_logfile=/var/log/supervisor/%(program_name)s.log stderr_logfile=/var/log/supervisor/%(program_name)s.log diff --git a/docs/sources/examples/supervisord.conf b/docs/sources/examples/supervisord.conf new file mode 100644 index 0000000000..385fbe7a41 --- /dev/null +++ b/docs/sources/examples/supervisord.conf @@ -0,0 +1,12 @@ +[supervisord] +nodaemon=true + +[program:riak] +command=bash -c "/usr/sbin/riak console" +numprocs=1 +autostart=true +autorestart=true +user=riak +environment=HOME="/var/lib/riak" +stdout_logfile=/var/log/supervisor/%(program_name)s.log +stderr_logfile=/var/log/supervisor/%(program_name)s.log