Merge pull request #11870 from dekobon/master

11558 - Documentation fixes and improvements for Riak Dockerfile
This commit is contained in:
moxiegirl 2015-03-29 12:42:54 -07:00
commit 584df44d42
3 changed files with 76 additions and 42 deletions

View File

@ -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"]

View File

@ -15,61 +15,54 @@ Create an empty file called `Dockerfile`:
Next, define the parent image you want to use to build your image on top 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: 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 # Riak
# #
# VERSION 0.1.0 # VERSION 0.1.1
# Use the Ubuntu base image provided by dotCloud # Use the Ubuntu base image provided by dotCloud
FROM ubuntu:latest FROM ubuntu:trusty
MAINTAINER Hector Castro hector@basho.com 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.
- `curl` is used to download Basho's APT # Install Riak repository before we do apt-get update, so that update happens
repository key # in a single step
- `lsb-release` helps us derive the Ubuntu release RUN apt-get install -q -y curl && \
codename curl -sSL https://packagecloud.io/install/repositories/basho/riak/script.deb | sudo bash
- `openssh-server` allows us to login to
containers remotely and join Riak nodes to form a cluster Then we install and setup a few dependencies:
- `supervisor` is used manage the OpenSSH and Riak
processes - `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 # 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 supervisor riak=2.0.5-1
RUN mkdir -p /var/run/sshd
RUN mkdir -p /var/log/supervisor RUN mkdir -p /var/log/supervisor
RUN locale-gen en_US en_US.UTF-8 RUN locale-gen en_US en_US.UTF-8
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf 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: # 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 curl -sSL http://apt.basho.com/gpg/basho.apt.key | apt-key add -- RUN sed -i "s|listener.protobuf.internal = 127.0.0.1:8087|listener.protobuf.internal = 0.0.0.0:8087|" /etc/riak/riak.conf
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
RUN echo "ulimit -n 4096" >> /etc/default/riak
Then, we expose the Riak Protocol Buffers and HTTP interfaces, along Then, we expose the Riak Protocol Buffers and HTTP interfaces, along
with SSH: with SSH:
# Expose Riak Protocol Buffers and HTTP interfaces, along with SSH # Expose Riak Protocol Buffers and HTTP interfaces
EXPOSE 8087 8098 22 EXPOSE 8087 8098
Finally, run `supervisord` so that Riak and OpenSSH Finally, run `supervisord` so that Riak is started:
are started:
CMD ["/usr/bin/supervisord"] CMD ["/usr/bin/supervisord"]
@ -84,16 +77,14 @@ Populate it with the following program definitions:
[supervisord] [supervisord]
nodaemon=true 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] [program:riak]
command=bash -c ". /etc/default/riak && /usr/sbin/riak console" command=bash -c "/usr/sbin/riak console"
pidfile=/var/log/riak/riak.pid numprocs=1
autostart=true
autorestart=true
user=riak
environment=HOME="/var/lib/riak"
stdout_logfile=/var/log/supervisor/%(program_name)s.log stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log stderr_logfile=/var/log/supervisor/%(program_name)s.log

View File

@ -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